Skip to content

Commit aa8d566

Browse files
author
Jessica Wang
committed
CLOUDSTACK-4142: listNetworkOfferings API has been changed to not return system-owned network offerings to regular user(domain user). Therefore, change UI to determine whether a network has EIP service/capability upon listNetworks API response instead of listNetworkOfferings API response.
1 parent a5ca05f commit aa8d566

1 file changed

Lines changed: 28 additions & 38 deletions

File tree

‎ui/scripts/network.js‎

Lines changed: 28 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -982,57 +982,47 @@
982982
},
983983

984984
tabFilter: function(args) {
985-
var networkOfferingHavingELB = false;
985+
var networkHavingELB = false;
986986
var hasNetworkACL = false;
987987
var hasSRXFirewall = false;
988988
var isVPC = false;
989989
var isAdvancedSGZone = false;
990990
var hiddenTabs = [];
991991
var isSharedNetwork;
992+
993+
var thisNetwork = args.context.networks[0];
994+
if (thisNetwork.vpcid != null) {
995+
isVPC = true;
996+
}
997+
if (thisNetwork.type == 'Shared') {
998+
isSharedNetwork = true;
999+
}
9921000

993-
// Get network offering data
994-
$.ajax({
995-
url: createURL("listNetworkOfferings&id=" + args.context.networks[0].networkofferingid),
996-
dataType: "json",
997-
async: false,
998-
success: function(json) {
999-
var networkoffering = json.listnetworkofferingsresponse.networkoffering[0];
1000-
1001-
if (networkoffering.forvpc) {
1002-
isVPC = true;
1003-
}
1004-
1005-
if (networkoffering.guestiptype == 'Shared') {
1006-
isSharedNetwork = true;
1007-
}
1008-
1009-
$(networkoffering.service).each(function() {
1010-
var thisService = this;
1001+
$(thisNetwork.service).each(function() {
1002+
var thisService = this;
10111003

1012-
if (thisService.name == 'NetworkACL') {
1013-
hasNetworkACL = true;
1014-
} else if (thisService.name == "Lb") {
1015-
$(thisService.capability).each(function() {
1016-
if (this.name == "ElasticLb" && this.value == "true") {
1017-
networkOfferingHavingELB = true;
1018-
}
1019-
});
1004+
if (thisService.name == 'NetworkACL') {
1005+
hasNetworkACL = true;
1006+
} else if (thisService.name == "Lb") {
1007+
$(thisService.capability).each(function() {
1008+
if (this.name == "ElasticLb" && this.value == "true") {
1009+
networkHavingELB = true;
10201010
}
1011+
});
1012+
}
10211013

1022-
if (thisService.name == 'Firewall') {
1023-
$(thisService.provider).each(function() {
1024-
if (this.name == 'JuniperSRX') {
1025-
hasSRXFirewall = true;
1026-
1027-
return false;
1028-
}
1014+
if (thisService.name == 'Firewall') {
1015+
$(thisService.provider).each(function() {
1016+
if (this.name == 'JuniperSRX') {
1017+
hasSRXFirewall = true;
10291018

1030-
return true;
1031-
});
1019+
return false;
10321020
}
1021+
1022+
return true;
10331023
});
10341024
}
1035-
});
1025+
});
10361026

10371027
// Get zone data
10381028
$.ajax({
@@ -1048,7 +1038,7 @@
10481038
}
10491039
});
10501040

1051-
if (!networkOfferingHavingELB) {
1041+
if (!networkHavingELB) {
10521042
hiddenTabs.push("addloadBalancer");
10531043
}
10541044

0 commit comments

Comments
 (0)