UI: Update IP address server calls to support per-NIC IPs

Update the following actions on IP address section to support per-NIC IP
addresses:

- List IPs -> listNics
- Add IP -> addIpToNic
- Remove IP -> removeIpFromNic

These API calls will be conditionally invoked in place of the existing
calls if a NIC is selected -- i.e., args.context.nics is present
This commit is contained in:
Brian Federle 2013-02-25 11:35:41 -08:00
parent b652d2e4ba
commit 6c8182b6f4

View File

@ -1585,6 +1585,22 @@
});
}
}
if (args.context.nics) {
$.ajax({
url: createURL('addIpToNic'),
data: {
nicId: args.context.nics[0].id
},
success: function(json) {
args.response.success({
_custom: {
jobId: json.addiptonicresponse.jobid
}
});
}
});
} else {
$.ajax({
url: createURL('associateIpAddress'),
data: dataObj,
@ -1609,6 +1625,7 @@
args.response.error(parseXMLHttpResponse(json));
}
});
}
},
notification: {
@ -1643,6 +1660,20 @@
});
}
if (args.context.nics) {
$.ajax({
url: createURL('listNics'),
data: {
nicId: args.context.nics[0].id,
vmId: args.context.instances[0].id
},
success: function(json) {
args.response.success({
data: json.listnicsresponse.nic[0].ipAddresses
});
}
});
} else {
$.ajax({
url: createURL('listPublicIpAddresses'),
data: data,
@ -1664,6 +1695,7 @@
args.response.error(parseXMLHttpResponse(data));
}
});
}
},
// Detail view
@ -2017,6 +2049,19 @@
remove: {
label: 'label.action.release.ip',
action: function(args) {
if (args.context.nics) {
$.ajax({
url: createURL('removeIpFromNic'),
data: {
id: args.context.ipAddresses[0].id
},
success: function(json) {
args.response.success({
_custom: { jobId: json.removeipfromnicresponse.jobid }
});
}
});
} else {
$.ajax({
url: createURL('disassociateIpAddress'),
data: {
@ -2050,6 +2095,7 @@
args.response.error(parseXMLHttpResponse(data));
}
});
}
},
messages: {
confirm: function(args) {