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': { 'management': {
detailView: { 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});
}
});
}
}
},
tabs: { tabs: {
details: { details: {
title: 'Details', title: 'Details',
@ -303,99 +279,28 @@
}); });
} }
}, },
ipAddresses: { //read-only listView (no actions) filled with pod info (not VlanIpRange info)???
ipAddresses: { title: 'IP Ranges',
title: 'IP Ranges', listView: {
custom: function(args) { fields: {
return $('<div></div>').multiEdit({ name: { label: 'Pod name' },
context: args.context, gateway: { label: 'Gateway' },
noSelect: true, netmask: { label: 'Netmask' },
fields: { startip: { label: 'Start IP' },
'gateway': { edit: true, label: 'Gateway' }, endip: { label: 'End IP' }
'netmask': { edit: true, label: 'Netmask' }, },
'vlan': { edit: true, label: 'VLAN', isOptional: true }, dataProvider: function(args) {
'startip': { edit: true, label: 'Start IP' }, $.ajax({
'endip': { edit: true, label: 'End IP' }, url: createURL("listPods&zoneid=" + selectedZoneObj.id + "&page=" + args.page + "&pagesize=" + pageSize),
'add-rule': { label: 'Add', addButton: true } dataType: "json",
}, async: true,
add: { success: function(json) {
label: 'Add', var items = json.listpodsresponse.pod;
action: function(args) { args.response.success({ data:items });
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});
}
});
}
});
}
} }
} }
} }