diff --git a/ui/scripts/vpc.js b/ui/scripts/vpc.js index d9eeab80fba..aa1e8d98ac3 100644 --- a/ui/scripts/vpc.js +++ b/ui/scripts/vpc.js @@ -892,7 +892,74 @@ } }); }, - + actions:{ + add: { + label:'add VPN connection', + messages: { + notification:function(args) { + return 'add VPN connection'; + }, + createForm: { + title:'add VPN connection', + fields: { + zoneid: { + label:'Zone', + validation:{required:true}, + select: function(args) { + $.ajax({ + url: createURL('listZones'), + data: { + available: true + }, + success: function(json) { + var zones = json.listzonesresponse.zone; + args.response.success({ + data: $.map(zones, function(zone) { + return { + id: zone.id, + description: zone.name + }; + }) + }); + } + }); + } + }, + vpcid:{ + label:'VPC', + validation:{ required:true}, + dependsOn: 'zoneid', + select: function(args) { + $.ajax({ + url: createURL('listVPCs'), + data: { + zoneid: args.zoneid, + listAll: true + }, + success: function(json) { + var items = json.listvpcsresponse.vpc; + var data; + if(items != null && items.length > 0) { + data = $.map(items, function(item) { + return { + id: item.id, + description: item.name + } + }); + } + args.response.success({ data: data }); + } + }); + } + } + } + }, + action:function(args) { + // Code for passing the customer gateway ID and VPN id + // Server side Integration code + } + } + }, detailView: { name: 'label.details', tabs: {