CLOUDSTACK-767:nTier Apps 2.0 : Allow more than one Private GW to a VPC

Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/690c3129
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/690c3129
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/690c3129

Branch: refs/heads/bvt
Commit: 690c31290bcbd138c1cf49a7f8ca72fbe8c33c24
Parents: 5a66ec3
Author: Pranav Saxena <pranav.sax...@citrix.com>
Authored: Fri Mar 29 18:00:42 2013 +0530
Committer: Pranav Saxena <pranav.sax...@citrix.com>
Committed: Fri Mar 29 18:00:42 2013 +0530

----------------------------------------------------------------------
 ui/scripts/vpc.js |   87 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 87 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/690c3129/ui/scripts/vpc.js
----------------------------------------------------------------------
diff --git a/ui/scripts/vpc.js b/ui/scripts/vpc.js
index 4281ca2..a4834f2 100644
--- a/ui/scripts/vpc.js
+++ b/ui/scripts/vpc.js
@@ -616,6 +616,7 @@
       }
     },
     gateways: {
+
       add: {
         preCheck: function(args) {          
                                        if(isAdmin()) { //root-admin
@@ -732,6 +733,92 @@
               netmask: { label: 'label.netmask', validation: { required: true 
}},
               vlan: { label: 'label.vlan', validation: { required: true }}
             },
+
+         actions:{
+           add:{
+            label:'Add Private Gateway',
+            createForm:{
+                 title: 'label.add.new.gateway',
+                 desc: 'message.add.new.gateway.to.vpc',
+                 fields: {
+                     physicalnetworkid: {
+                     docID: 'helpVPCGatewayPhysicalNetwork',
+                     label: 'label.physical.network',
+                     select: function(args) {
+                                                                $.ajax({
+                                                                        url: 
createURL("listPhysicalNetworks"),
+                                                                        data: {
+                                                                          
zoneid: args.context.vpc[0].zoneid
+                                                                        },
+                                                                        
success: function(json) {
+                                                                               
 var objs = json.listphysicalnetworksresponse.physicalnetwork;
+                                                                               
 var items = [];
+                                                                               
 $(objs).each(function() {
+                                                                               
         items.push({id: this.id, description: this.name});
+                                                                               
 });
+                                                                               
 args.response.success({data: items});
+                                                                        }
+                                                                });
+              }
+                                                },
+            vlan: {
+              label: 'label.vlan', validation: { required: true },
+              docID: 'helpVPCGatewayVLAN'
+            },
+            ipaddress: {
+              label: 'label.ip.address', validation: { required: true },
+              docID: 'helpVPCGatewayIP'
+            },
+            gateway: {
+              label: 'label.gateway', validation: { required: true },
+              docID: 'helpVPCGatewayGateway'
+            },
+            netmask: {
+              label: 'label.netmask', validation: { required: true },
+              docID: 'helpVPCGatewayNetmask'
+            }
+          }
+
+
+
+            },
+            action:function(args){
+                       $.ajax({
+            url: createURL('createPrivateGateway'),
+            data: {
+                                                  physicalnetworkid: 
args.data.physicalnetworkid,
+              vpcid: args.context.vpc[0].id,
+              ipaddress: args.data.ipaddress,
+              gateway: args.data.gateway,
+              netmask: args.data.netmask,
+              vlan: args.data.vlan
+            },
+            success: function(json) {
+              var jid = json.createprivategatewayresponse.jobid;
+              args.response.success(
+                {_custom:
+                 {jobId: jid,
+                  getUpdatedItem: function(json) {
+                    return 
json.queryasyncjobresultresponse.jobresult.privategateway;
+                  }
+                 }
+                }
+              );
+            },
+            error: function(json) {
+              args.response.error(parseXMLHttpResponse(json));
+            }
+          });
+               },
+
+          notification: {
+          poll: pollAsyncJobResult
+                   }
+
+
+             }
+           },
+
             dataProvider: function(args) {
               $.ajax({
                 url: createURL('listPrivateGateways'),

Reply via email to