Skip to content

Commit 156b08a

Browse files
GaborApatiNagybfederle
authored andcommitted
CLOUDSTACK-6255
UI for supporting region level VPC, distributed routing enabled VPC and stretched L2 neworks
1 parent 1e0d671 commit 156b08a

8 files changed

Lines changed: 805 additions & 74 deletions

File tree

client/WEB-INF/classes/resources/messages.properties

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1284,6 +1284,18 @@ label.assign.instance.another=Assign Instance to Another Account
12841284
label.network.addVM=Add network to VM
12851285
label.set.default.NIC=Set default NIC
12861286
label.Xenserver.Tools.Version61plus=XenServer Tools Version 6.1\+
1287+
label.supportsstrechedl2subnet=Supports Streched L2 Subnet
1288+
label.menu.vpc.offerings=VPC Offerings
1289+
label.vpc.offering=VPC Offering
1290+
label.regionlevelvpc=Region Level VPC
1291+
label.add.vpc.offering=Add VPC Offering
1292+
label.distributedrouter=DistributedRouter
1293+
label.vpc.offering.details=VPC offering details
1294+
label.disable.vpc.offering=Disable VPC offering
1295+
label.enable.vpc.offering=Enable VPC offering
1296+
label.remove.vpc.offering=Remove VPC offering
1297+
label.vpc.distributedvpcrouter=Distributed VPC Router
1298+
label.vpc.supportsregionlevelvpc=Supports Region Level VPC
12871299
label.dynamically.scalable=Dynamically Scalable
12881300
label.instance.scaled.up=Instance Scaled Up
12891301
label.tag.key=Tag Key
@@ -1891,6 +1903,11 @@ message.confirm.enable.network.offering=Are you sure you want to enable this net
18911903
message.enabling.network.offering=Enabling network offering
18921904
message.confirm.remove.network.offering=Are you sure you want to remove this network offering?
18931905
message.confirm.disable.network.offering=Are you sure you want to disable this network offering?
1906+
message.disabling.vpc.offering=Disabling VPC offering
1907+
message.confirm.enable.vpc.offering=Are you sure you want to enable this VPC offering?
1908+
message.enabling.vpc.offering=Enabling VPC offering
1909+
message.confirm.remove.vpc.offering=Are you sure you want to remove this VPC offering?
1910+
message.confirm.disable.vpc.offering=Are you sure you want to disable this VPC offering?
18941911
mode=Mode
18951912
network.rate=Network Rate
18961913
notification.reboot.instance=Reboot instance

ui/dictionary.jsp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1865,5 +1865,23 @@ dictionary = {
18651865
'message.enabling.network.offering': '<fmt:message key="message.enabling.network.offering" />',
18661866
'message.confirm.remove.network.offering': '<fmt:message key="message.confirm.remove.network.offering" />',
18671867
'message.confirm.disable.network.offering': '<fmt:message key="message.confirm.disable.network.offering" />',
1868+
'label.supportsstrechedl2subnet': '<fmt:message key="label.supportsstrechedl2subnet" />',
1869+
'label.menu.vpc.offerings': '<fmt:message key="label.menu.vpc.offerings" />',
1870+
'label.vpc.offering': '<fmt:message key="label.vpc.offering" />',
1871+
'label.add.vpc.offering': '<fmt:message key="label.add.vpc.offering" />',
1872+
'label.distributedrouter': '<fmt:message key="label.distributedrouter" />',
1873+
'label.regionlevelvpc': '<fmt:message key="label.regionlevelvpc" />',
1874+
'label.vpc.offering.details': '<fmt:message key="label.vpc.offering.details" />',
1875+
'label.disable.vpc.offering': '<fmt:message key="label.disable.vpc.offering" />',
1876+
'label.enable.vpc.offering': '<fmt:message key="label.enable.vpc.offering" />',
1877+
'label.remove.vpc.offering': '<fmt:message key="label.remove.vpc.offering" />',
1878+
'label.vpc.distributedvpcrouter': '<fmt:message key="label.vpc.distributedvpcrouter" />',
1879+
'label.vpc.supportsregionlevelvpc': '<fmt:message key="label.vpc.supportsregionlevelvpc" />',
1880+
'message.disabling.vpc.offering': '<fmt:message key="message.disabling.vpc.offering" />',
1881+
'message.confirm.enable.vpc.offering': '<fmt:message key="message.confirm.enable.vpc.offering" />',
1882+
'message.enabling.vpc.offering': '<fmt:message key="message.enabling.vpc.offering" />',
1883+
'message.confirm.remove.vpc.offering': '<fmt:message key="message.confirm.remove.vpc.offering" />',
1884+
'message.confirm.disable.vpc.offering': '<fmt:message key="message.confirm.disable.vpc.offering" />'
1885+
18681886
};
18691887
</script>

ui/scripts/configuration.js

Lines changed: 662 additions & 54 deletions
Large diffs are not rendered by default.

ui/scripts/docs.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1219,5 +1219,13 @@ cloudStack.docs = {
12191219
helpLdapGroupName: {
12201220
desc: 'The group name from which you want to import LDAP users',
12211221
externalLink: ''
1222+
},
1223+
helpVpcOfferingName: {
1224+
desc: 'Any desired name for the VPC offering',
1225+
externalLink: ''
1226+
},
1227+
helpVpcOfferingDescription: {
1228+
desc: 'A short description of the offering that can be displayed to users',
1229+
externalLink: ''
12221230
}
12231231
};

ui/scripts/network.js

Lines changed: 44 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5178,7 +5178,16 @@
51785178
url: createURL('listVPCs'),
51795179
data: data,
51805180
success: function(json) {
5181-
var items = json.listvpcsresponse.vpc;
5181+
var items = json.listvpcsresponse.vpc ? json.listvpcsresponse.vpc : { };
5182+
5183+
//If we are coming from Home > Regions, show only regional vpcs
5184+
if (args.context.regions)
5185+
items = $.grep(
5186+
items,
5187+
function (vpc, i) {
5188+
return vpc.regionlevelvpc;
5189+
});
5190+
51825191
args.response.success({
51835192
data: items
51845193
});
@@ -5272,30 +5281,49 @@
52725281
data: items
52735282
});
52745283
}
5284+
},
5285+
vpcoffering: {
5286+
label: 'label.vpc.offering',
5287+
validation: {
5288+
required: true
5289+
},
5290+
5291+
select: function(args) {
5292+
var data = {
5293+
listAll: true
5294+
};
5295+
$.ajax({
5296+
url: createURL('listVPCOfferings'),
5297+
data: {
5298+
listAll: true
5299+
},
5300+
success: function(json) {
5301+
var offerings = json.listvpcofferingsresponse.vpcoffering ? json.listvpcofferingsresponse.vpcoffering : [];
5302+
var filteredofferings = $.grep(offerings, function(offering) {
5303+
return offering.state == 'Enabled';
5304+
});
5305+
args.response.success({
5306+
data: $.map(filteredofferings, function(vpco) {
5307+
return {
5308+
id: vpco.id,
5309+
description: vpco.name
5310+
};
5311+
})
5312+
});
5313+
}
5314+
});
5315+
}
52755316
}
52765317
}
52775318
},
52785319
action: function(args) {
5279-
var vpcOfferingName;
5280-
if (args.data.publicLoadBalancerProvider == 'VpcVirtualRouter')
5281-
vpcOfferingName = 'Default VPC offering';
5282-
else if (args.data.publicLoadBalancerProvider == 'Netscaler')
5283-
vpcOfferingName = 'Default VPC offering with Netscaler';
5284-
5285-
$.ajax({
5286-
url: createURL('listVPCOfferings'),
5287-
data: {
5288-
name: vpcOfferingName
5289-
},
5290-
success: function(json) {
5291-
var vpcofferingid = json.listvpcofferingsresponse.vpcoffering[0].id;
5292-
5320+
var vpcOfferingName = args.data.vpcoffering
52935321
var dataObj = {
52945322
name: args.data.name,
52955323
displaytext: args.data.displaytext,
52965324
zoneid: args.data.zoneid,
52975325
cidr: args.data.cidr,
5298-
vpcofferingid: vpcofferingid
5326+
vpcofferingid: args.data.vpcoffering
52995327
};
53005328

53015329
if (args.data.networkdomain != null && args.data.networkdomain.length > 0)
@@ -5323,8 +5351,6 @@
53235351
args.response.error(parseXMLHttpResponse(data));
53245352
}
53255353
});
5326-
}
5327-
});
53285354

