bug 12650: cloudStack 3.0 new UI - system - management - IP ranges tab - list pods info instead of VlanIpRange info.

This commit is contained in:
Jessica Wang 2011-12-19 11:27:36 -08:00
parent 1fbff5bd05
commit e816b3a80b

View File

@ -258,31 +258,7 @@
},
'management': {
detailView: {
viewAll: { path: '_zone.pods', label: 'Pods' },
actions: {
edit: {
label: 'Edit',
action: function(args) {
var array1 = [];
array1.push("&name=" +todb(args.data.name));
array1.push("&dns1=" + todb(args.data.dns1));
array1.push("&dns2=" + todb(args.data.dns2)); //dns2 can be empty ("") when passed to API
array1.push("&internaldns1=" + todb(args.data.internaldns1));
array1.push("&internaldns2=" + todb(args.data.internaldns2)); //internaldns2 can be empty ("") when passed to API
array1.push("&domain=" + todb(args.data.domain));
$.ajax({
url: createURL("updateZone&id=" + args.context.zones[0].id + array1.join("")),
dataType: "json",
async: false,
success: function(json) {
selectedZoneObj = json.updatezoneresponse.zone; //override selectedZoneObj after update zone
args.response.success({data: selectedZoneObj});
}
});
}
}
},
detailView: {
tabs: {
details: {
title: 'Details',
@ -303,99 +279,28 @@
});
}
},
ipAddresses: {
title: 'IP Ranges',
custom: function(args) {
return $('<div></div>').multiEdit({
context: args.context,
noSelect: true,
fields: {
'gateway': { edit: true, label: 'Gateway' },
'netmask': { edit: true, label: 'Netmask' },
'vlan': { edit: true, label: 'VLAN', isOptional: true },
'startip': { edit: true, label: 'Start IP' },
'endip': { edit: true, label: 'End IP' },
'add-rule': { label: 'Add', addButton: true }
},
add: {
label: 'Add',
action: function(args) {
var array1 = [];
array1.push("&zoneId=" + args.context.zones[0].id);
if (args.data.vlan != null && args.data.vlan.length > 0)
array1.push("&vlan=" + todb(args.data.vlan));
else
array1.push("&vlan=untagged");
array1.push("&gateway=" + args.data.gateway);
array1.push("&netmask=" + args.data.netmask);
array1.push("&startip=" + args.data.startip);
if(args.data.endip != null && args.data.endip.length > 0)
array1.push("&endip=" + args.data.endip);
if(args.context.zones[0].securitygroupsenabled == false)
array1.push("&forVirtualNetwork=true");
else
array1.push("&forVirtualNetwork=false");
$.ajax({
url: createURL("createVlanIpRange" + array1.join("")),
dataType: "json",
success: function(json) {
var item = json.createvlaniprangeresponse.vlan;
args.response.success({
data: item,
notification: {
label: 'IP range is added',
poll: function(args) {
args.complete();
}
}
});
},
error: function(XMLHttpResponse) {
var errorMsg = parseXMLHttpResponse(XMLHttpResponse);
args.response.error(errorMsg);
}
});
}
},
actions: {
destroy: {
label: 'Delete',
action: function(args) {
$.ajax({
url: createURL('deleteVlanIpRange&id=' + args.context.multiRule[0].id),
dataType: 'json',
async: true,
success: function(json) {
args.response.success({
notification: {
label: 'Remove IP range ' + args.context.multiRule[0].id,
poll: function(args) {
args.complete();
}
}
});
}
});
}
}
},
dataProvider: function(args) {
$.ajax({
url: createURL("listVlanIpRanges&zoneid=" + args.context.zones[0].id + "&networkId=" + selectedManagementNetworkObj.id),
dataType: "json",
success: function(json) {
var items = json.listvlaniprangesresponse.vlaniprange;
args.response.success({data: items});
}
});
}
});
}
ipAddresses: { //read-only listView (no actions) filled with pod info (not VlanIpRange info)???
title: 'IP Ranges',
listView: {
fields: {
name: { label: 'Pod name' },
gateway: { label: 'Gateway' },
netmask: { label: 'Netmask' },
startip: { label: 'Start IP' },
endip: { label: 'End IP' }
},
dataProvider: function(args) {
$.ajax({
url: createURL("listPods&zoneid=" + selectedZoneObj.id + "&page=" + args.page + "&pagesize=" + pageSize),
dataType: "json",
async: true,
success: function(json) {
var items = json.listpodsresponse.pod;
args.response.success({ data:items });
}
});
}
}
}
}
}