Skip to content

Commit 690c312

Browse files
committed
CLOUDSTACK-767:nTier Apps 2.0 : Allow more than one Private GW to a VPC
1 parent 5a66ec3 commit 690c312

1 file changed

Lines changed: 87 additions & 0 deletions

File tree

ui/scripts/vpc.js

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -616,6 +616,7 @@
616616
}
617617
},
618618
gateways: {
619+
619620
add: {
620621
preCheck: function(args) {
621622
if(isAdmin()) { //root-admin
@@ -732,6 +733,92 @@
732733
netmask: { label: 'label.netmask', validation: { required: true }},
733734
vlan: { label: 'label.vlan', validation: { required: true }}
734735
},
736+
737+
actions:{
738+
add:{
739+
label:'Add Private Gateway',
740+
createForm:{
741+
title: 'label.add.new.gateway',
742+
desc: 'message.add.new.gateway.to.vpc',
743+
fields: {
744+
physicalnetworkid: {
745+
docID: 'helpVPCGatewayPhysicalNetwork',
746+
label: 'label.physical.network',
747+
select: function(args) {
748+
$.ajax({
749+
url: createURL("listPhysicalNetworks"),
750+
data: {
751+
zoneid: args.context.vpc[0].zoneid
752+
},
753+
success: function(json) {
754+
var objs = json.listphysicalnetworksresponse.physicalnetwork;
755+
var items = [];
756+
$(objs).each(function() {
757+
items.push({id: this.id, description: this.name});
758+
});
759+
args.response.success({data: items});
760+
}
761+
});
762+
}
763+
},
764+
vlan: {
765+
label: 'label.vlan', validation: { required: true },
766+
docID: 'helpVPCGatewayVLAN'
767+
},
768+
ipaddress: {
769+
label: 'label.ip.address', validation: { required: true },
770+
docID: 'helpVPCGatewayIP'
771+
},
772+
gateway: {
773+
label: 'label.gateway', validation: { required: true },
774+
docID: 'helpVPCGatewayGateway'
775+
},
776+
netmask: {
777+
label: 'label.netmask', validation: { required: true },
778+
docID: 'helpVPCGatewayNetmask'
779+
}
780+
}
781+
782+
783+
784+
},
785+
action:function(args){
786+
$.ajax({
787+
url: createURL('createPrivateGateway'),
788+
data: {
789+
physicalnetworkid: args.data.physicalnetworkid,
790+
vpcid: args.context.vpc[0].id,
791+
ipaddress: args.data.ipaddress,
792+
gateway: args.data.gateway,
793+
netmask: args.data.netmask,
794+
vlan: args.data.vlan
795+
},
796+
success: function(json) {
797+
var jid = json.createprivategatewayresponse.jobid;
798+
args.response.success(
799+
{_custom:
800+
{jobId: jid,
801+
getUpdatedItem: function(json) {
802+
return json.queryasyncjobresultresponse.jobresult.privategateway;
803+
}
804+
}
805+
}
806+
);
807+
},
808+
error: function(json) {
809+
args.response.error(parseXMLHttpResponse(json));
810+
}
811+
});
812+
},
813+
814+
notification: {
815+
poll: pollAsyncJobResult
816+
}
817+
818+
819+
}
820+
},
821+
735822
dataProvider: function(args) {
736823
$.ajax({
737824
url: createURL('listPrivateGateways'),

0 commit comments

Comments
 (0)