diff --git a/ui/src/views/image/RegisterOrUploadIso.vue b/ui/src/views/image/RegisterOrUploadIso.vue
index 871a8482e99..37ae369727f 100644
--- a/ui/src/views/image/RegisterOrUploadIso.vue
+++ b/ui/src/views/image/RegisterOrUploadIso.vue
@@ -85,7 +85,7 @@
-
+
@@ -110,7 +110,7 @@
}"
:loading="zoneLoading"
:placeholder="apiParams.zoneid.description">
-
+
@@ -361,17 +361,18 @@ export default {
},
created () {
this.initForm()
- this.zones = []
- if (this.$store.getters.userInfo.roletype === 'Admin' && this.currentForm === 'Create') {
- this.zones = [
- {
- id: '-1',
- name: this.$t('label.all.zone')
- }
- ]
- }
+ this.initZones()
this.fetchData()
},
+ computed: {
+ zoneList () {
+ let filteredZones = this.zones
+ if (!this.form.directdownload) {
+ filteredZones = this.zones.filter(zone => zone.type !== 'Edge')
+ }
+ return filteredZones
+ }
+ },
methods: {
initForm () {
this.formRef = ref()
@@ -390,6 +391,17 @@ export default {
ostypeid: [{ required: true, message: this.$t('message.error.select') }]
})
},
+ initZones () {
+ this.zones = []
+ if (this.$store.getters.userInfo.roletype === 'Admin' && this.currentForm === 'Create') {
+ this.zones = [
+ {
+ id: '-1',
+ name: this.$t('label.all.zone')
+ }
+ ]
+ }
+ },
fetchData () {
this.fetchZoneData()
this.fetchOsType()
@@ -412,11 +424,10 @@ export default {
const listZones = json.listzonesresponse.zone
if (listZones) {
this.zones = this.zones.concat(listZones)
- this.zones = this.zones.filter(zone => zone.type !== 'Edge')
}
}).finally(() => {
this.zoneLoading = false
- this.form.zoneid = (this.zones[0].id ? this.zones[0].id : '')
+ this.form.zoneid = this.zoneList?.[0]?.id || ''
})
},
fetchOsType () {
@@ -467,6 +478,12 @@ export default {
this.fileList = newFileList
this.form.file = undefined
},
+ handleDirectDownloadChange () {
+ if (this.form.zoneid && this.zoneList.find(entry => entry.id === this.form.zoneid)) {
+ return
+ }
+ this.form.zoneid = this.zoneList?.[0]?.id || ''
+ },
beforeUpload (file) {
this.fileList = [file]
this.form.file = file
@@ -531,7 +548,7 @@ export default {
}
switch (key) {
case 'zoneid':
- var zone = this.zones.filter(zone => zone.id === input)
+ var zone = this.zoneList.filter(zone => zone.id === input)
params[key] = zone[0].id
break
case 'ostypeid':