From bea3f441446aa1b56a758233dc812da10e1a9ff3 Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Wed, 5 Jun 2013 13:43:51 -0700 Subject: [PATCH] CLOUDSTACK-747: UI - Internal LB detailView - Assigned VMs tab - implement Remove from LB action. --- ui/scripts/vpc.js | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/ui/scripts/vpc.js b/ui/scripts/vpc.js index 4cdc1408ca6..7ebc3f31065 100644 --- a/ui/scripts/vpc.js +++ b/ui/scripts/vpc.js @@ -606,7 +606,8 @@ assignedVms: { title: 'Assigned VMs', multiple: true, - listView: { + listView: { + id: 'assignedVms', fields: { name: { label: 'label.name' }, ipaddress: { label: 'label.ip.address' } @@ -622,7 +623,39 @@ args.response.success({ data: item.loadbalancerinstance }); } }); - } + }, + actions: { + remove: { + label: 'remove VM from load balancer', + addRow: 'false', + messages: { + confirm: function(args) { + return 'Please confirm you want to remove VM from load balancer'; + }, + notification: function(args) { + return 'remove VM from load balancer'; + } + }, + action: function(args) { + $.ajax({ + url: createURL('removeFromLoadBalancerRule'), + data: { + id: args.context.internalLoadBalancers[0].id, + virtualmachineids: args.context.assignedVms[0].id + }, + success: function(json) { + var jid = json.removefromloadbalancerruleresponse.jobid; + args.response.success({ + _custom: { jobId: jid } + }); + } + }); + }, + notificaton: { + poll: pollAsyncJobResult + } + } + } } } }