Skip to content
This repository was archived by the owner on Jan 20, 2021. It is now read-only.

Commit d3d7a6c

Browse files
author
Hoang Nguyen
authored
Fixes ostype combobox not respond (#890)
1 parent b937056 commit d3d7a6c

2 files changed

Lines changed: 11 additions & 11 deletions

File tree

src/views/image/RegisterOrUploadIso.vue

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@
118118
}"
119119
:loading="osTypeLoading"
120120
:placeholder="apiParams.ostypeid.description">
121-
<a-select-option :value="opt.description" v-for="(opt, optIndex) in osTypes" :key="optIndex">
121+
<a-select-option :value="opt.id" v-for="(opt, optIndex) in osTypes" :key="optIndex">
122122
{{ opt.name || opt.description }}
123123
</a-select-option>
124124
</a-select>
@@ -244,7 +244,7 @@ export default {
244244
this.osTypes = this.osTypes.concat(listOsTypes)
245245
}).finally(() => {
246246
this.osTypeLoading = false
247-
this.defaultOsType = this.osTypes[0].description
247+
this.defaultOsType = this.osTypes[0].id
248248
})
249249
},
250250
handleRemove (file) {
@@ -320,8 +320,7 @@ export default {
320320
params[key] = zone[0].id
321321
break
322322
case 'ostypeid':
323-
var os = this.osTypes.filter(osType => osType.description === input)
324-
params[key] = os[0].id
323+
params[key] = input
325324
break
326325
default:
327326
params[key] = input

src/views/image/RegisterOrUploadTemplate.vue

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -252,8 +252,12 @@
252252
<a-form-item :label="$t('label.ostypeid')">
253253
<a-select
254254
showSearch
255+
optionFilterProp="children"
256+
:filterOption="(input, option) => {
257+
return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
258+
}"
255259
v-decorator="['ostypeid', {
256-
initialValue: defaultOsType,
260+
initialValue: defaultOsId,
257261
rules: [
258262
{
259263
required: true,
@@ -263,7 +267,7 @@
263267
}]"
264268
:loading="osTypes.loading"
265269
:placeholder="apiParams.ostypeid.description">
266-
<a-select-option v-for="opt in osTypes.opts" :key="opt.name || opt.description">
270+
<a-select-option v-for="opt in osTypes.opts" :key="opt.id">
267271
{{ opt.name || opt.description }}
268272
</a-select-option>
269273
</a-select>
@@ -792,12 +796,9 @@ export default {
792796
}
793797
params[key] = input.join()
794798
} else if (key === 'zoneid') {
795-
params[key] = values[key]
799+
params[key] = input
796800
} else if (key === 'ostypeid') {
797-
const osTypeSelected = this.osTypes.opts.filter(item => item.description === input)
798-
if (osTypeSelected && osTypeSelected[0]) {
799-
params[key] = osTypeSelected[0].id
800-
}
801+
params[key] = input
801802
} else if (key === 'hypervisor') {
802803
params[key] = this.hyperVisor.opts[input].name
803804
} else if (key === 'groupenabled') {

0 commit comments

Comments
 (0)