From 2bab7dc838e59d95cedda37ab6615c32eea476d5 Mon Sep 17 00:00:00 2001 From: bfederle Date: Mon, 19 Dec 2011 10:31:49 -0800 Subject: [PATCH] bug 12560: Implement change network offering status 12560: resolved fixed --- ui/scripts/network.js | 59 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 58 insertions(+), 1 deletion(-) diff --git a/ui/scripts/network.js b/ui/scripts/network.js index d1c4e60802b..3d6ddb7980b 100644 --- a/ui/scripts/network.js +++ b/ui/scripts/network.js @@ -114,6 +114,33 @@ detailView: { name: 'Network details', viewAll: { path: 'network.ipAddresses', label: 'Associated IP Addresses' }, + actions: { + edit: { + label: 'Edit network', + messages: { + notification: function() { return 'Updated network'; } + }, + action: function(args) { + $.ajax({ + url: createURL('updateNetwork'), + data: $.extend(args.data, { + id: args.context.networks[0].id + }), + success: function(json) { + args.response.success({ + _custom: { + jobId: json.updatenetworkresponse.jobid + } + }); + }, + error: function(json) { + args.response.error(parseXMLHttpResponse(json)); + } + }); + }, + notification: { poll: pollAsyncJobResult } + } + }, tabs: { details: { title: 'Details', @@ -125,7 +152,37 @@ type: { label: 'Type' }, displaytext: { label: 'Description' }, traffictype: { label: 'Traffic Type' }, - gateway: { label: 'Gateway' } + gateway: { label: 'Gateway' }, + networkofferingid: { + label: 'Network Offering', + isEditable: true, + select: function(args) { + $.ajax({ + url: createURL('listNetworkOfferings'), + data: { + state: 'enabled', + traffictype: args.context.networks[0].traffictype, + guestiptype: args.context.networks[0].type + }, + success: function(json) { + args.response.success({ + data: $.map( + json.listnetworkofferingsresponse.networkoffering, + function(networkOffering) { + return { + id: networkOffering.id, + description: networkOffering.name + }; + } + ) + }); + }, + error: function(json) { + args.response.error(parseXMLHttpResponse(json)); + } + }); + } + } }, { startip: { label: 'Start IP' },