CS-15044:API changes to provide UI option to view the list of instances which are part of the guestnetwork is not availble

This commit is contained in:
Pranav Saxena 2012-07-31 02:02:17 +05:30
parent 691dc9066f
commit 2388bd8f82
3 changed files with 33 additions and 8 deletions

View File

@ -26,6 +26,9 @@ public class NicResponse extends BaseResponse {
@SerializedName("networkid") @Param(description="the ID of the corresponding network")
private final IdentityProxy networkId = new IdentityProxy("networks");
@SerializedName("networkname") @Param(description="the name of the corresponding network")
private String networkName ;
@SerializedName(ApiConstants.NETMASK) @Param(description="the netmask of the nic")
private String netmask;
@ -65,6 +68,10 @@ public class NicResponse extends BaseResponse {
this.networkId.setValue(networkid);
}
public void setNetworkName(String networkname) {
this.networkName = networkname;
}
public void setNetmask(String netmask) {
this.netmask = netmask;
}

View File

@ -1588,6 +1588,7 @@ public class ApiResponseHelper implements ResponseGenerator {
nicResponse.setGateway(singleNicProfile.getGateway());
nicResponse.setNetmask(singleNicProfile.getNetmask());
nicResponse.setNetworkid(singleNicProfile.getNetworkId());
nicResponse.setNetworkName(ApiDBUtils.findNetworkById(singleNicProfile.getNetworkId()).getName() );
if (acct.getType() == Account.ACCOUNT_TYPE_ADMIN) {
if (singleNicProfile.getBroadCastUri() != null) {
nicResponse.setBroadcastUri(singleNicProfile.getBroadCastUri().toString());

View File

@ -1179,9 +1179,11 @@
nics: {
title: 'label.nics',
multiple: true,
cache:false,
fields: [
{
name: { label: 'label.name', header: true },
networkname: {label: 'Network Name' },
ipaddress: { label: 'label.ip.address' },
type: { label: 'label.type' },
gateway: { label: 'label.gateway' },
@ -1195,17 +1197,32 @@
}
],
dataProvider: function(args) {
args.response.success({data: $.map(args.context.instances[0].nic, function(nic, index) {
var name = 'NIC ' + (index + 1);
$.ajax({
url:createURL("listVirtualMachines&details=nics&id=" + args.context.instances[0].id),
dataType: "json",
async:true,
success:function(json) {
args.response.success({
data: $.map(args.context.instances[0].nic, function(nic, index) {
var name = 'NIC ' + (index + 1);
var networkname = json.listvirtualmachinesresponse.virtualmachine[0].nic[index].networkname;
if (nic.isdefault) {
name += ' (' + _l('label.default') + ')';
}
return $.extend(nic, {
name: name,
networkname: networkname
});
})
});
if (nic.isdefault) {
name += ' (' + _l('label.default') + ')';
}
return $.extend(nic, {
name: name
}
});
})});
}
},
/**