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 2012/11/26 22:13:15 UTC

git commit: CLOUDSTACK-537: cloudstack UI - Advanced SG-Enabled zone - Network menu - guest network section - (1) hide create network button if there is no Advacned SG-disabled zones. (2) create network dialog - zone dropdown - populate only Advacned SG-

Updated Branches:
  refs/heads/master b94981343 -> 1fb80fc6c


CLOUDSTACK-537: cloudstack UI - Advanced SG-Enabled zone - Network menu - guest network section - (1) hide create network button if there is no Advacned SG-disabled zones. (2) create network dialog - zone dropdown - populate only Advacned SG-disabled zones.


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

Branch: refs/heads/master
Commit: 1fb80fc6ce70fd11f956c0cfedc337bc8bff87a8
Parents: b949813
Author: Jessica Wang <je...@citrix.com>
Authored: Mon Nov 26 13:12:41 2012 -0800
Committer: Jessica Wang <je...@citrix.com>
Committed: Mon Nov 26 13:12:41 2012 -0800

----------------------------------------------------------------------
 ui/scripts/network.js |   31 ++++++++++++-------------------
 1 files changed, 12 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/1fb80fc6/ui/scripts/network.js
----------------------------------------------------------------------
diff --git a/ui/scripts/network.js b/ui/scripts/network.js
index e6a1eb3..5458de1 100755
--- a/ui/scripts/network.js
+++ b/ui/scripts/network.js
@@ -309,24 +309,17 @@
               label: 'label.add.guest.network',
 
               preFilter: function(args) {
-                var basicZoneExists = true; //Modifying the logic behind displaying the tabs depending on the networktype
-                $.ajax({
-                  url: createURL("listZones"),
-                  dataType: "json",
-                  async: false,
-                  success: function(json) {
-                    if(json.listzonesresponse.zone != null && json.listzonesresponse.zone.length > 0) {
-                      zoneObjs = json.listzonesresponse.zone;
-                      $(zoneObjs).each(function() {
-                        if(this.networktype == "Advanced") {
-                          basicZoneExists = false; // For any occurence of an Advanced zone with any combination of basic zone , the add guest network tab will be displayed
-                          return false; //break each loop
-                        }
-                      });
-                    }
-                  }
-                })
-                return !basicZoneExists; //hide Add guest network button if any basic zone exists
+                var advSgDisabledZones;
+								$.ajax({
+									url: createURL('listZones'),
+									async: false,
+									success: function(json) {									 
+										advSgDisabledZones = $.grep(json.listzonesresponse.zone, function(zone) {
+											return (zone.networktype == 'Advanced' && zone.securitygroupsenabled	!= true); //Isolated networks can only be created in Advanced SG-disabled zone (but not in Basic zone nor Advanced SG-enabled zone)
+										});										
+									}
+								});								
+								return (advSgDisabledZones.length > 0);							
               },
 
               createForm: {
@@ -345,7 +338,7 @@
                         url: createURL('listZones'),
                         success: function(json) {
                           var zones = $.grep(json.listzonesresponse.zone, function(zone) {
-                            return zone.networktype == 'Advanced';
+                            return (zone.networktype == 'Advanced' && zone.securitygroupsenabled	!= true); //Isolated networks can only be created in Advanced SG-disabled zone (but not in Basic zone nor Advanced SG-enabled zone)
                           });
 
                           args.response.success({