Skip to content

Commit 7e0006a

Browse files
author
Jessica Wang
committed
CLOUDSTACK-747: internalLb in VPC - UI - create tier dialog - only one tier is allowed to have PublicLb in a VPC.
1 parent dbb223e commit 7e0006a

2 files changed

Lines changed: 17 additions & 28 deletions

File tree

‎ui/scripts/sharedFunctions.js‎

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -122,34 +122,22 @@ function createURL(apiName, options) {
122122
return urlString;
123123
}
124124

125-
/*
126-
function fromdb(val) {
127-
return sanitizeXSS(noNull(val));
128-
}
129-
*/
130-
131125
function todb(val) {
132126
return encodeURIComponent(val);
133127
}
134128

135-
/*
136-
function noNull(val) {
137-
if(val == null)
138-
return "";
139-
else
140-
return val;
141-
}
142-
*/
143-
144-
/*
145-
function sanitizeXSS(val) { // Prevent cross-site-script(XSS) attack
146-
if(val == null || typeof(val) != "string")
147-
return val;
148-
val = val.replace(/</g, "&lt;"); //replace < whose unicode is \u003c
149-
val = val.replace(/>/g, "&gt;"); //replace > whose unicode is \u003e
150-
return unescape(val);
151-
}
152-
*/
129+
//LB provider map
130+
var lbProviderMap = {
131+
"publicLb": {
132+
"non-vpc": ["VirtualRouter", "Netscaler", "F5"],
133+
"vpc": ["VpcVirtualRouter", "Netscaler"]
134+
},
135+
"internalLb": {
136+
"non-vpc": [],
137+
"vpc": ["InternalLbVm"]
138+
}
139+
};
140+
153141

154142
// Role Functions
155143
function isAdmin() {

‎ui/scripts/vpc.js‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2344,15 +2344,16 @@
23442344
var items;
23452345
if(networkSupportingLbExists == true) {
23462346
items = $.grep(networkOfferings, function(networkOffering) {
2347-
var includingLbService = false;
2347+
var includingPublicLbService = false;
23482348
$(networkOffering.service).each(function(){
23492349
var thisService = this;
2350-
if(thisService.name == "Lb") {
2351-
includingLbService = true;
2350+
//only one tier is allowed to have PublicLb provider in a VPC
2351+
if(thisService.name == "Lb" && lbProviderMap.publicLb.vpc.indexOf(thisService.provider[0].name) != -1) {
2352+
includingPublicLbService = true;
23522353
return false; //break $.each() loop
23532354
}
23542355
});
2355-
return !includingLbService;
2356+
return !includingPublicLbService;
23562357
});
23572358
}
23582359
else {

0 commit comments

Comments
 (0)