Skip to content

Commit 83b568e

Browse files
authored
ui: fix add cluster form for vmware (#4841)
Filter null values else API returns error. Signed-off-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
1 parent 6262366 commit 83b568e

1 file changed

Lines changed: 18 additions & 7 deletions

File tree

ui/src/views/infra/ClusterAdd.vue

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -247,19 +247,30 @@ export default {
247247
}
248248
this.loading = true
249249
this.parentToggleLoading()
250-
api('addCluster', {}, 'POST', {
250+
var data = {
251251
zoneId: this.zoneId,
252252
hypervisor: this.hypervisor,
253253
clustertype: this.clustertype,
254254
podId: this.podId,
255255
clustername: this.clustername,
256-
ovm3pool: this.ovm3pool,
257-
ovm3cluster: this.ovm3cluster,
258-
ovm3vip: this.ovm3vip,
259-
username: this.username,
260-
password: this.password,
261256
url: this.url
262-
}).then(response => {
257+
}
258+
if (this.ovm3pool) {
259+
data.ovm3pool = this.ovm3pool
260+
}
261+
if (this.ovm3cluster) {
262+
data.ovm3cluster = this.ovm3cluster
263+
}
264+
if (this.ovm3vip) {
265+
data.ovm3vip = this.ovm3vip
266+
}
267+
if (this.username) {
268+
data.username = this.username
269+
}
270+
if (this.password) {
271+
data.password = this.password
272+
}
273+
api('addCluster', {}, 'POST', data).then(response => {
263274
const cluster = response.addclusterresponse.cluster[0] || {}
264275
if (cluster.id && this.showDedicated) {
265276
this.dedicateCluster(cluster.id)

0 commit comments

Comments
 (0)