mirror of https://github.com/apache/cloudstack.git
Merge pull request #897 from nitin-maharana/CloudStack-Nitin10
CLOUDSTACK-8919: Slow UI response while loading the list of networks in network tab.Instead of searching for each network, now it is searching for each zone. For basic zone, it will show the security group directly because by default securitygroupsenabled is true. For advanced zone, check the securitygroupsenabled option in each zone. If any one has value true, then show. * pr/897: CLOUDSTACK-8919: Slow UI response while loading the list of networks in network tab. Signed-off-by: Remi Bergsma <github@remi.nl>
This commit is contained in:
commit
8db10be093
|
|
@ -376,7 +376,9 @@
|
|||
sectionSelect: {
|
||||
preFilter: function(args) {
|
||||
var sectionsToShow = ['networks'];
|
||||
var securityGroupsEnabledFound = false; //Until we found a zone where securitygroupsenabled is true.
|
||||
|
||||
//This call to show VPC and VPN Customer Gateway sections, if zone is advanced.
|
||||
$.ajax({
|
||||
url: createURL('listZones'),
|
||||
data: {
|
||||
|
|
@ -384,29 +386,40 @@
|
|||
},
|
||||
async: false,
|
||||
success: function(json) {
|
||||
advZoneObjs = json.listzonesresponse.zone;
|
||||
advZoneObjs = json.listzonesresponse ? json.listzonesresponse.zone : null;
|
||||
if (advZoneObjs != null && advZoneObjs.length > 0) {
|
||||
sectionsToShow.push('vpc');
|
||||
sectionsToShow.push('vpnCustomerGateway');
|
||||
|
||||
//At the same time check if any advanced zone has securitygroupsenabled is true.
|
||||
//If so, show Security Group section.
|
||||
for (var i = 0; (i < advZoneObjs.length) && !securityGroupsEnabledFound; i++) {
|
||||
if (advZoneObjs[i].securitygroupsenabled) {
|
||||
securityGroupsEnabledFound = true;
|
||||
sectionsToShow.push('securityGroups');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
url: createURL('listNetworks', {
|
||||
ignoreProject: true
|
||||
}),
|
||||
data: {
|
||||
supportedServices: 'SecurityGroup',
|
||||
listAll: true
|
||||
},
|
||||
async: false,
|
||||
success: function(json) {
|
||||
if (json.listnetworksresponse.network != null && json.listnetworksresponse.network.length > 0) {
|
||||
sectionsToShow.push('securityGroups');
|
||||
//If we didn't find any advanced zone whose securitygroupsenabled is true.
|
||||
//Search in all Basic zones.
|
||||
if (!securityGroupsEnabledFound) {
|
||||
$.ajax({
|
||||
url: createURL('listZones'),
|
||||
data: {
|
||||
networktype: 'Basic'
|
||||
},
|
||||
async: false,
|
||||
success: function(json) {
|
||||
var basicZoneObjs = json.listzonesresponse ? json.listzonesresponse.zone : null;
|
||||
if (basicZoneObjs != null && basicZoneObjs.length > 0) {
|
||||
sectionsToShow.push('securityGroups');
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
return sectionsToShow;
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue