ui: fix add cluster form for vmware (#4841)

Filter null values else API returns error.

Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
This commit is contained in:
Abhishek Kumar 2021-03-22 12:14:29 +05:30 committed by GitHub
parent 6262366d85
commit 83b568ecde
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 18 additions and 7 deletions

View File

@ -247,19 +247,30 @@ export default {
}
this.loading = true
this.parentToggleLoading()
api('addCluster', {}, 'POST', {
var data = {
zoneId: this.zoneId,
hypervisor: this.hypervisor,
clustertype: this.clustertype,
podId: this.podId,
clustername: this.clustername,
ovm3pool: this.ovm3pool,
ovm3cluster: this.ovm3cluster,
ovm3vip: this.ovm3vip,
username: this.username,
password: this.password,
url: this.url
}).then(response => {
}
if (this.ovm3pool) {
data.ovm3pool = this.ovm3pool
}
if (this.ovm3cluster) {
data.ovm3cluster = this.ovm3cluster
}
if (this.ovm3vip) {
data.ovm3vip = this.ovm3vip
}
if (this.username) {
data.username = this.username
}
if (this.password) {
data.password = this.password
}
api('addCluster', {}, 'POST', data).then(response => {
const cluster = response.addclusterresponse.cluster[0] || {}
if (cluster.id && this.showDedicated) {
this.dedicateCluster(cluster.id)