ui: fix add Vmware cluster (#4663)

When adding a cluster from existing host-datacenter UI shoudl list and autofill host, DC name while making addCluster API call.

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
This commit is contained in:
Abhishek Kumar 2021-02-25 22:04:00 +05:30 committed by GitHub
parent a234501172
commit fef0e66764
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 25 additions and 1 deletions

View File

@ -216,11 +216,35 @@ export default {
if (this.hypervisor === 'VMware') {
this.clustertype = 'ExternalManaged'
if ((this.host === null || this.host.length === 0) &&
(this.dataCenter === null || this.dataCenter.length === 0)) {
api('listVmwareDcs', {
zoneid: this.zoneId
}).then(response => {
var vmwaredcs = response.listvmwaredcsresponse.VMwareDC
if (vmwaredcs !== null) {
this.host = vmwaredcs[0].vcenter
this.dataCenter = vmwaredcs[0].name
}
this.addCluster()
}).catch(error => {
this.$notification.error({
message: `${this.$t('label.error')} ${error.response.status}`,
description: error.response.data.listvmwaredcsresponse.errortext,
duration: 0
})
})
return
}
}
this.addCluster()
},
addCluster () {
if (this.hypervisor === 'VMware') {
const clusternameVal = this.clustername
this.url = `http://${this.host}/${this.dataCenter}/${clusternameVal}`
this.clustername = `${this.host}/${this.dataCenter}/${clusternameVal}`
}
this.loading = true
this.parentToggleLoading()
api('addCluster', {}, 'POST', {