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 = {
|
cloudStack.sections.network = {
|
||||||
title: 'Network',
|
title: 'Network',
|
||||||
id: 'network',
|
id: 'network',
|
||||||
sectionSelect: {
|
sectionSelect: {
|
||||||
preFilter: function(args) {
|
preFilter: function(args) {
|
||||||
|
var havingSecurityGroupNetwork = false;
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: createURL('listNetworks', { ignoreProject: true }),
|
url: createURL('listNetworks'),
|
||||||
data: {
|
data: {
|
||||||
supportedServices: 'SecurityGroup',
|
supportedServices: 'SecurityGroup',
|
||||||
listAll: true
|
listAll: true
|
||||||
},
|
},
|
||||||
async: false,
|
async: false,
|
||||||
success: function(data) {
|
|
||||||
if (data.listnetworksresponse.network && data.listnetworksresponse.network.length) {
|
|
||||||
securityGroupNetworkObjs = data.listnetworksresponse.network;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$.ajax({
|
|
||||||
url: createURL('listNetworks'),
|
|
||||||
data: {
|
|
||||||
type: 'isolated',
|
|
||||||
supportedServices: 'SourceNat',
|
|
||||||
listAll: true
|
|
||||||
},
|
|
||||||
async: false,
|
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
if (data.listnetworksresponse.network != null && data.listnetworksresponse.network.length > 0) {
|
if (data.listnetworksresponse.network != null && data.listnetworksresponse.network.length > 0) {
|
||||||
isolatedSourcenatNetworkObjs = data.listnetworksresponse.network;
|
havingSecurityGroupNetwork = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$.ajax({
|
var sectionsToShow = ['networks'];
|
||||||
url: createURL('listNetworks'),
|
if(havingSecurityGroupNetwork == true)
|
||||||
data: {
|
sectionsToShow.push('securityGroups');
|
||||||
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;
|
return sectionsToShow;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user