mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
cloudstack 3.0 new UI - Instance detail page - show/hide Security Group tab upon zone's networktype and guest network's including SecurityGroup service or not.
This commit is contained in:
parent
4a0a2fbf8e
commit
107ae09acb
@ -738,9 +738,42 @@
|
|||||||
name: 'Instance details',
|
name: 'Instance details',
|
||||||
viewAll: { path: 'storage.volumes', label: 'Volumes' },
|
viewAll: { path: 'storage.volumes', label: 'Volumes' },
|
||||||
tabFilter: function(args) {
|
tabFilter: function(args) {
|
||||||
var hiddenTabs = [];
|
var hiddenTabs = [];
|
||||||
if(g_directAttachSecurityGroupsEnabled != "true")
|
var zoneNetworktype;
|
||||||
hiddenTabs.push("securityGroups");
|
$.ajax({
|
||||||
|
url: createURL("listZones&id=" + args.context.instances[0].zoneid),
|
||||||
|
dataType: "json",
|
||||||
|
async: false,
|
||||||
|
success: function(json) {
|
||||||
|
zoneNetworktype = json.listzonesresponse.zone[0].networktype;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if(zoneNetworktype == "Basic") { //Basic zone has only one guest network (only one NIC)
|
||||||
|
var includingSecurityGroupService = false;
|
||||||
|
$.ajax({
|
||||||
|
url: createURL("listNetworks&id=" + args.context.instances[0].nic[0].networkid),
|
||||||
|
dataType: "json",
|
||||||
|
async: false,
|
||||||
|
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 serviceObjArray = networkObj.service;
|
||||||
|
for(var k = 0; k < serviceObjArray.length; k++) {
|
||||||
|
if(serviceObjArray[k].name == "SecurityGroup") {
|
||||||
|
includingSecurityGroupService = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if(includingSecurityGroupService == false)
|
||||||
|
hiddenTabs.push("securityGroups");
|
||||||
|
}
|
||||||
|
else { //Advanced zone
|
||||||
|
hiddenTabs.push("securityGroups");
|
||||||
|
}
|
||||||
return hiddenTabs;
|
return hiddenTabs;
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user