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/28 00:10:43 UTC

git commit: CLOUDSTACK-537: cloudstack UI - Advanced SG-Enabled zone - Instance menu - instance detailView - show SecurityGroups tab for Advanced SG-Enabled zone.

Updated Branches:
  refs/heads/master d15f5a751 -> 46cec7342


CLOUDSTACK-537: cloudstack UI - Advanced SG-Enabled zone - Instance menu - instance detailView - show SecurityGroups tab for Advanced SG-Enabled zone.


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

Branch: refs/heads/master
Commit: 46cec7342ad446e3e6d3e6fd97b0b32d9a2c529f
Parents: d15f5a7
Author: Jessica Wang <je...@citrix.com>
Authored: Tue Nov 27 15:09:55 2012 -0800
Committer: Jessica Wang <je...@citrix.com>
Committed: Tue Nov 27 15:09:55 2012 -0800

----------------------------------------------------------------------
 ui/scripts/instances.js |   28 ++++++++++++++++++----------
 1 files changed, 18 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/46cec734/ui/scripts/instances.js
----------------------------------------------------------------------
diff --git a/ui/scripts/instances.js b/ui/scripts/instances.js
index 3ef00df..610f753 100644
--- a/ui/scripts/instances.js
+++ b/ui/scripts/instances.js
@@ -235,17 +235,19 @@
         viewAll: { path: 'storage.volumes', label: 'label.volumes' },
         tabFilter: function(args) {
           var hiddenTabs = [];
-          var zoneNetworktype;
+					
+					var zoneObj;
           $.ajax({
             url: createURL("listZones&id=" + args.context.instances[0].zoneid),
             dataType: "json",
             async: false,
-            success: function(json) {
-              zoneNetworktype = json.listzonesresponse.zone[0].networktype;
+            success: function(json) {              
+							zoneObj = json.listzonesresponse.zone[0];
             }
           });
-          if(zoneNetworktype == "Basic") { //Basic zone has only one guest network (only one NIC)
-            var includingSecurityGroupService = false;
+					
+					var includingSecurityGroupService = false;
+          if(zoneObj.networktype == "Basic") { //Basic zone           
             $.ajax({
               url: createURL("listNetworks&id=" + args.context.instances[0].nic[0].networkid),
               dataType: "json",
@@ -253,7 +255,7 @@
               success: function(json) {
                 var items = json.listnetworksresponse.network;
                 if(items != null && items.length > 0) {
-                  var networkObj = items[0];    //basic zone has only one guest network
+                  var networkObj = items[0];    //Basic zone has only one guest network (only one NIC)    
                   var serviceObjArray = networkObj.service;
                   for(var k = 0; k < serviceObjArray.length; k++) {
                     if(serviceObjArray[k].name == "SecurityGroup") {
@@ -264,12 +266,18 @@
                 }
               }
             });
-            if(includingSecurityGroupService == false)
-              hiddenTabs.push("securityGroups");
           }
-          else { //Advanced zone
-            hiddenTabs.push("securityGroups");
+          else if(zoneObj.networktype == "Advanced") { //Advanced zone    
+            if(zoneObj.securitygroupsenabled == true)	
+              includingSecurityGroupService = true;
+						else
+						  includingSecurityGroupService = false;						
           }
+					
+					if(includingSecurityGroupService == false) {
+            hiddenTabs.push("securityGroups");
+					}
+					
           return hiddenTabs;
         },
         actions: {