Skip to content

Commit bfb65aa

Browse files
author
Jessica Wang
committed
CLOUDSTACK-5098: UI > VMware > during zone creation, after addVmwareDc succeeds, if addClsuter fails (e.g. because of wrong input value), zone detail page will show wrong button ("Add Vmware Datacenter") since listVmwareDcs is only called when a zone has a VMware cluster.
To resolve this specific use case, change UI to use listApis instead of listClusters to determine whether to call listVmwareDcs.
1 parent 25dcd88 commit bfb65aa

1 file changed

Lines changed: 19 additions & 28 deletions

File tree

‎ui/scripts/system.js‎

Lines changed: 19 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -6473,38 +6473,29 @@
64736473
});
64746474

64756475
$.ajax({
6476-
url: createURL('listClusters'),
6476+
url: createURL('listApis'), //listVmwareDcs API only exists in non-oss bild, so have to check whether it exists before calling it.
64776477
data: {
6478-
zoneid: args.context.physicalResources[0].id
6478+
name: 'listVmwareDcs'
64796479
},
64806480
async: false,
64816481
success: function(json) {
6482-
var clusters = json.listclustersresponse.cluster;
6483-
if (clusters != null) {
6484-
for (var i = 0; i < clusters.length; i++) {
6485-
if (clusters[i].hypervisortype == 'VMware') {
6486-
$.ajax({
6487-
url: createURL('listVmwareDcs'), //listVmwareDcs API exists in only non-oss bild
6488-
data: {
6489-
zoneid: args.context.physicalResources[0].id
6490-
},
6491-
async: false,
6492-
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"} ] } }
6493-
var vmwaredcs = json.listvmwaredcsresponse.VMwareDC;
6494-
if (vmwaredcs != null) {
6495-
selectedZoneObj.vmwaredcName = vmwaredcs[0].name;
6496-
selectedZoneObj.vmwaredcVcenter = vmwaredcs[0].vcenter;
6497-
selectedZoneObj.vmwaredcId = vmwaredcs[0].id;
6498-
}
6499-
}
6500-
//, error: function(XMLHttpResponse) {} //override default error handling: cloudStack.dialog.notice({ message: parseXMLHttpResponse(XMLHttpResponse)});
6501-
});
6502-
6503-
break;
6504-
}
6505-
}
6506-
}
6507-
}
6482+
$.ajax({
6483+
url: createURL('listVmwareDcs'),
6484+
data: {
6485+
zoneid: args.context.physicalResources[0].id
6486+
},
6487+
async: false,
6488+
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"} ] } }
6489+
var vmwaredcs = json.listvmwaredcsresponse.VMwareDC;
6490+
if (vmwaredcs != null) {
6491+
selectedZoneObj.vmwaredcName = vmwaredcs[0].name;
6492+
selectedZoneObj.vmwaredcVcenter = vmwaredcs[0].vcenter;
6493+
selectedZoneObj.vmwaredcId = vmwaredcs[0].id;
6494+
}
6495+
}
6496+
});
6497+
},
6498+
error: function(XMLHttpResponse) {} //override default error handling: cloudStack.dialog.notice({ message: parseXMLHttpResponse(XMLHttpResponse)});
65086499
});
65096500

65106501
args.response.success({

0 commit comments

Comments
 (0)