mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
bug 13553: When clicking network on left menu - (1) make network section always available. (2) Check if there is SecurityGroup network, if yes, make SecurityGroup section available in filter dropdown.
This commit is contained in:
parent
9d4437e089
commit
c233a5c07e
@ -76,68 +76,30 @@
|
||||
}
|
||||
};
|
||||
|
||||
var securityGroupNetworkObjs = [];
|
||||
var isolatedSourcenatNetworkObjs = [];
|
||||
var sharedLbStaticnatSgNetworkObjs = [];
|
||||
|
||||
cloudStack.sections.network = {
|
||||
title: 'Network',
|
||||
id: 'network',
|
||||
sectionSelect: {
|
||||
preFilter: function(args) {
|
||||
var havingSecurityGroupNetwork = false;
|
||||
$.ajax({
|
||||
url: createURL('listNetworks', { ignoreProject: true }),
|
||||
url: createURL('listNetworks'),
|
||||
data: {
|
||||
supportedServices: 'SecurityGroup',
|
||||
listAll: true
|
||||
},
|
||||
async: false,
|
||||
success: function(data) {
|
||||
if (data.listnetworksresponse.network && data.listnetworksresponse.network.length) {
|
||||
securityGroupNetworkObjs = data.listnetworksresponse.network;
|
||||
if (data.listnetworksresponse.network != null && data.listnetworksresponse.network.length > 0) {
|
||||
havingSecurityGroupNetwork = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
url: createURL('listNetworks'),
|
||||
data: {
|
||||
type: 'isolated',
|
||||
supportedServices: 'SourceNat',
|
||||
listAll: true
|
||||
},
|
||||
async: false,
|
||||
success: function(data) {
|
||||
if (data.listnetworksresponse.network != null && data.listnetworksresponse.network.length > 0) {
|
||||
isolatedSourcenatNetworkObjs = data.listnetworksresponse.network;
|
||||
}
|
||||
}
|
||||
});
|
||||
var sectionsToShow = ['networks'];
|
||||
if(havingSecurityGroupNetwork == true)
|
||||
sectionsToShow.push('securityGroups');
|
||||
|
||||
$.ajax({
|
||||
url: createURL('listNetworks'),
|
||||
data: {
|
||||
type: 'shared',
|
||||
supportedServices: 'Lb,StaticNat,SecurityGroup',
|
||||
listAll: true
|
||||
},
|
||||
async: false,
|
||||
success: function(data) {
|
||||
if (data.listnetworksresponse.network != null && data.listnetworksresponse.network.length > 0) {
|
||||
sharedLbStaticnatSgNetworkObjs = data.listnetworksresponse.network;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var sectionsToShow = [];
|
||||
if(securityGroupNetworkObjs.length > 0) //if there is securityGroup networks
|
||||
sectionsToShow.push('securityGroups'); //show securityGroup section
|
||||
|
||||
if(isolatedSourcenatNetworkObjs.length > 0 || sharedLbStaticnatSgNetworkObjs.length > 0) //if there is isolatedSourceNat networks or sharedLbStaticnatSg networks
|
||||
sectionsToShow.push('networks'); //show network section
|
||||
|
||||
if(sectionsToShow.length == 0) //if no securityGroup networks, nor isolatedSourceNat networks, nor sharedLbStaticnatSg networks
|
||||
sectionsToShow.push('networks'); // still show network section (no networks in the grid though)
|
||||
return sectionsToShow;
|
||||
},
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user