From 1a48773c50d53ac6dc0f282d2881906c032af177 Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Thu, 12 Jul 2012 16:05:05 -0700 Subject: [PATCH] cloudstack 3.0 UI - VPC - implement update VPC action. --- ui/scripts/network.js | 49 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 41 insertions(+), 8 deletions(-) diff --git a/ui/scripts/network.js b/ui/scripts/network.js index a37875b055d..d735a6c60da 100644 --- a/ui/scripts/network.js +++ b/ui/scripts/network.js @@ -2608,8 +2608,7 @@ virtualmachineid: args.itemData[0].id, openfirewall: false }; - - //debugger; + if('vpc' in args.context) { //from VPC section if(args.data.tier == null) { args.response.error('Tier is required'); @@ -2624,7 +2623,7 @@ networkid: args.context.networks[0].id }); } - //debugger; + $.ajax({ url: createURL('createPortForwardingRule'), data: data, @@ -3548,6 +3547,40 @@ }, messages: { notification: function() { return ''; } } }, + + edit: { + label: 'label.edit', + action: function(args) { + $.ajax({ + url: createURL('updateVPC'), + data: { + id: args.context.vpc[0].id, + name: args.data.name, + displaytext: args.data.displaytext + }, + success: function(json) { + var jid = json.updatevpcresponse.jobid; + args.response.success( + {_custom: + { + jobId: jid, + getUpdatedItem: function(json) { + return json.queryasyncjobresultresponse.jobresult.vpc; + } + } + } + ); + }, + error: function(data) { + args.response.error(parseXMLHttpResponse(data)); + } + }); + }, + notification: { + poll: pollAsyncJobResult + } + }, + remove: { label: 'remove VPC', messages: { @@ -3568,9 +3601,9 @@ var jid = json.deletevpcresponse.jobid; args.response.success( {_custom: - { - jobId: jid //take snapshot from a volume doesn't change any property in this volume. So, don't need to specify getUpdatedItem() to return updated volume. Besides, createSnapshot API doesn't return updated volume. - } + { + jobId: jid + } } ); }, @@ -3589,10 +3622,10 @@ title: 'label.details', fields: [ { - name: { label: 'label.name' } + name: { label: 'label.name', isEditable: true } }, { - displaytext: { label: 'label.description' }, + displaytext: { label: 'label.description', isEditable: true }, zonename: { label: 'label.zone' }, cidr: { label: 'label.cidr' }, networkdomain: { label: 'label.network.domain' },