ui: fix zone options for image instance deploy button (#12060)

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
This commit is contained in:
Abhishek Kumar 2025-11-14 15:13:42 +05:30 committed by GitHub
parent e90e31d386
commit 21d844ba1c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -71,9 +71,14 @@ export default {
if (this.$route.meta.name === 'iso') { if (this.$route.meta.name === 'iso') {
this.imageApi = 'listIsos' this.imageApi = 'listIsos'
} }
setTimeout(() => {
this.fetchData() this.fetchData()
}, 100) },
watch: {
resource (newValue) {
if (newValue?.id) {
this.fetchData()
}
}
}, },
computed: { computed: {
allowed () { allowed () {
@ -82,23 +87,22 @@ export default {
} }
}, },
methods: { methods: {
arrayHasItems (array) {
return array !== null && array !== undefined && Array.isArray(array) && array.length > 0
},
fetchData () { fetchData () {
this.fetchResourceData() this.fetchResourceData()
}, },
fetchResourceData () { fetchResourceData () {
const params = {} if (!this.resource || !this.resource.id) {
params.id = this.resource.id return
params.templatefilter = 'executable' }
params.listall = true const params = {
params.page = this.page id: this.resource.id,
params.pagesize = this.pageSize templatefilter: 'executable',
listall: true
}
this.dataSource = [] this.dataSource = []
this.itemCount = 0 this.itemCount = 0
this.fetchLoading = true this.loading = true
this.zones = [] this.zones = []
getAPI(this.imageApi, params).then(json => { getAPI(this.imageApi, params).then(json => {
const imageResponse = json?.[this.imageApi.toLowerCase() + 'response']?.[this.$route.meta.name] || [] const imageResponse = json?.[this.imageApi.toLowerCase() + 'response']?.[this.$route.meta.name] || []
@ -108,8 +112,8 @@ export default {
})) }))
}).catch(error => { }).catch(error => {
this.$notifyError(error) this.$notifyError(error)
this.loading = false
}).finally(() => { }).finally(() => {
this.loading = false
if (this.zones.length !== 0) { if (this.zones.length !== 0) {
this.$emit('update-zones', this.zones) this.$emit('update-zones', this.zones)
} }
@ -122,7 +126,8 @@ export default {
} }
const zoneids = this.zones.map(z => z.id) const zoneids = this.zones.map(z => z.id)
this.loading = true this.loading = true
getAPI('listZones', { showicon: true, ids: zoneids.join(',') }).then(json => { const params = { showicon: true, ids: zoneids.join(',') }
getAPI('listZones', params).then(json => {
this.zones = json.listzonesresponse.zone || [] this.zones = json.listzonesresponse.zone || []
}).finally(() => { }).finally(() => {
this.loading = false this.loading = false