You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ro...@apache.org on 2021/02/25 16:34:15 UTC

[cloudstack] branch 4.15 updated: ui: fix add Vmware cluster (#4663)

This is an automated email from the ASF dual-hosted git repository.

rohit pushed a commit to branch 4.15
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/4.15 by this push:
     new fef0e66  ui: fix add Vmware cluster (#4663)
fef0e66 is described below

commit fef0e66764faaa75a18f533af1b7b31fefc5974f
Author: Abhishek Kumar <ab...@gmail.com>
AuthorDate: Thu Feb 25 22:04:00 2021 +0530

    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 <ab...@gmail.com>
---
 ui/src/views/infra/ClusterAdd.vue | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/ui/src/views/infra/ClusterAdd.vue b/ui/src/views/infra/ClusterAdd.vue
index a0665fe..f4c03fe 100644
--- a/ui/src/views/infra/ClusterAdd.vue
+++ b/ui/src/views/infra/ClusterAdd.vue
@@ -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', {