diff --git a/ui/src/views/image/RegisterOrUploadIso.vue b/ui/src/views/image/RegisterOrUploadIso.vue
index c56dcd8aa7b..6c34ec8972a 100644
--- a/ui/src/views/image/RegisterOrUploadIso.vue
+++ b/ui/src/views/image/RegisterOrUploadIso.vue
@@ -97,6 +97,48 @@
+
+
+
+
+ { handleDomainChange(val) }">
+
+
+
+
+ {{ opt.path || opt.name || opt.description }}
+
+
+
+
+
+
+
+
+ { handleAccountChange(val) }">
+
+ {{ acc.name }}
+
+
+
+
@@ -229,7 +271,12 @@ export default {
allowed: false,
uploadParams: null,
uploadPercentage: 0,
- currentForm: ['plus-outlined', 'PlusOutlined'].includes(this.action.currentAction.icon) ? 'Create' : 'Upload'
+ currentForm: ['plus-outlined', 'PlusOutlined'].includes(this.action.currentAction.icon) ? 'Create' : 'Upload',
+ domains: [],
+ accounts: [],
+ domainLoading: false,
+ domainid: null,
+ account: null
}
},
beforeCreate () {
@@ -270,6 +317,9 @@ export default {
this.fetchOsType()
this.fetchUserData()
this.fetchUserdataPolicy()
+ if ('listDomains' in this.$store.getters.apis) {
+ this.fetchDomains()
+ }
},
fetchZoneData () {
const params = {}
@@ -478,6 +528,43 @@ export default {
}).finally(() => {
this.loading = false
})
+ },
+ fetchDomains () {
+ const params = {}
+ params.listAll = true
+ params.showicon = true
+ params.details = 'min'
+ this.domainLoading = true
+ api('listDomains', params).then(json => {
+ this.domains = json.listdomainsresponse.domain
+ }).finally(() => {
+ this.domainLoading = false
+ this.handleDomainChange(null)
+ })
+ },
+ handleDomainChange (domain) {
+ this.domainid = domain
+ this.form.account = null
+ this.account = null
+ if ('listAccounts' in this.$store.getters.apis) {
+ this.fetchAccounts()
+ }
+ },
+ fetchAccounts () {
+ api('listAccounts', {
+ domainid: this.domainid
+ }).then(response => {
+ this.accounts = response.listaccountsresponse.account || []
+ }).catch(error => {
+ this.$notifyError(error)
+ })
+ },
+ handleAccountChange (acc) {
+ if (acc) {
+ this.account = acc.name
+ } else {
+ this.account = acc
+ }
}
}
}
diff --git a/ui/src/views/image/RegisterOrUploadTemplate.vue b/ui/src/views/image/RegisterOrUploadTemplate.vue
index 06ca207a0ab..f9578d4714d 100644
--- a/ui/src/views/image/RegisterOrUploadTemplate.vue
+++ b/ui/src/views/image/RegisterOrUploadTemplate.vue
@@ -117,6 +117,47 @@
+
+
+
+
+ { handleDomainChange(val) }">
+
+
+
+
+ {{ opt.path || opt.name || opt.description }}
+
+
+
+
+
+
+
+
+ { handleAccountChange(val) }">
+
+ {{ acc.name }}
+
+
+
@@ -410,6 +451,11 @@ export default {
allowDirectDownload: false,
uploadParams: null,
currentForm: ['plus-outlined', 'PlusOutlined'].includes(this.action.currentAction.icon) ? 'Create' : 'Upload',
+ domains: [],
+ accounts: [],
+ domainLoading: false,
+ domainid: null,
+ account: null,
customHypervisorName: 'Custom'
}
},
@@ -463,6 +509,9 @@ export default {
this.fetchOsTypes()
this.fetchUserData()
this.fetchUserdataPolicy()
+ if ('listDomains' in this.$store.getters.apis) {
+ this.fetchDomains()
+ }
if (Object.prototype.hasOwnProperty.call(store.getters.apis, 'listConfigurations')) {
if (this.allowed && this.hyperXenServerShow) {
this.fetchXenServerProvider()
@@ -1026,6 +1075,43 @@ export default {
arrSelectReset.forEach(name => {
this.form[name] = undefined
})
+ },
+ fetchDomains () {
+ const params = {}
+ params.listAll = true
+ params.showicon = true
+ params.details = 'min'
+ this.domainLoading = true
+ api('listDomains', params).then(json => {
+ this.domains = json.listdomainsresponse.domain
+ }).finally(() => {
+ this.domainLoading = false
+ this.handleDomainChange(null)
+ })
+ },
+ handleDomainChange (domain) {
+ this.domainid = domain
+ this.form.account = null
+ this.account = null
+ if ('listAccounts' in this.$store.getters.apis) {
+ this.fetchAccounts()
+ }
+ },
+ fetchAccounts () {
+ api('listAccounts', {
+ domainid: this.domainid
+ }).then(response => {
+ this.accounts = response.listaccountsresponse.account || []
+ }).catch(error => {
+ this.$notifyError(error)
+ })
+ },
+ handleAccountChange (acc) {
+ if (acc) {
+ this.account = acc.name
+ } else {
+ this.account = acc
+ }
}
}
}