Skip to content

Commit

Permalink
Add new input type for test endpoint: select
Browse files Browse the repository at this point in the history
  • Loading branch information
Krissz authored Oct 3, 2023
1 parent 27c729e commit 5a0a283
Showing 1 changed file with 22 additions and 9 deletions.
31 changes: 22 additions & 9 deletions template/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,13 @@ <h3 class="cursor-pointer" @click="showBrokerOptions = !showBrokerOptions">Broke
<div :class="{field:true,required:field.optional===false}" v-for="field,ix in item.fields" :key="field.name">
<label :for="field.name+'--'+ix">{{ field.label }}: </label>
<input v-if="field.dataType==='number'" :min="field.min" :max="field.max" :type="field.type" :id="field.name+'--'+ix" :name="field.name" v-model.number="field.value" :required="field.required === true || field.optional===false"></input>
<select v-else-if="field.dataType==='enum'"
:id="field.name+'--'+ix"
:name="field.name"
v-model="field.value"
:required="field.required === true || field.optional===false">
<option v-for="fvalue in field.values" :value="fvalue">{{fvalue}}</option>
</select>
<input v-else :type="field.type" :maxlength="field.maxLength" :minlength="field.minLength" :id="field.name+'--'+ix" :name="field.name" v-model="field.value" :required="field.required === true || field.optional===false"></input>
</div>
</div>
Expand Down Expand Up @@ -486,6 +493,8 @@ <h3 class="cursor-pointer" @click="showBrokerOptions = !showBrokerOptions">Broke
const maxLength = item.params[key].max || undefined;
const minLength = item.params[key].min || undefined;
const pattern = item.params[key].pattern || undefined;
const values = item.params[key].values || undefined;

let type = "text";
let value = item.params[key].default || undefined;
if (dataType.includes("number")) {type = "number"; };
Expand All @@ -501,15 +510,19 @@ <h3 class="cursor-pointer" @click="showBrokerOptions = !showBrokerOptions">Broke
if (dataType === "enum") type = "select";
if (dataType === "enum-multi") type = "select-multi";

r.push({ name: key,
label: key,optional,
hidden,required,
[type==='number'?'min':'minLength'] :minLength,
[type==='number'?'max':'maxLength'] :maxLength,
pattern,
paramType: method==='GET' ? 'param' : 'body',
value,
type,dataType, value:undefined });
r.push({
name: key,
label: key, optional,
hidden, required,
[type === 'number' ? 'min' : 'minLength']: minLength,
[type === 'number' ? 'max' : 'maxLength']: maxLength,
pattern,
paramType: method === 'GET' ? 'param' : 'body',
value,
type,
dataType,
values
});
}
return r;
},
Expand Down

0 comments on commit 5a0a283

Please sign in to comment.