mirror of https://github.com/apache/cloudstack.git
UI: Add domain and account fields to Register/Upload Template/ISO view (#7872)
* UI: Add missing domain and account parameters to register template * Only display the domain if listDomains API is accessible * Add fields to Register ISO view
This commit is contained in:
parent
b0ae701ca4
commit
7049a6058d
|
|
@ -97,6 +97,48 @@
|
|||
</a-select>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item name="domainid" ref="domainid" v-if="'listDomains' in $store.getters.apis">
|
||||
<template #label>
|
||||
<tooltip-label :title="$t('label.domainid')" :tooltip="apiParams.domainid.description"/>
|
||||
</template>
|
||||
<a-select
|
||||
v-model:value="form.domainid"
|
||||
showSearch
|
||||
optionFilterProp="label"
|
||||
:filterOption="(input, option) => {
|
||||
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0
|
||||
}"
|
||||
:loading="domainLoading"
|
||||
:placeholder="apiParams.domainid.description"
|
||||
@change="val => { handleDomainChange(val) }">
|
||||
<a-select-option v-for="(opt, optIndex) in this.domains" :key="optIndex" :label="opt.path || opt.name || opt.description" :value="opt.id">
|
||||
<span>
|
||||
<resource-icon v-if="opt && opt.icon" :image="opt.icon.base64image" size="1x" style="margin-right: 5px"/>
|
||||
<block-outlined v-else style="margin-right: 5px" />
|
||||
{{ opt.path || opt.name || opt.description }}
|
||||
</span>
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
<a-form-item name="account" ref="account" v-if="domainid">
|
||||
<template #label>
|
||||
<tooltip-label :title="$t('label.account')" :tooltip="apiParams.account.description"/>
|
||||
</template>
|
||||
<a-select
|
||||
v-model:value="form.account"
|
||||
showSearch
|
||||
optionFilterProp="label"
|
||||
:filterOption="(input, option) => {
|
||||
return option.value.toLowerCase().indexOf(input.toLowerCase()) >= 0
|
||||
}"
|
||||
:placeholder="apiParams.account.description"
|
||||
@change="val => { handleAccountChange(val) }">
|
||||
<a-select-option v-for="(acc, index) in accounts" :value="acc.name" :key="index">
|
||||
{{ acc.name }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
|
||||
<a-form-item ref="bootable" name="bootable" :label="$t('label.bootable')">
|
||||
<a-switch v-model:checked="form.bootable" />
|
||||
</a-form-item>
|
||||
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -117,6 +117,47 @@
|
|||
</a-select>
|
||||
</a-form-item>
|
||||
</div>
|
||||
<a-form-item name="domainid" ref="domainid" v-if="'listDomains' in $store.getters.apis">
|
||||
<template #label>
|
||||
<tooltip-label :title="$t('label.domainid')" :tooltip="apiParams.domainid.description"/>
|
||||
</template>
|
||||
<a-select
|
||||
v-model:value="form.domainid"
|
||||
showSearch
|
||||
optionFilterProp="label"
|
||||
:filterOption="(input, option) => {
|
||||
return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0
|
||||
}"
|
||||
:loading="domainLoading"
|
||||
:placeholder="apiParams.domainid.description"
|
||||
@change="val => { handleDomainChange(val) }">
|
||||
<a-select-option v-for="(opt, optIndex) in this.domains" :key="optIndex" :label="opt.path || opt.name || opt.description" :value="opt.id">
|
||||
<span>
|
||||
<resource-icon v-if="opt && opt.icon" :image="opt.icon.base64image" size="1x" style="margin-right: 5px"/>
|
||||
<block-outlined v-else style="margin-right: 5px" />
|
||||
{{ opt.path || opt.name || opt.description }}
|
||||
</span>
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
<a-form-item name="account" ref="account" v-if="domainid">
|
||||
<template #label>
|
||||
<tooltip-label :title="$t('label.account')" :tooltip="apiParams.account.description"/>
|
||||
</template>
|
||||
<a-select
|
||||
v-model:value="form.account"
|
||||
showSearch
|
||||
optionFilterProp="label"
|
||||
:filterOption="(input, option) => {
|
||||
return option.value.toLowerCase().indexOf(input.toLowerCase()) >= 0
|
||||
}"
|
||||
:placeholder="apiParams.account.description"
|
||||
@change="val => { handleAccountChange(val) }">
|
||||
<a-select-option v-for="(acc, index) in accounts" :value="acc.name" :key="index">
|
||||
{{ acc.name }}
|
||||
</a-select-option>
|
||||
</a-select>
|
||||
</a-form-item>
|
||||
<a-row :gutter="12">
|
||||
<a-col :md="24" :lg="12">
|
||||
<a-form-item ref="hypervisor" name="hypervisor" :label="$t('label.hypervisor')">
|
||||
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue