You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by je...@apache.org on 2013/12/14 00:51:21 UTC

git commit: updated refs/heads/master to 420e7ae

Updated Branches:
  refs/heads/master 5dc1d46c6 -> 420e7aed1


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.


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/420e7aed
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/420e7aed
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/420e7aed

Branch: refs/heads/master
Commit: 420e7aed1fd6f7b4c8d75ace5a66072ecf863253
Parents: 5dc1d46c
Author: Jessica Wang <je...@apache.org>
Authored: Fri Dec 13 15:50:21 2013 -0800
Committer: Jessica Wang <je...@apache.org>
Committed: Fri Dec 13 15:51:11 2013 -0800

----------------------------------------------------------------------
 ui/scripts/system.js | 47 +++++++++++++++++++----------------------------
 1 file changed, 19 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/420e7aed/ui/scripts/system.js
----------------------------------------------------------------------
diff --git a/ui/scripts/system.js b/ui/scripts/system.js
index b490d0d..f6a50a4 100644
--- a/ui/scripts/system.js
+++ b/ui/scripts/system.js
@@ -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({