Fixes an issue that could not search on zone select (#602)

* Fixes an issue that could not search on zone select

* Fixes show error from console

* add search zone for Upload ISO

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
Hoang Nguyen 2020-08-25 14:37:42 +07:00 committed by Rohit Yadav
parent ec3b28caf4
commit 86daf79a77
2 changed files with 14 additions and 14 deletions

View File

@ -91,14 +91,7 @@
:loading="zoneLoading"
:placeholder="apiParams.zoneid.description">
<a-select-option :value="opt.id" v-for="opt in zones" :key="opt.id">
<div v-if="currentForm === 'Upload'">
<div v-if="opt.name !== $t('label.all.zone')">
{{ opt.name || opt.description }}
</div>
</div>
<div v-else>
{{ opt.name || opt.description }}
</div>
{{ opt.name || opt.description }}
</a-select-option>
</a-select>
</a-form-item>
@ -205,7 +198,7 @@ export default {
},
created () {
this.zones = []
if (this.$store.getters.userInfo.roletype === 'Admin') {
if (this.$store.getters.userInfo.roletype === 'Admin' && this.currentForm === 'Create') {
this.zones = [
{
id: '-1',
@ -235,7 +228,7 @@ export default {
this.zones = this.zones.concat(listZones)
}).finally(() => {
this.zoneLoading = false
this.selectedZone = this.currentForm === 'Create' ? (this.zones[0].id ? this.zones[0].id : '') : ((this.zones[1].id) ? this.zones[1].id : '')
this.selectedZone = (this.zones[0].id ? this.zones[0].id : '')
})
},
fetchOsType () {

View File

@ -95,6 +95,10 @@
}]"
:loading="zones.loading"
mode="multiple"
optionFilterProp="children"
:filterOption="(input, option) => {
return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
}"
:placeholder="apiParams.zoneids.description"
@change="handlerSelectZone">
<a-select-option v-for="opt in zones.opts" :key="opt.id">
@ -122,13 +126,16 @@
}
]
}]"
showSearch
optionFilterProp="children"
:filterOption="(input, option) => {
return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
}"
@change="handlerSelectZone"
:placeholder="apiParams.zoneid.description"
:loading="zones.loading">
<a-select-option :value="zone.id" v-for="zone in zones.opts" :key="zone.id">
<div v-if="zone.name !== $t('label.all.zone')">
{{ zone.name || zone.description }}
</div>
{{ zone.name || zone.description }}
</a-select-option>
</a-select>
</a-form-item>
@ -517,7 +524,7 @@ export default {
this.allowed = false
if (store.getters.userInfo.roletype === this.rootAdmin) {
if (store.getters.userInfo.roletype === this.rootAdmin && this.currentForm === 'Create') {
this.allowed = true
listZones.push({
id: this.$t('label.all.zone'),