From 37786a832559ff896b4f4f82416bcd071f371af0 Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Wed, 11 Jul 2012 14:42:00 -0700 Subject: [PATCH] cloudstack 3.0 UI - VPC - gateways - static route - implement Add action. --- ui/scripts/vpc.js | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/ui/scripts/vpc.js b/ui/scripts/vpc.js index 0d830363422..4133ee7b462 100644 --- a/ui/scripts/vpc.js +++ b/ui/scripts/vpc.js @@ -507,8 +507,7 @@ account: { label: 'label.account' } } ], - dataProvider: function(args) { - /* + dataProvider: function(args) { $.ajax({ url: createURL('listPrivateGateways'), data: { @@ -519,10 +518,6 @@ args.response.success({ data: item }); } }); - */ - - args.response.success({ data: args.context.vpcGateways[0] }); - } }, staticRoutes: { @@ -540,13 +535,28 @@ }, add: { label: 'Add', - action: function(args) { - args.response.success({ - notification: { - label: 'Add static route to gateway', - poll: function(args) { args.complete(); } - } - }); + action: function(args) { + $.ajax({ + url: createURL('createStaticRoute'), + data: { + gatewayid: args.context.vpcGateways[0].id, + cidr: args.data.cidr + }, + success: function(data) { + args.response.success({ + _custom: { + jobId: data.createstaticrouteresponse.jobid + }, + notification: { + label: 'Add static route', + poll: pollAsyncJobResult + } + }); + }, + error: function(data) { + args.response.error(parseXMLHttpResponse(data)); + } + }); } }, actions: {