Network->IP Addresses -- update 'Acquire new IP' action

-Replace zone select with network select
-Use network ID to acquire IP, instead of zone ID
This commit is contained in:
Brian Federle 2011-12-06 12:53:00 -08:00
parent fa4e08aa9c
commit 89235c6cb9
1 changed files with 30 additions and 19 deletions

View File

@ -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
};
})
});
}
});
}
}
}
}