From 38cb16df367db3b0e5cfb4b73b08cee183427349 Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Thu, 11 Jul 2013 15:39:33 -0700 Subject: [PATCH] CLOUDSTACK-3460: UI > Infrastructure menu > clusters > add cluster dialog > when hypervisor is VMware, call listVmwareDcs API to get vCenter Host and vCenter Datacenter value if the 2 fields are not filled (the 2 fields are optional). --- ui/scripts/system.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/ui/scripts/system.js b/ui/scripts/system.js index 04d5b8f63a6..3b0fb21c17b 100644 --- a/ui/scripts/system.js +++ b/ui/scripts/system.js @@ -10383,7 +10383,24 @@ var hostname = args.data.vCenterHost; var dcName = args.data.vCenterDatacenter; - + + if(hostname.length == 0 && dcName.length == 0) { + $.ajax({ + url: createURL('listVmwareDcs'), + data: { + zoneid: args.data.zoneid + }, + async: false, + success: function(json) { //e.g. json == { "listvmwaredcsresponse" { "count":1 ,"VMwareDC" [ {"id":"c3c2562d-65e9-4fc7-92e2-773c2efe8f37","zoneid":1,"name":"datacenter","vcenter":"10.10.20.20"} ] } } + var vmwaredcs = json.listvmwaredcsresponse.VMwareDC; + if(vmwaredcs != null) { + hostname = vmwaredcs[0].vcenter; + dcName = vmwaredcs[0].name; + } + } + }); + } + var url; if(hostname.indexOf("http://") == -1) url = "http://" + hostname;