53295355
},
53305356
notification: {

ui/scripts/regions.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,9 @@
147147
viewAll: [{
148148
path: 'regions.GSLB',
149149
label: 'GSLB'
150+
}, {
151+
path: 'network.vpc',
152+
label: 'label.regionlevelvpc'
150153
}, {
151154
path: 'regions.portableIpRanges',
152155
label: 'Portable IP',

ui/scripts/ui/dialog.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,10 @@
223223
});
224224

225225
if ($dependsOn.is('[type=checkbox]')) {
226-
var isReverse = args.form.fields[dependsOn].isReverse;
226+
227+
var isReverse = false;
228+
if (args.form.fields[dependsOn])
229+
isReverse = args.form.fields[dependsOn].isReverse;
227230

228231
// Checkbox
229232
$dependsOn.bind('click', function(event) {

ui/scripts/vpc.js

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3955,13 +3955,51 @@
39553955
}
39563956
});
39573957
}
3958+
},
3959+
3960+
zoneid: {
3961+
label: 'label.zone',
3962+
validation: {
3963+
required: true
3964+
},
3965+
isHidden: true,
3966+
3967+
select: function(args) {
3968+
//var $zoneSelect = $(".ui-dialog-content").find('select.zoneid');
3969+
var $zoneSelect = args.$select.closest('form').find('[rel=zoneid]');
3970+
if (!args.context.regions) {
3971+
$zoneSelect.hide();
39583972

3973+
args.response.success({
3974+
data: []
3975+
});
3976+
}
3977+
else {
3978+
$zoneSelect.css('display', 'inline-block');
3979+
$.ajax({
3980+
url: createURL('listZones'),
3981+
success: function(json) {
3982+
var zones = $.grep(json.listzonesresponse.zone, function(zone) {
3983+
return (zone.networktype == 'Advanced');
3984+
});
3985+
3986+
args.response.success({
3987+
data: $.map(zones, function(zone) {
3988+
return {
3989+
id: zone.id,
3990+
description: zone.name
3991+
};
3992+
})
3993+
});
3994+
}
3995+
});
3996+
}
3997+
}
39593998
}
39603999
}
39614000
},
39624001
action: function(args) {
39634002
var dataObj = {
3964-
zoneId: args.context.vpc[0].zoneid,
39654003
vpcid: args.context.vpc[0].id,
39664004
domainid: args.context.vpc[0].domainid,
39674005
account: args.context.vpc[0].account,
@@ -3972,6 +4010,16 @@
39724010
netmask: args.data.netmask
39734011
};
39744012

4013+
if (args.context.regions)
4014+
$.extend(dataObj, {
4015+
zoneId: args.data.zoneid
4016+
})
4017+
else
4018+
$.extend(dataObj, {
4019+
zoneId: args.context.vpc[0].zoneid
4020+
});
4021+
4022+
39754023
if (args.data.aclid != '')
39764024
$.extend(dataObj, {
39774025
aclid: args.data.aclid

0 commit comments

Comments
 (0)