Fixes ostype combobox not respond (#890)

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
Hoang Nguyen 2020-12-07 20:14:17 +07:00 committed by Rohit Yadav
parent 4e369c67de
commit f1ec81a250
2 changed files with 11 additions and 11 deletions

View File

@ -118,7 +118,7 @@
}" }"
:loading="osTypeLoading" :loading="osTypeLoading"
:placeholder="apiParams.ostypeid.description"> :placeholder="apiParams.ostypeid.description">
<a-select-option :value="opt.description" v-for="(opt, optIndex) in osTypes" :key="optIndex"> <a-select-option :value="opt.id" v-for="(opt, optIndex) in osTypes" :key="optIndex">
{{ opt.name || opt.description }} {{ opt.name || opt.description }}
</a-select-option> </a-select-option>
</a-select> </a-select>
@ -244,7 +244,7 @@ export default {
this.osTypes = this.osTypes.concat(listOsTypes) this.osTypes = this.osTypes.concat(listOsTypes)
}).finally(() => { }).finally(() => {
this.osTypeLoading = false this.osTypeLoading = false
this.defaultOsType = this.osTypes[0].description this.defaultOsType = this.osTypes[0].id
}) })
}, },
handleRemove (file) { handleRemove (file) {
@ -320,8 +320,7 @@ export default {
params[key] = zone[0].id params[key] = zone[0].id
break break
case 'ostypeid': case 'ostypeid':
var os = this.osTypes.filter(osType => osType.description === input) params[key] = input
params[key] = os[0].id
break break
default: default:
params[key] = input params[key] = input

View File

@ -252,8 +252,12 @@
<a-form-item :label="$t('label.ostypeid')"> <a-form-item :label="$t('label.ostypeid')">
<a-select <a-select
showSearch showSearch
optionFilterProp="children"
:filterOption="(input, option) => {
return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
}"
v-decorator="['ostypeid', { v-decorator="['ostypeid', {
initialValue: defaultOsType, initialValue: defaultOsId,
rules: [ rules: [
{ {
required: true, required: true,
@ -263,7 +267,7 @@
}]" }]"
:loading="osTypes.loading" :loading="osTypes.loading"
:placeholder="apiParams.ostypeid.description"> :placeholder="apiParams.ostypeid.description">
<a-select-option v-for="opt in osTypes.opts" :key="opt.name || opt.description"> <a-select-option v-for="opt in osTypes.opts" :key="opt.id">
{{ opt.name || opt.description }} {{ opt.name || opt.description }}
</a-select-option> </a-select-option>
</a-select> </a-select>
@ -792,12 +796,9 @@ export default {
} }
params[key] = input.join() params[key] = input.join()
} else if (key === 'zoneid') { } else if (key === 'zoneid') {
params[key] = values[key] params[key] = input
} else if (key === 'ostypeid') { } else if (key === 'ostypeid') {
const osTypeSelected = this.osTypes.opts.filter(item => item.description === input) params[key] = input
if (osTypeSelected && osTypeSelected[0]) {
params[key] = osTypeSelected[0].id
}
} else if (key === 'hypervisor') { } else if (key === 'hypervisor') {
params[key] = this.hyperVisor.opts[input].name params[key] = this.hyperVisor.opts[input].name
} else if (key === 'groupenabled') { } else if (key === 'groupenabled') {