mirror of https://github.com/apache/cloudstack.git
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.
This commit is contained in:
parent
5dc1d46c6d
commit
420e7aed1f
|
|
@ -7032,38 +7032,29 @@
|
|||
});
|
||||
|
||||
$.ajax({
|
||||
url: createURL('listClusters'),
|
||||
url: createURL('listApis'), //listVmwareDcs API only exists in non-oss bild, so have to check whether it exists before calling it.
|
||||
data: {
|
||||
zoneid: args.context.physicalResources[0].id
|
||||
name: 'listVmwareDcs'
|
||||
},
|
||||
async: false,
|
||||
success: function(json) {
|
||||
var clusters = json.listclustersresponse.cluster;
|
||||
if (clusters != null) {
|
||||
for (var i = 0; i < clusters.length; i++) {
|
||||
if (clusters[i].hypervisortype == 'VMware') {
|
||||
$.ajax({
|
||||
url: createURL('listVmwareDcs'), //listVmwareDcs API exists in only non-oss bild
|
||||
data: {
|
||||
zoneid: args.context.physicalResources[0].id
|
||||
},
|
||||
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) {
|
||||
selectedZoneObj.vmwaredcName = vmwaredcs[0].name;
|
||||
selectedZoneObj.vmwaredcVcenter = vmwaredcs[0].vcenter;
|
||||
selectedZoneObj.vmwaredcId = vmwaredcs[0].id;
|
||||
}
|
||||
}
|
||||
//, error: function(XMLHttpResponse) {} //override default error handling: cloudStack.dialog.notice({ message: parseXMLHttpResponse(XMLHttpResponse)});
|
||||
});
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$.ajax({
|
||||
url: createURL('listVmwareDcs'),
|
||||
data: {
|
||||
zoneid: args.context.physicalResources[0].id
|
||||
},
|
||||
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) {
|
||||
selectedZoneObj.vmwaredcName = vmwaredcs[0].name;
|
||||
selectedZoneObj.vmwaredcVcenter = vmwaredcs[0].vcenter;
|
||||
selectedZoneObj.vmwaredcId = vmwaredcs[0].id;
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
error: function(XMLHttpResponse) {} //override default error handling: cloudStack.dialog.notice({ message: parseXMLHttpResponse(XMLHttpResponse)});
|
||||
});
|
||||
|
||||
args.response.success({
|
||||
|
|
|
|||
Loading…
Reference in New Issue