From e816b3a80b3e64b22c15c9d6749da3a9621f2fa6 Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Mon, 19 Dec 2011 11:27:36 -0800 Subject: [PATCH] bug 12650: cloudStack 3.0 new UI - system - management - IP ranges tab - list pods info instead of VlanIpRange info. --- ui/scripts/system.js | 141 +++++++------------------------------------ 1 file changed, 23 insertions(+), 118 deletions(-) diff --git a/ui/scripts/system.js b/ui/scripts/system.js index 90f4d393156..0bc4da50c5f 100644 --- a/ui/scripts/system.js +++ b/ui/scripts/system.js @@ -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 $('
').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 }); + } + }); + } + } } } }