mirror of
https://github.com/apache/cloudstack.git
synced 2025-12-16 18:43:26 +01:00
ui: fix zone options for image instance deploy button (#12060)
Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
This commit is contained in:
parent
e90e31d386
commit
21d844ba1c
@ -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
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user