From 89235c6cb9c290a243c9d8e32821cd302d08de9a Mon Sep 17 00:00:00 2001 From: Brian Federle Date: Tue, 6 Dec 2011 12:53:00 -0800 Subject: [PATCH] Network->IP Addresses -- update 'Acquire new IP' action -Replace zone select with network select -Use network ID to acquire IP, instead of zone ID --- ui/scripts/network.js | 49 ++++++++++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 19 deletions(-) diff --git a/ui/scripts/network.js b/ui/scripts/network.js index dadfd0ae620..bb1d0d5bbe7 100644 --- a/ui/scripts/network.js +++ b/ui/scripts/network.js @@ -167,7 +167,7 @@ $.ajax({ url: createURL('associateIpAddress'), data: { - zoneid: args.data.availabilityZone + networkId: args.data.networkid }, dataType: 'json', async: true, @@ -201,26 +201,37 @@ createForm: { title: 'Acquire new IP', - desc: 'Please select a zone from which you want to acquire your new IP from.', + desc: 'Please select a network from which you want to acquire your new IP from.', fields: { - availabilityZone: { - label: 'Zone', + networkid: { + label: 'Network', select: function(args) { - $.ajax({ - url: createURL('listZones'), - dataType: 'json', - async: true, - success: function(data) { - args.response.success({ - data: $.map(data.listzonesresponse.zone, function(zone) { - return { - id: zone.id, - description: zone.name - }; - }) - }); - } - }); + if (args.context.networks && args.context.networks[0]) { + args.response.success({ + data: [ + { + id: args.context.networks[0].id, + description: args.context.networks[0].name + } + ] + }); + } else { + $.ajax({ + url: createURL('listNetworks'), + dataType: 'json', + async: true, + success: function(data) { + args.response.success({ + data: $.map(data.listnetworksresponse.network, function(network) { + return { + id: network.id, + description: network.name + }; + }) + }); + } + }); + } } } }