cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t..@apache.org
Subject [12/49] git commit: updated refs/heads/marvin_refactor to 0b5fe9a
Date Sun, 21 Apr 2013 17:03:23 GMT
CLOUDSTACK-2038: cloudstack UI - mixed zone management - template menu - register template
action - populate zone dropdown upon selected zone type on top menu.


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

Branch: refs/heads/marvin_refactor
Commit: 2431c814a8b070f55e36f9a94d08066cb81ea870
Parents: ba7e49f
Author: Jessica Wang <jessica.wang@citrix.com>
Authored: Mon Apr 15 15:57:37 2013 -0700
Committer: Jessica Wang <jessica.wang@citrix.com>
Committed: Mon Apr 15 15:57:37 2013 -0700

----------------------------------------------------------------------
 ui/scripts/templates.js |   36 ++++++++++++++++++++++++++----------
 1 files changed, 26 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2431c814/ui/scripts/templates.js
----------------------------------------------------------------------
diff --git a/ui/scripts/templates.js b/ui/scripts/templates.js
index 6268f6b..f579c50 100644
--- a/ui/scripts/templates.js
+++ b/ui/scripts/templates.js
@@ -115,16 +115,32 @@
                         url: createURL("listZones&available=true"),
                         dataType: "json",
                         async: true,
-                        success: function(json) {
-                          var zoneObjs = json.listzonesresponse.zone;
-                          var items = [];
-                          if (isAdmin() && !(cloudStack.context.projects &&
-                                             cloudStack.context.projects[0]))
-                            items.push({id: -1, description: "All Zones"});
-                          $(zoneObjs).each(function() {
-                            items.push({id: this.id, description: this.name});
-                          });
-                          args.response.success({data: items});
+                        success: function(json) {    
+													var zoneObjs;
+							            if(args.context.zoneType == null || args.context.zoneType == '') { //all
types
+														zoneObjs = [];
+														var items = json.listzonesresponse.zone;
+														if(items != null) {
+															for(var i = 0; i < items.length; i++) {																
+																zoneObjs.push({id: items[i].id, description: items[i].name});		
+															}
+														}
+													}
+													else { //Basic type or Advanced type
+														zoneObjs = [];
+														var items = json.listzonesresponse.zone;
+														if(items != null) {
+															for(var i = 0; i < items.length; i++) {
+																if(items[i].networktype == args.context.zoneType) {
+																  zoneObjs.push({id: items[i].id, description: items[i].name});									
							
+																}
+															}
+														}
+													}		
+													if (isAdmin() && !(cloudStack.context.projects && cloudStack.context.projects[0])){
+                            zoneObjs.unshift({id: -1, description: "All Zones"});
+                          }																										
+													args.response.success({data: zoneObjs});     
                         }
                       });
                     }


Mime
View raw message