Return-Path: X-Original-To: apmail-cloudstack-commits-archive@www.apache.org Delivered-To: apmail-cloudstack-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 42C32DC27 for ; Tue, 14 May 2013 17:27:27 +0000 (UTC) Received: (qmail 96462 invoked by uid 500); 14 May 2013 17:27:27 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 96380 invoked by uid 500); 14 May 2013 17:27:27 -0000 Mailing-List: contact commits-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list commits@cloudstack.apache.org Received: (qmail 96370 invoked by uid 99); 14 May 2013 17:27:27 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 14 May 2013 17:27:27 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id C8DFF86E5; Tue, 14 May 2013 17:27:26 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: pranavs@apache.org To: commits@cloudstack.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: git commit: updated refs/heads/master to 10380ce Date: Tue, 14 May 2013 17:27:26 +0000 (UTC) Updated Branches: refs/heads/master b5bb9f251 -> 10380cea4 CLOUDSTACK-768:ACLs on Private GATEWAY Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/10380cea Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/10380cea Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/10380cea Branch: refs/heads/master Commit: 10380cea41257608db45a7f6ad588d754ebe8811 Parents: b5bb9f2 Author: Pranav Saxena Authored: Tue May 14 22:47:53 2013 +0530 Committer: Pranav Saxena Committed: Tue May 14 22:47:53 2013 +0530 ---------------------------------------------------------------------- ui/scripts/vpc.js | 138 +++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 130 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/10380cea/ui/scripts/vpc.js ---------------------------------------------------------------------- diff --git a/ui/scripts/vpc.js b/ui/scripts/vpc.js index 7f56f9b..1f01d47 100644 --- a/ui/scripts/vpc.js +++ b/ui/scripts/vpc.js @@ -723,9 +723,32 @@ isBoolean:true, isChecked:false - } + }, + + aclid:{ + label:'ACL', + select:function(args){ + $.ajax({ + url: createURL('listNetworkACLLists'), + dataType: 'json', + async: true, + success: function(json) { + var objs = json.listnetworkacllistsresponse.networkacllist; + var items = []; + $(objs).each(function() { + if(this.name == "default_deny") + items.unshift({id:this.id,description:this.name}); + else + items.push({id: this.id, description: this.name}); + + + }); + args.response.success({data: items}); + } + }); - + } + } } }, action: function(args) { @@ -745,7 +768,9 @@ ipaddress: args.data.ipaddress, gateway: args.data.gateway, netmask: args.data.netmask, - vlan: args.data.vlan + vlan: args.data.vlan, + aclid:args.data.aclid + }, success: function(json) { var jid = json.createprivategatewayresponse.jobid; @@ -834,11 +859,34 @@ isBoolean:true, isChecked:false - } + }, - } + aclid:{ + label:'ACL', + select:function(args){ + $.ajax({ + url: createURL('listNetworkACLLists'), + dataType: 'json', + async: true, + success: function(json) { + var objs = json.listnetworkacllistsresponse.networkacllist; + var items = []; + $(objs).each(function() { + if(this.name == "default_deny") + items.unshift({id:this.id,description:this.name}); + else + items.push({id: this.id, description: this.name}); + + + }); + args.response.success({data: items}); + } + }); + } + } + } }, action:function(args){ @@ -851,15 +899,17 @@ array1.push("&sourcenatsupported=false"); - $.ajax({ + $.ajax({ url: createURL('createPrivateGateway'+ array1.join("")), data: { - physicalnetworkid: args.data.physicalnetworkid, + 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 + vlan: args.data.vlan, + aclid:args.data.aclid + }, success: function(json) { var jid = json.createprivategatewayresponse.jobid; @@ -933,7 +983,77 @@ notification: { poll: pollAsyncJobResult } + }, + + replaceACL:{ + label:'Replace ACL', + createForm:{ + title:'Replace ACL', + label:'Replace ACL', + fields:{ + aclid:{ + label:'ACL', + select:function(args){ + $.ajax({ + url: createURL('listNetworkACLLists'), + dataType: 'json', + async: true, + success: function(json) { + var objs = json.listnetworkacllistsresponse.networkacllist; + var items = []; + $(objs).each(function() { + + items.push({id: this.id, description: this.name}); + }); + args.response.success({data: items}); + } + }); + } } + } + }, + + action: function(args) { + $.ajax({ + url: createURL("replaceNetworkACLList&gatewayid=" + args.context.vpcGateways[0].id + "&aclid=" + args.data.aclid ), + dataType: "json", + success: function(json) { + var jid = json.replacenetworkacllistresponse.jobid; + args.response.success( + + {_custom: + { + jobId: jid, + getUpdatedItem: function(json) { + var item = json.queryasyncjobresultresponse.jobresult.aclid; + return {data:item}; + } + } + } + + ) + }, + + error:function(json){ + + args.response.error(parseXMLHttpResponse(json)); + } + }); + }, + + notification: { + poll: pollAsyncJobResult + }, + + messages: { + confirm: function(args) { + return 'Do you want to replace the ACL with a new one ?'; + }, + notification: function(args) { + return 'ACL replaced'; + } + } + } }, tabs: { details: { @@ -975,6 +1095,8 @@ var allowedActions = []; if(isAdmin()) { allowedActions.push("remove"); + allowedActions.push("replaceACL"); + } return allowedActions; }