From 0ba1abe2627bd05c64aabf25142b266837c6e044 Mon Sep 17 00:00:00 2001 From: Hugo Trippaers Date: Wed, 8 Jan 2014 16:04:44 +0100 Subject: [PATCH] Apply some formatting to system.js --- ui/scripts/system.js | 8633 +++++++++++++++++++++--------------------- 1 file changed, 4352 insertions(+), 4281 deletions(-) diff --git a/ui/scripts/system.js b/ui/scripts/system.js index 403fce0c40b..5145dcb69f0 100644 --- a/ui/scripts/system.js +++ b/ui/scripts/system.js @@ -15,30 +15,33 @@ // specific language governing permissions and limitations // under the License. -(function($, cloudStack) { - +(function ($, cloudStack) { + var zoneObjs, podObjs, clusterObjs, domainObjs, networkOfferingObjs, physicalNetworkObjs; var selectedClusterObj, selectedZoneObj, selectedPublicNetworkObj, selectedManagementNetworkObj, selectedPhysicalNetworkObj, selectedGuestNetworkObj; - var nspMap = {}; //from listNetworkServiceProviders API - var nspHardcodingArray = []; //for service providers listView (hardcoding, not from listNetworkServiceProviders API) - + var nspMap = { + }; + //from listNetworkServiceProviders API + var nspHardcodingArray =[]; //for service providers listView (hardcoding, not from listNetworkServiceProviders API) + // Add router type to virtual router // -- can be either Project, VPC, or System (standard) - var mapRouterType = function(index, router) { + var mapRouterType = function (index, router) { var routerType = _l('label.menu.system'); - + if (router.projectid) routerType = _l('label.project'); if (router.vpcid) routerType = 'VPC'; - + return $.extend(router, { routerType: routerType }); }; - + cloudStack.publicIpRangeAccount = { - dialog: function(args) { - return function(args) { - var data = args.data ? args.data : {}; + dialog: function (args) { + return function (args) { + var data = args.data ? args.data: { + }; var fields = { account: { label: 'Account', @@ -47,15 +50,15 @@ domainid: { label: 'Domain', defaultValue: data.domainid, - select: function(args) { + select: function (args) { $.ajax({ url: createURL('listDomains'), data: { listAll: true }, - success: function(json) { + success: function (json) { args.response.success({ - data: $.map(json.listdomainsresponse.domain, function(domain) { + data: $.map(json.listdomainsresponse.domain, function (domain) { return { id: domain.id, description: domain.path @@ -68,17 +71,18 @@ } }; var success = args.response.success; - - if (args.$item) { // Account data is read-only after creation + + if (args.$item) { + // Account data is read-only after creation $.ajax({ url: createURL('listDomains'), data: { id: data.domainid, listAll: true }, - success: function(json) { + success: function (json) { var domain = json.listdomainsresponse.domain[0]; - + cloudStack.dialog.notice({ message: '' }); @@ -91,9 +95,9 @@ desc: '(optional) Please specify an account to be associated with this IP range.', fields: fields }, - after: function(args) { + after: function (args) { var data = cloudStack.serializeForm(args.$form); - + success({ data: data }); @@ -103,155 +107,158 @@ }; } }; - - var getTrafficType = function(physicalNetwork, typeID) { - var trafficType = {}; - + + var getTrafficType = function (physicalNetwork, typeID) { + var trafficType = { + }; + $.ajax({ url: createURL('listTrafficTypes'), data: { physicalnetworkid: physicalNetwork.id }, async: false, - success: function(json) { + success: function (json) { trafficType = $.grep( - json.listtraffictypesresponse.traffictype, - function(trafficType) { - return trafficType.traffictype == typeID; - } - )[0]; + json.listtraffictypesresponse.traffictype, + function (trafficType) { + return trafficType.traffictype == typeID; + })[0]; } }); - + if (trafficType.xennetworklabel == null || trafficType.xennetworklabel == 0) - trafficType.xennetworklabel = dictionary['label.network.label.display.for.blank.value']; + trafficType.xennetworklabel = dictionary[ 'label.network.label.display.for.blank.value']; if (trafficType.kvmnetworklabel == null || trafficType.kvmnetworklabel == 0) - trafficType.kvmnetworklabel = dictionary['label.network.label.display.for.blank.value']; + trafficType.kvmnetworklabel = dictionary[ 'label.network.label.display.for.blank.value']; if (trafficType.vmwarenetworklabel == null || trafficType.vmwarenetworklabel == 0) - trafficType.vmwarenetworklabel = dictionary['label.network.label.display.for.blank.value']; + trafficType.vmwarenetworklabel = dictionary[ 'label.network.label.display.for.blank.value']; if (trafficType.ovmnetworklabel == null || trafficType.ovmnetworklabel == 0) - trafficType.ovmnetworklabel = dictionary['label.network.label.display.for.blank.value']; + trafficType.ovmnetworklabel = dictionary[ 'label.network.label.display.for.blank.value']; if (trafficType.lxcnetworklabel == null || trafficType.lxcnetworklabel == 0) - trafficType.lxcnetworklabel = dictionary['label.network.label.display.for.blank.value']; + trafficType.lxcnetworklabel = dictionary[ 'label.network.label.display.for.blank.value']; if (trafficType.hypervnetworklabel == null || trafficType.hypervnetworklabel == 0) - trafficType.hypervnetworklabel = dictionary['label.network.label.display.for.blank.value']; - + trafficType.hypervnetworklabel = dictionary[ 'label.network.label.display.for.blank.value']; + return trafficType; }; - - var updateTrafficLabels = function(trafficType, labels, complete) { - var array1 = []; - if (labels.xennetworklabel != dictionary['label.network.label.display.for.blank.value']) - array1.push("&xennetworklabel=" + labels.xennetworklabel); - if (labels.kvmnetworklabel != dictionary['label.network.label.display.for.blank.value']) - array1.push("&kvmnetworklabel=" + labels.kvmnetworklabel); - if (labels.vmwarenetworklabel != dictionary['label.network.label.display.for.blank.value']) - array1.push("&vmwarenetworklabel=" + labels.vmwarenetworklabel); - if (labels.ovmnetworklabel != dictionary['label.network.label.display.for.blank.value']) - array1.push("&ovmnetworklabel=" + labels.ovmnetworklabel); - if (labels.lxcnetworklabel != dictionary['label.network.label.display.for.blank.value']) - array1.push("&lxcnetworklabel=" + labels.lxcnetworklabel); - if (labels.hypervnetworklabel != dictionary['label.network.label.display.for.blank.value']) - array1.push("&hypervnetworklabel=" + labels.hypervnetworklabel); + + var updateTrafficLabels = function (trafficType, labels, complete) { + var array1 =[]; + if (labels.xennetworklabel != dictionary[ 'label.network.label.display.for.blank.value']) + array1.push("&xennetworklabel=" + labels.xennetworklabel); + if (labels.kvmnetworklabel != dictionary[ 'label.network.label.display.for.blank.value']) + array1.push("&kvmnetworklabel=" + labels.kvmnetworklabel); + if (labels.vmwarenetworklabel != dictionary[ 'label.network.label.display.for.blank.value']) + array1.push("&vmwarenetworklabel=" + labels.vmwarenetworklabel); + if (labels.ovmnetworklabel != dictionary[ 'label.network.label.display.for.blank.value']) + array1.push("&ovmnetworklabel=" + labels.ovmnetworklabel); + if (labels.lxcnetworklabel != dictionary[ 'label.network.label.display.for.blank.value']) + array1.push("&lxcnetworklabel=" + labels.lxcnetworklabel); + if (labels.hypervnetworklabel != dictionary[ 'label.network.label.display.for.blank.value']) + array1.push("&hypervnetworklabel=" + labels.hypervnetworklabel); $.ajax({ url: createURL('updateTrafficType' + array1.join("")), data: { id: trafficType.id }, - success: function(json) { + success: function (json) { var jobID = json.updatetraffictyperesponse.jobid; - + cloudStack.ui.notifications.add({ - desc: 'Update traffic labels', - poll: pollAsyncJobResult, - section: 'System', - _custom: { - jobId: jobID - } - }, - complete ? complete : function() {}, {}, - function(data) { - // Error - cloudStack.dialog.notice({ - message: parseXMLHttpResponse(data) - }); - }, {} - ); + desc: 'Update traffic labels', + poll: pollAsyncJobResult, + section: 'System', + _custom: { + jobId: jobID + } + }, + complete ? complete: function () { + }, + { + }, + function (data) { + // Error + cloudStack.dialog.notice({ + message: parseXMLHttpResponse(data) + }); + }, + { + }); } }) }; - + function virtualRouterProviderActionFilter(args) { - var allowedActions = []; + var allowedActions =[]; var jsonObj = args.context.item; //args.context.item == nspMap["virtualRouter"] if (jsonObj.state == "Enabled") - allowedActions.push("disable"); - else if (jsonObj.state == "Disabled") - allowedActions.push("enable"); + allowedActions.push("disable"); else if (jsonObj.state == "Disabled") + allowedActions.push("enable"); return allowedActions; }; - + cloudStack.sections.system = { title: 'label.menu.infrastructure', id: 'system', - + // System dashboard dashboard: { - dataProvider: function(args) { + dataProvider: function (args) { var dataFns = { - zoneCount: function(data) { + zoneCount: function (data) { $.ajax({ url: createURL('listZones'), - success: function(json) { + success: function (json) { dataFns.podCount($.extend(data, { - zoneCount: json.listzonesresponse.count ? json.listzonesresponse.count : 0, + zoneCount: json.listzonesresponse.count ? json.listzonesresponse.count: 0, zones: json.listzonesresponse.zone })); } }); }, - - podCount: function(data) { + + podCount: function (data) { $.ajax({ url: createURL('listPods'), data: { page: 1, pagesize: 1 //specifying pagesize as 1 because we don't need any embedded objects to be returned here. The only thing we need from API response is "count" property. }, - success: function(json) { + success: function (json) { dataFns.clusterCount($.extend(data, { - podCount: json.listpodsresponse.count ? json.listpodsresponse.count : 0 + podCount: json.listpodsresponse.count ? json.listpodsresponse.count: 0 })); } }); }, - - clusterCount: function(data) { + + clusterCount: function (data) { $.ajax({ url: createURL('listClusters'), data: { page: 1, pagesize: 1 //specifying pagesize as 1 because we don't need any embedded objects to be returned here. The only thing we need from API response is "count" property. }, - success: function(json) { + success: function (json) { dataFns.hostCount($.extend(data, { - clusterCount: json.listclustersresponse.count ? json.listclustersresponse.count : 0 + clusterCount: json.listclustersresponse.count ? json.listclustersresponse.count: 0 })); - + //comment the 4 lines above and uncomment the following 4 lines if listHosts API still responds slowly. - + /* - dataFns.primaryStorageCount($.extend(data, { - clusterCount: json.listclustersresponse.count ? - json.listclustersresponse.count : 0 - })); - */ + dataFns.primaryStorageCount($.extend(data, { + clusterCount: json.listclustersresponse.count ? + json.listclustersresponse.count : 0 + })); + */ } }); }, - - hostCount: function(data) { + + hostCount: function (data) { var data2 = { type: 'routing', page: 1, @@ -260,15 +267,15 @@ $.ajax({ url: createURL('listHosts'), data: data2, - success: function(json) { + success: function (json) { dataFns.primaryStorageCount($.extend(data, { - hostCount: json.listhostsresponse.count ? json.listhostsresponse.count : 0 + hostCount: json.listhostsresponse.count ? json.listhostsresponse.count: 0 })); } }); }, - - primaryStorageCount: function(data) { + + primaryStorageCount: function (data) { var data2 = { page: 1, pagesize: 1 //specifying pagesize as 1 because we don't need any embedded objects to be returned here. The only thing we need from API response is "count" property. @@ -276,15 +283,15 @@ $.ajax({ url: createURL('listStoragePools'), data: data2, - success: function(json) { + success: function (json) { dataFns.secondaryStorageCount($.extend(data, { - primaryStorageCount: json.liststoragepoolsresponse.count ? json.liststoragepoolsresponse.count : 0 + primaryStorageCount: json.liststoragepoolsresponse.count ? json.liststoragepoolsresponse.count: 0 })); } }); }, - - secondaryStorageCount: function(data) { + + secondaryStorageCount: function (data) { var data2 = { type: 'SecondaryStorage', page: 1, @@ -293,30 +300,30 @@ $.ajax({ url: createURL('listImageStores'), data: data2, - success: function(json) { + success: function (json) { dataFns.systemVmCount($.extend(data, { - secondaryStorageCount: json.listimagestoresresponse.imagestore ? json.listimagestoresresponse.count : 0 + secondaryStorageCount: json.listimagestoresresponse.imagestore ? json.listimagestoresresponse.count: 0 })); } }); }, - - systemVmCount: function(data) { + + systemVmCount: function (data) { $.ajax({ url: createURL('listSystemVms'), data: { page: 1, pagesize: 1 //specifying pagesize as 1 because we don't need any embedded objects to be returned here. The only thing we need from API response is "count" property. }, - success: function(json) { + success: function (json) { dataFns.virtualRouterCount($.extend(data, { - systemVmCount: json.listsystemvmsresponse.count ? json.listsystemvmsresponse.count : 0 + systemVmCount: json.listsystemvmsresponse.count ? json.listsystemvmsresponse.count: 0 })); } }); }, - - virtualRouterCount: function(data) { + + virtualRouterCount: function (data) { var data2 = { projectid: -1, page: 1, @@ -325,9 +332,9 @@ $.ajax({ url: createURL('listRouters'), data: data2, - success: function(json) { - var total1 = json.listroutersresponse.count ? json.listroutersresponse.count : 0; - + success: function (json) { + var total1 = json.listroutersresponse.count ? json.listroutersresponse.count: 0; + var data3 = { listAll: true, page: 1, @@ -336,8 +343,8 @@ $.ajax({ url: createURL('listRouters'), data: data3, - success: function(json) { - var total2 = json.listroutersresponse.count ? json.listroutersresponse.count : 0; + success: function (json) { + var total2 = json.listroutersresponse.count ? json.listroutersresponse.count: 0; dataFns.capacity($.extend(data, { virtualRouterCount: (total1 + total2) })); @@ -346,28 +353,28 @@ } }); }, - - capacity: function(data) { + + capacity: function (data) { if (data.zoneCount) { $.ajax({ url: createURL('listCapacity'), - success: function(json) { + success: function (json) { var capacities = json.listcapacityresponse.capacity; - - var capacityTotal = function(id, converter) { - var capacity = $.grep(capacities, function(capacity) { + + var capacityTotal = function (id, converter) { + var capacity = $.grep(capacities, function (capacity) { return capacity.type == id; })[0]; - - var total = capacity ? capacity.capacitytotal : 0; - + + var total = capacity ? capacity.capacitytotal: 0; + if (converter) { return converter(total); } - + return total; }; - + dataFns.socketInfo($.extend(data, { cpuCapacityTotal: capacityTotal(1, cloudStack.converters.convertHz), memCapacityTotal: capacityTotal(0, cloudStack.converters.convertBytes), @@ -383,106 +390,108 @@ })); } }, - - socketInfo: function(data) { - var socketCount = 0; - $.ajax({ + + socketInfo: function (data) { + var socketCount = 0; + $.ajax({ url: createURL('listHypervisors'), async: false, - success: function(json) { + success: function (json) { args.response.success({ - data: $(json.listhypervisorsresponse.hypervisor).map(function(index, hypervisor) { - var totalHostCount = 0; - var currentPage = 1; - var returnedHostCount = 0; - var returnedHostCpusocketsSum = 0; - - var callListHostsWithPage = function(setTotalHostCount) { - $.ajax({ - url: createURL('listHosts'), - async: false, - data: { - type: 'routing', - hypervisor: hypervisor.name, - page: currentPage, - pagesize: pageSize //global variable - }, - success: function(json) { - if (json.listhostsresponse.count == undefined) { - return; - } - - if (setTotalHostCount) { - totalHostCount = json.listhostsresponse.count; - } - returnedHostCount += json.listhostsresponse.host.length; - - var items = json.listhostsresponse.host; - for (var i = 0; i < items.length; i++) { - if (items[i].cpusockets != undefined && isNaN(items[i].cpusockets) == false) { - returnedHostCpusocketsSum += items[i].cpusockets; - } - } - - if (returnedHostCount < totalHostCount) { - currentPage++; - callListHostsWithPage(false); - } - } - }); - } - - callListHostsWithPage(true); - - socketCount += returnedHostCpusocketsSum; + data: $(json.listhypervisorsresponse.hypervisor).map(function (index, hypervisor) { + var totalHostCount = 0; + var currentPage = 1; + var returnedHostCount = 0; + var returnedHostCpusocketsSum = 0; + + var callListHostsWithPage = function (setTotalHostCount) { + $.ajax({ + url: createURL('listHosts'), + async: false, + data: { + type: 'routing', + hypervisor: hypervisor.name, + page: currentPage, + pagesize: pageSize //global variable + }, + success: function (json) { + if (json.listhostsresponse.count == undefined) { + return; + } + + if (setTotalHostCount) { + totalHostCount = json.listhostsresponse.count; + } + returnedHostCount += json.listhostsresponse.host.length; + + var items = json.listhostsresponse.host; + for (var i = 0; i < items.length; i++) { + if (items[i].cpusockets != undefined && isNaN(items[i].cpusockets) == false) { + returnedHostCpusocketsSum += items[i].cpusockets; + } + } + + if (returnedHostCount < totalHostCount) { + currentPage++; + callListHostsWithPage(false); + } + } + }); + } + + callListHostsWithPage(true); + + socketCount += returnedHostCpusocketsSum; }) }); } }); - + complete($.extend(data, { socketCount: socketCount })); } }; - - var complete = function(data) { + + var complete = function (data) { args.response.success({ data: data }); }; - - dataFns.zoneCount({}); + + dataFns.zoneCount({ + }); } }, - - zoneDashboard: function(args) { + + zoneDashboard: function (args) { $.ajax({ url: createURL('listCapacity'), data: { zoneid: args.context.zones[0].id }, - success: function(json) { + success: function (json) { var capacities = json.listcapacityresponse.capacity; - var data = {}; - - $(capacities).each(function() { + var data = { + }; + + $(capacities).each(function () { var capacity = this; - + data[capacity.type] = { used: cloudStack.converters.convertByType(capacity.type, capacity.capacityused), total: cloudStack.converters.convertByType(capacity.type, capacity.capacitytotal), percent: parseInt(capacity.percentused) }; }); - + args.response.success({ data: data }); } }); }, - + // Network-as-a-service configuration naas: { providerListView: { @@ -493,7 +502,7 @@ }, state: { label: 'label.state', - converter: function(str) { + converter: function (str) { // For localization return str; }, @@ -503,17 +512,16 @@ } } }, - dataProvider: function(args) { + dataProvider: function (args) { refreshNspData(); args.response.success({ data: nspHardcodingArray }) }, - - detailView: function(args) { + + detailView: function (args) { return cloudStack.sections.system.naas.networkProviders.types[ - args.context.networkProviders[0].id - ]; + args.context.networkProviders[0].id]; } }, mainNetworks: { @@ -522,10 +530,10 @@ actions: { edit: { label: 'label.edit', - action: function(args) { + action: function (args) { var trafficType = getTrafficType(selectedPhysicalNetworkObj, 'Public'); - - updateTrafficLabels(trafficType, args.data, function() { + + updateTrafficLabels(trafficType, args.data, function () { args.response.success(); }); } @@ -534,14 +542,15 @@ tabs: { details: { title: 'label.details', - fields: [{ + fields:[ { traffictype: { label: 'label.traffic.type' }, broadcastdomaintype: { label: 'label.broadcast.domain.type' } - }, { + }, + { xennetworklabel: { label: 'label.xen.traffic.label', isEditable: true @@ -567,18 +576,18 @@ isEditable: true } }], - - dataProvider: function(args) { + + dataProvider: function (args) { $.ajax({ url: createURL("listNetworks&listAll=true&trafficType=Public&isSystem=true&zoneId=" + selectedZoneObj.id), dataType: "json", async: false, - success: function(json) { + success: function (json) { var trafficType = getTrafficType(selectedPhysicalNetworkObj, 'Public'); var items = json.listnetworksresponse.network; - + selectedPublicNetworkObj = items[0]; - + // Include traffic labels selectedPublicNetworkObj.xennetworklabel = trafficType.xennetworklabel; selectedPublicNetworkObj.kvmnetworklabel = trafficType.kvmnetworklabel; @@ -594,10 +603,10 @@ }); } }, - + ipAddresses: { title: 'label.ip.ranges', - custom: function(args) { + custom: function (args) { return $('
').multiEdit({ context: args.context, noSelect: true, @@ -637,108 +646,107 @@ }, add: { label: 'label.add', - action: function(args) { - var array1 = []; + 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("&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); - + array1.push("&endip=" + args.data.endip); + if (args.data.account) { array1.push("&account=" + args.data.account.account); array1.push("&domainid=" + args.data.account.domainid); } - - array1.push("&forVirtualNetwork=true"); //indicates this new IP range is for public network, not guest network - + + array1.push("&forVirtualNetwork=true"); + //indicates this new IP range is for public network, not guest network + $.ajax({ url: createURL("createVlanIpRange" + array1.join("")), dataType: "json", - success: function(json) { + success: function (json) { var item = json.createvlaniprangeresponse.vlan; args.response.success({ data: item, notification: { label: 'label.add.ip.range', - poll: function(args) { + poll: function (args) { args.complete(); } } }); }, - error: function(XMLHttpResponse) { + error: function (XMLHttpResponse) { var errorMsg = parseXMLHttpResponse(XMLHttpResponse); args.response.error(errorMsg); } }); } }, - actionPreFilter: function(args) { - var actionsToShow = ['destroy']; + actionPreFilter: function (args) { + var actionsToShow =[ 'destroy']; if (args.context.multiRule[0].domain == 'ROOT' && args.context.multiRule[0].account.account == 'system') - actionsToShow.push('addAccount'); - else - actionsToShow.push('releaseFromAccount'); + actionsToShow.push('addAccount'); else + actionsToShow.push('releaseFromAccount'); return actionsToShow; }, actions: { destroy: { label: 'label.remove.ip.range', - action: function(args) { + action: function (args) { $.ajax({ url: createURL('deleteVlanIpRange&id=' + args.context.multiRule[0].id), dataType: 'json', async: true, - success: function(json) { + success: function (json) { args.response.success({ notification: { label: 'label.remove.ip.range', - poll: function(args) { + poll: function (args) { args.complete(); } } }); }, - error: function(json) { + error: function (json) { args.response.error(parseXMLHttpResponse(json)); } }); } }, - + releaseFromAccount: { label: 'Release from Account', - action: function(args) { + action: function (args) { $.ajax({ url: createURL('releasePublicIpRange'), data: { id: args.context.multiRule[0].id }, - success: function(json) { + success: function (json) { args.response.success({ notification: { label: 'release from account', - poll: function(args) { + poll: function (args) { args.complete(); } } }); }, - error: function(json) { + error: function (json) { args.response.error(parseXMLHttpResponse(json)); } }); } }, - + addAccount: { label: 'Add Account', createForm: { @@ -749,15 +757,15 @@ }, domainid: { label: 'Domain', - select: function(args) { + select: function (args) { $.ajax({ url: createURL('listDomains'), data: { listAll: true }, - success: function(json) { + success: function (json) { args.response.success({ - data: $.map(json.listdomainsresponse.domain, function(domain) { + data: $.map(json.listdomainsresponse.domain, function (domain) { return { id: domain.id, description: domain.path @@ -770,7 +778,7 @@ } } }, - action: function(args) { + action: function (args) { var data = { id: args.context.multiRule[0].id, zoneid: args.context.multiRule[0].zoneid, @@ -780,33 +788,32 @@ $.ajax({ url: createURL('dedicatePublicIpRange'), data: data, - success: function(json) { + success: function (json) { args.response.success({ notification: { label: 'Add Account', - poll: function(args) { + poll: function (args) { args.complete(); } } }); }, - error: function(json) { + error: function (json) { args.response.error(parseXMLHttpResponse(json)); } }); } } - }, - dataProvider: function(args) { + dataProvider: function (args) { $.ajax({ url: createURL("listVlanIpRanges&zoneid=" + args.context.zones[0].id + "&networkId=" + selectedPublicNetworkObj.id), dataType: "json", - success: function(json) { + success: function (json) { var items = json.listvlaniprangesresponse.vlaniprange; - + args.response.success({ - data: $.map(items, function(item) { + data: $.map(items, function (item) { return $.extend(item, { account: { _buttonLabel: item.account, @@ -825,16 +832,16 @@ } } }, - + 'storage': { detailView: { actions: { edit: { label: 'label.edit', - action: function(args) { + action: function (args) { var trafficType = getTrafficType(selectedPhysicalNetworkObj, 'Storage'); - - updateTrafficLabels(trafficType, args.data, function() { + + updateTrafficLabels(trafficType, args.data, function () { args.response.success(); }); } @@ -843,14 +850,15 @@ tabs: { details: { title: 'label.details', - fields: [{ + fields:[ { traffictype: { label: 'label.traffic.type' }, broadcastdomaintype: { label: 'label.broadcast.domain.type' } - }, { + }, + { xennetworklabel: { label: 'label.xen.traffic.label', isEditable: true @@ -876,17 +884,17 @@ isEditable: true } }], - - dataProvider: function(args) { + + dataProvider: function (args) { $.ajax({ url: createURL("listNetworks&listAll=true&trafficType=Storage&isSystem=true&zoneId=" + selectedZoneObj.id), dataType: "json", async: false, - success: function(json) { + success: function (json) { var items = json.listnetworksresponse.network; var trafficType = getTrafficType(selectedPhysicalNetworkObj, 'Storage'); selectedPublicNetworkObj = items[0]; - + selectedPublicNetworkObj.xennetworklabel = trafficType.xennetworklabel; selectedPublicNetworkObj.kvmnetworklabel = trafficType.kvmnetworklabel; selectedPublicNetworkObj.vmwarenetworklabel = trafficType.vmwarenetworklabel; @@ -901,28 +909,29 @@ }); } }, - + ipAddresses: { title: 'label.ip.ranges', - custom: function(args) { + custom: function (args) { return $('
').multiEdit({ context: args.context, noSelect: true, fields: { 'podid': { label: 'label.pod', - select: function(args) { + select: function (args) { $.ajax({ url: createURL("listPods&zoneid=" + selectedZoneObj.id), dataType: "json", - success: function(json) { - var items = []; + success: function (json) { + var items =[]; var pods = json.listpodsresponse.pod; - $(pods).each(function() { + $(pods).each(function () { items.push({ name: this.id, description: this.name - }); //should be "{id: this.id, description: this.name}" (to be consistent with dropdown in createFrom and edit mode) (Brian will fix widget later) + }); + //should be "{id: this.id, description: this.name}" (to be consistent with dropdown in createFrom and edit mode) (Brian will fix widget later) }); args.response.success({ data: items @@ -959,25 +968,25 @@ }, add: { label: 'label.add', - action: function(args) { - var array1 = []; + action: function (args) { + var array1 =[]; array1.push("&zoneId=" + args.context.zones[0].id); array1.push("&podid=" + args.data.podid); - + array1.push("&gateway=" + args.data.gateway); - + if (args.data.vlan != null && args.data.vlan.length > 0) - array1.push("&vlan=" + todb(args.data.vlan)); - + array1.push("&vlan=" + todb(args.data.vlan)); + 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); - + array1.push("&endip=" + args.data.endip); + $.ajax({ url: createURL("createStorageNetworkIpRange" + array1.join("")), dataType: "json", - success: function(json) { + success: function (json) { args.response.success({ _custom: { jobId: json.createstoragenetworkiprangeresponse.jobid @@ -988,7 +997,7 @@ } }); }, - error: function(XMLHttpResponse) { + error: function (XMLHttpResponse) { var errorMsg = parseXMLHttpResponse(XMLHttpResponse); args.response.error(errorMsg); } @@ -998,16 +1007,16 @@ actions: { destroy: { label: 'label.delete', - action: function(args) { + action: function (args) { $.ajax({ url: createURL('deleteStorageNetworkIpRange&id=' + args.context.multiRule[0].id), dataType: 'json', async: true, - success: function(json) { + success: function (json) { args.response.success({ notification: { label: 'label.remove.ip.range', - poll: function(args) { + poll: function (args) { args.complete(); } } @@ -1017,11 +1026,11 @@ } } }, - dataProvider: function(args) { + dataProvider: function (args) { $.ajax({ url: createURL("listStorageNetworkIpRange&zoneid=" + args.context.zones[0].id + "&networkId=" + selectedPublicNetworkObj.id), dataType: "json", - success: function(json) { + success: function (json) { var items = json.liststoragenetworkiprangeresponse.storagenetworkiprange; args.response.success({ data: items @@ -1035,16 +1044,16 @@ } } }, - + 'management': { detailView: { actions: { edit: { label: 'label.edit', - action: function(args) { + action: function (args) { var trafficType = getTrafficType(selectedPhysicalNetworkObj, 'Management'); - - updateTrafficLabels(trafficType, args.data, function() { + + updateTrafficLabels(trafficType, args.data, function () { args.response.success(); }); } @@ -1053,14 +1062,15 @@ tabs: { details: { title: 'label.details', - fields: [{ + fields:[ { traffictype: { label: 'label.traffic.type' }, broadcastdomaintype: { label: 'label.broadcast.domain.type' } - }, { + }, + { xennetworklabel: { label: 'label.xen.traffic.label', isEditable: true @@ -1086,15 +1096,15 @@ isEditable: true } }], - dataProvider: function(args) { + dataProvider: function (args) { $.ajax({ url: createURL("listNetworks&listAll=true&issystem=true&trafficType=Management&zoneId=" + selectedZoneObj.id), dataType: "json", - success: function(json) { + success: function (json) { selectedManagementNetworkObj = json.listnetworksresponse.network[0]; - + var trafficType = getTrafficType(selectedPhysicalNetworkObj, 'Management'); - + selectedManagementNetworkObj.xennetworklabel = trafficType.xennetworklabel; selectedManagementNetworkObj.kvmnetworklabel = trafficType.kvmnetworklabel; selectedManagementNetworkObj.vmwarenetworklabel = trafficType.vmwarenetworklabel; @@ -1109,35 +1119,41 @@ }); } }, - ipAddresses: { //read-only listView (no actions) filled with pod info (not VlanIpRange info) + ipAddresses: { + //read-only listView (no actions) filled with pod info (not VlanIpRange info) title: 'label.ip.ranges', listView: { fields: { name: { label: 'label.pod' - }, //pod name + }, + //pod name gateway: { label: 'label.gateway' - }, //'Reserved system gateway' is too long and causes a visual format bug (2 lines overlay) + }, + //'Reserved system gateway' is too long and causes a visual format bug (2 lines overlay) netmask: { label: 'label.netmask' - }, //'Reserved system netmask' is too long and causes a visual format bug (2 lines overlay) + }, + //'Reserved system netmask' is too long and causes a visual format bug (2 lines overlay) startip: { label: 'label.start.IP' - }, //'Reserved system start IP' is too long and causes a visual format bug (2 lines overlay) + }, + //'Reserved system start IP' is too long and causes a visual format bug (2 lines overlay) endip: { label: 'label.end.IP' - } //'Reserved system end IP' is too long and causes a visual format bug (2 lines overlay) + } + //'Reserved system end IP' is too long and causes a visual format bug (2 lines overlay) }, - dataProvider: function(args) { - var array1 = []; + dataProvider: function (args) { + var array1 =[]; if (args.filterBy != null) { if (args.filterBy.search != null && args.filterBy.search.by != null && args.filterBy.search.value != null) { switch (args.filterBy.search.by) { case "name": - if (args.filterBy.search.value.length > 0) - array1.push("&keyword=" + args.filterBy.search.value); - break; + if (args.filterBy.search.value.length > 0) + array1.push("&keyword=" + args.filterBy.search.value); + break; } } } @@ -1145,7 +1161,7 @@ url: createURL("listPods&zoneid=" + selectedZoneObj.id + "&page=" + args.page + "&pagesize=" + pageSize + array1.join("")), dataType: "json", async: true, - success: function(json) { + success: function (json) { var items = json.listpodsresponse.pod; args.response.success({ data: items @@ -1158,34 +1174,35 @@ } } }, - - 'guest': { //physical network + Guest traffic type + + 'guest': { + //physical network + Guest traffic type detailView: { actions: { edit: { label: 'label.edit', - action: function(args) { + action: function (args) { var data = { - id: selectedPhysicalNetworkObj.id + id: selectedPhysicalNetworkObj.id }; - - $.extend(data, { - vlan: args.data.vlan - }); - - $.extend(data, { - tags: args.data.tags - }); - + + $.extend(data, { + vlan: args.data.vlan + }); + + $.extend(data, { + tags: args.data.tags + }); + $.ajax({ url: createURL('updatePhysicalNetwork'), data: data, - success: function(json) { + success: function (json) { var jobId = json.updatephysicalnetworkresponse.jobid; - + var trafficType = getTrafficType(selectedPhysicalNetworkObj, 'Guest'); - - updateTrafficLabels(trafficType, args.data, function() { + + updateTrafficLabels(trafficType, args.data, function () { args.response.success({ _custom: { jobId: jobId @@ -1200,30 +1217,32 @@ } } }, - - tabFilter: function(args) { - var hiddenTabs = []; + + tabFilter: function (args) { + var hiddenTabs =[]; if (selectedZoneObj.networktype == 'Basic') { hiddenTabs.push("network"); hiddenTabs.push("dedicatedGuestVlanRanges"); - } else { //selectedZoneObj.networktype == 'Advanced' + } else { + //selectedZoneObj.networktype == 'Advanced' hiddenTabs.push("ipAddresses"); } return hiddenTabs; }, - + tabs: { details: { title: 'label.details', - preFilter: function(args) { - var hiddenFields = []; + preFilter: function (args) { + var hiddenFields =[]; if (selectedZoneObj.networktype == "Basic") { hiddenFields.push("vlan"); // hiddenFields.push("endVlan"); } return hiddenFields; }, - fields: [{ //updatePhysicalNetwork API + fields:[ { + //updatePhysicalNetwork API state: { label: 'label.state' }, @@ -1238,7 +1257,9 @@ broadcastdomainrange: { label: 'label.broadcast.domain.range' } - }, { //updateTrafficType API + }, + { + //updateTrafficType API xennetworklabel: { label: 'label.xen.traffic.label', isEditable: true @@ -1264,7 +1285,8 @@ isEditable: true } }], - dataProvider: function(args) { //physical network + Guest traffic type + dataProvider: function (args) { + //physical network + Guest traffic type //refresh physical network $.ajax({ url: createURL('listPhysicalNetworks'), @@ -1272,37 +1294,38 @@ id: args.context.physicalNetworks[0].id }, async: true, - success: function(json) { + success: function (json) { selectedPhysicalNetworkObj = json.listphysicalnetworksresponse.physicalnetwork[0]; - + // var startVlan, endVlan; var vlan = selectedPhysicalNetworkObj.vlan; /* if(vlan != null && vlan.length > 0) { - if(vlan.indexOf("-") != -1) { - var vlanArray = vlan.split("-"); - startVlan = vlanArray[0]; - endVlan = vlanArray[1]; - } - else { - startVlan = vlan; - } - selectedPhysicalNetworkObj["startVlan"] = startVlan; - selectedPhysicalNetworkObj["endVlan"] = endVlan; - }*/ - + if(vlan.indexOf("-") != -1) { + var vlanArray = vlan.split("-"); + startVlan = vlanArray[0]; + endVlan = vlanArray[1]; + } + else { + startVlan = vlan; + } + selectedPhysicalNetworkObj["startVlan"] = startVlan; + selectedPhysicalNetworkObj["endVlan"] = endVlan; + }*/ + //traffic type var xentrafficlabel, kvmtrafficlabel, vmwaretrafficlabel; - var trafficType = getTrafficType(selectedPhysicalNetworkObj, 'Guest'); //refresh Guest traffic type - selectedPhysicalNetworkObj["xennetworklabel"] = trafficType.xennetworklabel; - selectedPhysicalNetworkObj["kvmnetworklabel"] = trafficType.kvmnetworklabel; - selectedPhysicalNetworkObj["vmwarenetworklabel"] = trafficType.vmwarenetworklabel; - selectedPhysicalNetworkObj["ovmnetworklabel"] = trafficType.ovmnetworklabel; - selectedPhysicalNetworkObj["lxcnetworklabel"] = trafficType.lxcnetworklabel; - selectedPhysicalNetworkObj["hypervnetworklabel"] = trafficType.hypervnetworklabel; + var trafficType = getTrafficType(selectedPhysicalNetworkObj, 'Guest'); + //refresh Guest traffic type + selectedPhysicalNetworkObj[ "xennetworklabel"] = trafficType.xennetworklabel; + selectedPhysicalNetworkObj[ "kvmnetworklabel"] = trafficType.kvmnetworklabel; + selectedPhysicalNetworkObj[ "vmwarenetworklabel"] = trafficType.vmwarenetworklabel; + selectedPhysicalNetworkObj[ "ovmnetworklabel"] = trafficType.ovmnetworklabel; + selectedPhysicalNetworkObj[ "lxcnetworklabel"] = trafficType.lxcnetworklabel; + selectedPhysicalNetworkObj[ "hypervnetworklabel"] = trafficType.hypervnetworklabel; args.response.success({ - actionFilter: function() { - var allowedActions = ['edit', 'addVlanRange', 'removeVlanRange']; + actionFilter: function () { + var allowedActions =[ 'edit', 'addVlanRange', 'removeVlanRange']; return allowedActions; }, data: selectedPhysicalNetworkObj @@ -1311,28 +1334,29 @@ }); } }, - + ipAddresses: { title: 'label.ip.ranges', - custom: function(args) { + custom: function (args) { return $('
').multiEdit({ context: args.context, noSelect: true, fields: { 'podid': { label: 'label.pod', - select: function(args) { + select: function (args) { $.ajax({ url: createURL("listPods&zoneid=" + selectedZoneObj.id), dataType: "json", - success: function(json) { - var items = []; + success: function (json) { + var items =[]; var pods = json.listpodsresponse.pod; - $(pods).each(function() { + $(pods).each(function () { items.push({ name: this.id, description: this.name - }); //should be "{id: this.id, description: this.name}" (to be consistent with dropdown in createFrom and edit mode) (Brian will fix widget later) + }); + //should be "{id: this.id, description: this.name}" (to be consistent with dropdown in createFrom and edit mode) (Brian will fix widget later) }); args.response.success({ data: items @@ -1364,33 +1388,34 @@ }, add: { label: 'label.add', - action: function(args) { - var array1 = []; + action: function (args) { + var array1 =[]; array1.push("&podid=" + args.data.podid); array1.push("&networkid=" + selectedGuestNetworkObj.id); 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); - array1.push("&forVirtualNetwork=false"); //indicates this new IP range is for guest network, not public network - + array1.push("&endip=" + args.data.endip); + array1.push("&forVirtualNetwork=false"); + //indicates this new IP range is for guest network, not public network + $.ajax({ url: createURL("createVlanIpRange" + array1.join("")), dataType: "json", - success: function(json) { + success: function (json) { var item = json.createvlaniprangeresponse.vlan; args.response.success({ data: item, notification: { label: 'label.add.ip.range', - poll: function(args) { + poll: function (args) { args.complete(); } } }); }, - error: function(XMLHttpResponse) { + error: function (XMLHttpResponse) { var errorMsg = parseXMLHttpResponse(XMLHttpResponse); args.response.error(errorMsg); } @@ -1400,47 +1425,48 @@ actions: { destroy: { label: 'label.remove.ip.range', - action: function(args) { + action: function (args) { $.ajax({ url: createURL('deleteVlanIpRange&id=' + args.context.multiRule[0].id), dataType: 'json', async: true, - success: function(json) { + success: function (json) { args.response.success({ notification: { label: 'label.remove.ip.range', - poll: function(args) { + poll: function (args) { args.complete(); } } }); }, - error: function(json) { + error: function (json) { args.response.error(parseXMLHttpResponse(json)); } }); } } }, - dataProvider: function(args) { //only basic zone has IP Range tab + dataProvider: function (args) { + //only basic zone has IP Range tab selectedGuestNetworkObj = null; $.ajax({ url: createURL("listNetworks&listAll=true&trafficType=Guest&zoneid=" + selectedZoneObj.id), dataType: "json", async: false, - success: function(json) { + success: function (json) { var items = json.listnetworksresponse.network; if (items != null && items.length > 0) - selectedGuestNetworkObj = json.listnetworksresponse.network[0]; + selectedGuestNetworkObj = json.listnetworksresponse.network[0]; } }); if (selectedGuestNetworkObj == null) - return; - + return; + $.ajax({ url: createURL("listVlanIpRanges&zoneid=" + selectedZoneObj.id + "&networkId=" + selectedGuestNetworkObj.id), dataType: "json", - success: function(json) { + success: function (json) { var items = json.listvlaniprangesresponse.vlaniprange; args.response.success({ data: items @@ -1451,7 +1477,7 @@ }); } }, - + network: { title: 'label.network', listView: { @@ -1481,74 +1507,75 @@ actions: { add: addGuestNetworkDialog.def }, - - dataProvider: function(args) { - var array1 = []; + + dataProvider: function (args) { + var array1 =[]; if (args.filterBy != null) { if (args.filterBy.search != null && args.filterBy.search.by != null && args.filterBy.search.value != null) { switch (args.filterBy.search.by) { case "name": - if (args.filterBy.search.value.length > 0) - array1.push("&keyword=" + args.filterBy.search.value); - break; + if (args.filterBy.search.value.length > 0) + array1.push("&keyword=" + args.filterBy.search.value); + break; } } } - + //need to make 2 listNetworks API call to get all guest networks from one physical network in Advanced zone - var items = []; + var items =[]; //"listNetworks&projectid=-1": list guest networks under all projects (no matter who the owner is) $.ajax({ url: createURL("listNetworks&projectid=-1&trafficType=Guest&zoneId=" + selectedZoneObj.id + "&physicalnetworkid=" + selectedPhysicalNetworkObj.id + "&page=" + args.page + "&pagesize=" + pageSize + array1.join("")), dataType: "json", async: false, - success: function(json) { + success: function (json) { if (json.listnetworksresponse.network != null && json.listnetworksresponse.network.length > 0) - items = json.listnetworksresponse.network; + items = json.listnetworksresponse.network; } }); - - var networkCollectionMap = {}; - $(items).each(function() { - networkCollectionMap[this.id] = this.name; + + var networkCollectionMap = { + }; + $(items).each(function () { + networkCollectionMap[ this.id] = this.name; }); - + //"listNetworks&listAll=true: list guest networks that are not under any project (no matter who the owner is) $.ajax({ url: createURL("listNetworks&listAll=true&trafficType=Guest&zoneId=" + selectedZoneObj.id + "&physicalnetworkid=" + selectedPhysicalNetworkObj.id + "&page=" + args.page + "&pagesize=" + pageSize + array1.join("")), dataType: "json", async: false, - success: function(json) { - $(json.listnetworksresponse.network).each(function() { + success: function (json) { + $(json.listnetworksresponse.network).each(function () { if ((this.id in networkCollectionMap) == false) - items.push(this); + items.push(this); }); } }); - - $(items).each(function() { + + $(items).each(function () { addExtraPropertiesToGuestNetworkObject(this); }); - + args.response.success({ data: items }); }, - + detailView: { name: 'Guest network details', noCompact: true, viewAll: { path: '_zone.guestIpRanges', label: 'label.ip.ranges', - preFilter: function(args) { + preFilter: function (args) { if (selectedGuestNetworkObj.type == "Isolated") { var services = selectedGuestNetworkObj.service; if (services != null) { for (var i = 0; i < services.length; i++) { var service = services[i]; if (service.name == "SourceNat") - return false; + return false; } } } @@ -1558,33 +1585,35 @@ actions: { edit: { label: 'label.edit', - action: function(args) { - var array1 = []; + action: function (args) { + var array1 =[]; array1.push("&name=" + todb(args.data.name)); array1.push("&displaytext=" + todb(args.data.displaytext)); - + //args.data.networkdomain is null when networkdomain field is hidden if (args.data.networkdomain != null && args.data.networkdomain != selectedGuestNetworkObj.networkdomain) - array1.push("&networkdomain=" + todb(args.data.networkdomain)); - + array1.push("&networkdomain=" + todb(args.data.networkdomain)); + //args.data.networkofferingid is null when networkofferingid field is hidden if (args.data.networkofferingid != null && args.data.networkofferingid != args.context.networks[0].networkofferingid) { array1.push("&networkofferingid=" + todb(args.data.networkofferingid)); - - if (args.context.networks[0].type == "Isolated") { //Isolated network + + if (args.context.networks[0].type == "Isolated") { + //Isolated network cloudStack.dialog.confirm({ message: 'Do you want to keep the current guest network CIDR unchanged?', - action: function() { //"Yes" button is clicked + action: function () { + //"Yes" button is clicked array1.push("&changecidr=false"); $.ajax({ url: createURL("updateNetwork&id=" + args.context.networks[0].id + array1.join("")), dataType: "json", - success: function(json) { + success: function (json) { var jid = json.updatenetworkresponse.jobid; args.response.success({ _custom: { jobId: jid, - getUpdatedItem: function(json) { + getUpdatedItem: function (json) { var item = json.queryasyncjobresultresponse.jobresult.network; return { data: item @@ -1595,17 +1624,18 @@ } }); }, - cancelAction: function() { //"Cancel" button is clicked + cancelAction: function () { + //"Cancel" button is clicked array1.push("&changecidr=true"); $.ajax({ url: createURL("updateNetwork&id=" + args.context.networks[0].id + array1.join("")), dataType: "json", - success: function(json) { + success: function (json) { var jid = json.updatenetworkresponse.jobid; args.response.success({ _custom: { jobId: jid, - getUpdatedItem: function(json) { + getUpdatedItem: function (json) { var item = json.queryasyncjobresultresponse.jobresult.network; return { data: item @@ -1620,16 +1650,16 @@ return; } } - + $.ajax({ url: createURL("updateNetwork&id=" + args.context.networks[0].id + array1.join("")), dataType: "json", - success: function(json) { + success: function (json) { var jid = json.updatenetworkresponse.jobid; args.response.success({ _custom: { jobId: jid, - getUpdatedItem: function(json) { + getUpdatedItem: function (json) { var item = json.queryasyncjobresultresponse.jobresult.network; return { data: item @@ -1644,19 +1674,23 @@ poll: pollAsyncJobResult } }, - + 'restart': { label: 'label.restart.network', createForm: { title: 'label.restart.network', desc: 'message.restart.network', - preFilter: function(args) { + preFilter: function (args) { if (selectedZoneObj.networktype == "Basic") { - args.$form.find('.form-item[rel=cleanup]').find('input').removeAttr('checked'); //unchecked - args.$form.find('.form-item[rel=cleanup]').hide(); //hidden + args.$form.find('.form-item[rel=cleanup]').find('input').removeAttr('checked'); + //unchecked + args.$form.find('.form-item[rel=cleanup]').hide(); + //hidden } else { - args.$form.find('.form-item[rel=cleanup]').find('input').attr('checked', 'checked'); //checked - args.$form.find('.form-item[rel=cleanup]').css('display', 'inline-block'); //shown + args.$form.find('.form-item[rel=cleanup]').find('input').attr('checked', 'checked'); + //checked + args.$form.find('.form-item[rel=cleanup]').css('display', 'inline-block'); + //shown } }, fields: { @@ -1666,19 +1700,19 @@ } } }, - action: function(args) { - var array1 = []; + action: function (args) { + var array1 =[]; array1.push("&cleanup=" + (args.data.cleanup == "on")); $.ajax({ url: createURL("restartNetwork&cleanup=true&id=" + args.context.networks[0].id + array1.join("")), dataType: "json", async: true, - success: function(json) { + success: function (json) { var jid = json.restartnetworkresponse.jobid; args.response.success({ _custom: { jobId: jid, - getUpdatedItem: function(json) { + getUpdatedItem: function (json) { return json.queryasyncjobresultresponse.jobresult.network; } } @@ -1687,7 +1721,7 @@ }); }, messages: { - notification: function(args) { + notification: function (args) { return 'label.restart.network'; } }, @@ -1695,29 +1729,31 @@ poll: pollAsyncJobResult } }, - + 'remove': { label: 'label.action.delete.network', messages: { - confirm: function(args) { + confirm: function (args) { return 'message.action.delete.network'; }, - notification: function(args) { + notification: function (args) { return 'label.action.delete.network'; } }, - action: function(args) { + action: function (args) { $.ajax({ url: createURL("deleteNetwork&id=" + args.context.networks[0].id), dataType: "json", async: true, - success: function(json) { + success: function (json) { var jid = json.deletenetworkresponse.jobid; args.response.success({ _custom: { jobId: jid, - getUpdatedItem: function(json) { - return {}; //nothing in this network needs to be updated, in fact, this whole template has being deleted + getUpdatedItem: function (json) { + return { + }; + //nothing in this network needs to be updated, in fact, this whole template has being deleted } } }); @@ -1732,31 +1768,33 @@ tabs: { details: { title: 'label.details', - preFilter: function(args) { - var hiddenFields = []; + preFilter: function (args) { + var hiddenFields =[]; if (selectedZoneObj.networktype == "Basic") { hiddenFields.push("account"); hiddenFields.push("gateway"); //hiddenFields.push("netmask"); } - + if (selectedGuestNetworkObj.type == "Isolated") { hiddenFields.push("networkofferingdisplaytext"); hiddenFields.push("networkdomaintext"); hiddenFields.push("gateway"); //hiddenFields.push("netmask"); - } else { //selectedGuestNetworkObj.type == "Shared" + } else { + //selectedGuestNetworkObj.type == "Shared" hiddenFields.push("networkofferingid"); hiddenFields.push("networkdomain"); } return hiddenFields; }, - fields: [{ + fields:[ { name: { label: 'label.name', isEditable: true } - }, { + }, + { id: { label: 'label.id' }, @@ -1772,11 +1810,10 @@ }, restartrequired: { label: 'label.restart.required', - converter: function(booleanValue) { + converter: function (booleanValue) { if (booleanValue == true) - return "Yes"; - else if (booleanValue == false) - return "No"; + return "Yes"; else if (booleanValue == false) + return "No"; } }, vlan: { @@ -1794,15 +1831,15 @@ networkofferingid: { label: 'label.network.offering', isEditable: true, - select: function(args) { - var items = []; + select: function (args) { + var items =[]; $.ajax({ url: createURL("listNetworkOfferings&state=Enabled&networkid=" + selectedGuestNetworkObj.id + "&zoneid=" + selectedGuestNetworkObj.zoneid), dataType: "json", async: false, - success: function(json) { + success: function (json) { var networkOfferingObjs = json.listnetworkofferingsresponse.networkoffering; - $(networkOfferingObjs).each(function() { + $(networkOfferingObjs).each(function () { items.push({ id: this.id, description: this.displaytext @@ -1810,23 +1847,23 @@ }); } }); - + //include currently selected network offeirng to dropdown items.push({ id: selectedGuestNetworkObj.networkofferingid, description: selectedGuestNetworkObj.networkofferingdisplaytext }); - + args.response.success({ data: items }); } }, - + networkofferingidText: { label: 'label.network.offering.id' }, - + gateway: { label: 'IPv4 Gateway' }, @@ -1834,14 +1871,14 @@ cidr: { label: 'IPv4 CIDR' }, - + ip6gateway: { label: 'IPv6 Gateway' }, ip6cidr: { label: 'IPv6 CIDR' }, - + networkdomaintext: { label: 'label.network.domain' }, @@ -1849,14 +1886,14 @@ label: 'label.network.domain', isEditable: true }, - + domain: { label: 'label.domain' }, subdomainaccess: { label: 'label.subdomain.access', - converter: function(data) { - return data ? 'Yes' : 'No'; + converter: function (data) { + return data ? 'Yes': 'No'; } }, account: { @@ -1866,7 +1903,7 @@ label: 'label.project' } }], - dataProvider: function(args) { + dataProvider: function (args) { var data = { id: args.context.networks[0].id }; @@ -1879,12 +1916,12 @@ listAll: true //pass "&listAll=true" to "listNetworks&id=xxxxxxxx" for now before API gets fixed. }); } - + $.ajax({ url: createURL("listNetworks"), data: data, async: false, - success: function(json) { + success: function (json) { selectedGuestNetworkObj = json.listnetworksresponse.network[0]; addExtraPropertiesToGuestNetworkObject(selectedGuestNetworkObj); args.response.success({ @@ -1899,7 +1936,7 @@ } } }, - + dedicatedGuestVlanRanges: { title: 'Dedicated VLAN/VNI Ranges', listView: { @@ -1916,13 +1953,13 @@ label: 'label.account' } }, - dataProvider: function(args) { + dataProvider: function (args) { $.ajax({ url: createURL('listDedicatedGuestVlanRanges'), data: { physicalnetworkid: args.context.physicalNetworks[0].id }, - success: function(json) { + success: function (json) { var items = json.listdedicatedguestvlanrangesresponse.dedicatedguestvlanrange; args.response.success({ data: items @@ -1934,7 +1971,7 @@ add: { label: 'Dedicate VLAN/VNI Range', messages: { - notification: function(args) { + notification: function (args) { return 'Dedicate VLAN/VNI Range'; } }, @@ -1944,15 +1981,15 @@ vlanrange: { label: 'VLAN/VNI Range', /* select: function(args) { - var items = []; - if(args.context.physicalNetworks[0].vlan != null && args.context.physicalNetworks[0].vlan.length > 0) { - var vlanranges = args.context.physicalNetworks[0].vlan.split(";"); - for(var i = 0; i < vlanranges.length ; i++) { - items.push({id: vlanranges[i], description: vlanranges[i]}); - } - } - args.response.success({data: items}); - },*/ + var items = []; + if(args.context.physicalNetworks[0].vlan != null && args.context.physicalNetworks[0].vlan.length > 0) { + var vlanranges = args.context.physicalNetworks[0].vlan.split(";"); + for(var i = 0; i < vlanranges.length ; i++) { + items.push({id: vlanranges[i], description: vlanranges[i]}); + } + } + args.response.success({data: items}); + },*/ validation: { required: true } @@ -1968,15 +2005,15 @@ validation: { required: true }, - select: function(args) { + select: function (args) { $.ajax({ url: createURL('listDomains'), data: { listAll: true }, - success: function(json) { + success: function (json) { args.response.success({ - data: $.map(json.listdomainsresponse.domain, function(domain) { + data: $.map(json.listdomainsresponse.domain, function (domain) { return { id: domain.id, description: domain.path @@ -1989,7 +2026,7 @@ } } }, - action: function(args) { + action: function (args) { var data = { physicalnetworkid: args.context.physicalNetworks[0].id, vlanrange: args.data.vlanrange, @@ -1999,7 +2036,7 @@ $.ajax({ url: createURL('dedicateGuestVlanRange'), data: data, - success: function(json) { + success: function (json) { var item = json.dedicateguestvlanrangeresponse.dedicatedguestvlanrange; args.response.success({ data: item @@ -2008,27 +2045,27 @@ }); }, notification: { - poll: function(args) { + poll: function (args) { args.complete(); } } } }, - + detailView: { name: 'VLAN Range details', actions: { remove: { label: 'Release dedicated VLAN range', messages: { - confirm: function(args) { + confirm: function (args) { return 'Please confirm you want to release dedicated VLAN range'; }, - notification: function(args) { + notification: function (args) { return 'Release dedicated VLAN range'; } }, - action: function(args) { + action: function (args) { var data = { id: args.context.dedicatedGuestVlanRanges[0].id }; @@ -2036,7 +2073,7 @@ url: createURL('releaseDedicatedGuestVlanRange'), data: data, async: true, - success: function(json) { + success: function (json) { var jid = json.releasededicatedguestvlanrangeresponse.jobid; args.response.success({ _custom: { @@ -2051,15 +2088,16 @@ } } }, - + tabs: { details: { title: 'label.details', - fields: [{ + fields:[ { guestvlanrange: { label: 'VLAN Range(s)' } - }, { + }, + { domain: { label: 'label.domain' }, @@ -2070,13 +2108,13 @@ label: 'label.id' } }], - dataProvider: function(args) { + dataProvider: function (args) { $.ajax({ url: createURL('listDedicatedGuestVlanRanges'), data: { id: args.context.dedicatedGuestVlanRanges[0].id }, - success: function(json) { + success: function (json) { var item = json.listdedicatedguestvlanrangesresponse.dedicatedguestvlanrange[0]; args.response.success({ data: item @@ -2093,7 +2131,7 @@ } } }, - + networks: { listView: { id: 'physicalNetworks', @@ -2103,7 +2141,7 @@ label: 'label.name' }, state: { - converter: function(str) { + converter: function (str) { // For localization return str; }, @@ -2117,24 +2155,24 @@ label: 'label.isolation.method' } }, - + actions: { remove: { label: 'label.action.delete.physical.network', messages: { - confirm: function(args) { + confirm: function (args) { return 'message.action.delete.physical.network'; }, - notification: function(args) { + notification: function (args) { return 'label.action.delete.physical.network'; } }, - action: function(args) { + action: function (args) { $.ajax({ url: createURL("deletePhysicalNetwork&id=" + args.context.physicalNetworks[0].id), dataType: "json", async: true, - success: function(json) { + success: function (json) { var jid = json.deletephysicalnetworkresponse.jobid; args.response.success({ _custom: { @@ -2150,13 +2188,13 @@ } } }, - dataProvider: function(args) { + dataProvider: function (args) { $.ajax({ url: createURL('listPhysicalNetworks'), data: { zoneid: args.context.zones[0].id }, - success: function(json) { + success: function (json) { physicalNetworkObjs = json.listphysicalnetworksresponse.physicalnetwork; args.response.success({ actionFilter: cloudStack.actionFilter.physicalNetwork, @@ -2166,19 +2204,19 @@ }); } }, - + trafficTypes: { - dataProvider: function(args) { + dataProvider: function (args) { selectedPhysicalNetworkObj = args.context.physicalNetworks[0]; - + $.ajax({ url: createURL('listTrafficTypes'), data: { physicalnetworkid: selectedPhysicalNetworkObj.id }, - success: function(json) { + success: function (json) { args.response.success({ - data: $.map(json.listtraffictypesresponse.traffictype, function(trafficType) { + data: $.map(json.listtraffictypesresponse.traffictype, function (trafficType) { return { id: trafficType.id, name: trafficType.traffictype @@ -2189,25 +2227,25 @@ }); } }, - + networkProviders: { statusLabels: { enabled: 'Enabled', //having device, network service provider is enabled 'not-configured': 'Not setup', //no device disabled: 'Disabled' //having device, network service provider is disabled }, - + // Actions performed on entire net. provider type actions: { - enable: function(args) { + enable: function (args) { args.response.success(); }, - - disable: function(args) { + + disable: function (args) { args.response.success(); } }, - + types: { virtualRouter: { id: 'virtualRouterProviders', @@ -2231,11 +2269,12 @@ tabs: { network: { title: 'label.network', - fields: [{ + fields:[ { name: { label: 'label.name' } - }, { + }, + { id: { label: 'label.id' }, @@ -2252,17 +2291,17 @@ label: 'label.supported.services' } }], - dataProvider: function(args) { + dataProvider: function (args) { refreshNspData("VirtualRouter"); args.response.success({ actionFilter: virtualRouterProviderActionFilter, - data: $.extend(nspMap["virtualRouter"], { - supportedServices: nspMap["virtualRouter"].servicelist.join(', ') + data: $.extend(nspMap[ "virtualRouter"], { + supportedServices: nspMap[ "virtualRouter"].servicelist.join(', ') }) }); } }, - + instances: { title: 'label.instances', listView: { @@ -2279,7 +2318,7 @@ label: 'label.type' }, state: { - converter: function(str) { + converter: function (str) { // For localization return str; }, @@ -2291,43 +2330,43 @@ } } }, - dataProvider: function(args) { - var array1 = []; + dataProvider: function (args) { + var array1 =[]; if (args.filterBy != null) { if (args.filterBy.search != null && args.filterBy.search.by != null && args.filterBy.search.value != null) { switch (args.filterBy.search.by) { case "name": - if (args.filterBy.search.value.length > 0) - array1.push("&keyword=" + args.filterBy.search.value); - break; + if (args.filterBy.search.value.length > 0) + array1.push("&keyword=" + args.filterBy.search.value); + break; } } } - + var data2 = { forvpc: false }; - var routers = []; + var routers =[]; $.ajax({ url: createURL("listRouters&zoneid=" + selectedZoneObj.id + "&listAll=true&page=" + args.page + "&pagesize=" + pageSize + array1.join("")), data: data2, - success: function(json) { + success: function (json) { var items = json.listroutersresponse.router ? - json.listroutersresponse.router : []; - - $(items).map(function(index, item) { + json.listroutersresponse.router:[]; + + $(items).map(function (index, item) { routers.push(item); }); - + // Get project routers $.ajax({ url: createURL("listRouters&zoneid=" + selectedZoneObj.id + "&listAll=true&page=" + args.page + "&pagesize=" + pageSize + array1.join("") + "&projectid=-1"), data: data2, - success: function(json) { + success: function (json) { var items = json.listroutersresponse.router ? - json.listroutersresponse.router : []; - - $(items).map(function(index, item) { + json.listroutersresponse.router:[]; + + $(items).map(function (index, item) { routers.push(item); }); args.response.success({ @@ -2345,27 +2384,27 @@ start: { label: 'label.action.start.router', messages: { - confirm: function(args) { + confirm: function (args) { return 'message.action.start.router'; }, - notification: function(args) { + notification: function (args) { return 'label.action.start.router'; } }, - action: function(args) { + action: function (args) { $.ajax({ url: createURL('startRouter&id=' + args.context.routers[0].id), dataType: 'json', async: true, - success: function(json) { + success: function (json) { var jid = json.startrouterresponse.jobid; args.response.success({ _custom: { jobId: jid, - getUpdatedItem: function(json) { + getUpdatedItem: function (json) { return json.queryasyncjobresultresponse.jobresult.router; }, - getActionFilter: function() { + getActionFilter: function () { return routerActionfilter; } } @@ -2377,7 +2416,7 @@ poll: pollAsyncJobResult } }, - + stop: { label: 'label.action.stop.router', createForm: { @@ -2392,26 +2431,26 @@ } }, messages: { - notification: function(args) { + notification: function (args) { return 'label.action.stop.router'; } }, - action: function(args) { - var array1 = []; + action: function (args) { + var array1 =[]; array1.push("&forced=" + (args.data.forced == "on")); $.ajax({ url: createURL('stopRouter&id=' + args.context.routers[0].id + array1.join("")), dataType: 'json', async: true, - success: function(json) { + success: function (json) { var jid = json.stoprouterresponse.jobid; args.response.success({ _custom: { jobId: jid, - getUpdatedItem: function(json) { + getUpdatedItem: function (json) { return json.queryasyncjobresultresponse.jobresult.router; }, - getActionFilter: function() { + getActionFilter: function () { return routerActionfilter; } } @@ -2423,23 +2462,23 @@ poll: pollAsyncJobResult } }, - + 'remove': { label: 'label.destroy.router', messages: { - confirm: function(args) { + confirm: function (args) { return 'message.confirm.destroy.router'; }, - notification: function(args) { + notification: function (args) { return 'label.destroy.router'; } }, - action: function(args) { + action: function (args) { $.ajax({ url: createURL("destroyRouter&id=" + args.context.routers[0].id), dataType: "json", async: true, - success: function(json) { + success: function (json) { var jid = json.destroyrouterresponse.jobid; args.response.success({ _custom: { @@ -2453,7 +2492,7 @@ poll: pollAsyncJobResult } }, - + migrate: { label: 'label.action.migrate.router', createForm: { @@ -2465,18 +2504,18 @@ validation: { required: true }, - select: function(args) { + select: function (args) { $.ajax({ url: createURL("findHostsForMigration&VirtualMachineId=" + args.context.routers[0].id), dataType: "json", async: true, - success: function(json) { + success: function (json) { var hostObjs = json.findhostsformigrationresponse.host; - var items = []; - $(hostObjs).each(function() { + var items =[]; + $(hostObjs).each(function () { items.push({ id: this.id, - description: (this.name + " (" + (this.suitableformigration ? "Suitable" : "Not Suitable") + ")") + description: (this.name + " (" + (this.suitableformigration ? "Suitable": "Not Suitable") + ")") }); }); args.response.success({ @@ -2485,7 +2524,7 @@ } }); }, - error: function(XMLHttpResponse) { + error: function (XMLHttpResponse) { var errorMsg = parseXMLHttpResponse(XMLHttpResponse); args.response.error(errorMsg); } @@ -2493,27 +2532,27 @@ } }, messages: { - notification: function(args) { + notification: function (args) { return 'label.action.migrate.router'; } }, - action: function(args) { + action: function (args) { $.ajax({ url: createURL("migrateSystemVm&hostid=" + args.data.hostId + "&virtualmachineid=" + args.context.routers[0].id), dataType: "json", async: true, - success: function(json) { + success: function (json) { var jid = json.migratesystemvmresponse.jobid; args.response.success({ _custom: { jobId: jid, - getUpdatedItem: function(json) { + getUpdatedItem: function (json) { //return json.queryasyncjobresultresponse.jobresult.systemvminstance; //not all properties returned in systemvminstance $.ajax({ url: createURL("listRouters&id=" + json.queryasyncjobresultresponse.jobresult.systemvminstance.id), dataType: "json", async: false, - success: function(json) { + success: function (json) { var items = json.listroutersresponse.router; if (items != null && items.length > 0) { return items[0]; @@ -2521,7 +2560,7 @@ } }); }, - getActionFilter: function() { + getActionFilter: function () { return routerActionfilter; } } @@ -2533,16 +2572,17 @@ poll: pollAsyncJobResult } }, - + viewConsole: { label: 'label.view.console', action: { externalLink: { - url: function(args) { + url: function (args) { return clientConsoleUrl + '?cmd=access&vm=' + args.context.routers[0].id; }, - title: function(args) { - return args.context.routers[0].id.substr(0, 8); //title in window.open() can't have space nor longer than 8 characters. Otherwise, IE browser will have error. + title: function (args) { + return args.context.routers[0].id.substr(0, 8); + //title in window.open() can't have space nor longer than 8 characters. Otherwise, IE browser will have error. }, width: 820, height: 640 @@ -2553,25 +2593,27 @@ tabs: { details: { title: 'label.details', - preFilter: function(args) { - var hiddenFields = []; - if (!args.context.routers[0].project) { + preFilter: function (args) { + var hiddenFields =[]; + if (! args.context.routers[0].project) { hiddenFields.push('project'); hiddenFields.push('projectid'); } if (selectedZoneObj.networktype == 'Basic') { - hiddenFields.push('publicip'); //In Basic zone, guest IP is public IP. So, publicip is not returned by listRouters API. Only guestipaddress is returned by listRouters API. + hiddenFields.push('publicip'); + //In Basic zone, guest IP is public IP. So, publicip is not returned by listRouters API. Only guestipaddress is returned by listRouters API. } return hiddenFields; }, - fields: [{ + fields:[ { name: { label: 'label.name' }, project: { label: 'label.project' } - }, { + }, + { id: { label: 'label.id' }, @@ -2620,12 +2662,12 @@ label: 'label.redundant.state' } }], - dataProvider: function(args) { + dataProvider: function (args) { $.ajax({ url: createURL("listRouters&id=" + args.context.routers[0].id), dataType: 'json', async: true, - success: function(json) { + success: function (json) { var jsonObj = json.listroutersresponse.router[0]; addExtraPropertiesToRouterInstanceObject(jsonObj); args.response.success({ @@ -2639,7 +2681,7 @@ nics: { title: 'label.nics', multiple: true, - fields: [{ + fields:[ { name: { label: 'label.name', header: true @@ -2672,17 +2714,17 @@ label: 'label.broadcast.uri' } }], - dataProvider: function(args) { + dataProvider: function (args) { $.ajax({ url: createURL("listRouters&id=" + args.context.routers[0].id), dataType: 'json', async: true, - success: function(json) { + success: function (json) { var jsonObj = json.listroutersresponse.router[0].nic; - + args.response.success({ actionFilter: routerActionfilter, - data: $.map(jsonObj, function(nic, index) { + data: $.map(jsonObj, function (nic, index) { var name = 'NIC ' + (index + 1); if (nic.isdefault) { name += ' (' + _l('label.default') + ')'; @@ -2704,16 +2746,16 @@ actions: { enable: { label: 'label.enable.provider', - action: function(args) { + action: function (args) { $.ajax({ - url: createURL("updateNetworkServiceProvider&id=" + nspMap["virtualRouter"].id + "&state=Enabled"), + url: createURL("updateNetworkServiceProvider&id=" + nspMap[ "virtualRouter"].id + "&state=Enabled"), dataType: "json", - success: function(json) { + success: function (json) { var jid = json.updatenetworkserviceproviderresponse.jobid; args.response.success({ _custom: { jobId: jid, - getUpdatedItem: function(json) { + getUpdatedItem: function (json) { $(window).trigger('cloudStack.fullRefresh'); } } @@ -2722,10 +2764,10 @@ }); }, messages: { - confirm: function(args) { + confirm: function (args) { return 'message.confirm.enable.provider'; }, - notification: function() { + notification: function () { return 'label.enable.provider'; } }, @@ -2735,16 +2777,16 @@ }, disable: { label: 'label.disable.provider', - action: function(args) { + action: function (args) { $.ajax({ - url: createURL("updateNetworkServiceProvider&id=" + nspMap["virtualRouter"].id + "&state=Disabled"), + url: createURL("updateNetworkServiceProvider&id=" + nspMap[ "virtualRouter"].id + "&state=Disabled"), dataType: "json", - success: function(json) { + success: function (json) { var jid = json.updatenetworkserviceproviderresponse.jobid; args.response.success({ _custom: { jobId: jid, - getUpdatedItem: function(json) { + getUpdatedItem: function (json) { $(window).trigger('cloudStack.fullRefresh'); } } @@ -2753,10 +2795,10 @@ }); }, messages: { - confirm: function(args) { + confirm: function (args) { return 'message.confirm.disable.provider'; }, - notification: function() { + notification: function () { return 'label.disable.provider'; } }, @@ -2766,7 +2808,7 @@ } } }, - + InternalLbVm: { id: 'InternalLbVm', label: 'InternalLbVm', @@ -2789,11 +2831,12 @@ tabs: { network: { title: 'label.network', - fields: [{ + fields:[ { name: { label: 'label.name' } - }, { + }, + { id: { label: 'label.id' }, @@ -2810,17 +2853,17 @@ label: 'label.supported.services' } }], - dataProvider: function(args) { + dataProvider: function (args) { refreshNspData("InternalLbVm"); args.response.success({ actionFilter: virtualRouterProviderActionFilter, - data: $.extend(nspMap["InternalLbVm"], { - supportedServices: nspMap["InternalLbVm"].servicelist.join(', ') + data: $.extend(nspMap[ "InternalLbVm"], { + supportedServices: nspMap[ "InternalLbVm"].servicelist.join(', ') }) }); } }, - + instances: { title: 'label.instances', listView: { @@ -2837,7 +2880,7 @@ label: 'label.type' }, state: { - converter: function(str) { + converter: function (str) { // For localization return str; }, @@ -2849,38 +2892,38 @@ } } }, - dataProvider: function(args) { - var array1 = []; + dataProvider: function (args) { + var array1 =[]; if (args.filterBy != null) { if (args.filterBy.search != null && args.filterBy.search.by != null && args.filterBy.search.value != null) { switch (args.filterBy.search.by) { case "name": - if (args.filterBy.search.value.length > 0) - array1.push("&keyword=" + args.filterBy.search.value); - break; + if (args.filterBy.search.value.length > 0) + array1.push("&keyword=" + args.filterBy.search.value); + break; } } } - - var routers = []; + + var routers =[]; $.ajax({ url: createURL("listInternalLoadBalancerVMs&zoneid=" + selectedZoneObj.id + "&listAll=true&page=" + args.page + "&pagesize=" + pageSize + array1.join("")), - success: function(json) { + success: function (json) { var items = json.listinternallbvmssresponse.internalloadbalancervm ? - json.listinternallbvmssresponse.internalloadbalancervm : []; - - $(items).map(function(index, item) { + json.listinternallbvmssresponse.internalloadbalancervm:[]; + + $(items).map(function (index, item) { routers.push(item); }); - + // Get project routers $.ajax({ url: createURL("listInternalLoadBalancerVMs&zoneid=" + selectedZoneObj.id + "&listAll=true&page=" + args.page + "&pagesize=" + pageSize + array1.join("") + "&projectid=-1"), - success: function(json) { + success: function (json) { var items = json.listinternallbvmssresponse.internalloadbalancervm ? - json.listinternallbvmssresponse.internalloadbalancervm : []; - - $(items).map(function(index, item) { + json.listinternallbvmssresponse.internalloadbalancervm:[]; + + $(items).map(function (index, item) { routers.push(item); }); args.response.success({ @@ -2898,27 +2941,27 @@ start: { label: 'Start LB VM', messages: { - confirm: function(args) { + confirm: function (args) { return 'Please confirm you want to start LB VM'; }, - notification: function(args) { + notification: function (args) { return 'Start LB VM'; } }, - action: function(args) { + action: function (args) { $.ajax({ url: createURL('startInternalLoadBalancerVM&id=' + args.context.internallbinstances[0].id), dataType: 'json', async: true, - success: function(json) { + success: function (json) { var jid = json.startinternallbvmresponse.jobid; args.response.success({ _custom: { jobId: jid, - getUpdatedItem: function(json) { + getUpdatedItem: function (json) { return json.queryasyncjobresultresponse.jobresult.internalloadbalancervm; }, - getActionFilter: function() { + getActionFilter: function () { return internallbinstanceActionfilter; } } @@ -2930,7 +2973,7 @@ poll: pollAsyncJobResult } }, - + stop: { label: 'Stop LB VM', createForm: { @@ -2945,26 +2988,26 @@ } }, messages: { - notification: function(args) { + notification: function (args) { return 'Stop LB VM'; } }, - action: function(args) { - var array1 = []; + action: function (args) { + var array1 =[]; array1.push("&forced=" + (args.data.forced == "on")); $.ajax({ url: createURL('stopInternalLoadBalancerVM&id=' + args.context.internallbinstances[0].id + array1.join("")), dataType: 'json', async: true, - success: function(json) { + success: function (json) { var jid = json.stopinternallbvmresponse.jobid; args.response.success({ _custom: { jobId: jid, - getUpdatedItem: function(json) { + getUpdatedItem: function (json) { return json.queryasyncjobresultresponse.jobresult.internalloadbalancervm; }, - getActionFilter: function() { + getActionFilter: function () { return internallbinstanceActionfilter; } } @@ -2976,7 +3019,7 @@ poll: pollAsyncJobResult } }, - + migrate: { label: 'Migrate LB VM', createForm: { @@ -2987,18 +3030,18 @@ validation: { required: true }, - select: function(args) { + select: function (args) { $.ajax({ url: createURL("findHostsForMigration&VirtualMachineId=" + args.context.internallbinstances[0].id), dataType: "json", async: true, - success: function(json) { + success: function (json) { var hostObjs = json.findhostsformigrationresponse.host; - var items = []; - $(hostObjs).each(function() { + var items =[]; + $(hostObjs).each(function () { items.push({ id: this.id, - description: (this.name + " (" + (this.suitableformigration ? "Suitable" : "Not Suitable") + ")") + description: (this.name + " (" + (this.suitableformigration ? "Suitable": "Not Suitable") + ")") }); }); args.response.success({ @@ -3007,7 +3050,7 @@ } }); }, - error: function(XMLHttpResponse) { + error: function (XMLHttpResponse) { var errorMsg = parseXMLHttpResponse(XMLHttpResponse); args.response.error(errorMsg); } @@ -3015,27 +3058,27 @@ } }, messages: { - notification: function(args) { + notification: function (args) { return 'Migrate LB VM'; } }, - action: function(args) { + action: function (args) { $.ajax({ url: createURL("migrateSystemVm&hostid=" + args.data.hostId + "&virtualmachineid=" + args.context.internallbinstances[0].id), dataType: "json", async: true, - success: function(json) { + success: function (json) { var jid = json.migratesystemvmresponse.jobid; args.response.success({ _custom: { jobId: jid, - getUpdatedItem: function(json) { + getUpdatedItem: function (json) { //return json.queryasyncjobresultresponse.jobresult.systemvminstance; //not all properties returned in systemvminstance $.ajax({ url: createURL("listInternalLoadBalancerVMs&id=" + json.queryasyncjobresultresponse.jobresult.systemvminstance.id), dataType: "json", async: false, - success: function(json) { + success: function (json) { var items = json.listinternallbvmssresponse.internalloadbalancervm; if (items != null && items.length > 0) { return items[0]; @@ -3043,7 +3086,7 @@ } }); }, - getActionFilter: function() { + getActionFilter: function () { return internallbinstanceActionfilter; } } @@ -3055,16 +3098,17 @@ poll: pollAsyncJobResult } }, - + viewConsole: { label: 'label.view.console', action: { externalLink: { - url: function(args) { + url: function (args) { return clientConsoleUrl + '?cmd=access&vm=' + args.context.internallbinstances[0].id; }, - title: function(args) { - return args.context.internallbinstances[0].id.substr(0, 8); //title in window.open() can't have space nor longer than 8 characters. Otherwise, IE browser will have error. + title: function (args) { + return args.context.internallbinstances[0].id.substr(0, 8); + //title in window.open() can't have space nor longer than 8 characters. Otherwise, IE browser will have error. }, width: 820, height: 640 @@ -3075,25 +3119,27 @@ tabs: { details: { title: 'label.details', - preFilter: function(args) { - var hiddenFields = []; - if (!args.context.internallbinstances[0].project) { + preFilter: function (args) { + var hiddenFields =[]; + if (! args.context.internallbinstances[0].project) { hiddenFields.push('project'); hiddenFields.push('projectid'); } if (selectedZoneObj.networktype == 'Basic') { - hiddenFields.push('publicip'); //In Basic zone, guest IP is public IP. So, publicip is not returned by listRouters API. Only guestipaddress is returned by listRouters API. + hiddenFields.push('publicip'); + //In Basic zone, guest IP is public IP. So, publicip is not returned by listRouters API. Only guestipaddress is returned by listRouters API. } return hiddenFields; }, - fields: [{ + fields:[ { name: { label: 'label.name' }, project: { label: 'label.project' } - }, { + }, + { id: { label: 'label.id' }, @@ -3142,12 +3188,12 @@ label: 'label.redundant.state' } }], - dataProvider: function(args) { + dataProvider: function (args) { $.ajax({ url: createURL("listInternalLoadBalancerVMs&id=" + args.context.internallbinstances[0].id), dataType: 'json', async: true, - success: function(json) { + success: function (json) { var jsonObj = json.listinternallbvmssresponse.internalloadbalancervm[0]; addExtraPropertiesToRouterInstanceObject(jsonObj); args.response.success({ @@ -3161,7 +3207,7 @@ nics: { title: 'label.nics', multiple: true, - fields: [{ + fields:[ { name: { label: 'label.name', header: true @@ -3194,17 +3240,17 @@ label: 'label.broadcast.uri' } }], - dataProvider: function(args) { + dataProvider: function (args) { $.ajax({ url: createURL("listInternalLoadBalancerVMs&id=" + args.context.internallbinstances[0].id), dataType: 'json', async: true, - success: function(json) { + success: function (json) { var jsonObj = json.listinternallbvmssresponse.internalloadbalancervm[0].nic; - + args.response.success({ actionFilter: internallbinstanceActionfilter, - data: $.map(jsonObj, function(nic, index) { + data: $.map(jsonObj, function (nic, index) { var name = 'NIC ' + (index + 1); if (nic.isdefault) { name += ' (' + _l('label.default') + ')'; @@ -3226,16 +3272,16 @@ actions: { enable: { label: 'label.enable.provider', - action: function(args) { + action: function (args) { $.ajax({ - url: createURL("updateNetworkServiceProvider&id=" + nspMap["InternalLbVm"].id + "&state=Enabled"), + url: createURL("updateNetworkServiceProvider&id=" + nspMap[ "InternalLbVm"].id + "&state=Enabled"), dataType: "json", - success: function(json) { + success: function (json) { var jid = json.updatenetworkserviceproviderresponse.jobid; args.response.success({ _custom: { jobId: jid, - getUpdatedItem: function(json) { + getUpdatedItem: function (json) { $(window).trigger('cloudStack.fullRefresh'); } } @@ -3244,10 +3290,10 @@ }); }, messages: { - confirm: function(args) { + confirm: function (args) { return 'message.confirm.enable.provider'; }, - notification: function() { + notification: function () { return 'label.enable.provider'; } }, @@ -3257,16 +3303,16 @@ }, disable: { label: 'label.disable.provider', - action: function(args) { + action: function (args) { $.ajax({ - url: createURL("updateNetworkServiceProvider&id=" + nspMap["InternalLbVm"].id + "&state=Disabled"), + url: createURL("updateNetworkServiceProvider&id=" + nspMap[ "InternalLbVm"].id + "&state=Disabled"), dataType: "json", - success: function(json) { + success: function (json) { var jid = json.updatenetworkserviceproviderresponse.jobid; args.response.success({ _custom: { jobId: jid, - getUpdatedItem: function(json) { + getUpdatedItem: function (json) { $(window).trigger('cloudStack.fullRefresh'); } } @@ -3275,10 +3321,10 @@ }); }, messages: { - confirm: function(args) { + confirm: function (args) { return 'message.confirm.disable.provider'; }, - notification: function() { + notification: function () { return 'label.disable.provider'; } }, @@ -3288,7 +3334,7 @@ } } }, - + vpcVirtualRouter: { id: 'vpcVirtualRouterProviders', label: 'VPC Virtual Router', @@ -3311,11 +3357,12 @@ tabs: { network: { title: 'label.network', - fields: [{ + fields:[ { name: { label: 'label.name' } - }, { + }, + { id: { label: 'label.id' }, @@ -3332,17 +3379,17 @@ label: 'label.supported.services' } }], - dataProvider: function(args) { + dataProvider: function (args) { refreshNspData("VpcVirtualRouter"); args.response.success({ actionFilter: virtualRouterProviderActionFilter, - data: $.extend(nspMap["vpcVirtualRouter"], { - supportedServices: nspMap["vpcVirtualRouter"].servicelist.join(', ') + data: $.extend(nspMap[ "vpcVirtualRouter"], { + supportedServices: nspMap[ "vpcVirtualRouter"].servicelist.join(', ') }) }); } }, - + instances: { title: 'label.instances', listView: { @@ -3359,7 +3406,7 @@ label: 'label.type' }, state: { - converter: function(str) { + converter: function (str) { // For localization return str; }, @@ -3371,43 +3418,43 @@ } } }, - dataProvider: function(args) { - var array1 = []; + dataProvider: function (args) { + var array1 =[]; if (args.filterBy != null) { if (args.filterBy.search != null && args.filterBy.search.by != null && args.filterBy.search.value != null) { switch (args.filterBy.search.by) { case "name": - if (args.filterBy.search.value.length > 0) - array1.push("&keyword=" + args.filterBy.search.value); - break; + if (args.filterBy.search.value.length > 0) + array1.push("&keyword=" + args.filterBy.search.value); + break; } } } - + var data2 = { forvpc: true }; - var routers = []; + var routers =[]; $.ajax({ url: createURL("listRouters&zoneid=" + selectedZoneObj.id + "&listAll=true&page=" + args.page + "&pagesize=" + pageSize + array1.join("")), dataType: 'json', data: data2, async: true, - success: function(json) { + success: function (json) { var items = json.listroutersresponse.router; - $(items).map(function(index, item) { + $(items).map(function (index, item) { routers.push(item); }); - + // Get project routers $.ajax({ url: createURL("listRouters&zoneid=" + selectedZoneObj.id + "&listAll=true&page=" + args.page + "&pagesize=" + pageSize + array1.join("") + "&projectid=-1"), dataType: 'json', data: data2, async: true, - success: function(json) { + success: function (json) { var items = json.listroutersresponse.router; - $(items).map(function(index, item) { + $(items).map(function (index, item) { routers.push(item); }); args.response.success({ @@ -3425,27 +3472,27 @@ start: { label: 'label.action.start.router', messages: { - confirm: function(args) { + confirm: function (args) { return 'message.action.start.router'; }, - notification: function(args) { + notification: function (args) { return 'label.action.start.router'; } }, - action: function(args) { + action: function (args) { $.ajax({ url: createURL('startRouter&id=' + args.context.routers[0].id), dataType: 'json', async: true, - success: function(json) { + success: function (json) { var jid = json.startrouterresponse.jobid; args.response.success({ _custom: { jobId: jid, - getUpdatedItem: function(json) { + getUpdatedItem: function (json) { return json.queryasyncjobresultresponse.jobresult.router; }, - getActionFilter: function() { + getActionFilter: function () { return routerActionfilter; } } @@ -3457,7 +3504,7 @@ poll: pollAsyncJobResult } }, - + stop: { label: 'label.action.stop.router', createForm: { @@ -3472,26 +3519,26 @@ } }, messages: { - notification: function(args) { + notification: function (args) { return 'label.action.stop.router'; } }, - action: function(args) { - var array1 = []; + action: function (args) { + var array1 =[]; array1.push("&forced=" + (args.data.forced == "on")); $.ajax({ url: createURL('stopRouter&id=' + args.context.routers[0].id + array1.join("")), dataType: 'json', async: true, - success: function(json) { + success: function (json) { var jid = json.stoprouterresponse.jobid; args.response.success({ _custom: { jobId: jid, - getUpdatedItem: function(json) { + getUpdatedItem: function (json) { return json.queryasyncjobresultresponse.jobresult.router; }, - getActionFilter: function() { + getActionFilter: function () { return routerActionfilter; } } @@ -3503,31 +3550,31 @@ poll: pollAsyncJobResult } }, - + restart: { label: 'label.action.reboot.router', messages: { - confirm: function(args) { + confirm: function (args) { return 'message.action.reboot.router'; }, - notification: function(args) { + notification: function (args) { return 'label.action.reboot.router'; } }, - action: function(args) { + action: function (args) { $.ajax({ url: createURL('rebootRouter&id=' + args.context.routers[0].id), dataType: 'json', async: true, - success: function(json) { + success: function (json) { var jid = json.rebootrouterresponse.jobid; args.response.success({ _custom: { jobId: jid, - getUpdatedItem: function(json) { + getUpdatedItem: function (json) { return json.queryasyncjobresultresponse.jobresult.router; }, - getActionFilter: function() { + getActionFilter: function () { return routerActionfilter; } } @@ -3539,23 +3586,23 @@ poll: pollAsyncJobResult } }, - + 'remove': { label: 'label.destroy.router', messages: { - confirm: function(args) { + confirm: function (args) { return 'message.confirm.destroy.router'; }, - notification: function(args) { + notification: function (args) { return 'label.destroy.router'; } }, - action: function(args) { + action: function (args) { $.ajax({ url: createURL("destroyRouter&id=" + args.context.routers[0].id), dataType: "json", async: true, - success: function(json) { + success: function (json) { var jid = json.destroyrouterresponse.jobid; args.response.success({ _custom: { @@ -3569,7 +3616,7 @@ poll: pollAsyncJobResult } }, - + migrate: { label: 'label.action.migrate.router', createForm: { @@ -3581,18 +3628,18 @@ validation: { required: true }, - select: function(args) { + select: function (args) { $.ajax({ url: createURL("findHostsForMigration&VirtualMachineId=" + args.context.routers[0].id), dataType: "json", async: true, - success: function(json) { + success: function (json) { var hostObjs = json.findhostsformigrationresponse.host; - var items = []; - $(hostObjs).each(function() { + var items =[]; + $(hostObjs).each(function () { items.push({ id: this.id, - description: (this.name + " (" + (this.suitableformigration ? "Suitable" : "Not Suitable") + ")") + description: (this.name + " (" + (this.suitableformigration ? "Suitable": "Not Suitable") + ")") }); }); args.response.success({ @@ -3601,7 +3648,7 @@ } }); }, - error: function(XMLHttpResponse) { + error: function (XMLHttpResponse) { var errorMsg = parseXMLHttpResponse(XMLHttpResponse); args.response.error(errorMsg); } @@ -3609,27 +3656,27 @@ } }, messages: { - notification: function(args) { + notification: function (args) { return 'label.action.migrate.router'; } }, - action: function(args) { + action: function (args) { $.ajax({ url: createURL("migrateSystemVm&hostid=" + args.data.hostId + "&virtualmachineid=" + args.context.routers[0].id), dataType: "json", async: true, - success: function(json) { + success: function (json) { var jid = json.migratesystemvmresponse.jobid; args.response.success({ _custom: { jobId: jid, - getUpdatedItem: function(json) { + getUpdatedItem: function (json) { //return json.queryasyncjobresultresponse.jobresult.systemvminstance; //not all properties returned in systemvminstance $.ajax({ url: createURL("listRouters&id=" + json.queryasyncjobresultresponse.jobresult.systemvminstance.id), dataType: "json", async: false, - success: function(json) { + success: function (json) { var items = json.listroutersresponse.router; if (items != null && items.length > 0) { return items[0]; @@ -3637,7 +3684,7 @@ } }); }, - getActionFilter: function() { + getActionFilter: function () { return routerActionfilter; } } @@ -3649,16 +3696,17 @@ poll: pollAsyncJobResult } }, - + viewConsole: { label: 'label.view.console', action: { externalLink: { - url: function(args) { + url: function (args) { return clientConsoleUrl + '?cmd=access&vm=' + args.context.routers[0].id; }, - title: function(args) { - return args.context.routers[0].id.substr(0, 8); //title in window.open() can't have space nor longer than 8 characters. Otherwise, IE browser will have error. + title: function (args) { + return args.context.routers[0].id.substr(0, 8); + //title in window.open() can't have space nor longer than 8 characters. Otherwise, IE browser will have error. }, width: 820, height: 640 @@ -3669,25 +3717,27 @@ tabs: { details: { title: 'label.details', - preFilter: function(args) { - var hiddenFields = []; - if (!args.context.routers[0].project) { + preFilter: function (args) { + var hiddenFields =[]; + if (! args.context.routers[0].project) { hiddenFields.push('project'); hiddenFields.push('projectid'); } if (selectedZoneObj.networktype == 'Basic') { - hiddenFields.push('publicip'); //In Basic zone, guest IP is public IP. So, publicip is not returned by listRouters API. Only guestipaddress is returned by listRouters API. + hiddenFields.push('publicip'); + //In Basic zone, guest IP is public IP. So, publicip is not returned by listRouters API. Only guestipaddress is returned by listRouters API. } return hiddenFields; }, - fields: [{ + fields:[ { name: { label: 'label.name' }, project: { label: 'label.project' } - }, { + }, + { id: { label: 'label.id' }, @@ -3736,12 +3786,12 @@ label: 'VPC ID' } }], - dataProvider: function(args) { + dataProvider: function (args) { $.ajax({ url: createURL("listRouters&id=" + args.context.routers[0].id), dataType: 'json', async: true, - success: function(json) { + success: function (json) { var jsonObj = json.listroutersresponse.router[0]; addExtraPropertiesToRouterInstanceObject(jsonObj); args.response.success({ @@ -3760,16 +3810,16 @@ actions: { enable: { label: 'label.enable.provider', - action: function(args) { + action: function (args) { $.ajax({ - url: createURL("updateNetworkServiceProvider&id=" + nspMap["vpcVirtualRouter"].id + "&state=Enabled"), + url: createURL("updateNetworkServiceProvider&id=" + nspMap[ "vpcVirtualRouter"].id + "&state=Enabled"), dataType: "json", - success: function(json) { + success: function (json) { var jid = json.updatenetworkserviceproviderresponse.jobid; args.response.success({ _custom: { jobId: jid, - getUpdatedItem: function(json) { + getUpdatedItem: function (json) { $(window).trigger('cloudStack.fullRefresh'); } } @@ -3778,10 +3828,10 @@ }); }, messages: { - confirm: function(args) { + confirm: function (args) { return 'message.confirm.enable.provider'; }, - notification: function() { + notification: function () { return 'label.enable.provider'; } }, @@ -3791,16 +3841,16 @@ }, disable: { label: 'label.disable.provider', - action: function(args) { + action: function (args) { $.ajax({ - url: createURL("updateNetworkServiceProvider&id=" + nspMap["vpcVirtualRouter"].id + "&state=Disabled"), + url: createURL("updateNetworkServiceProvider&id=" + nspMap[ "vpcVirtualRouter"].id + "&state=Disabled"), dataType: "json", - success: function(json) { + success: function (json) { var jid = json.updatenetworkserviceproviderresponse.jobid; args.response.success({ _custom: { jobId: jid, - getUpdatedItem: function(json) { + getUpdatedItem: function (json) { $(window).trigger('cloudStack.fullRefresh'); } } @@ -3809,10 +3859,10 @@ }); }, messages: { - confirm: function(args) { + confirm: function (args) { return 'message.confirm.disable.provider'; }, - notification: function() { + notification: function () { return 'label.disable.provider'; } }, @@ -3822,7 +3872,7 @@ } } }, - + // NetScaler provider detail view netscaler: { type: 'detailView', @@ -3835,19 +3885,20 @@ tabs: { details: { title: 'label.details', - fields: [{ + fields:[ { name: { label: 'label.name' } - }, { + }, + { state: { label: 'label.state' } }], - dataProvider: function(args) { + dataProvider: function (args) { refreshNspData("Netscaler"); var providerObj; - $(nspHardcodingArray).each(function() { + $(nspHardcodingArray).each(function () { if (this.id == "netscaler") { providerObj = this; return false; //break each loop @@ -3883,8 +3934,8 @@ networkdevicetype: { label: 'label.type', docID: 'helpNetScalerType', - select: function(args) { - var items = []; + select: function (args) { + var items =[]; items.push({ id: "NetscalerMPXLoadBalancer", description: "NetScaler MPX LoadBalancer" @@ -3910,7 +3961,7 @@ label: 'label.private.interface', docID: 'helpNetScalerPrivateInterface' }, - + gslbprovider: { label: 'GSLB service', isBoolean: true, @@ -3922,7 +3973,7 @@ gslbproviderprivateip: { label: 'GSLB service Private IP' }, - + numretries: { label: 'label.numretries', defaultValue: '2', @@ -3954,42 +4005,43 @@ } }, messages: { - notification: function(args) { + notification: function (args) { return 'label.add.netScaler.device'; } }, - action: function(args) { - if (nspMap["netscaler"] == null) { + action: function (args) { + if (nspMap[ "netscaler"] == null) { $.ajax({ url: createURL("addNetworkServiceProvider&name=Netscaler&physicalnetworkid=" + selectedPhysicalNetworkObj.id), dataType: "json", async: true, - success: function(json) { + success: function (json) { var jobId = json.addnetworkserviceproviderresponse.jobid; - var addNetscalerProviderIntervalID = setInterval(function() { + var addNetscalerProviderIntervalID = setInterval(function () { $.ajax({ url: createURL("queryAsyncJobResult&jobId=" + jobId), dataType: "json", - success: function(json) { + success: function (json) { var result = json.queryasyncjobresultresponse; if (result.jobstatus == 0) { return; //Job has not completed } else { clearInterval(addNetscalerProviderIntervalID); if (result.jobstatus == 1) { - nspMap["netscaler"] = result.jobresult.networkserviceprovider; + nspMap[ "netscaler"] = result.jobresult.networkserviceprovider; addExternalLoadBalancer(args, selectedPhysicalNetworkObj, "addNetscalerLoadBalancer", "addnetscalerloadbalancerresponse", "netscalerloadbalancer"); } else if (result.jobstatus == 2) { alert("addNetworkServiceProvider&name=Netscaler failed. Error: " + _s(result.jobresult.errortext)); } } }, - error: function(XMLHttpResponse) { + error: function (XMLHttpResponse) { var errorMsg = parseXMLHttpResponse(XMLHttpResponse); alert("addNetworkServiceProvider&name=Netscaler failed. Error: " + errorMsg); } }); - }, g_queryAsyncJobResultInterval); + }, + g_queryAsyncJobResultInterval); } }); } else { @@ -4002,16 +4054,16 @@ }, enable: { label: 'label.enable.provider', - action: function(args) { + action: function (args) { $.ajax({ - url: createURL("updateNetworkServiceProvider&id=" + nspMap["netscaler"].id + "&state=Enabled"), + url: createURL("updateNetworkServiceProvider&id=" + nspMap[ "netscaler"].id + "&state=Enabled"), dataType: "json", - success: function(json) { + success: function (json) { var jid = json.updatenetworkserviceproviderresponse.jobid; args.response.success({ _custom: { jobId: jid, - getUpdatedItem: function(json) { + getUpdatedItem: function (json) { $(window).trigger('cloudStack.fullRefresh'); } } @@ -4020,10 +4072,10 @@ }); }, messages: { - confirm: function(args) { + confirm: function (args) { return 'message.confirm.enable.provider'; }, - notification: function() { + notification: function () { return 'label.enable.provider'; } }, @@ -4033,16 +4085,16 @@ }, disable: { label: 'label.disable.provider', - action: function(args) { + action: function (args) { $.ajax({ - url: createURL("updateNetworkServiceProvider&id=" + nspMap["netscaler"].id + "&state=Disabled"), + url: createURL("updateNetworkServiceProvider&id=" + nspMap[ "netscaler"].id + "&state=Disabled"), dataType: "json", - success: function(json) { + success: function (json) { var jid = json.updatenetworkserviceproviderresponse.jobid; args.response.success({ _custom: { jobId: jid, - getUpdatedItem: function(json) { + getUpdatedItem: function (json) { $(window).trigger('cloudStack.fullRefresh'); } } @@ -4051,10 +4103,10 @@ }); }, messages: { - confirm: function(args) { + confirm: function (args) { return 'message.confirm.disable.provider'; }, - notification: function() { + notification: function () { return 'label.disable.provider'; } }, @@ -4064,27 +4116,27 @@ }, destroy: { label: 'label.shutdown.provider', - action: function(args) { + action: function (args) { $.ajax({ - url: createURL("deleteNetworkServiceProvider&id=" + nspMap["netscaler"].id), + url: createURL("deleteNetworkServiceProvider&id=" + nspMap[ "netscaler"].id), dataType: "json", - success: function(json) { + success: function (json) { var jid = json.deletenetworkserviceproviderresponse.jobid; args.response.success({ _custom: { jobId: jid } }); - + $(window).trigger('cloudStack.fullRefresh'); } }); }, messages: { - confirm: function(args) { + confirm: function (args) { return 'message.confirm.shutdown.provider'; }, - notification: function(args) { + notification: function (args) { return 'label.shutdown.provider'; } }, @@ -4094,7 +4146,7 @@ } } }, - + //Baremetal DHCP provider detail view BaremetalDhcpProvider: { type: 'detailView', @@ -4107,19 +4159,20 @@ tabs: { details: { title: 'label.details', - fields: [{ + fields:[ { name: { label: 'label.name' } - }, { + }, + { state: { label: 'label.state' } }], - dataProvider: function(args) { + dataProvider: function (args) { refreshNspData("BaremetalDhcpProvider"); var providerObj; - $(nspHardcodingArray).each(function() { + $(nspHardcodingArray).each(function () { if (this.id == "BaremetalDhcpProvider") { providerObj = this; return false; //break each loop @@ -4159,11 +4212,11 @@ } } }, - action: function(args) { + action: function (args) { addBaremetalDhcpDeviceFn(args); }, messages: { - notification: function(args) { + notification: function (args) { return 'Add Baremetal DHCP Device'; } }, @@ -4173,16 +4226,16 @@ }, enable: { label: 'label.enable.provider', - action: function(args) { + action: function (args) { $.ajax({ - url: createURL("updateNetworkServiceProvider&id=" + nspMap["BaremetalDhcpProvider"].id + "&state=Enabled"), + url: createURL("updateNetworkServiceProvider&id=" + nspMap[ "BaremetalDhcpProvider"].id + "&state=Enabled"), dataType: "json", - success: function(json) { + success: function (json) { var jid = json.updatenetworkserviceproviderresponse.jobid; args.response.success({ _custom: { jobId: jid, - getUpdatedItem: function(json) { + getUpdatedItem: function (json) { $(window).trigger('cloudStack.fullRefresh'); } } @@ -4191,10 +4244,10 @@ }); }, messages: { - confirm: function(args) { + confirm: function (args) { return 'message.confirm.enable.provider'; }, - notification: function() { + notification: function () { return 'label.enable.provider'; } }, @@ -4204,16 +4257,16 @@ }, disable: { label: 'label.disable.provider', - action: function(args) { + action: function (args) { $.ajax({ - url: createURL("updateNetworkServiceProvider&id=" + nspMap["BaremetalDhcpProvider"].id + "&state=Disabled"), + url: createURL("updateNetworkServiceProvider&id=" + nspMap[ "BaremetalDhcpProvider"].id + "&state=Disabled"), dataType: "json", - success: function(json) { + success: function (json) { var jid = json.updatenetworkserviceproviderresponse.jobid; args.response.success({ _custom: { jobId: jid, - getUpdatedItem: function(json) { + getUpdatedItem: function (json) { $(window).trigger('cloudStack.fullRefresh'); } } @@ -4222,10 +4275,10 @@ }); }, messages: { - confirm: function(args) { + confirm: function (args) { return 'message.confirm.disable.provider'; }, - notification: function() { + notification: function () { return 'label.disable.provider'; } }, @@ -4235,27 +4288,27 @@ }, destroy: { label: 'label.shutdown.provider', - action: function(args) { + action: function (args) { $.ajax({ - url: createURL("deleteNetworkServiceProvider&id=" + nspMap["BaremetalDhcpProvider"].id), + url: createURL("deleteNetworkServiceProvider&id=" + nspMap[ "BaremetalDhcpProvider"].id), dataType: "json", - success: function(json) { + success: function (json) { var jid = json.deletenetworkserviceproviderresponse.jobid; args.response.success({ _custom: { jobId: jid } }); - + $(window).trigger('cloudStack.fullRefresh'); } }); }, messages: { - confirm: function(args) { + confirm: function (args) { return 'message.confirm.shutdown.provider'; }, - notification: function(args) { + notification: function (args) { return 'label.shutdown.provider'; } }, @@ -4265,7 +4318,7 @@ } } }, - + //Baremetal PXE provider detail view BaremetalPxeProvider: { type: 'detailView', @@ -4278,19 +4331,20 @@ tabs: { details: { title: 'label.details', - fields: [{ + fields:[ { name: { label: 'label.name' } - }, { + }, + { state: { label: 'label.state' } }], - dataProvider: function(args) { + dataProvider: function (args) { refreshNspData("BaremetalPxeProvider"); var providerObj; - $(nspHardcodingArray).each(function() { + $(nspHardcodingArray).each(function () { if (this.id == "BaremetalPxeProvider") { providerObj = this; return false; //break each loop @@ -4336,11 +4390,11 @@ } } }, - action: function(args) { + action: function (args) { addBaremetalPxeDeviceFn(args); }, messages: { - notification: function(args) { + notification: function (args) { return 'Add Baremetal PXE Device'; } }, @@ -4350,16 +4404,16 @@ }, enable: { label: 'label.enable.provider', - action: function(args) { + action: function (args) { $.ajax({ - url: createURL("updateNetworkServiceProvider&id=" + nspMap["BaremetalPxeProvider"].id + "&state=Enabled"), + url: createURL("updateNetworkServiceProvider&id=" + nspMap[ "BaremetalPxeProvider"].id + "&state=Enabled"), dataType: "json", - success: function(json) { + success: function (json) { var jid = json.updatenetworkserviceproviderresponse.jobid; args.response.success({ _custom: { jobId: jid, - getUpdatedItem: function(json) { + getUpdatedItem: function (json) { $(window).trigger('cloudStack.fullRefresh'); } } @@ -4368,10 +4422,10 @@ }); }, messages: { - confirm: function(args) { + confirm: function (args) { return 'message.confirm.enable.provider'; }, - notification: function() { + notification: function () { return 'label.enable.provider'; } }, @@ -4381,16 +4435,16 @@ }, disable: { label: 'label.disable.provider', - action: function(args) { + action: function (args) { $.ajax({ - url: createURL("updateNetworkServiceProvider&id=" + nspMap["BaremetalPxeProvider"].id + "&state=Disabled"), + url: createURL("updateNetworkServiceProvider&id=" + nspMap[ "BaremetalPxeProvider"].id + "&state=Disabled"), dataType: "json", - success: function(json) { + success: function (json) { var jid = json.updatenetworkserviceproviderresponse.jobid; args.response.success({ _custom: { jobId: jid, - getUpdatedItem: function(json) { + getUpdatedItem: function (json) { $(window).trigger('cloudStack.fullRefresh'); } } @@ -4399,10 +4453,10 @@ }); }, messages: { - confirm: function(args) { + confirm: function (args) { return 'message.confirm.disable.provider'; }, - notification: function() { + notification: function () { return 'label.disable.provider'; } }, @@ -4412,27 +4466,27 @@ }, destroy: { label: 'label.shutdown.provider', - action: function(args) { + action: function (args) { $.ajax({ - url: createURL("deleteNetworkServiceProvider&id=" + nspMap["BaremetalPxeProvider"].id), + url: createURL("deleteNetworkServiceProvider&id=" + nspMap[ "BaremetalPxeProvider"].id), dataType: "json", - success: function(json) { + success: function (json) { var jid = json.deletenetworkserviceproviderresponse.jobid; args.response.success({ _custom: { jobId: jid } }); - + $(window).trigger('cloudStack.fullRefresh'); } }); }, messages: { - confirm: function(args) { + confirm: function (args) { return 'message.confirm.shutdown.provider'; }, - notification: function(args) { + notification: function (args) { return 'label.shutdown.provider'; } }, @@ -4442,7 +4496,7 @@ } } }, - + //f5 provider detail view f5: { type: 'detailView', @@ -4455,19 +4509,20 @@ tabs: { details: { title: 'label.details', - fields: [{ + fields:[ { name: { label: 'label.name' } - }, { + }, + { state: { label: 'label.state' } }], - dataProvider: function(args) { + dataProvider: function (args) { refreshNspData("F5BigIp"); var providerObj; - $(nspHardcodingArray).each(function() { + $(nspHardcodingArray).each(function () { if (this.id == "f5") { providerObj = this; return false; //break each loop @@ -4503,8 +4558,8 @@ networkdevicetype: { label: 'label.type', docID: 'helpF5Type', - select: function(args) { - var items = []; + select: function (args) { + var items =[]; items.push({ id: "F5BigIpLoadBalancer", description: "F5 Big Ip Load Balancer" @@ -4529,17 +4584,17 @@ }, //Inline Mode has been moved from Add F5 Device to Create Network Offering (both backend and UI) /* - inline: { - label: 'Mode', - docID: 'helpF5Mode', - select: function(args) { - var items = []; - items.push({id: "false", description: "side by side"}); - items.push({id: "true", description: "inline"}); - args.response.success({data: items}); - } - }, - */ + inline: { + label: 'Mode', + docID: 'helpF5Mode', + select: function(args) { + var items = []; + items.push({id: "false", description: "side by side"}); + items.push({id: "true", description: "inline"}); + args.response.success({data: items}); + } + }, + */ dedicated: { label: 'label.dedicated', docID: 'helpF5Dedicated', @@ -4556,38 +4611,39 @@ } } }, - action: function(args) { - if (nspMap["f5"] == null) { + action: function (args) { + if (nspMap[ "f5"] == null) { $.ajax({ url: createURL("addNetworkServiceProvider&name=F5BigIp&physicalnetworkid=" + selectedPhysicalNetworkObj.id), dataType: "json", async: true, - success: function(json) { + success: function (json) { var jobId = json.addnetworkserviceproviderresponse.jobid; - var addF5ProviderIntervalID = setInterval(function() { + var addF5ProviderIntervalID = setInterval(function () { $.ajax({ url: createURL("queryAsyncJobResult&jobId=" + jobId), dataType: "json", - success: function(json) { + success: function (json) { var result = json.queryasyncjobresultresponse; if (result.jobstatus == 0) { return; //Job has not completed } else { clearInterval(addF5ProviderIntervalID); if (result.jobstatus == 1) { - nspMap["f5"] = json.queryasyncjobresultresponse.jobresult.networkserviceprovider; + nspMap[ "f5"] = json.queryasyncjobresultresponse.jobresult.networkserviceprovider; addExternalLoadBalancer(args, selectedPhysicalNetworkObj, "addF5LoadBalancer", "addf5bigiploadbalancerresponse"); } else if (result.jobstatus == 2) { alert("addNetworkServiceProvider&name=F5BigIp failed. Error: " + _s(result.jobresult.errortext)); } } }, - error: function(XMLHttpResponse) { + error: function (XMLHttpResponse) { var errorMsg = parseXMLHttpResponse(XMLHttpResponse); alert("addNetworkServiceProvider&name=F5BigIpfailed. Error: " + errorMsg); } }); - }, g_queryAsyncJobResultInterval); + }, + g_queryAsyncJobResultInterval); } }); } else { @@ -4595,7 +4651,7 @@ } }, messages: { - notification: function(args) { + notification: function (args) { return 'label.add.F5.device'; } }, @@ -4605,16 +4661,16 @@ }, enable: { label: 'label.enable.provider', - action: function(args) { + action: function (args) { $.ajax({ - url: createURL("updateNetworkServiceProvider&id=" + nspMap["f5"].id + "&state=Enabled"), + url: createURL("updateNetworkServiceProvider&id=" + nspMap[ "f5"].id + "&state=Enabled"), dataType: "json", - success: function(json) { + success: function (json) { var jid = json.updatenetworkserviceproviderresponse.jobid; args.response.success({ _custom: { jobId: jid, - getUpdatedItem: function(json) { + getUpdatedItem: function (json) { $(window).trigger('cloudStack.fullRefresh'); } } @@ -4623,10 +4679,10 @@ }); }, messages: { - confirm: function(args) { + confirm: function (args) { return 'message.confirm.enable.provider'; }, - notification: function() { + notification: function () { return 'label.enable.provider'; } }, @@ -4636,16 +4692,16 @@ }, disable: { label: 'label.disable.provider', - action: function(args) { + action: function (args) { $.ajax({ - url: createURL("updateNetworkServiceProvider&id=" + nspMap["f5"].id + "&state=Disabled"), + url: createURL("updateNetworkServiceProvider&id=" + nspMap[ "f5"].id + "&state=Disabled"), dataType: "json", - success: function(json) { + success: function (json) { var jid = json.updatenetworkserviceproviderresponse.jobid; args.response.success({ _custom: { jobId: jid, - getUpdatedItem: function(json) { + getUpdatedItem: function (json) { $(window).trigger('cloudStack.fullRefresh'); } } @@ -4654,10 +4710,10 @@ }); }, messages: { - confirm: function(args) { + confirm: function (args) { return 'message.confirm.disable.provider'; }, - notification: function() { + notification: function () { return 'label.disable.provider'; } }, @@ -4667,27 +4723,27 @@ }, destroy: { label: 'label.shutdown.provider', - action: function(args) { + action: function (args) { $.ajax({ - url: createURL("deleteNetworkServiceProvider&id=" + nspMap["f5"].id), + url: createURL("deleteNetworkServiceProvider&id=" + nspMap[ "f5"].id), dataType: "json", - success: function(json) { + success: function (json) { var jid = json.deletenetworkserviceproviderresponse.jobid; args.response.success({ _custom: { jobId: jid } }); - + $(window).trigger('cloudStack.fullRefresh'); } }); }, messages: { - confirm: function(args) { + confirm: function (args) { return 'message.confirm.shutdown.provider'; }, - notification: function(args) { + notification: function (args) { return 'label.shutdown.provider'; } }, @@ -4697,7 +4753,7 @@ } } }, - + // SRX provider detailView srx: { type: 'detailView', @@ -4710,19 +4766,20 @@ tabs: { details: { title: 'label.details', - fields: [{ + fields:[ { name: { label: 'label.name' } - }, { + }, + { state: { label: 'label.state' } }], - dataProvider: function(args) { + dataProvider: function (args) { refreshNspData("JuniperSRX"); var providerObj; - $(nspHardcodingArray).each(function() { + $(nspHardcodingArray).each(function () { if (this.id == "srx") { providerObj = this; return false; //break each loop @@ -4757,8 +4814,8 @@ networkdevicetype: { label: 'label.type', docID: 'helpSRXType', - select: function(args) { - var items = []; + select: function (args) { + var items =[]; items.push({ id: "JuniperSRXFirewall", description: "Juniper SRX Firewall" @@ -4828,38 +4885,39 @@ } } }, - action: function(args) { - if (nspMap["srx"] == null) { + action: function (args) { + if (nspMap[ "srx"] == null) { $.ajax({ url: createURL("addNetworkServiceProvider&name=JuniperSRX&physicalnetworkid=" + selectedPhysicalNetworkObj.id), dataType: "json", async: true, - success: function(json) { + success: function (json) { var jobId = json.addnetworkserviceproviderresponse.jobid; - var addJuniperSRXProviderIntervalID = setInterval(function() { + var addJuniperSRXProviderIntervalID = setInterval(function () { $.ajax({ url: createURL("queryAsyncJobResult&jobId=" + jobId), dataType: "json", - success: function(json) { + success: function (json) { var result = json.queryasyncjobresultresponse; if (result.jobstatus == 0) { return; //Job has not completed } else { clearInterval(addJuniperSRXProviderIntervalID); if (result.jobstatus == 1) { - nspMap["srx"] = json.queryasyncjobresultresponse.jobresult.networkserviceprovider; + nspMap[ "srx"] = json.queryasyncjobresultresponse.jobresult.networkserviceprovider; addExternalFirewall(args, selectedPhysicalNetworkObj, "addSrxFirewall", "addsrxfirewallresponse", "srxfirewall"); } else if (result.jobstatus == 2) { alert("addNetworkServiceProvider&name=JuniperSRX failed. Error: " + _s(result.jobresult.errortext)); } } }, - error: function(XMLHttpResponse) { + error: function (XMLHttpResponse) { var errorMsg = parseXMLHttpResponse(XMLHttpResponse); alert("addNetworkServiceProvider&name=JuniperSRX failed. Error: " + errorMsg); } }); - }, g_queryAsyncJobResultInterval); + }, + g_queryAsyncJobResultInterval); } }); } else { @@ -4867,7 +4925,7 @@ } }, messages: { - notification: function(args) { + notification: function (args) { return 'label.add.SRX.device'; } }, @@ -4877,16 +4935,16 @@ }, enable: { label: 'label.enable.provider', - action: function(args) { + action: function (args) { $.ajax({ - url: createURL("updateNetworkServiceProvider&id=" + nspMap["srx"].id + "&state=Enabled"), + url: createURL("updateNetworkServiceProvider&id=" + nspMap[ "srx"].id + "&state=Enabled"), dataType: "json", - success: function(json) { + success: function (json) { var jid = json.updatenetworkserviceproviderresponse.jobid; args.response.success({ _custom: { jobId: jid, - getUpdatedItem: function(json) { + getUpdatedItem: function (json) { $(window).trigger('cloudStack.fullRefresh'); } } @@ -4895,10 +4953,10 @@ }); }, messages: { - confirm: function(args) { + confirm: function (args) { return 'message.confirm.enable.provider'; }, - notification: function() { + notification: function () { return 'label.enable.provider'; } }, @@ -4908,16 +4966,16 @@ }, disable: { label: 'label.disable.provider', - action: function(args) { + action: function (args) { $.ajax({ - url: createURL("updateNetworkServiceProvider&id=" + nspMap["srx"].id + "&state=Disabled"), + url: createURL("updateNetworkServiceProvider&id=" + nspMap[ "srx"].id + "&state=Disabled"), dataType: "json", - success: function(json) { + success: function (json) { var jid = json.updatenetworkserviceproviderresponse.jobid; args.response.success({ _custom: { jobId: jid, - getUpdatedItem: function(json) { + getUpdatedItem: function (json) { $(window).trigger('cloudStack.fullRefresh'); } } @@ -4926,10 +4984,10 @@ }); }, messages: { - confirm: function(args) { + confirm: function (args) { return 'message.confirm.disable.provider'; }, - notification: function() { + notification: function () { return 'label.disable.provider'; } }, @@ -4939,27 +4997,27 @@ }, destroy: { label: 'label.shutdown.provider', - action: function(args) { + action: function (args) { $.ajax({ - url: createURL("deleteNetworkServiceProvider&id=" + nspMap["srx"].id), + url: createURL("deleteNetworkServiceProvider&id=" + nspMap[ "srx"].id), dataType: "json", - success: function(json) { + success: function (json) { var jid = json.deletenetworkserviceproviderresponse.jobid; args.response.success({ _custom: { jobId: jid } }); - + $(window).trigger('cloudStack.fullRefresh'); } }); }, messages: { - confirm: function(args) { + confirm: function (args) { return 'message.confirm.shutdown.provider'; }, - notification: function(args) { + notification: function (args) { return 'label.shutdown.provider'; } }, @@ -4969,7 +5027,7 @@ } } }, - + // Palo Alto provider detailView pa: { type: 'detailView', @@ -4982,11 +5040,12 @@ tabs: { details: { title: 'label.details', - fields: [{ + fields:[ { name: { label: 'label.name' } - }, { + }, + { state: { label: 'label.state' } @@ -5030,7 +5089,7 @@ label: 'label.type', docID: 'helpPaloAltoType', select: function (args) { - var items = []; + var items =[]; items.push({ id: "PaloAltoFirewall", description: "Palo Alto Firewall" @@ -5111,7 +5170,7 @@ } }, action: function (args) { - if (nspMap["pa"] == null) { + if (nspMap[ "pa"] == null) { $.ajax({ url: createURL("addNetworkServiceProvider&name=PaloAlto&physicalnetworkid=" + selectedPhysicalNetworkObj.id), dataType: "json", @@ -5129,7 +5188,7 @@ } else { clearInterval(addPaloAltoProviderIntervalID); if (result.jobstatus == 1) { - nspMap["pa"] = json.queryasyncjobresultresponse.jobresult.networkserviceprovider; + nspMap[ "pa"] = json.queryasyncjobresultresponse.jobresult.networkserviceprovider; addExternalFirewall(args, selectedPhysicalNetworkObj, "addPaloAltoFirewall", "addpaloaltofirewallresponse", "pafirewall"); } else if (result.jobstatus == 2) { alert("addNetworkServiceProvider&name=Palo Alto failed. Error: " + _s(result.jobresult.errortext)); @@ -5141,7 +5200,8 @@ alert("addNetworkServiceProvider&name=Palo Alto failed. Error: " + errorMsg); } }); - }, 3000); + }, + 3000); } }); } else { @@ -5161,7 +5221,7 @@ label: 'label.enable.provider', action: function (args) { $.ajax({ - url: createURL("updateNetworkServiceProvider&id=" + nspMap["pa"].id + "&state=Enabled"), + url: createURL("updateNetworkServiceProvider&id=" + nspMap[ "pa"].id + "&state=Enabled"), dataType: "json", success: function (json) { var jid = json.updatenetworkserviceproviderresponse.jobid; @@ -5192,7 +5252,7 @@ label: 'label.disable.provider', action: function (args) { $.ajax({ - url: createURL("updateNetworkServiceProvider&id=" + nspMap["pa"].id + "&state=Disabled"), + url: createURL("updateNetworkServiceProvider&id=" + nspMap[ "pa"].id + "&state=Disabled"), dataType: "json", success: function (json) { var jid = json.updatenetworkserviceproviderresponse.jobid; @@ -5223,7 +5283,7 @@ label: 'label.shutdown.provider', action: function (args) { $.ajax({ - url: createURL("deleteNetworkServiceProvider&id=" + nspMap["pa"].id), + url: createURL("deleteNetworkServiceProvider&id=" + nspMap[ "pa"].id), dataType: "json", success: function (json) { var jid = json.deletenetworkserviceproviderresponse.jobid; @@ -5232,7 +5292,7 @@ jobId: jid } }); - + $(window).trigger('cloudStack.fullRefresh'); } }); @@ -5251,7 +5311,7 @@ } } }, - + // Security groups detail view securityGroups: { id: 'securityGroup-providers', @@ -5264,32 +5324,32 @@ tabs: { details: { title: 'label.details', - fields: [{ + fields:[ { name: { label: 'label.name' } - }, { + }, + { state: { label: 'label.state' } }], - dataProvider: function(args) { + dataProvider: function (args) { refreshNspData("SecurityGroupProvider"); var providerObj; - $(nspHardcodingArray).each(function() { + $(nspHardcodingArray).each(function () { if (this.id == "securityGroups") { providerObj = this; return false; //break each loop } }); args.response.success({ - actionFilter: function(args) { - var allowedActions = []; + actionFilter: function (args) { + var allowedActions =[]; var jsonObj = providerObj; if (jsonObj.state == "Enabled") - allowedActions.push("disable"); - else if (jsonObj.state == "Disabled") - allowedActions.push("enable"); + allowedActions.push("disable"); else if (jsonObj.state == "Disabled") + allowedActions.push("enable"); return allowedActions; }, data: providerObj @@ -5300,16 +5360,16 @@ actions: { enable: { label: 'label.enable.provider', - action: function(args) { + action: function (args) { $.ajax({ - url: createURL("updateNetworkServiceProvider&id=" + nspMap["securityGroups"].id + "&state=Enabled"), + url: createURL("updateNetworkServiceProvider&id=" + nspMap[ "securityGroups"].id + "&state=Enabled"), async: true, - success: function(json) { + success: function (json) { var jid = json.updatenetworkserviceproviderresponse.jobid; args.response.success({ _custom: { jobId: jid, - getUpdatedItem: function(json) { + getUpdatedItem: function (json) { $(window).trigger('cloudStack.fullRefresh'); } } @@ -5318,10 +5378,10 @@ }); }, messages: { - confirm: function(args) { + confirm: function (args) { return 'message.confirm.enable.provider'; }, - notification: function() { + notification: function () { return 'label.enable.provider'; } }, @@ -5331,16 +5391,16 @@ }, disable: { label: 'label.disable.provider', - action: function(args) { + action: function (args) { $.ajax({ - url: createURL("updateNetworkServiceProvider&id=" + nspMap["securityGroups"].id + "&state=Disabled"), + url: createURL("updateNetworkServiceProvider&id=" + nspMap[ "securityGroups"].id + "&state=Disabled"), dataType: "json", - success: function(json) { + success: function (json) { var jid = json.updatenetworkserviceproviderresponse.jobid; args.response.success({ _custom: { jobId: jid, - getUpdatedItem: function(json) { + getUpdatedItem: function (json) { $(window).trigger('cloudStack.fullRefresh'); } } @@ -5349,10 +5409,10 @@ }); }, messages: { - confirm: function(args) { + confirm: function (args) { return 'message.confirm.disable.provider'; }, - notification: function() { + notification: function () { return 'label.disable.provider'; } }, @@ -5361,14 +5421,15 @@ } } }, - + fields: { id: { label: 'label.id' }, name: { label: 'label.name' - } //, + } + //, //state: { label: 'label.status' } //comment it for now, since dataProvider below doesn't get called by widget code after action is done } }, @@ -5384,19 +5445,20 @@ tabs: { details: { title: 'label.details', - fields: [{ + fields:[ { name: { label: 'label.name' } - }, { + }, + { state: { label: 'label.state' } }], - dataProvider: function(args) { + dataProvider: function (args) { refreshNspData("NiciraNvp"); var providerObj; - $(nspHardcodingArray).each(function() { + $(nspHardcodingArray).each(function () { if (this.id == "niciraNvp") { providerObj = this; return false; //break each loop @@ -5414,7 +5476,9 @@ label: 'label.add.NiciraNvp.device', createForm: { title: 'label.add.NiciraNvp.device', - preFilter: function(args) {}, // TODO What is this? + preFilter: function (args) { + }, + // TODO What is this? fields: { host: { label: 'label.ip.address' @@ -5438,38 +5502,39 @@ } } }, - action: function(args) { - if (nspMap["niciraNvp"] == null) { + action: function (args) { + if (nspMap[ "niciraNvp"] == null) { $.ajax({ url: createURL("addNetworkServiceProvider&name=NiciraNvp&physicalnetworkid=" + selectedPhysicalNetworkObj.id), dataType: "json", async: true, - success: function(json) { + success: function (json) { var jobId = json.addnetworkserviceproviderresponse.jobid; - var addNiciraNvpProviderIntervalID = setInterval(function() { + var addNiciraNvpProviderIntervalID = setInterval(function () { $.ajax({ url: createURL("queryAsyncJobResult&jobId=" + jobId), dataType: "json", - success: function(json) { + success: function (json) { var result = json.queryasyncjobresultresponse; if (result.jobstatus == 0) { return; //Job has not completed } else { clearInterval(addNiciraNvpProviderIntervalID); if (result.jobstatus == 1) { - nspMap["niciraNvp"] = json.queryasyncjobresultresponse.jobresult.networkserviceprovider; + nspMap[ "niciraNvp"] = json.queryasyncjobresultresponse.jobresult.networkserviceprovider; addNiciraNvpDevice(args, selectedPhysicalNetworkObj, "addNiciraNvpDevice", "addniciranvpdeviceresponse", "niciranvpdevice") } else if (result.jobstatus == 2) { alert("addNetworkServiceProvider&name=NiciraNvp failed. Error: " + _s(result.jobresult.errortext)); } } }, - error: function(XMLHttpResponse) { + error: function (XMLHttpResponse) { var errorMsg = parseXMLHttpResponse(XMLHttpResponse); alert("addNetworkServiceProvider&name=NiciraNvp failed. Error: " + errorMsg); } }); - }, g_queryAsyncJobResultInterval); + }, + g_queryAsyncJobResultInterval); } }); } else { @@ -5477,7 +5542,7 @@ } }, messages: { - notification: function(args) { + notification: function (args) { return 'label.add.NiciraNvp.device'; } }, @@ -5487,16 +5552,16 @@ }, enable: { label: 'label.enable.provider', - action: function(args) { + action: function (args) { $.ajax({ - url: createURL("updateNetworkServiceProvider&id=" + nspMap["niciraNvp"].id + "&state=Enabled"), + url: createURL("updateNetworkServiceProvider&id=" + nspMap[ "niciraNvp"].id + "&state=Enabled"), dataType: "json", - success: function(json) { + success: function (json) { var jid = json.updatenetworkserviceproviderresponse.jobid; args.response.success({ _custom: { jobId: jid, - getUpdatedItem: function(json) { + getUpdatedItem: function (json) { $(window).trigger('cloudStack.fullRefresh'); } } @@ -5505,10 +5570,10 @@ }); }, messages: { - confirm: function(args) { + confirm: function (args) { return 'message.confirm.enable.provider'; }, - notification: function() { + notification: function () { return 'label.enable.provider'; } }, @@ -5518,16 +5583,16 @@ }, disable: { label: 'label.disable.provider', - action: function(args) { + action: function (args) { $.ajax({ - url: createURL("updateNetworkServiceProvider&id=" + nspMap["niciraNvp"].id + "&state=Disabled"), + url: createURL("updateNetworkServiceProvider&id=" + nspMap[ "niciraNvp"].id + "&state=Disabled"), dataType: "json", - success: function(json) { + success: function (json) { var jid = json.updatenetworkserviceproviderresponse.jobid; args.response.success({ _custom: { jobId: jid, - getUpdatedItem: function(json) { + getUpdatedItem: function (json) { $(window).trigger('cloudStack.fullRefresh'); } } @@ -5536,10 +5601,10 @@ }); }, messages: { - confirm: function(args) { + confirm: function (args) { return 'message.confirm.disable.provider'; }, - notification: function() { + notification: function () { return 'label.disable.provider'; } }, @@ -5549,27 +5614,27 @@ }, destroy: { label: 'label.shutdown.provider', - action: function(args) { + action: function (args) { $.ajax({ - url: createURL("deleteNetworkServiceProvider&id=" + nspMap["niciraNvp"].id), + url: createURL("deleteNetworkServiceProvider&id=" + nspMap[ "niciraNvp"].id), dataType: "json", - success: function(json) { + success: function (json) { var jid = json.deletenetworkserviceproviderresponse.jobid; args.response.success({ _custom: { jobId: jid } }); - + $(window).trigger('cloudStack.fullRefresh'); } }); }, messages: { - confirm: function(args) { + confirm: function (args) { return 'message.confirm.shutdown.provider'; }, - notification: function(args) { + notification: function (args) { return 'label.shutdown.provider'; } }, @@ -5591,19 +5656,20 @@ tabs: { details: { title: 'label.details', - fields: [{ + fields:[ { name: { label: 'label.name' } - }, { + }, + { state: { label: 'label.state' } }], - dataProvider: function(args) { + dataProvider: function (args) { refreshNspData("BigSwitchVns"); var providerObj; - $(nspHardcodingArray).each(function() { + $(nspHardcodingArray).each(function () { if (this.id == "bigswitchVns") { providerObj = this; return false; @@ -5621,7 +5687,8 @@ label: 'label.add.BigSwitchVns.device', createForm: { title: 'label.add.BigSwitchVns.device', - preFilter: function(args) {}, + preFilter: function (args) { + }, fields: { host: { label: 'label.ip.address' @@ -5632,38 +5699,39 @@ } } }, - action: function(args) { - if (nspMap["bigswitchVns"] == null) { + action: function (args) { + if (nspMap[ "bigswitchVns"] == null) { $.ajax({ url: createURL("addNetworkServiceProvider&name=BigSwitchVns&physicalnetworkid=" + selectedPhysicalNetworkObj.id), dataType: "json", async: true, - success: function(json) { + success: function (json) { var jobId = json.addnetworkserviceproviderresponse.jobid; - var addBigSwitchVnsProviderIntervalID = setInterval(function() { + var addBigSwitchVnsProviderIntervalID = setInterval(function () { $.ajax({ url: createURL("queryAsyncJobResult&jobId=" + jobId), dataType: "json", - success: function(json) { + success: function (json) { var result = json.queryasyncjobresultresponse; if (result.jobstatus == 0) { return; //Job has not completed } else { clearInterval(addBigSwitchVnsProviderIntervalID); if (result.jobstatus == 1) { - nspMap["bigswitchVns"] = json.queryasyncjobresultresponse.jobresult.networkserviceprovider; + nspMap[ "bigswitchVns"] = json.queryasyncjobresultresponse.jobresult.networkserviceprovider; addBigSwitchVnsDevice(args, selectedPhysicalNetworkObj, "addBigSwitchVnsDevice", "addbigswitchvnsdeviceresponse", "bigswitchvnsdevice") } else if (result.jobstatus == 2) { alert("addNetworkServiceProvider&name=BigSwitchVns failed. Error: " + _s(result.jobresult.errortext)); } } }, - error: function(XMLHttpResponse) { + error: function (XMLHttpResponse) { var errorMsg = parseXMLHttpResponse(XMLHttpResponse); alert("addNetworkServiceProvider&name=BigSwitchVns failed. Error: " + errorMsg); } }); - }, 3000); + }, + 3000); } }); } else { @@ -5671,7 +5739,7 @@ } }, messages: { - notification: function(args) { + notification: function (args) { return 'label.add.BigSwitchVns.device'; } }, @@ -5681,16 +5749,16 @@ }, enable: { label: 'label.enable.provider', - action: function(args) { + action: function (args) { $.ajax({ - url: createURL("updateNetworkServiceProvider&id=" + nspMap["bigswitchVns"].id + "&state=Enabled"), + url: createURL("updateNetworkServiceProvider&id=" + nspMap[ "bigswitchVns"].id + "&state=Enabled"), dataType: "json", - success: function(json) { + success: function (json) { var jid = json.updatenetworkserviceproviderresponse.jobid; args.response.success({ _custom: { jobId: jid, - getUpdatedItem: function(json) { + getUpdatedItem: function (json) { $(window).trigger('cloudStack.fullRefresh'); } } @@ -5699,10 +5767,10 @@ }); }, messages: { - confirm: function(args) { + confirm: function (args) { return 'message.confirm.enable.provider'; }, - notification: function() { + notification: function () { return 'label.enable.provider'; } }, @@ -5712,16 +5780,16 @@ }, disable: { label: 'label.disable.provider', - action: function(args) { + action: function (args) { $.ajax({ - url: createURL("updateNetworkServiceProvider&id=" + nspMap["bigswitchVns"].id + "&state=Disabled"), + url: createURL("updateNetworkServiceProvider&id=" + nspMap[ "bigswitchVns"].id + "&state=Disabled"), dataType: "json", - success: function(json) { + success: function (json) { var jid = json.updatenetworkserviceproviderresponse.jobid; args.response.success({ _custom: { jobId: jid, - getUpdatedItem: function(json) { + getUpdatedItem: function (json) { $(window).trigger('cloudStack.fullRefresh'); } } @@ -5730,10 +5798,10 @@ }); }, messages: { - confirm: function(args) { + confirm: function (args) { return 'message.confirm.disable.provider'; }, - notification: function() { + notification: function () { return 'label.disable.provider'; } }, @@ -5743,27 +5811,27 @@ }, destroy: { label: 'label.shutdown.provider', - action: function(args) { + action: function (args) { $.ajax({ - url: createURL("deleteNetworkServiceProvider&id=" + nspMap["bigswitchVns"].id), + url: createURL("deleteNetworkServiceProvider&id=" + nspMap[ "bigswitchVns"].id), dataType: "json", - success: function(json) { + success: function (json) { var jid = json.deletenetworkserviceproviderresponse.jobid; args.response.success({ _custom: { jobId: jid } }); - + $(window).trigger('cloudStack.fullRefresh'); } }); }, messages: { - confirm: function(args) { + confirm: function (args) { return 'message.confirm.shutdown.provider'; }, - notification: function(args) { + notification: function (args) { return 'label.shutdown.provider'; } }, @@ -5773,8 +5841,8 @@ } } }, - - + + // MidoNet provider detailView midoNet: { id: 'midoNet', @@ -5796,11 +5864,12 @@ tabs: { details: { title: 'label.network', - fields: [{ + fields:[ { name: { label: 'label.name' } - }, { + }, + { id: { label: 'label.id' }, @@ -5817,12 +5886,12 @@ label: 'label.supported.services' } }], - dataProvider: function(args) { + dataProvider: function (args) { refreshNspData("MidoNet"); args.response.success({ actionFilter: virtualRouterProviderActionFilter, - data: $.extend(nspMap["midoNet"], { - supportedServices: nspMap["midoNet"].servicelist.join(', ') + data: $.extend(nspMap[ "midoNet"], { + supportedServices: nspMap[ "midoNet"].servicelist.join(', ') }) }); } @@ -5831,16 +5900,16 @@ actions: { enable: { label: 'label.enable.provider', - action: function(args) { + action: function (args) { $.ajax({ - url: createURL("updateNetworkServiceProvider&id=" + nspMap["midoNet"].id + "&state=Enabled"), + url: createURL("updateNetworkServiceProvider&id=" + nspMap[ "midoNet"].id + "&state=Enabled"), dataType: "json", - success: function(json) { + success: function (json) { var jid = json.updatenetworkserviceproviderresponse.jobid; args.response.success({ _custom: { jobId: jid, - getUpdatedItem: function(json) { + getUpdatedItem: function (json) { $(window).trigger('cloudStack.fullRefresh'); } } @@ -5849,10 +5918,10 @@ }); }, messages: { - confirm: function(args) { + confirm: function (args) { return 'message.confirm.enable.provider'; }, - notification: function() { + notification: function () { return 'label.enable.provider'; } }, @@ -5862,16 +5931,16 @@ }, disable: { label: 'label.disable.provider', - action: function(args) { + action: function (args) { $.ajax({ - url: createURL("updateNetworkServiceProvider&id=" + nspMap["midoNet"].id + "&state=Disabled"), + url: createURL("updateNetworkServiceProvider&id=" + nspMap[ "midoNet"].id + "&state=Disabled"), dataType: "json", - success: function(json) { + success: function (json) { var jid = json.updatenetworkserviceproviderresponse.jobid; args.response.success({ _custom: { jobId: jid, - getUpdatedItem: function(json) { + getUpdatedItem: function (json) { $(window).trigger('cloudStack.fullRefresh'); } } @@ -5880,10 +5949,10 @@ }); }, messages: { - confirm: function(args) { + confirm: function (args) { return 'message.confirm.disable.provider'; }, - notification: function() { + notification: function () { return 'label.disable.provider'; } }, @@ -5893,7 +5962,7 @@ } } }, - + //ovs Ovs: { id: 'ovsProviders', @@ -5917,11 +5986,12 @@ tabs: { network: { title: 'label.network', - fields: [{ + fields:[ { name: { label: 'label.name' } - }, { + }, + { id: { label: 'label.id' }, @@ -5942,13 +6012,13 @@ refreshNspData("Ovs"); args.response.success({ actionFilter: virtualRouterProviderActionFilter, - data: $.extend(nspMap["Ovs"], { - supportedServices: nspMap["Ovs"].servicelist.join(', ') + data: $.extend(nspMap[ "Ovs"], { + supportedServices: nspMap[ "Ovs"].servicelist.join(', ') }) }); } }, - + instances: { title: 'label.instances', listView: { @@ -5978,41 +6048,41 @@ } }, dataProvider: function (args) { - var array1 = []; + var array1 =[]; if (args.filterBy != null) { if (args.filterBy.search != null && args.filterBy.search.by != null && args.filterBy.search.value != null) { switch (args.filterBy.search.by) { - case "name": + case "name": if (args.filterBy.search.value.length > 0) - array1.push("&keyword=" + args.filterBy.search.value); + array1.push("&keyword=" + args.filterBy.search.value); break; } } } - + var data2 = { forvpc: false }; - var routers = []; + var routers =[]; $.ajax({ url: createURL("listRouters&zoneid=" + selectedZoneObj.id + "&listAll=true&page=" + args.page + "&pagesize=" + pageSize + array1.join("")), data: data2, success: function (json) { var items = json.listroutersresponse.router ? - json.listroutersresponse.router : []; - + json.listroutersresponse.router:[]; + $(items).map(function (index, item) { routers.push(item); }); - + // Get project routers $.ajax({ url: createURL("listRouters&zoneid=" + selectedZoneObj.id + "&listAll=true&page=" + args.page + "&pagesize=" + pageSize + array1.join("") + "&projectid=-1"), data: data2, success: function (json) { var items = json.listroutersresponse.router ? - json.listroutersresponse.router : []; - + json.listroutersresponse.router:[]; + $(items).map(function (index, item) { routers.push(item); }); @@ -6063,7 +6133,7 @@ poll: pollAsyncJobResult } }, - + stop: { label: 'label.action.stop.router', createForm: { @@ -6083,7 +6153,7 @@ } }, action: function (args) { - var array1 = []; + var array1 =[]; array1.push("&forced=" + (args.data.forced == "on")); $.ajax({ url: createURL('stopRouter&id=' + args.context.routers[0].id + array1.join("")), @@ -6109,7 +6179,7 @@ poll: pollAsyncJobResult } }, - + 'remove': { label: 'label.destroy.router', messages: { @@ -6139,7 +6209,7 @@ poll: pollAsyncJobResult } }, - + migrate: { label: 'label.action.migrate.router', createForm: { @@ -6158,11 +6228,11 @@ async: true, success: function (json) { var hostObjs = json.findhostsformigrationresponse.host; - var items = []; + var items =[]; $(hostObjs).each(function () { items.push({ id: this.id, - description: (this.name + " (" + (this.suitableformigration ? "Suitable" : "Not Suitable") + ")") + description: (this.name + " (" + (this.suitableformigration ? "Suitable": "Not Suitable") + ")") }); }); args.response.success({ @@ -6219,7 +6289,7 @@ poll: pollAsyncJobResult } }, - + viewConsole: { label: 'label.view.console', action: { @@ -6228,7 +6298,8 @@ return clientConsoleUrl + '?cmd=access&vm=' + args.context.routers[0].id; }, title: function (args) { - return args.context.routers[0].id.substr(0, 8); //title in window.open() can't have space nor longer than 8 characters. Otherwise, IE browser will have error. + return args.context.routers[0].id.substr(0, 8); + //title in window.open() can't have space nor longer than 8 characters. Otherwise, IE browser will have error. }, width: 820, height: 640 @@ -6240,24 +6311,26 @@ details: { title: 'label.details', preFilter: function (args) { - var hiddenFields = []; - if (!args.context.routers[0].project) { + var hiddenFields =[]; + if (! args.context.routers[0].project) { hiddenFields.push('project'); hiddenFields.push('projectid'); } if (selectedZoneObj.networktype == 'Basic') { - hiddenFields.push('publicip'); //In Basic zone, guest IP is public IP. So, publicip is not returned by listRouters API. Only guestipaddress is returned by listRouters API. + hiddenFields.push('publicip'); + //In Basic zone, guest IP is public IP. So, publicip is not returned by listRouters API. Only guestipaddress is returned by listRouters API. } return hiddenFields; }, - fields: [{ + fields:[ { name: { label: 'label.name' }, project: { label: 'label.project' } - }, { + }, + { id: { label: 'label.id' }, @@ -6325,7 +6398,7 @@ nics: { title: 'label.nics', multiple: true, - fields: [{ + fields:[ { name: { label: 'label.name', header: true @@ -6365,7 +6438,7 @@ async: true, success: function (json) { var jsonObj = json.listroutersresponse.router[0].nic; - + args.response.success({ actionFilter: routerActionfilter, data: $.map(jsonObj, function (nic, index) { @@ -6392,7 +6465,7 @@ label: 'label.enable.provider', action: function (args) { $.ajax({ - url: createURL("updateNetworkServiceProvider&id=" + nspMap["Ovs"].id + "&state=Enabled"), + url: createURL("updateNetworkServiceProvider&id=" + nspMap[ "Ovs"].id + "&state=Enabled"), dataType: "json", success: function (json) { var jid = json.updatenetworkserviceproviderresponse.jobid; @@ -6423,7 +6496,7 @@ label: 'label.disable.provider', action: function (args) { $.ajax({ - url: createURL("updateNetworkServiceProvider&id=" + nspMap["Ovs"].id + "&state=Disabled"), + url: createURL("updateNetworkServiceProvider&id=" + nspMap[ "Ovs"].id + "&state=Disabled"), dataType: "json", success: function (json) { var jid = json.updatenetworkserviceproviderresponse.jobid; @@ -6473,16 +6546,15 @@ }, domainid: { label: 'label.public', - converter: function(args) { + converter: function (args) { if (args == null) - return "Yes"; - else - return "No"; + return "Yes"; else + return "No"; } }, allocationstate: { label: 'label.allocation.state', - converter: function(str) { + converter: function (str) { // For localization return str; }, @@ -6492,16 +6564,16 @@ } } }, - - dataProvider: function(args) { - var array1 = []; + + dataProvider: function (args) { + var array1 =[]; if (args.filterBy != null) { if (args.filterBy.search != null && args.filterBy.search.by != null && args.filterBy.search.value != null) { switch (args.filterBy.search.by) { case "name": - if (args.filterBy.search.value.length > 0) - array1.push("&keyword=" + args.filterBy.search.value); - break; + if (args.filterBy.search.value.length > 0) + array1.push("&keyword=" + args.filterBy.search.value); + break; } } } @@ -6509,7 +6581,7 @@ url: createURL("listZones&page=" + args.page + "&pagesize=" + pageSize + array1.join("")), dataType: "json", async: true, - success: function(json) { + success: function (json) { zoneObjs = json.listzonesresponse.zone; args.response.success({ actionFilter: zoneActionfilter, @@ -6518,22 +6590,21 @@ } }); }, - + actions: { add: { label: 'label.add.zone', action: { custom: cloudStack.uiCustom.zoneWizard( - cloudStack.zoneWizard - ) + cloudStack.zoneWizard) }, messages: { - notification: function(args) { + notification: function (args) { return 'label.add.zone'; } }, notification: { - poll: function(args) { + poll: function (args) { args.complete({ actionFilter: zoneActionfilter, data: args._custom.zone @@ -6542,7 +6613,7 @@ } } }, - + detailView: { isMaximized: true, actions: { @@ -6550,7 +6621,7 @@ label: 'Add VMware datacenter', textLabel: 'Add VMware datacenter', messages: { - notification: function(args) { + notification: function (args) { return 'Add VMware datacenter'; } }, @@ -6584,13 +6655,13 @@ } } }, - action: function(args) { + action: function (args) { var data = { zoneid: args.context.physicalResources[0].id, name: args.data.name, vcenter: args.data.vcenter }; - + if (args.data.username != null && args.data.username.length > 0) { $.extend(data, { username: args.data.username @@ -6601,81 +6672,81 @@ password: args.data.password }) } - + $.ajax({ url: createURL('addVmwareDc'), data: data, type: "POST", - success: function(json) { + success: function (json) { //var item = json.addvmwaredcresponse.vmwaredc; args.response.success(); } }); }, notification: { - poll: function(args) { + poll: function (args) { args.complete(); } } }, - + removeVmwareDc: { label: 'Remove VMware datacenter', messages: { - confirm: function(args) { + confirm: function (args) { return 'Please confirm you want to remove VMware datacenter'; }, - notification: function(args) { + notification: function (args) { return 'Remove VMware datacenter'; } }, - action: function(args) { + action: function (args) { var data = { zoneid: args.context.physicalResources[0].id }; $.ajax({ url: createURL('removeVmwareDc'), data: data, - success: function(json) { - delete args.context.physicalResources[0].vmwaredcName; - delete args.context.physicalResources[0].vmwaredcVcenter; - delete args.context.physicalResources[0].vmwaredcId; - - selectedZoneObj = args.context.physicalResources[0]; - - args.response.success({ + success: function (json) { + delete args.context.physicalResources[0].vmwaredcName; + delete args.context.physicalResources[0].vmwaredcVcenter; + delete args.context.physicalResources[0].vmwaredcId; + + selectedZoneObj = args.context.physicalResources[0]; + + args.response.success({ data: args.context.physicalResources[0] }); }, - error: function(XMLHttpResponse) { + error: function (XMLHttpResponse) { var errorMsg = parseXMLHttpResponse(XMLHttpResponse); args.response.error(errorMsg); } }); }, notification: { - poll: function(args) { + poll: function (args) { args.complete(); } } }, - + enable: { label: 'label.action.enable.zone', messages: { - confirm: function(args) { + confirm: function (args) { return 'message.action.enable.zone'; }, - notification: function(args) { + notification: function (args) { return 'label.action.enable.zone'; } }, - action: function(args) { + action: function (args) { $.ajax({ url: createURL("updateZone&id=" + args.context.physicalResources[0].id + "&allocationstate=Enabled"), //embedded objects in listView is called physicalResources while embedded objects in detailView is called zones dataType: "json", async: true, - success: function(json) { + success: function (json) { var item = json.updatezoneresponse.zone; args.response.success({ actionFilter: zoneActionfilter, @@ -6685,28 +6756,28 @@ }); }, notification: { - poll: function(args) { + poll: function (args) { args.complete(); } } }, - + disable: { label: 'label.action.disable.zone', messages: { - confirm: function(args) { + confirm: function (args) { return 'message.action.disable.zone'; }, - notification: function(args) { + notification: function (args) { return 'label.action.disable.zone'; } }, - action: function(args) { + action: function (args) { $.ajax({ url: createURL("updateZone&id=" + args.context.physicalResources[0].id + "&allocationstate=Disabled"), //embedded objects in listView is called physicalResources while embedded objects in detailView is called zones dataType: "json", async: true, - success: function(json) { + success: function (json) { var item = json.updatezoneresponse.zone; args.response.success({ actionFilter: zoneActionfilter, @@ -6716,19 +6787,19 @@ }); }, notification: { - poll: function(args) { + poll: function (args) { args.complete(); } } }, - + dedicateZone: { label: 'Dedicate Zone', messages: { - confirm: function(args) { + confirm: function (args) { return 'Do you really want to dedicate this zone to a domain/account? '; }, - notification: function(args) { + notification: function (args) { return 'Zone Dedicated'; } }, @@ -6740,22 +6811,22 @@ validation: { required: true }, - select: function(args) { + select: function (args) { $.ajax({ url: createURL("listDomains&listAll=true"), dataType: "json", async: false, - success: function(json) { + success: function (json) { var domainObjs = json.listdomainsresponse.domain; - var items = []; - - $(domainObjs).each(function() { + var items =[]; + + $(domainObjs).each(function () { items.push({ id: this.id, description: this.name }); }); - + args.response.success({ data: items }); @@ -6772,23 +6843,23 @@ } } }, - action: function(args) { + action: function (args) { //EXPLICIT DEDICATION - var array2 = []; + var array2 =[]; if (args.data.accountId != "") - array2.push("&account=" + todb(args.data.accountId)); - + array2.push("&account=" + todb(args.data.accountId)); + $.ajax({ url: createURL("dedicateZone&zoneId=" + - args.context.physicalResources[0].id + - "&domainId=" + args.data.domainId + array2.join("")), + args.context.physicalResources[0].id + + "&domainId=" + args.data.domainId + array2.join("")), dataType: "json", - success: function(json) { + success: function (json) { var jid = json.dedicatezoneresponse.jobid; args.response.success({ _custom: { jobId: jid, - getActionFilter: function() { + getActionFilter: function () { return zoneActionfilter; } } @@ -6803,31 +6874,31 @@ releaseDedicatedZone: { label: 'Release Dedicated Zone', messages: { - confirm: function(args) { + confirm: function (args) { return 'Do you want to release this dedicated zone ?'; }, - notification: function(args) { + notification: function (args) { return 'Zone dedication released'; } }, - action: function(args) { + action: function (args) { $.ajax({ url: createURL("releaseDedicatedZone&zoneid=" + - args.context.physicalResources[0].id), + args.context.physicalResources[0].id), dataType: "json", async: true, - success: function(json) { + success: function (json) { var jid = json.releasededicatedzoneresponse.jobid; args.response.success({ _custom: { jobId: jid, - getActionFilter: function() { + getActionFilter: function () { return zoneActionfilter; } } }); }, - error: function(json) { + error: function (json) { args.response.error(parseXMLHttpResponse(json)); } }); @@ -6836,67 +6907,72 @@ poll: pollAsyncJobResult } }, - + 'remove': { label: 'label.action.delete.zone', messages: { - confirm: function(args) { + confirm: function (args) { return 'message.action.delete.zone'; }, - notification: function(args) { + notification: function (args) { return 'label.action.delete.zone'; } }, - action: function(args) { + action: function (args) { $.ajax({ url: createURL("deleteZone&id=" + args.context.physicalResources[0].id), //embedded objects in listView is called physicalResources while embedded objects in detailView is called zones dataType: "json", async: true, - success: function(json) { + success: function (json) { args.response.success({ - data: {} + data: { + } }); }, - error: function(json) { + error: function (json) { args.response.error(parseXMLHttpResponse(json)); } }); }, notification: { - poll: function(args) { + poll: function (args) { args.complete(); } } }, edit: { label: 'label.edit', - action: function(args) { - var array1 = []; + 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, so a user gets to update this field from an existing value to blank. - array1.push("&ip6dns1=" + todb(args.data.ip6dns1)); //p6dns1 can be empty ("") when passed to API, so a user gets to update this field from an existing value to blank. - array1.push("&ip6dns2=" + todb(args.data.ip6dns2)); //ip6dns2 can be empty ("") when passed to API, so a user gets to update this field from an existing value to blank. - + array1.push("&dns2=" + todb(args.data.dns2)); + //dns2 can be empty ("") when passed to API, so a user gets to update this field from an existing value to blank. + array1.push("&ip6dns1=" + todb(args.data.ip6dns1)); + //p6dns1 can be empty ("") when passed to API, so a user gets to update this field from an existing value to blank. + array1.push("&ip6dns2=" + todb(args.data.ip6dns2)); + //ip6dns2 can be empty ("") when passed to API, so a user gets to update this field from an existing value to blank. + if (selectedZoneObj.networktype == "Advanced" && args.data.guestcidraddress) { array1.push("&guestcidraddress=" + todb(args.data.guestcidraddress)); } - + array1.push("&internaldns1=" + todb(args.data.internaldns1)); - array1.push("&internaldns2=" + todb(args.data.internaldns2)); //internaldns2 can be empty ("") when passed to API, so a user gets to update this field from an existing value to blank. + array1.push("&internaldns2=" + todb(args.data.internaldns2)); + //internaldns2 can be empty ("") when passed to API, so a user gets to update this field from an existing value to blank. array1.push("&domain=" + todb(args.data.domain)); array1.push("&localstorageenabled=" + (args.data.localstorageenabled == 'on')); $.ajax({ url: createURL("updateZone&id=" + args.context.physicalResources[0].id + array1.join("")), dataType: "json", async: false, - success: function(json) { + success: function (json) { selectedZoneObj = json.updatezoneresponse.zone; //override selectedZoneObj after update zone args.response.success({ data: selectedZoneObj }); }, - error: function(json) { + error: function (json) { args.response.error('Could not edit zone information; please ensure all fields are valid.'); } }); @@ -6906,15 +6982,15 @@ tabs: { details: { title: 'label.details', - - preFilter: function(args) { - var hiddenFields = []; + + preFilter: function (args) { + var hiddenFields =[]; if (selectedZoneObj.networktype == "Basic") - hiddenFields.push("guestcidraddress"); + hiddenFields.push("guestcidraddress"); return hiddenFields; }, - - fields: [{ + + fields:[ { name: { label: 'label.zone', isEditable: true, @@ -6922,7 +6998,8 @@ required: true } } - }, { + }, + { id: { label: 'label.id' }, @@ -6979,14 +7056,16 @@ isEditable: true, converter: cloudStack.converters.toBooleanText } - }, { + }, + { isdedicated: { label: 'Dedicated' }, domainid: { label: 'Domain ID' } - }, { + }, + { vmwaredcName: { label: 'VMware datacenter Name' }, @@ -6997,21 +7076,21 @@ label: 'VMware datacenter Id' } }], - dataProvider: function(args) { + dataProvider: function (args) { $.ajax({ url: createURL('listZones'), data: { id: args.context.physicalResources[0].id }, - success: function(json) { + success: function (json) { selectedZoneObj = json.listzonesresponse.zone[0]; $.ajax({ url: createURL('listDedicatedZones'), data: { - zoneid: args.context.physicalResources[0].id + zoneid: args.context.physicalResources[0].id }, async: false, - success: function(json) { + success: function (json) { if (json.listdedicatedzonesresponse.dedicatedzone != undefined) { var dedicatedzoneObj = json.listdedicatedzonesresponse.dedicatedzone[0]; if (dedicatedzoneObj.domainid != null) { @@ -7030,33 +7109,36 @@ } } }); - + $.ajax({ - url: createURL('listApis'), //listVmwareDcs API only exists in non-oss bild, so have to check whether it exists before calling it. - data: { + url: createURL('listApis'), //listVmwareDcs API only exists in non-oss bild, so have to check whether it exists before calling it. + data: { name: 'listVmwareDcs' }, async: false, - success: function(json) { - $.ajax({ - url: createURL('listVmwareDcs'), - data: { - zoneid: args.context.physicalResources[0].id - }, - async: false, - success: function (json) { //e.g. json == { "listvmwaredcsresponse" { "count":1 ,"VMwareDC" [ {"id":"c3c2562d-65e9-4fc7-92e2-773c2efe8f37","zoneid":1,"name":"datacenter","vcenter":"10.10.20.20"} ] } } - var vmwaredcs = json.listvmwaredcsresponse.VMwareDC; - if (vmwaredcs != null) { - selectedZoneObj.vmwaredcName = vmwaredcs[0].name; - selectedZoneObj.vmwaredcVcenter = vmwaredcs[0].vcenter; - selectedZoneObj.vmwaredcId = vmwaredcs[0].id; - } - } - }); + success: function (json) { + $.ajax({ + url: createURL('listVmwareDcs'), + data: { + zoneid: args.context.physicalResources[0].id + }, + async: false, + success: function (json) { + //e.g. json == { "listvmwaredcsresponse" { "count":1 ,"VMwareDC" [ {"id":"c3c2562d-65e9-4fc7-92e2-773c2efe8f37","zoneid":1,"name":"datacenter","vcenter":"10.10.20.20"} ] } } + var vmwaredcs = json.listvmwaredcsresponse.VMwareDC; + if (vmwaredcs != null) { + selectedZoneObj.vmwaredcName = vmwaredcs[0].name; + selectedZoneObj.vmwaredcVcenter = vmwaredcs[0].vcenter; + selectedZoneObj.vmwaredcId = vmwaredcs[0].id; + } + } + }); }, - error: function(XMLHttpResponse) {} //override default error handling: cloudStack.dialog.notice({ message: parseXMLHttpResponse(XMLHttpResponse)}); + error: function (XMLHttpResponse) { + } + //override default error handling: cloudStack.dialog.notice({ message: parseXMLHttpResponse(XMLHttpResponse)}); }); - + args.response.success({ actionFilter: zoneActionfilter, data: selectedZoneObj @@ -7065,7 +7147,7 @@ }); } }, - + compute: { title: 'label.compute.and.storage', custom: cloudStack.uiCustom.systemChart('compute') @@ -7078,7 +7160,7 @@ title: 'label.resources', custom: cloudStack.uiCustom.systemChart('resources') }, - + systemVMs: { title: 'label.system.vms', listView: { @@ -7090,13 +7172,11 @@ }, systemvmtype: { label: 'label.type', - converter: function(args) { + converter: function (args) { if (args == "consoleproxy") - return "Console Proxy VM"; - else if (args == "secondarystoragevm") - return "Secondary Storage VM"; - else - return args; + return "Console Proxy VM"; else if (args == "secondarystoragevm") + return "Secondary Storage VM"; else + return args; } }, zonename: { @@ -7104,7 +7184,7 @@ }, state: { label: 'label.status', - converter: function(str) { + converter: function (str) { // For localization return str; }, @@ -7116,25 +7196,25 @@ } } }, - dataProvider: function(args) { - var array1 = []; + dataProvider: function (args) { + var array1 =[]; if (args.filterBy != null) { if (args.filterBy.search != null && args.filterBy.search.by != null && args.filterBy.search.value != null) { switch (args.filterBy.search.by) { case "name": - if (args.filterBy.search.value.length > 0) - array1.push("&keyword=" + args.filterBy.search.value); - break; + if (args.filterBy.search.value.length > 0) + array1.push("&keyword=" + args.filterBy.search.value); + break; } } } - + var selectedZoneObj = args.context.physicalResources[0]; $.ajax({ url: createURL("listSystemVms&zoneid=" + selectedZoneObj.id + "&page=" + args.page + "&pagesize=" + pageSize + array1.join("")), dataType: "json", async: true, - success: function(json) { + success: function (json) { var items = json.listsystemvmsresponse.systemvm; args.response.success({ actionFilter: systemvmActionfilter, @@ -7143,7 +7223,7 @@ } }); }, - + detailView: { noCompact: true, name: 'System VM details', @@ -7151,27 +7231,27 @@ start: { label: 'label.action.start.systemvm', messages: { - confirm: function(args) { + confirm: function (args) { return 'message.action.start.systemvm'; }, - notification: function(args) { + notification: function (args) { return 'label.action.start.systemvm'; } }, - action: function(args) { + action: function (args) { $.ajax({ url: createURL('startSystemVm&id=' + args.context.systemVMs[0].id), dataType: 'json', async: true, - success: function(json) { + success: function (json) { var jid = json.startsystemvmresponse.jobid; args.response.success({ _custom: { jobId: jid, - getUpdatedItem: function(json) { + getUpdatedItem: function (json) { return json.queryasyncjobresultresponse.jobresult.systemvm; }, - getActionFilter: function() { + getActionFilter: function () { return systemvmActionfilter; } } @@ -7183,31 +7263,31 @@ poll: pollAsyncJobResult } }, - + stop: { label: 'label.action.stop.systemvm', messages: { - confirm: function(args) { + confirm: function (args) { return 'message.action.stop.systemvm'; }, - notification: function(args) { + notification: function (args) { return 'label.action.stop.systemvm'; } }, - action: function(args) { + action: function (args) { $.ajax({ url: createURL('stopSystemVm&id=' + args.context.systemVMs[0].id), dataType: 'json', async: true, - success: function(json) { + success: function (json) { var jid = json.stopsystemvmresponse.jobid; args.response.success({ _custom: { jobId: jid, - getUpdatedItem: function(json) { + getUpdatedItem: function (json) { return json.queryasyncjobresultresponse.jobresult.systemvm; }, - getActionFilter: function() { + getActionFilter: function () { return systemvmActionfilter; } } @@ -7219,31 +7299,31 @@ poll: pollAsyncJobResult } }, - + restart: { label: 'label.action.reboot.systemvm', messages: { - confirm: function(args) { + confirm: function (args) { return 'message.action.reboot.systemvm'; }, - notification: function(args) { + notification: function (args) { return 'label.action.reboot.systemvm'; } }, - action: function(args) { + action: function (args) { $.ajax({ url: createURL('rebootSystemVm&id=' + args.context.systemVMs[0].id), dataType: 'json', async: true, - success: function(json) { + success: function (json) { var jid = json.rebootsystemvmresponse.jobid; args.response.success({ _custom: { jobId: jid, - getUpdatedItem: function(json) { + getUpdatedItem: function (json) { return json.queryasyncjobresultresponse.jobresult.systemvm; }, - getActionFilter: function() { + getActionFilter: function () { return systemvmActionfilter; } } @@ -7255,27 +7335,27 @@ poll: pollAsyncJobResult } }, - + remove: { label: 'label.action.destroy.systemvm', messages: { - confirm: function(args) { + confirm: function (args) { return 'message.action.destroy.systemvm'; }, - notification: function(args) { + notification: function (args) { return 'label.action.destroy.systemvm'; } }, - action: function(args) { + action: function (args) { $.ajax({ url: createURL('destroySystemVm&id=' + args.context.systemVMs[0].id), dataType: 'json', async: true, - success: function(json) { + success: function (json) { var jid = json.destroysystemvmresponse.jobid; args.response.success({ _custom: { - getUpdatedItem: function() { + getUpdatedItem: function () { return { state: 'Destroyed' }; @@ -7290,11 +7370,11 @@ poll: pollAsyncJobResult } }, - + migrate: { label: 'label.action.migrate.systemvm', messages: { - notification: function(args) { + notification: function (args) { return 'label.action.migrate.systemvm'; } }, @@ -7307,19 +7387,19 @@ validation: { required: true }, - select: function(args) { + select: function (args) { $.ajax({ url: createURL("findHostsForMigration&VirtualMachineId=" + args.context.systemVMs[0].id), dataType: "json", async: true, - success: function(json) { + success: function (json) { var hostObjs = json.findhostsformigrationresponse.host; - var items = []; - $(hostObjs).each(function() { + var items =[]; + $(hostObjs).each(function () { if (this.requiresStorageMotion == false) { items.push({ id: this.id, - description: (this.name + " (" + (this.suitableformigration ? "Suitable" : "Not Suitable") + ")") + description: (this.name + " (" + (this.suitableformigration ? "Suitable": "Not Suitable") + ")") }); } }); @@ -7329,30 +7409,30 @@ } }); }, - error: function(XMLHttpResponse) { + error: function (XMLHttpResponse) { var errorMsg = parseXMLHttpResponse(XMLHttpResponse); args.response.error(errorMsg); } } } }, - action: function(args) { + action: function (args) { $.ajax({ url: createURL("migrateSystemVm&hostid=" + args.data.hostId + "&virtualmachineid=" + args.context.systemVMs[0].id), dataType: "json", async: true, - success: function(json) { + success: function (json) { var jid = json.migratesystemvmresponse.jobid; args.response.success({ _custom: { jobId: jid, - getUpdatedItem: function(json) { + getUpdatedItem: function (json) { //return json.queryasyncjobresultresponse.jobresult.systemvminstance; //not all properties returned in systemvminstance $.ajax({ url: createURL("listSystemVms&id=" + json.queryasyncjobresultresponse.jobresult.systemvminstance.id), dataType: "json", async: false, - success: function(json) { + success: function (json) { var items = json.listsystemvmsresponse.systemvm; if (items != null && items.length > 0) { return items[0]; @@ -7360,7 +7440,7 @@ } }); }, - getActionFilter: function() { + getActionFilter: function () { return systemvmActionfilter; } } @@ -7372,37 +7452,36 @@ poll: pollAsyncJobResult } }, - + scaleUp: { label: 'label.change.service.offering', createForm: { title: 'label.change.service.offering', - desc: function(args) { - var description = ''; - var vmObj = args.jsonObj; - //if (vmObj.state == 'Running' && vmObj.hypervisor == 'VMware') { //needs to wait for API fix that will return hypervisor property - if (vmObj.state == 'Running') { - description = 'Please read the dynamic scaling section in the admin guide before scaling up.'; - } + desc: function (args) { + var description = ''; + var vmObj = args.jsonObj; + //if (vmObj.state == 'Running' && vmObj.hypervisor == 'VMware') { //needs to wait for API fix that will return hypervisor property + if (vmObj.state == 'Running') { + description = 'Please read the dynamic scaling section in the admin guide before scaling up.'; + } return description; }, fields: { serviceOfferingId: { label: 'label.compute.offering', - select: function(args) { + select: function (args) { var apiCmd = "listServiceOfferings&issystem=true"; if (args.context.systemVMs[0].systemvmtype == "secondarystoragevm") - apiCmd += "&systemvmtype=secondarystoragevm"; - else if (args.context.systemVMs[0].systemvmtype == "consoleproxy") - apiCmd += "&systemvmtype=consoleproxy"; + apiCmd += "&systemvmtype=secondarystoragevm"; else if (args.context.systemVMs[0].systemvmtype == "consoleproxy") + apiCmd += "&systemvmtype=consoleproxy"; $.ajax({ url: createURL(apiCmd), dataType: "json", async: true, - success: function(json) { + success: function (json) { var serviceofferings = json.listserviceofferingsresponse.serviceoffering; - var items = []; - $(serviceofferings).each(function() { + var items =[]; + $(serviceofferings).each(function () { if (this.id != args.context.systemVMs[0].serviceofferingid) { items.push({ id: this.id, @@ -7419,59 +7498,56 @@ } } }, - - action: function(args) { + + action: function (args) { $.ajax({ url: createURL("scaleSystemVm&id=" + args.context.systemVMs[0].id + "&serviceofferingid=" + args.data.serviceOfferingId), dataType: "json", async: true, - success: function(json) { + success: function (json) { var jid = json.changeserviceforsystemvmresponse.jobid; args.response.success({ _custom: { jobId: jid, - getUpdatedItem: function(json) { + getUpdatedItem: function (json) { return json.queryasyncjobresultresponse.jobresult.systemvm; }, - getActionFilter: function() { + getActionFilter: function () { return systemvmActionfilter; } - } }); - }, - error: function(json) { + error: function (json) { args.response.error(parseXMLHttpResponse(json)); } - }); }, messages: { - confirm: function(args) { + confirm: function (args) { return 'Do you really want to scale up the system VM ?'; }, - notification: function(args) { - + notification: function (args) { + return 'System VM Scaled Up'; } }, notification: { poll: pollAsyncJobResult } - }, - - + + viewConsole: { label: 'label.view.console', action: { externalLink: { - url: function(args) { + url: function (args) { return clientConsoleUrl + '?cmd=access&vm=' + args.context.systemVMs[0].id; }, - title: function(args) { - return args.context.systemVMs[0].id.substr(0, 8); //title in window.open() can't have space nor longer than 8 characters. Otherwise, IE browser will have error. + title: function (args) { + return args.context.systemVMs[0].id.substr(0, 8); + //title in window.open() can't have space nor longer than 8 characters. Otherwise, IE browser will have error. }, width: 820, height: 640 @@ -7482,11 +7558,12 @@ tabs: { details: { title: 'label.details', - fields: [{ + fields:[ { name: { label: 'label.name' } - }, { + }, + { id: { label: 'label.id' }, @@ -7495,13 +7572,11 @@ }, systemvmtype: { label: 'label.type', - converter: function(args) { + converter: function (args) { if (args == "consoleproxy") - return "Console Proxy VM"; - else if (args == "secondarystoragevm") - return "Secondary Storage VM"; - else - return args; + return "Console Proxy VM"; else if (args == "secondarystoragevm") + return "Secondary Storage VM"; else + return args; } }, zonename: { @@ -7530,12 +7605,12 @@ label: 'label.active.sessions' } }], - dataProvider: function(args) { + dataProvider: function (args) { $.ajax({ url: createURL("listSystemVms&id=" + args.context.systemVMs[0].id), dataType: "json", async: true, - success: function(json) { + success: function (json) { args.response.success({ actionFilter: systemvmActionfilter, data: json.listsystemvmsresponse.systemvm[0] @@ -7548,52 +7623,51 @@ } } }, - + // Granular settings for zone settings: { title: 'Settings', custom: cloudStack.uiCustom.granularSettings({ - dataProvider: function(args) { + dataProvider: function (args) { $.ajax({ url: createURL('listConfigurations&zoneid=' + args.context.physicalResources[0].id), - data: listViewDataProvider(args, {}, { searchBy: 'name' }), - success: function(json) { + data: listViewDataProvider(args, { + }, + { + searchBy: 'name' + }), + success: function (json) { args.response.success({ data: json.listconfigurationsresponse.configuration - }); - }, - - error: function(json) { + + error: function (json) { args.response.error(parseXMLHttpResponse(json)); - } }); - }, actions: { - edit: function(args) { + edit: function (args) { // call updateZoneLevelParamter var data = { name: args.data.jsonObj.name, value: args.data.value }; - + $.ajax({ url: createURL('updateConfiguration&zoneid=' + args.context.physicalResources[0].id), data: data, - success: function(json) { + success: function (json) { var item = json.updateconfigurationresponse.configuration; args.response.success({ data: item }); }, - - error: function(json) { + + error: function (json) { args.response.error(parseXMLHttpResponse(json)); } - }); } } @@ -7602,276 +7676,290 @@ } } }, - pods: function() { - var listView = $.extend(true, {}, cloudStack.sections.system.subsections.pods.listView, { - dataProvider: function(args) { - var data = {}; + pods: function () { + var listView = $.extend(true, { + }, + cloudStack.sections.system.subsections.pods.listView, { + dataProvider: function (args) { + var data = { + }; listViewDataProvider(args, data); - + $.ajax({ url: createURL('listPods'), data: data, - success: function(json) { + success: function (json) { args.response.success({ data: json.listpodsresponse.pod }); }, - error: function(json) { + error: function (json) { args.response.error(parseXMLHttpResponse(json)); } }); }, - + detailView: { - updateContext: function(args) { + updateContext: function (args) { var zone; - + $.ajax({ url: createURL('listZones'), data: { id: args.context.pods[0].zoneid }, async: false, - success: function(json) { + success: function (json) { zone = json.listzonesresponse.zone[0]; } }); - + selectedZoneObj = zone; - + return { - zones: [zone] + zones:[zone] }; } } }); - + return listView; }, - clusters: function() { - var listView = $.extend(true, {}, cloudStack.sections.system.subsections.clusters.listView, { - dataProvider: function(args) { - var data = {}; + clusters: function () { + var listView = $.extend(true, { + }, + cloudStack.sections.system.subsections.clusters.listView, { + dataProvider: function (args) { + var data = { + }; listViewDataProvider(args, data); - + $.ajax({ url: createURL('listClusters'), data: data, - success: function(json) { + success: function (json) { args.response.success({ data: json.listclustersresponse.cluster }); }, - error: function(json) { + error: function (json) { args.response.error(parseXMLHttpResponse(json)); } }); }, - + detailView: { - updateContext: function(args) { + updateContext: function (args) { var zone; - + $.ajax({ url: createURL('listZones'), data: { id: args.context.clusters[0].zoneid }, async: false, - success: function(json) { + success: function (json) { zone = json.listzonesresponse.zone[0]; } }); - + selectedZoneObj = zone; - + return { - zones: [zone] + zones:[zone] }; } } }); - + return listView; }, - hosts: function() { - var listView = $.extend(true, {}, cloudStack.sections.system.subsections.hosts.listView, { - dataProvider: function(args) { + hosts: function () { + var listView = $.extend(true, { + }, + cloudStack.sections.system.subsections.hosts.listView, { + dataProvider: function (args) { var data = { - type: 'routing' + type: 'routing' }; listViewDataProvider(args, data); - + $.ajax({ url: createURL('listHosts'), data: data, - success: function(json) { + success: function (json) { args.response.success({ data: json.listhostsresponse.host }); }, - error: function(json) { + error: function (json) { args.response.error(parseXMLHttpResponse(json)); } }); }, - + detailView: { - updateContext: function(args) { + updateContext: function (args) { var zone; - + $.ajax({ url: createURL('listZones'), data: { id: args.context.hosts[0].zoneid }, async: false, - success: function(json) { + success: function (json) { zone = json.listzonesresponse.zone[0]; } }); - + selectedZoneObj = zone; - + return { - zones: [zone] + zones:[zone] }; } } }); - + return listView; }, - primaryStorage: function() { - var listView = $.extend(true, {}, cloudStack.sections.system.subsections['primary-storage'].listView, { - dataProvider: function(args) { - var data = {}; - listViewDataProvider(args, data); - + primaryStorage: function () { + var listView = $.extend(true, { + }, + cloudStack.sections.system.subsections[ 'primary-storage'].listView, { + dataProvider: function (args) { + var data = { + }; + listViewDataProvider(args, data); + $.ajax({ url: createURL('listStoragePools'), data: data, - success: function(json) { + success: function (json) { args.response.success({ data: json.liststoragepoolsresponse.storagepool }); }, - error: function(json) { + error: function (json) { args.response.error(parseXMLHttpResponse(json)); } }); }, - + detailView: { - updateContext: function(args) { + updateContext: function (args) { var zone; - + $.ajax({ url: createURL('listZones'), data: { id: args.context.primarystorages[0].zoneid }, async: false, - success: function(json) { + success: function (json) { zone = json.listzonesresponse.zone[0]; } }); - + selectedZoneObj = zone; - + return { - zones: [zone] + zones:[zone] }; } } }); - + return listView; }, - - secondaryStorage: function() { + + secondaryStorage: function () { var listView = $.extend( - true, {}, - cloudStack.sections.system.subsections['secondary-storage'], { - sections: { - secondaryStorage: { - listView: { - dataProvider: function(args) { - var data = { - type: 'SecondaryStorage' - }; - listViewDataProvider(args, data); - - $.ajax({ - url: createURL('listImageStores'), - data: data, - success: function(json) { - var items = json.listimagestoresresponse.imagestore; - if (items != undefined) { - for (var i = 0; i < items.length; i++) { - processPropertiesInImagestoreObject(items[i]); - } - } - args.response.success({ - data: items - }); - }, - error: function(json) { - args.response.error(parseXMLHttpResponse(json)); + true, { + }, + cloudStack.sections.system.subsections[ 'secondary-storage'], { + sections: { + secondaryStorage: { + listView: { + dataProvider: function (args) { + var data = { + type: 'SecondaryStorage' + }; + listViewDataProvider(args, data); + + $.ajax({ + url: createURL('listImageStores'), + data: data, + success: function (json) { + var items = json.listimagestoresresponse.imagestore; + if (items != undefined) { + for (var i = 0; i < items.length; i++) { + processPropertiesInImagestoreObject(items[i]); + } } - }); - } + args.response.success({ + data: items + }); + }, + error: function (json) { + args.response.error(parseXMLHttpResponse(json)); + } + }); } - }, - cacheStorage: { - listView: { - dataProvider: function(args) { - var data = {}; - listViewDataProvider(args, data); - - $.ajax({ - url: createURL('listSecondaryStagingStores'), - data: data, - success: function(json) { - args.response.success({ - data: json.listsecondarystagingstoreresponse.imagestore - }); - }, - error: function(json) { - args.response.error(parseXMLHttpResponse(json)); - } - }); - } - - /* - , - detailView: { - updateContext: function (args) { - return { - zones: [{}] - }; - } - } - */ - + } + }, + cacheStorage: { + listView: { + dataProvider: function (args) { + var data = { + }; + listViewDataProvider(args, data); + + $.ajax({ + url: createURL('listSecondaryStagingStores'), + data: data, + success: function (json) { + args.response.success({ + data: json.listsecondarystagingstoreresponse.imagestore + }); + }, + error: function (json) { + args.response.error(parseXMLHttpResponse(json)); + } + }); } + + /* + , + detailView: { + updateContext: function (args) { + return { + zones: [{}] + }; + } + } + */ } } } - ); - + }); + return listView; }, - systemVms: function() { - var listView = $.extend(true, {}, cloudStack.sections.system.subsections.systemVms.listView, { - dataProvider: function(args) { - var data = {}; - listViewDataProvider(args, data); - + systemVms: function () { + var listView = $.extend(true, { + }, + cloudStack.sections.system.subsections.systemVms.listView, { + dataProvider: function (args) { + var data = { + }; + listViewDataProvider(args, data); + $.ajax({ url: createURL('listSystemVms'), data: data, - success: function(json) { + success: function (json) { var systemvmObjs = json.listsystemvmsresponse.systemvm; if (systemvmObjs != undefined) { $.ajax({ @@ -7880,15 +7968,15 @@ listAll: true, details: 'min' }, - success: function(json) { + success: function (json) { var hostObjs = json.listhostsresponse.host; for (var i = 0; i < systemvmObjs.length; i++) { - for (var k = 0; k < hostObjs.length; k++) { - if (hostObjs[k].name == systemvmObjs[i].name) { - systemvmObjs[i].agentstate = hostObjs[k].state; - break; + for (var k = 0; k < hostObjs.length; k++) { + if (hostObjs[k].name == systemvmObjs[i].name) { + systemvmObjs[i].agentstate = hostObjs[k].state; + break; + } } - } } args.response.success({ data: systemvmObjs @@ -7896,84 +7984,89 @@ } }); } else { - args.response.success({ - data: [] + args.response.success({ + data:[] }); } } }); }, - + detailView: { - updateContext: function(args) { + updateContext: function (args) { var zone; - + $.ajax({ url: createURL('listZones'), data: { id: args.context.systemVMs[0].zoneid }, async: false, - success: function(json) { + success: function (json) { zone = json.listzonesresponse.zone[0]; } }); - + selectedZoneObj = zone; - + return { - zones: [zone] + zones:[zone] }; } } }); - + return listView; }, - virtualRouters: function() { - var listView = $.extend(true, {}, cloudStack.sections.system.subsections.virtualRouters, { + virtualRouters: function () { + var listView = $.extend(true, { + }, + cloudStack.sections.system.subsections.virtualRouters, { sections: { virtualRouterNoGrouping: { - listView: { - dataProvider: function(args) { - var data = {}; + listView: { + dataProvider: function (args) { + var data = { + }; listViewDataProvider(args, data); - - var routers = []; - + + var routers =[]; + //get account-owned routers $.ajax({ url: createURL('listRouters'), - data: $.extend(data,{ + data: $.extend(data, { listAll: true }), async: false, - success: function(json) { - var items = json.listroutersresponse.router ? json.listroutersresponse.router : []; - $(items).map(function(index, item) { + success: function (json) { + var items = json.listroutersresponse.router ? json.listroutersresponse.router:[]; + $(items).map(function (index, item) { routers.push(item); }); - + //get project-owned routers var toSearchByProjectid = true; if (args.filterBy != null) { - if (args.filterBy.advSearch != null && typeof(args.filterBy.advSearch) == "object") { //advanced search - if ('account' in args.filterBy.advSearch && args.filterBy.advSearch.account.length > 0) { //if account is specified in advanced search, don't search project-owned routers - toSearchByProjectid = false; //since account and projectid can't be specified together + if (args.filterBy.advSearch != null && typeof (args.filterBy.advSearch) == "object") { + //advanced search + if ('account' in args.filterBy.advSearch && args.filterBy.advSearch.account.length > 0) { + //if account is specified in advanced search, don't search project-owned routers + toSearchByProjectid = false; //since account and projectid can't be specified together } } } if (toSearchByProjectid) { $.ajax({ url: createURL('listRouters'), - data: $.extend(data,{ + data: $.extend(data, { listAll: true, projectid: -1 }), async: false, - success: function(json) { - var items = json.listroutersresponse.router ? json.listroutersresponse.router : []; - $(items).map(function(index, item) { + success: function (json) { + var items = json.listroutersresponse.router ? json.listroutersresponse.router:[]; + $(items).map(function (index, item) { routers.push(item); }); } @@ -7981,103 +8074,109 @@ } } }); - + args.response.success({ actionFilter: routerActionfilter, data: $(routers).map(mapRouterType) }); }, - + detailView: { - updateContext: function(args) { + updateContext: function (args) { var zone; - + $.ajax({ url: createURL('listZones'), data: { id: args.context.routers[0].zoneid }, async: false, - success: function(json) { + success: function (json) { zone = json.listzonesresponse.zone[0]; } }); - + selectedZoneObj = zone; - + return { - zones: [zone] + zones:[zone] }; } } } } - } + } }); - + return listView; }, - - sockets: function() { + + sockets: function () { var listView = { id: 'sockets', fields: { - hypervisor: { label: 'label.hypervisor' }, - hosts: { label: 'label.hosts' }, - sockets: { label: 'label.sockets' } + hypervisor: { + label: 'label.hypervisor' + }, + hosts: { + label: 'label.hosts' + }, + sockets: { + label: 'label.sockets' + } }, - dataProvider: function(args) { + dataProvider: function (args) { $.ajax({ url: createURL('listHypervisors'), - success: function(json) { + success: function (json) { args.response.success({ - data: $(json.listhypervisorsresponse.hypervisor).map(function(index, hypervisor) { - var totalHostCount = 0; - var currentPage = 1; - var returnedHostCount = 0; - var returnedHostCpusocketsSum = 0; - - var callListHostsWithPage = function(setTotalHostCount) { - $.ajax({ - url: createURL('listHosts'), - async: false, - data: { - type: 'routing', - hypervisor: hypervisor.name, - page: currentPage, - pagesize: pageSize //global variable - }, - success: function(json) { - if (json.listhostsresponse.count == undefined) { - return; - } - - if (setTotalHostCount) { - totalHostCount = json.listhostsresponse.count; - } - returnedHostCount += json.listhostsresponse.host.length; - - var items = json.listhostsresponse.host; - for (var i = 0; i < items.length; i++) { - if (items[i].cpusockets != undefined && isNaN(items[i].cpusockets) == false) { - returnedHostCpusocketsSum += items[i].cpusockets; - } - } - - if (returnedHostCount < totalHostCount) { - currentPage++; - callListHostsWithPage(false); - } - } - }); - } - - callListHostsWithPage(true); - + data: $(json.listhypervisorsresponse.hypervisor).map(function (index, hypervisor) { + var totalHostCount = 0; + var currentPage = 1; + var returnedHostCount = 0; + var returnedHostCpusocketsSum = 0; + + var callListHostsWithPage = function (setTotalHostCount) { + $.ajax({ + url: createURL('listHosts'), + async: false, + data: { + type: 'routing', + hypervisor: hypervisor.name, + page: currentPage, + pagesize: pageSize //global variable + }, + success: function (json) { + if (json.listhostsresponse.count == undefined) { + return; + } + + if (setTotalHostCount) { + totalHostCount = json.listhostsresponse.count; + } + returnedHostCount += json.listhostsresponse.host.length; + + var items = json.listhostsresponse.host; + for (var i = 0; i < items.length; i++) { + if (items[i].cpusockets != undefined && isNaN(items[i].cpusockets) == false) { + returnedHostCpusocketsSum += items[i].cpusockets; + } + } + + if (returnedHostCount < totalHostCount) { + currentPage++; + callListHostsWithPage(false); + } + } + }); + } + + callListHostsWithPage(true); + return { hypervisor: hypervisor.name, hosts: totalHostCount, - sockets: returnedHostCpusocketsSum + sockets: returnedHostCpusocketsSum }; }) }); @@ -8085,7 +8184,7 @@ }); } }; - + return listView; } } @@ -8094,9 +8193,9 @@ }), subsections: { virtualRouters: { - sectionSelect: { + sectionSelect: { label: 'label.select-view' - }, + }, sections: { routerNoGroup: { id: 'routers', @@ -8108,15 +8207,15 @@ fields: { name: { label: 'label.name' - }, + }, publicip: { label: 'label.public.ip' - }, + }, routerType: { label: 'label.type' }, state: { - converter: function(str) { + converter: function (str) { // For localization return str; }, @@ -8132,43 +8231,43 @@ converter: cloudStack.converters.toBooleanText } }, - dataProvider: function(args) { - var array1 = []; + dataProvider: function (args) { + var array1 =[]; if (args.filterBy != null) { if (args.filterBy.search != null && args.filterBy.search.by != null && args.filterBy.search.value != null) { switch (args.filterBy.search.by) { - case "name": + case "name": if (args.filterBy.search.value.length > 0) - array1.push("&keyword=" + args.filterBy.search.value); + array1.push("&keyword=" + args.filterBy.search.value); break; } } } - + var data2 = { // forvpc: false }; - - var routers = []; + + var routers =[]; $.ajax({ url: createURL("listRouters&listAll=true&page=" + args.page + "&pagesize=" + pageSize + array1.join("")), data: data2, - success: function(json) { + success: function (json) { var items = json.listroutersresponse.router ? - json.listroutersresponse.router : []; - - $(items).map(function(index, item) { + json.listroutersresponse.router:[]; + + $(items).map(function (index, item) { routers.push(item); }); // Get project routers $.ajax({ url: createURL("listRouters&listAll=true&page=" + args.page + "&pagesize=" + pageSize + array1.join("") + "&projectid=-1"), data: data2, - success: function(json) { + success: function (json) { var items = json.listroutersresponse.router ? - json.listroutersresponse.router : []; - - $(items).map(function(index, item) { + json.listroutersresponse.router:[]; + + $(items).map(function (index, item) { routers.push(item); }); args.response.success({ @@ -8186,27 +8285,27 @@ start: { label: 'label.action.start.router', messages: { - confirm: function(args) { + confirm: function (args) { return 'message.action.start.router'; }, - notification: function(args) { + notification: function (args) { return 'label.action.start.router'; } }, - action: function(args) { + action: function (args) { $.ajax({ url: createURL('startRouter&id=' + args.context.routers[0].id), dataType: 'json', async: true, - success: function(json) { + success: function (json) { var jid = json.startrouterresponse.jobid; args.response.success({ _custom: { jobId: jid, - getUpdatedItem: function(json) { + getUpdatedItem: function (json) { return json.queryasyncjobresultresponse.jobresult.router; }, - getActionFilter: function() { + getActionFilter: function () { return routerActionfilter; } } @@ -8218,7 +8317,7 @@ poll: pollAsyncJobResult } }, - + stop: { label: 'label.action.stop.router', createForm: { @@ -8233,26 +8332,26 @@ } }, messages: { - notification: function(args) { + notification: function (args) { return 'label.action.stop.router'; } }, - action: function(args) { - var array1 = []; + action: function (args) { + var array1 =[]; array1.push("&forced=" + (args.data.forced == "on")); $.ajax({ url: createURL('stopRouter&id=' + args.context.routers[0].id + array1.join("")), dataType: 'json', async: true, - success: function(json) { + success: function (json) { var jid = json.stoprouterresponse.jobid; args.response.success({ _custom: { jobId: jid, - getUpdatedItem: function(json) { + getUpdatedItem: function (json) { return json.queryasyncjobresultresponse.jobresult.router; }, - getActionFilter: function() { + getActionFilter: function () { return routerActionfilter; } } @@ -8264,11 +8363,11 @@ poll: pollAsyncJobResult } }, - + upgradeRouterToUseNewerTemplate: { label: 'Upgrade Router to Use Newer Template', messages: { - confirm: function(args) { + confirm: function (args) { return 'Please confirm that you want to upgrade router to use newer template'; }, notification: function (args) { @@ -8297,23 +8396,23 @@ poll: pollAsyncJobResult } }, - + 'remove': { label: 'label.destroy.router', messages: { - confirm: function(args) { + confirm: function (args) { return 'message.confirm.destroy.router'; }, - notification: function(args) { + notification: function (args) { return 'label.destroy.router'; } }, - action: function(args) { + action: function (args) { $.ajax({ url: createURL("destroyRouter&id=" + args.context.routers[0].id), dataType: "json", async: true, - success: function(json) { + success: function (json) { var jid = json.destroyrouterresponse.jobid; args.response.success({ _custom: { @@ -8327,31 +8426,31 @@ poll: pollAsyncJobResult } }, - + restart: { label: 'label.action.reboot.router', messages: { - confirm: function(args) { + confirm: function (args) { return 'message.action.reboot.router'; }, - notification: function(args) { + notification: function (args) { return 'label.action.reboot.router'; } }, - action: function(args) { + action: function (args) { $.ajax({ url: createURL('rebootRouter&id=' + args.context.routers[0].id), dataType: 'json', async: true, - success: function(json) { + success: function (json) { var jid = json.rebootrouterresponse.jobid; args.response.success({ _custom: { jobId: jid, - getUpdatedItem: function(json) { + getUpdatedItem: function (json) { return json.queryasyncjobresultresponse.jobresult.router; }, - getActionFilter: function() { + getActionFilter: function () { return routerActionfilter; } } @@ -8363,7 +8462,7 @@ poll: pollAsyncJobResult } }, - + migrate: { label: 'label.action.migrate.router', createForm: { @@ -8375,18 +8474,18 @@ validation: { required: true }, - select: function(args) { + select: function (args) { $.ajax({ url: createURL("findHostsForMigration&VirtualMachineId=" + args.context.routers[0].id), dataType: "json", async: true, - success: function(json) { + success: function (json) { var hostObjs = json.findhostsformigrationresponse.host; - var items = []; - $(hostObjs).each(function() { + var items =[]; + $(hostObjs).each(function () { items.push({ id: this.id, - description: (this.name + " (" + (this.suitableformigration ? "Suitable" : "Not Suitable") + ")") + description: (this.name + " (" + (this.suitableformigration ? "Suitable": "Not Suitable") + ")") }); }); args.response.success({ @@ -8395,7 +8494,7 @@ } }); }, - error: function(XMLHttpResponse) { + error: function (XMLHttpResponse) { var errorMsg = parseXMLHttpResponse(XMLHttpResponse); args.response.error(errorMsg); } @@ -8403,27 +8502,27 @@ } }, messages: { - notification: function(args) { + notification: function (args) { return 'label.action.migrate.router'; } }, - action: function(args) { + action: function (args) { $.ajax({ url: createURL("migrateSystemVm&hostid=" + args.data.hostId + "&virtualmachineid=" + args.context.routers[0].id), dataType: "json", async: true, - success: function(json) { + success: function (json) { var jid = json.migratesystemvmresponse.jobid; args.response.success({ _custom: { jobId: jid, - getUpdatedItem: function(json) { + getUpdatedItem: function (json) { //return json.queryasyncjobresultresponse.jobresult.systemvminstance; //not all properties returned in systemvminstance $.ajax({ url: createURL("listRouters&id=" + json.queryasyncjobresultresponse.jobresult.systemvminstance.id), dataType: "json", async: false, - success: function(json) { + success: function (json) { var items = json.listroutersresponse.router; if (items != null && items.length > 0) { return items[0]; @@ -8431,7 +8530,7 @@ } }); }, - getActionFilter: function() { + getActionFilter: function () { return routerActionfilter; } } @@ -8443,12 +8542,12 @@ poll: pollAsyncJobResult } }, - + scaleUp: { label: 'label.change.service.offering', createForm: { title: 'label.change.service.offering', - desc: function(args) { + desc: function (args) { var description = ''; var vmObj = args.jsonObj; //if (vmObj.state == 'Running' && vmObj.hypervisor == 'VMware') { //needs to wait for API fix that will return hypervisor property @@ -8460,23 +8559,23 @@ fields: { serviceOfferingId: { label: 'label.compute.offering', - select: function(args) { + select: function (args) { $.ajax({ url: createURL('listServiceOfferings'), data: { issystem: true, systemvmtype: 'domainrouter' }, - success: function(json) { + success: function (json) { var serviceofferings = json.listserviceofferingsresponse.serviceoffering; - var items = []; - $(serviceofferings).each(function() { + var items =[]; + $(serviceofferings).each(function () { // if(this.id != args.context.routers[0].serviceofferingid) { items.push({ id: this.id, description: this.name - }); //default one (i.e. "System Offering For Software Router") doesn't have displaytext property. So, got to use name property instead. - + }); + //default one (i.e. "System Offering For Software Router") doesn't have displaytext property. So, got to use name property instead. }); args.response.success({ data: items @@ -8487,58 +8586,56 @@ } } }, - - action: function(args) { + + action: function (args) { $.ajax({ url: createURL("scaleSystemVm&id=" + args.context.routers[0].id + "&serviceofferingid=" + args.data.serviceOfferingId), dataType: "json", async: true, - success: function(json) { + success: function (json) { var jid = json.changeserviceforsystemvmresponse.jobid; args.response.success({ _custom: { jobId: jid, - getUpdatedItem: function(json) { + getUpdatedItem: function (json) { return json.queryasyncjobresultresponse.jobresult.systemvm; }, - getActionFilter: function() { + getActionFilter: function () { return routerActionfilter; } } }); - }, - error: function(json) { + error: function (json) { args.response.error(parseXMLHttpResponse(json)); } - }); }, messages: { - confirm: function(args) { + confirm: function (args) { return 'Do you really want to scale up the Router VM ?'; }, - notification: function(args) { - + notification: function (args) { + return 'Router VM Scaled Up'; } }, notification: { poll: pollAsyncJobResult } - }, - - + + viewConsole: { label: 'label.view.console', action: { externalLink: { - url: function(args) { + url: function (args) { return clientConsoleUrl + '?cmd=access&vm=' + args.context.routers[0].id; }, - title: function(args) { - return args.context.routers[0].id.substr(0, 8); //title in window.open() can't have space nor longer than 8 characters. Otherwise, IE browser will have error. + title: function (args) { + return args.context.routers[0].id.substr(0, 8); + //title in window.open() can't have space nor longer than 8 characters. Otherwise, IE browser will have error. }, width: 820, height: 640 @@ -8549,9 +8646,9 @@ tabs: { details: { title: 'label.details', - preFilter: function(args) { - var hiddenFields = []; - if (!args.context.routers[0].project) { + preFilter: function (args) { + var hiddenFields =[]; + if (! args.context.routers[0].project) { hiddenFields.push('project'); hiddenFields.push('projectid'); } @@ -8561,26 +8658,28 @@ id: args.context.routers[0].zoneid }, async: false, - success: function(json) { + success: function (json) { if (json.listzonesresponse.zone != undefined) { var zoneObj = json.listzonesresponse.zone[0]; if (zoneObj.networktype == 'Basic') { - hiddenFields.push('publicip'); //In Basic zone, guest IP is public IP. So, publicip is not returned by listRouters API. Only guestipaddress is returned by listRouters API. + hiddenFields.push('publicip'); + //In Basic zone, guest IP is public IP. So, publicip is not returned by listRouters API. Only guestipaddress is returned by listRouters API. } } } }); - + return hiddenFields; }, - fields: [{ + fields:[ { name: { label: 'label.name' }, project: { label: 'label.project' } - }, { + }, + { id: { label: 'label.id' }, @@ -8639,12 +8738,12 @@ label: 'VPC ID' } }], - dataProvider: function(args) { + dataProvider: function (args) { $.ajax({ url: createURL("listRouters&id=" + args.context.routers[0].id), dataType: 'json', async: true, - success: function(json) { + success: function (json) { var jsonObj = json.listroutersresponse.router[0]; addExtraPropertiesToRouterInstanceObject(jsonObj); args.response.success({ @@ -8658,7 +8757,7 @@ nics: { title: 'label.nics', multiple: true, - fields: [{ + fields:[ { name: { label: 'label.name', header: true @@ -8691,17 +8790,17 @@ label: 'label.broadcast.uri' } }], - dataProvider: function(args) { + dataProvider: function (args) { $.ajax({ url: createURL("listRouters&id=" + args.context.routers[0].id), dataType: 'json', async: true, - success: function(json) { + success: function (json) { var jsonObj = json.listroutersresponse.router[0].nic; - + args.response.success({ actionFilter: routerActionfilter, - data: $.map(jsonObj, function(nic, index) { + data: $.map(jsonObj, function (nic, index) { var name = 'NIC ' + (index + 1); if (nic.isdefault) { name += ' (' + _l('label.default') + ')'; @@ -8718,7 +8817,7 @@ } } } - }, + }, routerGroupByZone: { id: 'routerGroupByZone', type: 'select', @@ -8731,29 +8830,29 @@ label: 'label.zone' }, routerCount: { - label: 'Total of Virtual Routers' + label: 'Total of Virtual Routers' }, routerRequiresUpgrade: { - label: 'Upgrade is required', - converter: function(args) { - if (args > 0) { - return 'Yes'; - } else { - return 'No'; - } - } + label: 'Upgrade is required', + converter: function (args) { + if (args > 0) { + return 'Yes'; + } else { + return 'No'; + } + } } }, - - dataProvider: function(args) { - var array1 = []; + + dataProvider: function (args) { + var array1 =[]; if (args.filterBy != null) { if (args.filterBy.search != null && args.filterBy.search.by != null && args.filterBy.search.value != null) { switch (args.filterBy.search.by) { case "name": - if (args.filterBy.search.value.length > 0) - array1.push("&keyword=" + args.filterBy.search.value); - break; + if (args.filterBy.search.value.length > 0) + array1.push("&keyword=" + args.filterBy.search.value); + break; } } } @@ -8761,35 +8860,35 @@ url: createURL("listZones&page=" + args.page + "&pagesize=" + pageSize + array1.join("")), dataType: "json", async: true, - success: function(json) { - var groupbyObjs = json.listzonesresponse.zone; + success: function (json) { + var groupbyObjs = json.listzonesresponse.zone; if (groupbyObjs != null) { - addExtraPropertiesToGroupbyObjects(groupbyObjs, 'zoneid'); - } - args.response.success({ + addExtraPropertiesToGroupbyObjects(groupbyObjs, 'zoneid'); + } + args.response.success({ data: groupbyObjs }); } }); - }, + }, detailView: { - name: 'Virtual Routers group by zone', - actions: { - upgradeRouterToUseNewerTemplate: { + name: 'Virtual Routers group by zone', + actions: { + upgradeRouterToUseNewerTemplate: { label: 'Upgrade Router to Use Newer Template', messages: { - confirm: function(args) { + confirm: function (args) { return 'Please confirm that you want to upgrade all routers in this zone to use newer template'; }, notification: function (args) { return 'Upgrade Router to Use Newer Template'; } }, - action: function (args) { + action: function (args) { $.ajax({ url: createURL('upgradeRouterTemplate'), data: { - zoneid: args.context.routerGroupByZone[0].id + zoneid: args.context.routerGroupByZone[0].id }, success: function (json) { var jobs = json.upgraderoutertemplateresponse.asyncjobs; @@ -8806,42 +8905,43 @@ notification: { poll: pollAsyncJobResult } - } - }, - tabs: { - details: { - title: 'Virtual Routers group by zone', - fields: [{ + } + }, + tabs: { + details: { + title: 'Virtual Routers group by zone', + fields:[ { name: { label: 'label.zone' } - }, { + }, + { routerCount: { - label: 'Total of Virtual Routers' + label: 'Total of Virtual Routers' }, routerRequiresUpgrade: { - label: 'Upgrade is required', - converter: function(args) { - if (args > 0) { - return 'Yes'; - } else { - return 'No'; - } - } + label: 'Upgrade is required', + converter: function (args) { + if (args > 0) { + return 'Yes'; + } else { + return 'No'; + } + } } - }], - dataProvider: function(args) { - addExtraPropertiesToGroupbyObject(args.context.routerGroupByZone[0], 'zoneid'); + }], + dataProvider: function (args) { + addExtraPropertiesToGroupbyObject(args.context.routerGroupByZone[0], 'zoneid'); args.response.success({ data: args.context.routerGroupByZone[0], actionFilter: routerGroupActionfilter - }); + }); } - } - } - } + } + } + } } - }, + }, routerGroupByPod: { id: 'routerGroupByPod', type: 'select', @@ -8867,15 +8967,15 @@ } } }, - + dataProvider: function (args) { - var array1 = []; + var array1 =[]; if (args.filterBy != null) { if (args.filterBy.search != null && args.filterBy.search.by != null && args.filterBy.search.value != null) { switch (args.filterBy.search.by) { - case "name": + case "name": if (args.filterBy.search.value.length > 0) - array1.push("&keyword=" + args.filterBy.search.value); + array1.push("&keyword=" + args.filterBy.search.value); break; } } @@ -8885,13 +8985,13 @@ dataType: "json", async: true, success: function (json) { - var groupbyObjs = json.listpodsresponse.pod; + var groupbyObjs = json.listpodsresponse.pod; if (groupbyObjs != null) { - addExtraPropertiesToGroupbyObjects(groupbyObjs, 'podid'); - } - args.response.success({ + addExtraPropertiesToGroupbyObjects(groupbyObjs, 'podid'); + } + args.response.success({ data: groupbyObjs - }); + }); } }); }, @@ -8934,11 +9034,12 @@ tabs: { details: { title: 'Virtual Routers group by pod', - fields: [{ + fields:[ { name: { label: 'label.pod' } - }, { + }, + { routerCount: { label: 'Total of Virtual Routers' }, @@ -8953,15 +9054,15 @@ } }, zonename: { - label: 'label.zone' + label: 'label.zone' } }], dataProvider: function (args) { - addExtraPropertiesToGroupbyObject(args.context.routerGroupByPod[0], 'podid'); - args.response.success({ + addExtraPropertiesToGroupbyObject(args.context.routerGroupByPod[0], 'podid'); + args.response.success({ data: args.context.routerGroupByPod[0], actionFilter: routerGroupActionfilter - }); + }); } } } @@ -8993,15 +9094,15 @@ } } }, - + dataProvider: function (args) { - var array1 = []; + var array1 =[]; if (args.filterBy != null) { if (args.filterBy.search != null && args.filterBy.search.by != null && args.filterBy.search.value != null) { switch (args.filterBy.search.by) { - case "name": + case "name": if (args.filterBy.search.value.length > 0) - array1.push("&keyword=" + args.filterBy.search.value); + array1.push("&keyword=" + args.filterBy.search.value); break; } } @@ -9011,13 +9112,13 @@ dataType: "json", async: true, success: function (json) { - var groupbyObjs = json.listclustersresponse.cluster; + var groupbyObjs = json.listclustersresponse.cluster; if (groupbyObjs != null) { - addExtraPropertiesToGroupbyObjects(groupbyObjs, 'clusterid'); - } - args.response.success({ + addExtraPropertiesToGroupbyObjects(groupbyObjs, 'clusterid'); + } + args.response.success({ data: groupbyObjs - }); + }); } }); }, @@ -9060,11 +9161,12 @@ tabs: { details: { title: 'Virtual Routers group by cluster', - fields: [{ + fields:[ { name: { label: 'label.cluster' } - }, { + }, + { routerCount: { label: 'Total of Virtual Routers' }, @@ -9079,24 +9181,24 @@ } }, podname: { - label: 'label.pod' + label: 'label.pod' }, zonename: { - label: 'zone' + label: 'zone' } }], - dataProvider: function (args) { - addExtraPropertiesToGroupbyObject(args.context.routerGroupByCluster[0], 'clusterid'); - args.response.success({ + dataProvider: function (args) { + addExtraPropertiesToGroupbyObject(args.context.routerGroupByCluster[0], 'clusterid'); + args.response.success({ data: args.context.routerGroupByCluster[0], actionFilter: routerGroupActionfilter - }); + }); } } } } } - }, + }, routerGroupByAccount: { id: 'routerGroupByAccount', type: 'select', @@ -9109,7 +9211,7 @@ label: 'label.account' }, domain: { - label: 'label.domain' + label: 'label.domain' }, routerCount: { label: 'Total of Virtual Routers' @@ -9125,27 +9227,27 @@ } } }, - + dataProvider: function (args) { - var array1 = []; + var array1 =[]; if (args.filterBy != null) { if (args.filterBy.search != null && args.filterBy.search.by != null && args.filterBy.search.value != null) { switch (args.filterBy.search.by) { - case "name": + case "name": if (args.filterBy.search.value.length > 0) - array1.push("&keyword=" + args.filterBy.search.value); + array1.push("&keyword=" + args.filterBy.search.value); break; } } } $.ajax({ - url: createURL("listAccounts&listAll=true&page=" + args.page + "&pagesize=" + pageSize + array1.join("")), - success: function (json) { + url: createURL("listAccounts&listAll=true&page=" + args.page + "&pagesize=" + pageSize + array1.join("")), + success: function (json) { var accountObjs = json.listaccountsresponse.account; if (accountObjs != null) { for (var i = 0; i < accountObjs.length; i++) { - var currentPage = 1; - $.ajax({ + var currentPage = 1; + $.ajax({ url: createURL('listRouters'), data: { account: accountObjs[i].name, @@ -9155,13 +9257,13 @@ pagesize: pageSize //global variable }, async: false, - success: function (json) { + success: function (json) { if (json.listroutersresponse.count != undefined) { accountObjs[i].routerCount = json.listroutersresponse.count; - var routerCountFromAllPages = json.listroutersresponse.count; + var routerCountFromAllPages = json.listroutersresponse.count; var routerCountFromFirstPageToCurrentPage = json.listroutersresponse.router.length; - var routerRequiresUpgrade = 0; - var callListApiWithPage = function () { + var routerRequiresUpgrade = 0; + var callListApiWithPage = function () { $.ajax({ url: createURL('listRouters'), async: false, @@ -9172,7 +9274,7 @@ page: currentPage, pagesize: pageSize //global variable }, - success: function (json) { + success: function (json) { routerCountFromFirstPageToCurrentPage += json.listroutersresponse.router.length; var items = json.listroutersresponse.router; for (var i = 0; i < items.length; i++) { @@ -9186,13 +9288,12 @@ } } }); - } + } if (routerCountFromFirstPageToCurrentPage < routerCountFromAllPages) { currentPage++; callListApiWithPage(); - } + } accountObjs[i].routerRequiresUpgrade = routerRequiresUpgrade; - } else { accountObjs[i].routerCount = 0; accountObjs[i].routerRequiresUpgrade = 0; @@ -9220,7 +9321,7 @@ return 'Upgrade Router to Use Newer Template'; } }, - action: function (args) { + action: function (args) { $.ajax({ url: createURL('upgradeRouterTemplate'), data: { @@ -9247,14 +9348,15 @@ tabs: { details: { title: 'Virtual Routers group by account', - fields: [{ + fields:[ { name: { label: 'label.account' }, domain: { label: 'label.domain' } - }, { + }, + { routerCount: { label: 'Total of Virtual Routers' }, @@ -9269,7 +9371,7 @@ } } }], - dataProvider: function (args) { + dataProvider: function (args) { var currentPage = 1; $.ajax({ url: createURL('listRouters'), @@ -9281,13 +9383,13 @@ pagesize: pageSize //global variable }, async: false, - success: function (json) { + success: function (json) { if (json.listroutersresponse.count != undefined) { args.context.routerGroupByAccount[0].routerCount = json.listroutersresponse.count; - var routerCountFromAllPages = json.listroutersresponse.count; + var routerCountFromAllPages = json.listroutersresponse.count; var routerCountFromFirstPageToCurrentPage = json.listroutersresponse.router.length; var routerRequiresUpgrade = 0; - var callListApiWithPage = function () { + var callListApiWithPage = function () { $.ajax({ url: createURL('listRouters'), async: false, @@ -9312,20 +9414,19 @@ } } }); - } + } if (routerCountFromFirstPageToCurrentPage < routerCountFromAllPages) { currentPage++; callListApiWithPage(); } args.context.routerGroupByAccount[0].routerRequiresUpgrade = routerRequiresUpgrade; - } else { args.context.routerGroupByAccount[0].routerCount = 0; args.context.routerGroupByAccount[0].routerRequiresUpgrade = 0; } } }); - setTimeout(function() { + setTimeout(function () { args.response.success({ data: args.context.routerGroupByAccount[0], actionFilter: routerGroupActionfilter @@ -9336,7 +9437,7 @@ } } } - } + } } }, systemVms: { @@ -9349,13 +9450,11 @@ }, systemvmtype: { label: 'label.type', - converter: function(args) { + converter: function (args) { if (args == "consoleproxy") - return "Console Proxy VM"; - else if (args == "secondarystoragevm") - return "Secondary Storage VM"; - else - return args; + return "Console Proxy VM"; else if (args == "secondarystoragevm") + return "Secondary Storage VM"; else + return args; } }, zonename: { @@ -9363,7 +9462,7 @@ }, state: { label: 'VM state', - converter: function(str) { + converter: function (str) { // For localization return str; }, @@ -9374,7 +9473,7 @@ 'Destroyed': 'off' } }, - + agentstate: { label: 'Agent State', indicator: { @@ -9382,28 +9481,26 @@ 'Down': 'off' } } - - }, - dataProvider: function(args) { - var array1 = []; + dataProvider: function (args) { + var array1 =[]; if (args.filterBy != null) { if (args.filterBy.search != null && args.filterBy.search.by != null && args.filterBy.search.value != null) { switch (args.filterBy.search.by) { case "name": - if (args.filterBy.search.value.length > 0) - array1.push("&keyword=" + args.filterBy.search.value); - break; + if (args.filterBy.search.value.length > 0) + array1.push("&keyword=" + args.filterBy.search.value); + break; } } } - + var selectedZoneObj = args.context.physicalResources[0]; $.ajax({ url: createURL("listSystemVms&zoneid=" + selectedZoneObj.id + "&page=" + args.page + "&pagesize=" + pageSize + array1.join("")), dataType: "json", async: true, - success: function(json) { + success: function (json) { var items = json.listsystemvmsresponse.systemvm; args.response.success({ actionFilter: systemvmActionfilter, @@ -9412,34 +9509,34 @@ } }); }, - + detailView: { name: 'System VM details', actions: { start: { label: 'label.action.start.systemvm', messages: { - confirm: function(args) { + confirm: function (args) { return 'message.action.start.systemvm'; }, - notification: function(args) { + notification: function (args) { return 'label.action.start.systemvm'; } }, - action: function(args) { + action: function (args) { $.ajax({ url: createURL('startSystemVm&id=' + args.context.systemVMs[0].id), dataType: 'json', async: true, - success: function(json) { + success: function (json) { var jid = json.startsystemvmresponse.jobid; args.response.success({ _custom: { jobId: jid, - getUpdatedItem: function(json) { + getUpdatedItem: function (json) { return json.queryasyncjobresultresponse.jobresult.systemvm; }, - getActionFilter: function() { + getActionFilter: function () { return systemvmActionfilter; } } @@ -9451,31 +9548,31 @@ poll: pollAsyncJobResult } }, - + stop: { label: 'label.action.stop.systemvm', messages: { - confirm: function(args) { + confirm: function (args) { return 'message.action.stop.systemvm'; }, - notification: function(args) { + notification: function (args) { return 'label.action.stop.systemvm'; } }, - action: function(args) { + action: function (args) { $.ajax({ url: createURL('stopSystemVm&id=' + args.context.systemVMs[0].id), dataType: 'json', async: true, - success: function(json) { + success: function (json) { var jid = json.stopsystemvmresponse.jobid; args.response.success({ _custom: { jobId: jid, - getUpdatedItem: function(json) { + getUpdatedItem: function (json) { return json.queryasyncjobresultresponse.jobresult.systemvm; }, - getActionFilter: function() { + getActionFilter: function () { return systemvmActionfilter; } } @@ -9487,31 +9584,31 @@ poll: pollAsyncJobResult } }, - + restart: { label: 'label.action.reboot.systemvm', messages: { - confirm: function(args) { + confirm: function (args) { return 'message.action.reboot.systemvm'; }, - notification: function(args) { + notification: function (args) { return 'label.action.reboot.systemvm'; } }, - action: function(args) { + action: function (args) { $.ajax({ url: createURL('rebootSystemVm&id=' + args.context.systemVMs[0].id), dataType: 'json', async: true, - success: function(json) { + success: function (json) { var jid = json.rebootsystemvmresponse.jobid; args.response.success({ _custom: { jobId: jid, - getUpdatedItem: function(json) { + getUpdatedItem: function (json) { return json.queryasyncjobresultresponse.jobresult.systemvm; }, - getActionFilter: function() { + getActionFilter: function () { return systemvmActionfilter; } } @@ -9523,27 +9620,27 @@ poll: pollAsyncJobResult } }, - + remove: { label: 'label.action.destroy.systemvm', messages: { - confirm: function(args) { + confirm: function (args) { return 'message.action.destroy.systemvm'; }, - notification: function(args) { + notification: function (args) { return 'label.action.destroy.systemvm'; } }, - action: function(args) { + action: function (args) { $.ajax({ url: createURL('destroySystemVm&id=' + args.context.systemVMs[0].id), dataType: 'json', async: true, - success: function(json) { + success: function (json) { var jid = json.destroysystemvmresponse.jobid; args.response.success({ _custom: { - getUpdatedItem: function() { + getUpdatedItem: function () { return { state: 'Destroyed' }; @@ -9558,11 +9655,11 @@ poll: pollAsyncJobResult } }, - + migrate: { label: 'label.action.migrate.systemvm', messages: { - notification: function(args) { + notification: function (args) { return 'label.action.migrate.systemvm'; } }, @@ -9575,19 +9672,19 @@ validation: { required: true }, - select: function(args) { + select: function (args) { $.ajax({ url: createURL("findHostsForMigration&VirtualMachineId=" + args.context.systemVMs[0].id), dataType: "json", async: true, - success: function(json) { + success: function (json) { var hostObjs = json.findhostsformigrationresponse.host; - var items = []; - $(hostObjs).each(function() { + var items =[]; + $(hostObjs).each(function () { if (this.requiresStorageMotion == false) { items.push({ id: this.id, - description: (this.name + " (" + (this.suitableformigration ? "Suitable" : "Not Suitable") + ")") + description: (this.name + " (" + (this.suitableformigration ? "Suitable": "Not Suitable") + ")") }); } }); @@ -9597,30 +9694,30 @@ } }); }, - error: function(XMLHttpResponse) { + error: function (XMLHttpResponse) { var errorMsg = parseXMLHttpResponse(XMLHttpResponse); args.response.error(errorMsg); } } } }, - action: function(args) { + action: function (args) { $.ajax({ url: createURL("migrateSystemVm&hostid=" + args.data.hostId + "&virtualmachineid=" + args.context.systemVMs[0].id), dataType: "json", async: true, - success: function(json) { + success: function (json) { var jid = json.migratesystemvmresponse.jobid; args.response.success({ _custom: { jobId: jid, - getUpdatedItem: function(json) { + getUpdatedItem: function (json) { //return json.queryasyncjobresultresponse.jobresult.systemvminstance; //not all properties returned in systemvminstance $.ajax({ url: createURL("listSystemVms&id=" + json.queryasyncjobresultresponse.jobresult.systemvminstance.id), dataType: "json", async: false, - success: function(json) { + success: function (json) { var items = json.listsystemvmsresponse.systemvm; if (items != null && items.length > 0) { return items[0]; @@ -9628,7 +9725,7 @@ } }); }, - getActionFilter: function() { + getActionFilter: function () { return systemvmActionfilter; } } @@ -9640,37 +9737,36 @@ poll: pollAsyncJobResult } }, - + scaleUp: { label: 'label.change.service.offering', createForm: { title: 'label.change.service.offering', - desc: function(args) { - var description = ''; - var vmObj = args.jsonObj; - //if (vmObj.state == 'Running' && vmObj.hypervisor == 'VMware') { //needs to wait for API fix that will return hypervisor property - if (vmObj.state == 'Running') { - description = 'Please read the dynamic scaling section in the admin guide before scaling up.'; - } + desc: function (args) { + var description = ''; + var vmObj = args.jsonObj; + //if (vmObj.state == 'Running' && vmObj.hypervisor == 'VMware') { //needs to wait for API fix that will return hypervisor property + if (vmObj.state == 'Running') { + description = 'Please read the dynamic scaling section in the admin guide before scaling up.'; + } return description; }, fields: { serviceOfferingId: { label: 'label.compute.offering', - select: function(args) { + select: function (args) { var apiCmd = "listServiceOfferings&issystem=true"; if (args.context.systemVMs[0].systemvmtype == "secondarystoragevm") - apiCmd += "&systemvmtype=secondarystoragevm"; - else if (args.context.systemVMs[0].systemvmtype == "consoleproxy") - apiCmd += "&systemvmtype=consoleproxy"; + apiCmd += "&systemvmtype=secondarystoragevm"; else if (args.context.systemVMs[0].systemvmtype == "consoleproxy") + apiCmd += "&systemvmtype=consoleproxy"; $.ajax({ url: createURL(apiCmd), dataType: "json", async: true, - success: function(json) { + success: function (json) { var serviceofferings = json.listserviceofferingsresponse.serviceoffering; - var items = []; - $(serviceofferings).each(function() { + var items =[]; + $(serviceofferings).each(function () { if (this.id != args.context.systemVMs[0].serviceofferingid) { items.push({ id: this.id, @@ -9687,58 +9783,57 @@ } } }, - - action: function(args) { + + action: function (args) { $.ajax({ url: createURL("scaleSystemVm&id=" + args.context.systemVMs[0].id + "&serviceofferingid=" + args.data.serviceOfferingId), dataType: "json", async: true, - success: function(json) { + success: function (json) { var jid = json.changeserviceforsystemvmresponse.jobid; args.response.success({ _custom: { jobId: jid, - getUpdatedItem: function(json) { + getUpdatedItem: function (json) { return json.queryasyncjobresultresponse.jobresult.systemvm; }, - getActionFilter: function() { + getActionFilter: function () { return vmActionfilter; } } }); }, - error: function(json) { + error: function (json) { args.response.error(parseXMLHttpResponse(json)); } - }); }, messages: { - confirm: function(args) { + confirm: function (args) { return 'Do you really want to scale up the system VM ?'; }, - notification: function(args) { - + notification: function (args) { + return 'System VM Scaled Up'; } }, notification: { poll: pollAsyncJobResult } - }, - - - + + + viewConsole: { label: 'label.view.console', action: { externalLink: { - url: function(args) { + url: function (args) { return clientConsoleUrl + '?cmd=access&vm=' + args.context.systemVMs[0].id; }, - title: function(args) { - return args.context.systemVMs[0].id.substr(0, 8); //title in window.open() can't have space nor longer than 8 characters. Otherwise, IE browser will have error. + title: function (args) { + return args.context.systemVMs[0].id.substr(0, 8); + //title in window.open() can't have space nor longer than 8 characters. Otherwise, IE browser will have error. }, width: 820, height: 640 @@ -9749,11 +9844,12 @@ tabs: { details: { title: 'label.details', - fields: [{ + fields:[ { name: { label: 'label.name' } - }, { + }, + { id: { label: 'label.id' }, @@ -9762,13 +9858,11 @@ }, systemvmtype: { label: 'label.type', - converter: function(args) { + converter: function (args) { if (args == "consoleproxy") - return "Console Proxy VM"; - else if (args == "secondarystoragevm") - return "Secondary Storage VM"; - else - return args; + return "Console Proxy VM"; else if (args == "secondarystoragevm") + return "Secondary Storage VM"; else + return args; } }, zonename: { @@ -9797,12 +9891,12 @@ label: 'label.active.sessions' } }], - dataProvider: function(args) { + dataProvider: function (args) { $.ajax({ url: createURL("listSystemVms&id=" + args.context.systemVMs[0].id), dataType: "json", async: true, - success: function(json) { + success: function (json) { args.response.success({ actionFilter: systemvmActionfilter, data: json.listsystemvmsresponse.systemvm[0] @@ -9826,14 +9920,14 @@ label: 'label.ip.address' }, lbdevicestate: { - converter: function(str) { + converter: function (str) { // For localization return str; }, label: 'label.status' } }, - dataProvider: function(args) { + dataProvider: function (args) { $.ajax({ url: createURL("listNetscalerLoadBalancers&physicalnetworkid=" + selectedPhysicalNetworkObj.id), data: { @@ -9842,7 +9936,7 @@ }, dataType: "json", async: false, - success: function(json) { + success: function (json) { var items = json.listnetscalerloadbalancerresponse.netscalerloadbalancer; args.response.success({ data: items @@ -9869,8 +9963,8 @@ }, networkdevicetype: { label: 'label.type', - select: function(args) { - var items = []; + select: function (args) { + var items =[]; items.push({ id: "NetscalerMPXLoadBalancer", description: "NetScaler MPX LoadBalancer" @@ -9894,7 +9988,7 @@ privateinterface: { label: 'label.private.interface' }, - + gslbprovider: { label: 'GSLB service', isBoolean: true, @@ -9906,20 +10000,20 @@ gslbproviderprivateip: { label: 'GSLB service Private IP' }, - + numretries: { label: 'label.numretries', defaultValue: '2' }, /* inline: { - label: 'Mode', - select: function(args) { - var items = []; - items.push({id: "false", description: "side by side"}); - items.push({id: "true", description: "inline"}); - args.response.success({data: items}); - } - },*/ + label: 'Mode', + select: function(args) { + var items = []; + items.push({id: "false", description: "side by side"}); + items.push({id: "true", description: "inline"}); + args.response.success({data: items}); + } + },*/ dedicated: { label: 'label.dedicated', isBoolean: true, @@ -9934,38 +10028,39 @@ } } }, - action: function(args) { - if (nspMap["netscaler"] == null) { + action: function (args) { + if (nspMap[ "netscaler"] == null) { $.ajax({ url: createURL("addNetworkServiceProvider&name=Netscaler&physicalnetworkid=" + selectedPhysicalNetworkObj.id), dataType: "json", async: true, - success: function(json) { + success: function (json) { var jobId = json.addnetworkserviceproviderresponse.jobid; - var addNetscalerProviderIntervalID = setInterval(function() { + var addNetscalerProviderIntervalID = setInterval(function () { $.ajax({ url: createURL("queryAsyncJobResult&jobId=" + jobId), dataType: "json", - success: function(json) { + success: function (json) { var result = json.queryasyncjobresultresponse; if (result.jobstatus == 0) { return; //Job has not completed } else { clearInterval(addNetscalerProviderIntervalID); if (result.jobstatus == 1) { - nspMap["netscaler"] = result.jobresult.networkserviceprovider; + nspMap[ "netscaler"] = result.jobresult.networkserviceprovider; addExternalLoadBalancer(args, selectedPhysicalNetworkObj, "addNetscalerLoadBalancer", "addnetscalerloadbalancerresponse", "netscalerloadbalancer"); } else if (result.jobstatus == 2) { alert("addNetworkServiceProvider&name=Netscaler failed. Error: " + _s(result.jobresult.errortext)); } } }, - error: function(XMLHttpResponse) { + error: function (XMLHttpResponse) { var errorMsg = parseXMLHttpResponse(XMLHttpResponse); alert("addNetworkServiceProvider&name=Netscaler failed. Error: " + errorMsg); } }); - }, g_queryAsyncJobResultInterval); + }, + g_queryAsyncJobResultInterval); } }); } else { @@ -9973,7 +10068,7 @@ } }, messages: { - notification: function(args) { + notification: function (args) { return 'label.add.netScaler.device'; } }, @@ -9988,19 +10083,19 @@ 'remove': { label: 'label.delete.NetScaler', messages: { - confirm: function(args) { + confirm: function (args) { return 'message.confirm.delete.NetScaler'; }, - notification: function(args) { + notification: function (args) { return 'label.delete.NetScaler'; } }, - action: function(args) { + action: function (args) { $.ajax({ url: createURL("deleteNetscalerLoadBalancer&lbdeviceid=" + args.context.netscalerDevices[0].lbdeviceid), dataType: "json", async: true, - success: function(json) { + success: function (json) { var jid = json.deletenetscalerloadbalancerresponse.jobid; args.response.success({ _custom: { @@ -10008,8 +10103,8 @@ } }); }, - - error: function(json) { + + error: function (json) { args.response.error(parseXMLHttpResponse(json)); } }); @@ -10022,7 +10117,7 @@ tabs: { details: { title: 'label.details', - fields: [{ + fields:[ { lbdeviceid: { label: 'label.id' }, @@ -10053,12 +10148,12 @@ label: 'GSLB service Private IP' } }], - dataProvider: function(args) { + dataProvider: function (args) { $.ajax({ url: createURL("listNetscalerLoadBalancers&lbdeviceid=" + args.context.netscalerDevices[0].lbdeviceid), dataType: "json", async: true, - success: function(json) { + success: function (json) { var item = json.listnetscalerloadbalancerresponse.netscalerloadbalancer[0]; args.response.success({ data: item @@ -10071,7 +10166,7 @@ } } }, - + // Baremetal DHCP devices listView BaremetalDhcpDevices: { id: 'BaremetalDhcpDevices', @@ -10110,11 +10205,11 @@ } } }, - action: function(args) { + action: function (args) { addBaremetalDhcpDeviceFn(args); }, messages: { - notification: function(args) { + notification: function (args) { return 'Add Baremetal DHCP Device'; } }, @@ -10123,7 +10218,7 @@ } } }, - dataProvider: function(args) { + dataProvider: function (args) { $.ajax({ url: createURL('listBaremetalDhcp'), data: { @@ -10133,7 +10228,7 @@ }, dataType: "json", async: false, - success: function(json) { + success: function (json) { var items = json.listbaremetaldhcpresponse.baremetaldhcp; args.response.success({ data: items @@ -10143,7 +10238,7 @@ } } }, - + // Baremetal PXE devices listView BaremetalPxeDevices: { id: 'BaremetalPxeDevices', @@ -10188,11 +10283,11 @@ } } }, - action: function(args) { + action: function (args) { addBaremetalPxeDeviceFn(args); }, messages: { - notification: function(args) { + notification: function (args) { return 'Add Baremetal PXE Device'; } }, @@ -10201,7 +10296,7 @@ } } }, - dataProvider: function(args) { + dataProvider: function (args) { $.ajax({ url: createURL('listBaremetalPxeServers'), data: { @@ -10211,7 +10306,7 @@ }, dataType: "json", async: false, - success: function(json) { + success: function (json) { var items = json.listbaremetalpxeserversresponse.baremetalpxeserver; args.response.success({ data: items @@ -10221,7 +10316,7 @@ } } }, - + // F5 devices listView f5Devices: { id: 'f5Devices', @@ -10233,7 +10328,7 @@ label: 'label.ip.address' }, lbdevicestate: { - converter: function(str) { + converter: function (str) { // For localization return str; }, @@ -10259,8 +10354,8 @@ }, networkdevicetype: { label: 'label.type', - select: function(args) { - var items = []; + select: function (args) { + var items =[]; items.push({ id: "F5BigIpLoadBalancer", description: "F5 Big Ip Load Balancer" @@ -10282,16 +10377,16 @@ }, //Inline Mode has been moved from Add F5 Device to Create Network Offering (both backend and UI) /* - inline: { - label: 'Mode', - select: function(args) { - var items = []; - items.push({id: "false", description: "side by side"}); - items.push({id: "true", description: "inline"}); - args.response.success({data: items}); - } - }, - */ + inline: { + label: 'Mode', + select: function(args) { + var items = []; + items.push({id: "false", description: "side by side"}); + items.push({id: "true", description: "inline"}); + args.response.success({data: items}); + } + }, + */ dedicated: { label: 'label.dedicated', isBoolean: true, @@ -10306,38 +10401,39 @@ } } }, - action: function(args) { - if (nspMap["f5"] == null) { + action: function (args) { + if (nspMap[ "f5"] == null) { $.ajax({ url: createURL("addNetworkServiceProvider&name=F5BigIp&physicalnetworkid=" + selectedPhysicalNetworkObj.id), dataType: "json", async: true, - success: function(json) { + success: function (json) { var jobId = json.addnetworkserviceproviderresponse.jobid; - var addF5ProviderIntervalID = setInterval(function() { + var addF5ProviderIntervalID = setInterval(function () { $.ajax({ url: createURL("queryAsyncJobResult&jobId=" + jobId), dataType: "json", - success: function(json) { + success: function (json) { var result = json.queryasyncjobresultresponse; if (result.jobstatus == 0) { return; //Job has not completed } else { clearInterval(addF5ProviderIntervalID); if (result.jobstatus == 1) { - nspMap["f5"] = json.queryasyncjobresultresponse.jobresult.networkserviceprovider; + nspMap[ "f5"] = json.queryasyncjobresultresponse.jobresult.networkserviceprovider; addExternalLoadBalancer(args, selectedPhysicalNetworkObj, "addF5LoadBalancer", "addf5bigiploadbalancerresponse", "f5loadbalancer"); } else if (result.jobstatus == 2) { alert("addNetworkServiceProvider&name=F5BigIp failed. Error: " + _s(result.jobresult.errortext)); } } }, - error: function(XMLHttpResponse) { + error: function (XMLHttpResponse) { var errorMsg = parseXMLHttpResponse(XMLHttpResponse); alert("addNetworkServiceProvider&name=F5BigIpfailed. Error: " + errorMsg); } }); - }, g_queryAsyncJobResultInterval); + }, + g_queryAsyncJobResultInterval); } }); } else { @@ -10345,7 +10441,7 @@ } }, messages: { - notification: function(args) { + notification: function (args) { return 'Added new F5'; } }, @@ -10354,7 +10450,7 @@ } } }, - dataProvider: function(args) { + dataProvider: function (args) { $.ajax({ url: createURL("listF5LoadBalancers&physicalnetworkid=" + selectedPhysicalNetworkObj.id), data: { @@ -10363,7 +10459,7 @@ }, dataType: "json", async: false, - success: function(json) { + success: function (json) { var items = json.listf5loadbalancerresponse.f5loadbalancer; args.response.success({ data: items @@ -10377,19 +10473,19 @@ 'remove': { label: 'label.delete.F5', messages: { - confirm: function(args) { + confirm: function (args) { return 'message.confirm.delete.F5'; }, - notification: function(args) { + notification: function (args) { return 'label.delete.F5'; } }, - action: function(args) { + action: function (args) { $.ajax({ url: createURL("deleteF5LoadBalancer&lbdeviceid=" + args.context.f5Devices[0].lbdeviceid), dataType: "json", async: true, - success: function(json) { + success: function (json) { var jid = json.deletef5loadbalancerresponse.jobid; args.response.success({ _custom: { @@ -10407,7 +10503,7 @@ tabs: { details: { title: 'label.details', - fields: [{ + fields:[ { lbdeviceid: { label: 'label.id' }, @@ -10428,12 +10524,12 @@ converter: cloudStack.converters.toBooleanText } }], - dataProvider: function(args) { + dataProvider: function (args) { $.ajax({ url: createURL("listF5LoadBalancers&lbdeviceid=" + args.context.f5Devices[0].lbdeviceid), dataType: "json", async: true, - success: function(json) { + success: function (json) { var item = json.listf5loadbalancerresponse.f5loadbalancer[0]; args.response.success({ data: item @@ -10446,7 +10542,7 @@ } } }, - + //SRX devices listView srxDevices: { id: 'srxDevices', @@ -10482,8 +10578,8 @@ }, networkdevicetype: { label: 'label.type', - select: function(args) { - var items = []; + select: function (args) { + var items =[]; items.push({ id: "JuniperSRXFirewall", description: "Juniper SRX Firewall" @@ -10543,38 +10639,39 @@ } } }, - action: function(args) { - if (nspMap["srx"] == null) { + action: function (args) { + if (nspMap[ "srx"] == null) { $.ajax({ url: createURL("addNetworkServiceProvider&name=JuniperSRX&physicalnetworkid=" + selectedPhysicalNetworkObj.id), dataType: "json", async: true, - success: function(json) { + success: function (json) { var jobId = json.addnetworkserviceproviderresponse.jobid; - var addJuniperSRXProviderIntervalID = setInterval(function() { + var addJuniperSRXProviderIntervalID = setInterval(function () { $.ajax({ url: createURL("queryAsyncJobResult&jobId=" + jobId), dataType: "json", - success: function(json) { + success: function (json) { var result = json.queryasyncjobresultresponse; if (result.jobstatus == 0) { return; //Job has not completed } else { clearInterval(addJuniperSRXProviderIntervalID); if (result.jobstatus == 1) { - nspMap["srx"] = json.queryasyncjobresultresponse.jobresult.networkserviceprovider; + nspMap[ "srx"] = json.queryasyncjobresultresponse.jobresult.networkserviceprovider; addExternalFirewall(args, selectedPhysicalNetworkObj, "addSrxFirewall", "addsrxfirewallresponse", "srxfirewall"); } else if (result.jobstatus == 2) { alert("addNetworkServiceProvider&name=JuniperSRX failed. Error: " + _s(result.jobresult.errortext)); } } }, - error: function(XMLHttpResponse) { + error: function (XMLHttpResponse) { var errorMsg = parseXMLHttpResponse(XMLHttpResponse); alert("addNetworkServiceProvider&name=JuniperSRX failed. Error: " + errorMsg); } }); - }, g_queryAsyncJobResultInterval); + }, + g_queryAsyncJobResultInterval); } }); } else { @@ -10582,7 +10679,7 @@ } }, messages: { - notification: function(args) { + notification: function (args) { return 'label.add.SRX.device'; } }, @@ -10591,7 +10688,7 @@ } } }, - dataProvider: function(args) { + dataProvider: function (args) { $.ajax({ url: createURL("listSrxFirewalls&physicalnetworkid=" + selectedPhysicalNetworkObj.id), data: { @@ -10600,7 +10697,7 @@ }, dataType: "json", async: false, - success: function(json) { + success: function (json) { var items = json.listsrxfirewallresponse.srxfirewall; args.response.success({ data: items @@ -10614,19 +10711,19 @@ 'remove': { label: 'label.delete.SRX', messages: { - confirm: function(args) { + confirm: function (args) { return 'message.confirm.delete.SRX'; }, - notification: function(args) { + notification: function (args) { return 'label.delete.SRX'; } }, - action: function(args) { + action: function (args) { $.ajax({ url: createURL("deleteSrxFirewall&fwdeviceid=" + args.context.srxDevices[0].fwdeviceid), dataType: "json", async: true, - success: function(json) { + success: function (json) { var jid = json.deletesrxfirewallresponse.jobid; args.response.success({ _custom: { @@ -10644,7 +10741,7 @@ tabs: { details: { title: 'label.details', - fields: [{ + fields:[ { fwdeviceid: { label: 'label.id' }, @@ -10664,12 +10761,12 @@ label: 'label.timeout' } }], - dataProvider: function(args) { + dataProvider: function (args) { $.ajax({ url: createURL("listSrxFirewalls&fwdeviceid=" + args.context.srxDevices[0].fwdeviceid), dataType: "json", async: true, - success: function(json) { + success: function (json) { var item = json.listsrxfirewallresponse.srxfirewall[0]; args.response.success({ data: item @@ -10682,7 +10779,7 @@ } } }, - + //Palo Alto devices listView paDevices: { id: 'paDevices', @@ -10719,7 +10816,7 @@ networkdevicetype: { label: 'label.type', select: function (args) { - var items = []; + var items =[]; items.push({ id: "PaloAltoFirewall", description: "Palo Alto Firewall" @@ -10787,7 +10884,7 @@ } }, action: function (args) { - if (nspMap["pa"] == null) { + if (nspMap[ "pa"] == null) { $.ajax({ url: createURL("addNetworkServiceProvider&name=PaloAlto&physicalnetworkid=" + selectedPhysicalNetworkObj.id), dataType: "json", @@ -10805,7 +10902,7 @@ } else { clearInterval(addPaloAltoProviderIntervalID); if (result.jobstatus == 1) { - nspMap["pa"] = json.queryasyncjobresultresponse.jobresult.networkserviceprovider; + nspMap[ "pa"] = json.queryasyncjobresultresponse.jobresult.networkserviceprovider; addExternalFirewall(args, selectedPhysicalNetworkObj, "addPaloAltoFirewall", "addpaloaltofirewallresponse", "pafirewall"); } else if (result.jobstatus == 2) { alert("addNetworkServiceProvider&name=Palo Alto failed. Error: " + _s(result.jobresult.errortext)); @@ -10817,7 +10914,8 @@ alert("addNetworkServiceProvider&name=Palo Alto failed. Error: " + errorMsg); } }); - }, 3000); + }, + 3000); } }); } else { @@ -10887,7 +10985,7 @@ tabs: { details: { title: 'label.details', - fields: [{ + fields:[ { fwdeviceid: { label: 'label.id' }, @@ -10925,7 +11023,7 @@ } } }, - + // FIXME convert to nicira detailview // NiciraNvp devices listView niciraNvpDevices: { @@ -10949,7 +11047,9 @@ label: 'label.add.NiciraNvp.device', createForm: { title: 'label.add.NiciraNvp.device', - preFilter: function(args) {}, // TODO What is this? + preFilter: function (args) { + }, + // TODO What is this? fields: { host: { label: 'label.ip.address' @@ -10973,47 +11073,48 @@ } } }, - action: function(args) { - if (nspMap["niciraNvp"] == null) { + action: function (args) { + if (nspMap[ "niciraNvp"] == null) { $.ajax({ url: createURL("addNetworkServiceProvider&name=NiciraNvp&physicalnetworkid=" + selectedPhysicalNetworkObj.id), dataType: "json", async: true, - success: function(json) { + success: function (json) { var jobId = json.addnetworkserviceproviderresponse.jobid; - var addNiciraNvpProviderIntervalID = setInterval(function() { + var addNiciraNvpProviderIntervalID = setInterval(function () { $.ajax({ url: createURL("queryAsyncJobResult&jobId=" + jobId), dataType: "json", - success: function(json) { + success: function (json) { var result = json.queryasyncjobresultresponse; if (result.jobstatus == 0) { return; // Job has not completed } else { clearInterval(addNiciraNvpProviderIntervalID); if (result.jobstatus == 1) { - nspMap["niciraNvp"] = json.queryasyncjobresultresponse.jobresult.networkserviceprovider; + nspMap[ "niciraNvp"] = json.queryasyncjobresultresponse.jobresult.networkserviceprovider; addNiciraNvpDevice(args, selectedPhysicalNetworkObj, "addNiciraNvpDevice", "addniciranvpdeviceresponse", "niciranvpdevice") } else if (result.jobstatus == 2) { alert("addNetworkServiceProvider&name=NiciraNvp failed. Error: " + _s(result.jobresult.errortext)); } } }, - error: function(XMLHttpResponse) { + error: function (XMLHttpResponse) { var errorMsg = parseXMLHttpResponse(XMLHttpResponse); alert("addNetworkServiceProvider&name=NiciraNvp failed. Error: " + errorMsg); } }); - }, g_queryAsyncJobResultInterval); + }, + g_queryAsyncJobResultInterval); } }); } else { addNiciraNvpDevice(args, selectedPhysicalNetworkObj, "addNiciraNvpDevice", "addniciranvpdeviceresponse", "niciranvpdevice") } }, - + messages: { - notification: function(args) { + notification: function (args) { return 'Added new Nicira Nvp Controller'; } }, @@ -11022,7 +11123,7 @@ } } }, - dataProvider: function(args) { + dataProvider: function (args) { $.ajax({ url: createURL("listNiciraNvpDevices&physicalnetworkid=" + selectedPhysicalNetworkObj.id), data: { @@ -11031,7 +11132,7 @@ }, dataType: "json", async: false, - success: function(json) { + success: function (json) { var items = json.listniciranvpdeviceresponse.niciranvpdevice; args.response.success({ data: items @@ -11045,19 +11146,19 @@ 'remove': { label: 'label.delete.NiciaNvp', messages: { - confirm: function(args) { + confirm: function (args) { return 'message.confirm.delete.NiciraNvp'; }, - notification: function(args) { + notification: function (args) { return 'label.delete.NiciraNvp'; } }, - action: function(args) { + action: function (args) { $.ajax({ url: createURL("deleteNiciraNvpDevice&nvpdeviceid=" + args.context.niciraNvpDevices[0].nvpdeviceid), dataType: "json", async: true, - success: function(json) { + success: function (json) { var jid = json.deleteniciranvpdeviceresponse.jobid; args.response.success({ _custom: { @@ -11075,7 +11176,7 @@ tabs: { details: { title: 'label.details', - fields: [{ + fields:[ { nvpdeviceid: { label: 'label.id' }, @@ -11089,12 +11190,12 @@ label: 'label.nicira.l3gatewayserviceuuid' } }], - dataProvider: function(args) { + dataProvider: function (args) { $.ajax({ url: createURL("listNiciraNvpDevices&nvpdeviceid=" + args.context.niciraNvpDevices[0].nvpdeviceid), dataType: "json", async: true, - success: function(json) { + success: function (json) { var item = json.listniciranvpdeviceresponse.niciranvpdevice[0]; args.response.success({ data: item @@ -11122,7 +11223,8 @@ label: 'label.add.BigSwitchVns.device', createForm: { title: 'label.add.BigSwitchVns.device', - preFilter: function(args) {}, + preFilter: function (args) { + }, fields: { host: { label: 'label.ip.address' @@ -11133,47 +11235,48 @@ } } }, - action: function(args) { - if (nspMap["bigswitchVns"] == null) { + action: function (args) { + if (nspMap[ "bigswitchVns"] == null) { $.ajax({ url: createURL("addNetworkServiceProvider&name=BigSwitchVns&physicalnetworkid=" + selectedPhysicalNetworkObj.id), dataType: "json", async: true, - success: function(json) { + success: function (json) { var jobId = json.addnetworkserviceproviderresponse.jobid; - var addBigSwitchVnsProviderIntervalID = setInterval(function() { + var addBigSwitchVnsProviderIntervalID = setInterval(function () { $.ajax({ url: createURL("queryAsyncJobResult&jobId=" + jobId), dataType: "json", - success: function(json) { + success: function (json) { var result = json.queryasyncjobresultresponse; if (result.jobstatus == 0) { return; } else { clearInterval(addBigSwitchVnsProviderIntervalID); if (result.jobstatus == 1) { - nspMap["bigswitchVns"] = json.queryasyncjobresultresponse.jobresult.networkserviceprovider; + nspMap[ "bigswitchVns"] = json.queryasyncjobresultresponse.jobresult.networkserviceprovider; addBigSwitchVnsDevice(args, selectedPhysicalNetworkObj, "addBigSwitchVnsDevice", "addbigswitchvnsdeviceresponse", "bigswitchvnsdevice") } else if (result.jobstatus == 2) { alert("addNetworkServiceProvider&name=BigSwitchVns failed. Error: " + _s(result.jobresult.errortext)); } } }, - error: function(XMLHttpResponse) { + error: function (XMLHttpResponse) { var errorMsg = parseXMLHttpResponse(XMLHttpResponse); alert("addNetworkServiceProvider&name=BigSwitchVns failed. Error: " + errorMsg); } }); - }, 3000); + }, + 3000); } }); } else { addBigSwitchVnsDevice(args, selectedPhysicalNetworkObj, "addBigSwitchVnsDevice", "addbigswitchvnsdeviceresponse", "bigswitchvnsdevice") } }, - + messages: { - notification: function(args) { + notification: function (args) { return 'Added new BigSwitch Vns Controller'; } }, @@ -11182,7 +11285,7 @@ } } }, - dataProvider: function(args) { + dataProvider: function (args) { $.ajax({ url: createURL("listBigSwitchVnsDevices&physicalnetworkid=" + selectedPhysicalNetworkObj.id), data: { @@ -11191,7 +11294,7 @@ }, dataType: "json", async: false, - success: function(json) { + success: function (json) { var items = json.listbigswitchvnsdeviceresponse.bigswitchvnsdevice; args.response.success({ data: items @@ -11205,19 +11308,19 @@ 'remove': { label: 'label.delete.BigSwitchVns', messages: { - confirm: function(args) { + confirm: function (args) { return 'message.confirm.delete.BigSwitchVns'; }, - notification: function(args) { + notification: function (args) { return 'label.delete.BigSwitchVns'; } }, - action: function(args) { + action: function (args) { $.ajax({ url: createURL("deleteBigSwitchVnsDevice&vnsdeviceid=" + args.context.bigswitchvnsDevices[0].vnsdeviceid), dataType: "json", async: true, - success: function(json) { + success: function (json) { var jid = json.deletebigswitchvnsdeviceresponse.jobid; args.response.success({ _custom: { @@ -11235,7 +11338,7 @@ tabs: { details: { title: 'label.details', - fields: [{ + fields:[ { vnsdeviceid: { label: 'label.id' }, @@ -11243,12 +11346,12 @@ label: 'label.ip.address' } }], - dataProvider: function(args) { + dataProvider: function (args) { $.ajax({ url: createURL("listBigSwitchVnsDevices&vnsdeviceid=" + args.context.bigswitchVnsDevices[0].vnsdeviceid), dataType: "json", async: true, - success: function(json) { + success: function (json) { var item = json.listbigswitchvnsdeviceresponse.bigswitchvnsdevice[0]; args.response.success({ data: item @@ -11277,32 +11380,32 @@ label: 'label.netmask' }, allocationstate: { - converter: function(str) { + converter: function (str) { // For localization return str; }, label: 'label.allocation.state' } }, - - dataProvider: function(args) { - var array1 = []; + + dataProvider: function (args) { + var array1 =[]; if (args.filterBy != null) { if (args.filterBy.search != null && args.filterBy.search.by != null && args.filterBy.search.value != null) { switch (args.filterBy.search.by) { case "name": - if (args.filterBy.search.value.length > 0) - array1.push("&keyword=" + args.filterBy.search.value); - break; + if (args.filterBy.search.value.length > 0) + array1.push("&keyword=" + args.filterBy.search.value); + break; } } } - + $.ajax({ url: createURL("listPods&zoneid=" + args.context.zones[0].id + "&page=" + args.page + "&pagesize=" + pageSize + array1.join("")), dataType: "json", async: true, - success: function(json) { + success: function (json) { var items = json.listpodsresponse.pod; args.response.success({ actionFilter: podActionfilter, @@ -11311,11 +11414,11 @@ } }); }, - + actions: { add: { label: 'label.add.pod', - + createForm: { title: 'label.add.pod', fields: { @@ -11325,21 +11428,21 @@ validation: { required: true }, - select: function(args) { + select: function (args) { var data = args.context.zones ? { id: args.context.zones[0].id - } : { + }: { listAll: true }; - + $.ajax({ url: createURL('listZones'), data: data, - success: function(json) { - var zones = json.listzonesresponse.zone ? json.listzonesresponse.zone : []; - + success: function (json) { + var zones = json.listzonesresponse.zone ? json.listzonesresponse.zone:[]; + args.response.success({ - data: $.map(zones, function(zone) { + data: $.map(zones, function (zone) { return { id: zone.id, description: zone.name @@ -11385,14 +11488,14 @@ required: false } }, - + isDedicated: { label: 'Dedicate', isBoolean: true, isChecked: false, docID: 'helpDedicateResource' }, - + domainId: { label: 'Domain', isHidden: true, @@ -11400,32 +11503,30 @@ required: true }, dependsOn: 'isDedicated', - select: function(args) { + select: function (args) { $.ajax({ url: createURL("listDomains&listAll=true"), dataType: "json", async: false, - success: function(json) { + success: function (json) { var domainObjs = json.listdomainsresponse.domain; - var items = []; - - $(domainObjs).each(function() { + var items =[]; + + $(domainObjs).each(function () { items.push({ id: this.id, description: this.name }); }); - + args.response.success({ data: items }); } - - }); } }, - + accountId: { label: 'Account', isHidden: true, @@ -11435,43 +11536,43 @@ required: false } } - } }, - - action: function(args) { - var array1 = []; - var appendData = args.data.append ? args.data.append : {}; - + + action: function (args) { + var array1 =[]; + var appendData = args.data.append ? args.data.append: { + }; + array1.push("&zoneId=" + args.data.zoneid); array1.push("&name=" + todb(args.data.podname)); array1.push("&gateway=" + todb(args.data.reservedSystemGateway)); array1.push("&netmask=" + todb(args.data.reservedSystemNetmask)); array1.push("&startIp=" + todb(args.data.reservedSystemStartIp)); - + var endip = args.data.reservedSystemEndIp; //optional if (endip != null && endip.length > 0) - array1.push("&endIp=" + todb(endip)); + array1.push("&endIp=" + todb(endip)); var podId = null; $.ajax({ url: createURL("createPod" + array1.join("")), data: appendData, dataType: "json", - success: function(json) { + success: function (json) { var item = json.createpodresponse.pod; podId = json.createpodresponse.pod.id; - + //EXPLICIT DEDICATION if (args.$form.find('.form-item[rel=isDedicated]').find('input[type=checkbox]').is(':Checked') == true) { - var array2 = []; + var array2 =[]; if (args.data.accountId != "") - array2.push("&account=" + todb(args.data.accountId)); - + array2.push("&account=" + todb(args.data.accountId)); + if (podId != null) { $.ajax({ url: createURL("dedicatePod&podId=" + podId + "&domainId=" + args.data.domainId + array2.join("")), dataType: "json", - success: function(json) { + success: function (json) { var jid = json.dedicatepodresponse.jobid; args.response.success({ _custom: { @@ -11482,57 +11583,56 @@ interval: 4500, desc: "Dedicate Pod" }, - + data: item }); - }, - - error: function(json) { + + error: function (json) { args.response.error(parseXMLHttpResponse(XMLHttpResponse)); } }); - } } args.response.success({ data: item }); }, - error: function(XMLHttpResponse) { + error: function (XMLHttpResponse) { var errorMsg = parseXMLHttpResponse(XMLHttpResponse); args.response.error(errorMsg); } - }); }, - + notification: { - poll: function(args) { + poll: function (args) { args.complete({ actionFilter: podActionfilter }); } }, - + messages: { - notification: function(args) { + notification: function (args) { return 'label.add.pod'; } } } }, - + detailView: { viewAll: { path: '_zone.clusters', label: 'Clusters' }, - tabFilter: function(args) { - var hiddenTabs = []; - if (selectedZoneObj.networktype == "Basic") { //basic-mode network (pod-wide VLAN) + tabFilter: function (args) { + var hiddenTabs =[]; + if (selectedZoneObj.networktype == "Basic") { + //basic-mode network (pod-wide VLAN) //$("#tab_ipallocation, #add_iprange_button, #tab_network_device, #add_network_device_button").show(); - } else if (selectedZoneObj.networktype == "Advanced") { //advanced-mode network (zone-wide VLAN) + } else if (selectedZoneObj.networktype == "Advanced") { + //advanced-mode network (zone-wide VLAN) //$("#tab_ipallocation, #add_iprange_button, #tab_network_device, #add_network_device_button").hide(); hiddenTabs.push("ipAllocations"); //hiddenTabs.push("networkDevices"); //network devices tab is moved out of pod page at 3.0 UI. It will go to new network page. @@ -11542,49 +11642,49 @@ actions: { edit: { label: 'label.edit', - action: function(args) { - var array1 = []; + action: function (args) { + var array1 =[]; array1.push("&name=" + todb(args.data.name)); array1.push("&netmask=" + todb(args.data.netmask)); array1.push("&startIp=" + todb(args.data.startip)); if (args.data.endip != null && args.data.endip.length > 0) - array1.push("&endIp=" + todb(args.data.endip)); + array1.push("&endIp=" + todb(args.data.endip)); if (args.data.gateway != null && args.data.gateway.length > 0) - array1.push("&gateway=" + todb(args.data.gateway)); - + array1.push("&gateway=" + todb(args.data.gateway)); + $.ajax({ url: createURL("updatePod&id=" + args.context.pods[0].id + array1.join("")), dataType: "json", - success: function(json) { + success: function (json) { var item = json.updatepodresponse.pod; args.response.success({ actionFilter: podActionfilter, data: item }); }, - error: function(data) { + error: function (data) { args.response.error(parseXMLHttpResponse(data)); } }); } }, - + enable: { label: 'label.action.enable.pod', messages: { - confirm: function(args) { + confirm: function (args) { return 'message.action.enable.pod'; }, - notification: function(args) { + notification: function (args) { return 'label.action.enable.pod'; } }, - action: function(args) { + action: function (args) { $.ajax({ url: createURL("updatePod&id=" + args.context.pods[0].id + "&allocationstate=Enabled"), dataType: "json", async: true, - success: function(json) { + success: function (json) { var item = json.updatepodresponse.pod; args.response.success({ actionFilter: podActionfilter, @@ -11594,19 +11694,19 @@ }); }, notification: { - poll: function(args) { + poll: function (args) { args.complete(); } } }, - + dedicate: { label: 'Dedicate Pod', messages: { - confirm: function(args) { + confirm: function (args) { return 'Do you really want to dedicate this pod to a domain/account? '; }, - notification: function(args) { + notification: function (args) { return 'Pod Dedicated'; } }, @@ -11618,22 +11718,22 @@ validation: { required: true }, - select: function(args) { + select: function (args) { $.ajax({ url: createURL("listDomains&listAll=true"), dataType: "json", async: false, - success: function(json) { + success: function (json) { var domainObjs = json.listdomainsresponse.domain; - var items = []; - - $(domainObjs).each(function() { + var items =[]; + + $(domainObjs).each(function () { items.push({ id: this.id, description: this.name }); }); - + args.response.success({ data: items }); @@ -11647,33 +11747,32 @@ validation: { required: false } - } } }, - action: function(args) { + action: function (args) { //EXPLICIT DEDICATION - var array2 = []; + var array2 =[]; if (args.data.accountId != "") - array2.push("&account=" + todb(args.data.accountId)); - + array2.push("&account=" + todb(args.data.accountId)); + $.ajax({ url: createURL("dedicatePod&podId=" + - args.context.pods[0].id + - "&domainId=" + args.data.domainId + array2.join("")), + args.context.pods[0].id + + "&domainId=" + args.data.domainId + array2.join("")), dataType: "json", - success: function(json) { + success: function (json) { var jid = json.dedicatepodresponse.jobid; args.response.success({ _custom: { jobId: jid, - getActionFilter: function() { + getActionFilter: function () { return podActionfilter; } } }); }, - error: function(json) { + error: function (json) { args.response.error(parseXMLHttpResponse(XMLHttpResponse)); } }); @@ -11685,30 +11784,30 @@ release: { label: 'Release Dedicated Pod', messages: { - confirm: function(args) { + confirm: function (args) { return 'Do you want to release this dedicated pod ?'; }, - notification: function(args) { + notification: function (args) { return 'Pod dedication released'; } }, - action: function(args) { + action: function (args) { $.ajax({ url: createURL("releaseDedicatedPod&podid=" + args.context.pods[0].id), dataType: "json", async: true, - success: function(json) { + success: function (json) { var jid = json.releasededicatedpodresponse.jobid; args.response.success({ _custom: { jobId: jid, - getActionFilter: function() { + getActionFilter: function () { return podActionfilter; } } }); }, - error: function(json) { + error: function (json) { args.response.error(parseXMLHttpResponse(json)); } }); @@ -11717,24 +11816,24 @@ poll: pollAsyncJobResult } }, - - + + disable: { label: 'label.action.disable.pod', messages: { - confirm: function(args) { + confirm: function (args) { return 'message.action.disable.pod'; }, - notification: function(args) { + notification: function (args) { return 'label.action.disable.pod'; } }, - action: function(args) { + action: function (args) { $.ajax({ url: createURL("updatePod&id=" + args.context.pods[0].id + "&allocationstate=Disabled"), dataType: "json", async: true, - success: function(json) { + success: function (json) { var item = json.updatepodresponse.pod; args.response.success({ actionFilter: podActionfilter, @@ -11744,36 +11843,37 @@ }); }, notification: { - poll: function(args) { + poll: function (args) { args.complete(); } } }, - + 'remove': { label: 'label.delete', messages: { - confirm: function(args) { + confirm: function (args) { return 'message.action.delete.pod'; }, - notification: function(args) { + notification: function (args) { return 'label.action.delete.pod'; } }, - action: function(args) { + action: function (args) { $.ajax({ url: createURL("deletePod&id=" + args.context.pods[0].id), dataType: "json", async: true, - success: function(json) { + success: function (json) { args.response.success({ - data: {} + data: { + } }); } }); }, notification: { - poll: function(args) { + poll: function (args) { args.complete(); } } @@ -11782,76 +11882,72 @@ tabs: { details: { title: 'label.details', - fields: [{ - name: { - label: 'label.name', - isEditable: true, - validation: { - required: true - } + fields:[ { + name: { + label: 'label.name', + isEditable: true, + validation: { + required: true } - }, { - id: { - label: 'label.id' - }, - netmask: { - label: 'label.netmask', - isEditable: true, - validation: { - required: true - } - }, - startip: { - label: 'label.start.IP', - isEditable: true, - validation: { - required: true - } - }, - endip: { - label: 'label.end.IP', - isEditable: true - }, - gateway: { - label: 'label.gateway', - isEditable: true, - validation: { - required: true - } - }, - allocationstate: { - converter: function(str) { - // For localization - return str; - }, - label: 'label.allocation.state' + } + }, + { + id: { + label: 'label.id' + }, + netmask: { + label: 'label.netmask', + isEditable: true, + validation: { + required: true } }, - - { - - isdedicated: { - label: 'Dedicated' - }, - domainid: { - label: 'Domain ID' + startip: { + label: 'label.start.IP', + isEditable: true, + validation: { + required: true } - + }, + endip: { + label: 'label.end.IP', + isEditable: true + }, + gateway: { + label: 'label.gateway', + isEditable: true, + validation: { + required: true + } + }, + allocationstate: { + converter: function (str) { + // For localization + return str; + }, + label: 'label.allocation.state' } - - ], - - dataProvider: function(args) { - + }, { + + isdedicated: { + label: 'Dedicated' + }, + domainid: { + label: 'Domain ID' + } + }], + + dataProvider: function (args) { + $.ajax({ url: createURL("listPods&id=" + args.context.pods[0].id), - success: function(json) { + success: function (json) { var item = json.listpodsresponse.pod[0]; - - + + $.ajax({ url: createURL("listDedicatedPods&podid=" + args.context.pods[0].id), - success: function(json) { + success: function (json) { if (json.listdedicatedpodsresponse.dedicatedpod != undefined) { var podItem = json.listdedicatedpodsresponse.dedicatedpod[0]; if (podItem.domainid != null) { @@ -11860,36 +11956,32 @@ }); } } else - $.extend(item, { - isdedicated: 'No' - }); - + $.extend(item, { + isdedicated: 'No' + }); + args.response.success({ actionFilter: podActionfilter, data: item }); }, - error: function(json) { + error: function (json) { args.response.error(parseXMLHttpResponse(XMLHttpResponse)); - } }); // args.response.success({ // actionFilter: podActionfilter, // data: item // }); - } }); - - } }, - + ipAllocations: { title: 'label.ip.allocations', multiple: true, - fields: [{ + fields:[ { id: { label: 'label.id' }, @@ -11906,11 +11998,11 @@ label: 'label.end.IP' } }], - dataProvider: function(args) { + dataProvider: function (args) { $.ajax({ url: createURL("listVlanIpRanges&zoneid=" + args.context.zones[0].id + "&podid=" + args.context.pods[0].id), dataType: "json", - success: function(json) { + success: function (json) { var items = json.listvlaniprangesresponse.vlaniprange; args.response.success({ data: items @@ -11941,7 +12033,7 @@ //allocationstate: { label: 'label.allocation.state' }, //managedstate: { label: 'Managed State' }, allocationstate: { - converter: function(str) { + converter: function (str) { // For localization return str; }, @@ -11952,32 +12044,32 @@ } } }, - - dataProvider: function(args) { - var array1 = []; + + dataProvider: function (args) { + var array1 =[]; if (args.filterBy != null) { if (args.filterBy.search != null && args.filterBy.search.by != null && args.filterBy.search.value != null) { switch (args.filterBy.search.by) { case "name": - if (args.filterBy.search.value.length > 0) - array1.push("&keyword=" + args.filterBy.search.value); - break; + if (args.filterBy.search.value.length > 0) + array1.push("&keyword=" + args.filterBy.search.value); + break; } } } array1.push("&zoneid=" + args.context.zones[0].id); if ("pods" in args.context) - array1.push("&podid=" + args.context.pods[0].id); + array1.push("&podid=" + args.context.pods[0].id); $.ajax({ url: createURL("listClusters" + array1.join("") + "&page=" + args.page + "&pagesize=" + pageSize), dataType: "json", async: true, - success: function(json) { + success: function (json) { var items = json.listclustersresponse.cluster; - $(items).each(function() { + $(items).each(function () { addExtraPropertiesToClusterObject(this); }); - + args.response.success({ actionFilter: clusterActionfilter, data: items @@ -11985,49 +12077,47 @@ } }); }, - + actions: { add: { label: 'label.add.cluster', messages: { - notification: function(args) { + notification: function (args) { return 'label.add.cluster'; } }, createForm: { title: 'label.add.cluster', - preFilter: function(args) { + preFilter: function (args) { var $form = args.$form; - $form.click(function() { - var $nexusDvsOptFields = $form.find('.form-item').filter(function() { - var nexusDvsOptFields = [ - 'vsmipaddress', - 'vsmusername', - 'vsmpassword' - ]; + $form.click(function () { + var $nexusDvsOptFields = $form.find('.form-item').filter(function () { + var nexusDvsOptFields =[ + 'vsmipaddress', + 'vsmusername', + 'vsmpassword']; return $.inArray($(this).attr('rel'), nexusDvsOptFields) > -1; }); - var $nexusDvsReqFields = $form.find('.form-item').filter(function() { - var nexusDvsReqFields = [ - 'vsmipaddress_req', - 'vsmusername_req', - 'vsmpassword_req' - ]; + var $nexusDvsReqFields = $form.find('.form-item').filter(function () { + var nexusDvsReqFields =[ + 'vsmipaddress_req', + 'vsmusername_req', + 'vsmpassword_req']; return $.inArray($(this).attr('rel'), nexusDvsReqFields) > -1; }); - - if ($form.find('.form-item[rel=hypervisor] select').val() == 'VMware' ) { - $form.find('.form-item[rel=vCenterHost]').css('display', 'inline-block'); + + if ($form.find('.form-item[rel=hypervisor] select').val() == 'VMware') { + $form.find('.form-item[rel=vCenterHost]').css('display', 'inline-block'); $form.find('.form-item[rel=vCenterUsername]').css('display', 'inline-block'); $form.find('.form-item[rel=vCenterPassword]').css('display', 'inline-block'); $form.find('.form-item[rel=vCenterDatacenter]').css('display', 'inline-block'); - + var $overridePublicTraffic = $form.find('.form-item[rel=overridepublictraffic] input[type=checkbox]'); - var $vSwitchPublicType = $form.find('.form-item[rel=vSwitchPublicType] select'); - var $overrideGuestTraffic = $form.find('.form-item[rel=overrideguesttraffic] input[type=checkbox]'); - var $vSwitchGuestType = $form.find('.form-item[rel=vSwitchGuestType] select'); - - + var $vSwitchPublicType = $form.find('.form-item[rel=vSwitchPublicType] select'); + var $overrideGuestTraffic = $form.find('.form-item[rel=overrideguesttraffic] input[type=checkbox]'); + var $vSwitchGuestType = $form.find('.form-item[rel=vSwitchGuestType] select'); + + var useDvs = false; $.ajax({ url: createURL('listConfigurations'), @@ -12035,88 +12125,89 @@ name: 'vmware.use.dvswitch' }, async: false, - success: function(json) { + success: function (json) { if (json.listconfigurationsresponse.configuration[0].value == 'true') { useDvs = true; } } }); - if (useDvs == true) { //If using Distributed vswitch, there is OverrideTraffic option. + if (useDvs == true) { + //If using Distributed vswitch, there is OverrideTraffic option. $form.find('.form-item[rel=overridepublictraffic]').css('display', 'inline-block'); $form.find('.form-item[rel=overrideguesttraffic]').css('display', 'inline-block'); - - var useNexusDvs = false; + + var useNexusDvs = false; $.ajax({ url: createURL('listConfigurations'), data: { name: 'vmware.use.nexus.vswitch' }, async: false, - success: function(json) { + success: function (json) { if (json.listconfigurationsresponse.configuration[0].value == 'true') { useNexusDvs = true; } } }); - if (useNexusDvs == true) { //If using Nexus Distributed vswitch, show Nexus Distributed vswitch fields (either required ones or optional ones). - if (($overridePublicTraffic.is(':checked') && $vSwitchPublicType.val() == 'nexusdvs') || - ($overrideGuestTraffic.is(':checked') && $vSwitchGuestType.val() == 'nexusdvs' )) { - $nexusDvsReqFields.css('display', 'inline-block'); - $nexusDvsOptFields.hide(); - } else { - $nexusDvsOptFields.css('display', 'inline-block'); - $nexusDvsReqFields.hide(); - } - - } else { //If not using Nexus Distributed vswitch, hide Nexus Distributed vswitch fields. - $nexusDvsOptFields.hide(); - $nexusDvsReqFields.hide(); + if (useNexusDvs == true) { + //If using Nexus Distributed vswitch, show Nexus Distributed vswitch fields (either required ones or optional ones). + if (($overridePublicTraffic.is(':checked') && $vSwitchPublicType.val() == 'nexusdvs') || + ($overrideGuestTraffic.is(':checked') && $vSwitchGuestType.val() == 'nexusdvs')) { + $nexusDvsReqFields.css('display', 'inline-block'); + $nexusDvsOptFields.hide(); + } else { + $nexusDvsOptFields.css('display', 'inline-block'); + $nexusDvsReqFields.hide(); + } + } else { + //If not using Nexus Distributed vswitch, hide Nexus Distributed vswitch fields. + $nexusDvsOptFields.hide(); + $nexusDvsReqFields.hide(); } - - } else { //useDvs == false + } else { + //useDvs == false $form.find('.form-item[rel=overridepublictraffic]').css('display', 'none'); $form.find('.form-item[rel=vSwitchPublicType]').css('display', 'none'); $form.find('.form-item[rel=vSwitchPublicName]').css('display', 'none'); - + $form.find('.form-item[rel=overrideguesttraffic]').css('display', 'none'); $form.find('.form-item[rel=vSwitchGuestType]').css('display', 'none'); $form.find('.form-item[rel=vSwitchGuestName]').css('display', 'none'); - + $nexusDvsOptFields.hide(); - $nexusDvsReqFields.hide(); + $nexusDvsReqFields.hide(); } - - - } else { //XenServer, KVM, etc (non-VMware) + } else { + //XenServer, KVM, etc (non-VMware) $form.find('.form-item[rel=vCenterHost]').css('display', 'none'); $form.find('.form-item[rel=vCenterUsername]').css('display', 'none'); $form.find('.form-item[rel=vCenterPassword]').css('display', 'none'); $form.find('.form-item[rel=vCenterDatacenter]').css('display', 'none'); $form.find('.form-item[rel=enableNexusVswitch]').css('display', 'none'); - + $form.find('.form-item[rel=overridepublictraffic]').css('display', 'none'); $form.find('.form-item[rel=overrideguesttraffic]').css('display', 'none'); - $nexusDvsOptFields.hide(); - $nexusDvsReqFields.hide(); + $nexusDvsOptFields.hide(); + $nexusDvsReqFields.hide(); } - + if ($form.find('.form-item[rel=overridepublictraffic]').css('display') != 'none' && $overridePublicTraffic.is(':checked')) { - $form.find('.form-item[rel=vSwitchPublicType]').css('display', 'inline-block'); + $form.find('.form-item[rel=vSwitchPublicType]').css('display', 'inline-block'); $form.find('.form-item[rel=vSwitchPublicName]').css('display', 'inline-block'); } else { - $form.find('.form-item[rel=vSwitchPublicType]').css('display', 'none'); + $form.find('.form-item[rel=vSwitchPublicType]').css('display', 'none'); $form.find('.form-item[rel=vSwitchPublicName]').css('display', 'none'); } - + if ($form.find('.form-item[rel=overrideguesttraffic]').css('display') != 'none' && $overrideGuestTraffic.is(':checked')) { - $form.find('.form-item[rel=vSwitchGuestType]').css('display', 'inline-block'); + $form.find('.form-item[rel=vSwitchGuestType]').css('display', 'inline-block'); $form.find('.form-item[rel=vSwitchGuestName]').css('display', 'inline-block'); } else { - $form.find('.form-item[rel=vSwitchGuestType]').css('display', 'none'); + $form.find('.form-item[rel=vSwitchGuestType]').css('display', 'none'); $form.find('.form-item[rel=vSwitchGuestName]').css('display', 'none'); } }); - + $form.trigger('click'); }, fields: { @@ -12126,21 +12217,21 @@ validation: { required: true }, - select: function(args) { + select: function (args) { var data = args.context.zones ? { id: args.context.zones[0].id - } : { + }: { listAll: true }; - + $.ajax({ url: createURL('listZones'), data: data, - success: function(json) { - var zones = json.listzonesresponse.zone ? json.listzonesresponse.zone : []; - + success: function (json) { + var zones = json.listzonesresponse.zone ? json.listzonesresponse.zone:[]; + args.response.success({ - data: $.map(zones, function(zone) { + data: $.map(zones, function (zone) { return { id: zone.id, description: zone.name @@ -12154,15 +12245,15 @@ hypervisor: { label: 'label.hypervisor', docID: 'helpClusterHypervisor', - select: function(args) { + select: function (args) { $.ajax({ url: createURL("listHypervisors"), dataType: "json", async: false, - success: function(json) { + success: function (json) { var hypervisors = json.listhypervisorsresponse.hypervisor; - var items = []; - $(hypervisors).each(function() { + var items =[]; + $(hypervisors).each(function () { items.push({ id: this.name, description: this.name @@ -12179,25 +12270,24 @@ label: 'Pod Name', docID: 'helpClusterPod', dependsOn: 'zoneid', - select: function(args) { + select: function (args) { $.ajax({ url: createURL("listPods&zoneid=" + args.zoneid), dataType: "json", async: true, - success: function(json) { + success: function (json) { var pods = json.listpodsresponse.pod; - var items = []; - $(pods).each(function() { + var items =[]; + $(pods).each(function () { if (("pods" in args.context) && (this.id == args.context.pods[0].id)) - items.unshift({ - id: this.id, - description: this.name - }); - else - items.push({ - id: this.id, - description: this.name - }); + items.unshift({ + id: this.id, + description: this.name + }); else + items.push({ + id: this.id, + description: this.name + }); }); args.response.success({ data: items @@ -12213,16 +12303,14 @@ required: true } }, - + isDedicated: { label: 'Dedicate', isBoolean: true, isChecked: false, docID: 'helpDedicateResource' - - }, - + domainId: { label: 'Domain', isHidden: true, @@ -12230,22 +12318,22 @@ required: true }, dependsOn: 'isDedicated', - select: function(args) { + select: function (args) { $.ajax({ url: createURL("listDomains&listAll=true"), dataType: "json", async: false, - success: function(json) { + success: function (json) { var domainObjs = json.listdomainsresponse.domain; - var items = []; - - $(domainObjs).each(function() { + var items =[]; + + $(domainObjs).each(function () { items.push({ id: this.id, description: this.name }); }); - + args.response.success({ data: items }); @@ -12253,7 +12341,7 @@ }); } }, - + accountId: { label: 'Account', isHidden: true, @@ -12263,7 +12351,7 @@ required: false } }, - + //hypervisor==VMWare begins here vCenterHost: { label: 'label.vcenter.host', @@ -12271,7 +12359,8 @@ docID: 'helpClustervCenterHost', validation: { required: false - } //legacy zone - validation not required for new VMware dc model + } + //legacy zone - validation not required for new VMware dc model }, vCenterUsername: { label: 'label.vcenter.username', @@ -12290,9 +12379,10 @@ docID: 'helpClustervCenterDatacenter', validation: { required: false - } //legacy zone - validation not required for new VMware dc model + } + //legacy zone - validation not required for new VMware dc model }, - + overridepublictraffic: { label: 'Override Public-Traffic', isBoolean: true, @@ -12300,26 +12390,26 @@ isChecked: false, docID: 'helpOverridePublicNetwork' }, - - + + vSwitchPublicType: { label: 'Public Traffic vSwitch Type', - select: function(args) { + select: function (args) { var useNexusDvs = false; - var items = [] + var items =[] $.ajax({ url: createURL('listConfigurations'), data: { name: 'vmware.use.nexus.vswitch' }, async: false, - success: function(json) { + success: function (json) { if (json.listconfigurationsresponse.configuration[0].value == 'true') { useNexusDvs = true; } } }); - + if (useNexusDvs) { items.push({ id: "nexusdvs", @@ -12333,76 +12423,6 @@ id: "vmwaredvs", description: "VMware vNetwork Distributed Virtual Switch" }); - } - else { - items.push({ - id: "vmwaredvs", - description: "VMware vNetwork Distributed Virtual Switch" - }); - items.push({ - id: "vmwaresvs", - description: "VMware vNetwork Standard Virtual Switch" - }); - items.push({ - id: "nexusdvs", - description: "Cisco Nexus 1000v Distributed Virtual Switch" - }); - } - - args.response.success({ - data: items - }); - }, - isHidden: true - }, - - vSwitchPublicName: { - label: 'Public Traffic vSwitch Name', - isHidden: true - }, - - overrideguesttraffic: { - label: 'Override Guest-Traffic', - isBoolean: true, - isHidden: true, - isChecked: false, - docID: 'helpOverrideGuestNetwork' - }, - - vSwitchGuestType: { - label: 'Guest Traffic vSwitch Type', - select: function(args) { - var items = [] - - var useNexusDvs = false; - $.ajax({ - url: createURL('listConfigurations'), - data: { - name: 'vmware.use.nexus.vswitch' - }, - async: false, - success: function(json) { - if (json.listconfigurationsresponse.configuration[0].value == 'true') { - useNexusDvs = true; - } - } - }); - - - if (useNexusDvs) { - items.push({ - id: "nexusdvs", - description: "Cisco Nexus 1000v Distributed Virtual Switch" - }); - items.push({ - id: "vmwaresvs", - description: "VMware vNetwork Standard Virtual Switch" - }); - items.push({ - id: "vmwaredvs", - description: "VMware vNetwork Distributed Virtual Switch" - }); - } else { items.push({ id: "vmwaredvs", @@ -12417,20 +12437,88 @@ description: "Cisco Nexus 1000v Distributed Virtual Switch" }); } - + args.response.success({ data: items }); }, isHidden: true }, - + + vSwitchPublicName: { + label: 'Public Traffic vSwitch Name', + isHidden: true + }, + + overrideguesttraffic: { + label: 'Override Guest-Traffic', + isBoolean: true, + isHidden: true, + isChecked: false, + docID: 'helpOverrideGuestNetwork' + }, + + vSwitchGuestType: { + label: 'Guest Traffic vSwitch Type', + select: function (args) { + var items =[] + + var useNexusDvs = false; + $.ajax({ + url: createURL('listConfigurations'), + data: { + name: 'vmware.use.nexus.vswitch' + }, + async: false, + success: function (json) { + if (json.listconfigurationsresponse.configuration[0].value == 'true') { + useNexusDvs = true; + } + } + }); + + + if (useNexusDvs) { + items.push({ + id: "nexusdvs", + description: "Cisco Nexus 1000v Distributed Virtual Switch" + }); + items.push({ + id: "vmwaresvs", + description: "VMware vNetwork Standard Virtual Switch" + }); + items.push({ + id: "vmwaredvs", + description: "VMware vNetwork Distributed Virtual Switch" + }); + } else { + items.push({ + id: "vmwaredvs", + description: "VMware vNetwork Distributed Virtual Switch" + }); + items.push({ + id: "vmwaresvs", + description: "VMware vNetwork Standard Virtual Switch" + }); + items.push({ + id: "nexusdvs", + description: "Cisco Nexus 1000v Distributed Virtual Switch" + }); + } + + args.response.success({ + data: items + }); + }, + isHidden: true + }, + vSwitchGuestName: { label: ' Guest Traffic vSwitch Name', isHidden: true }, - - + + vsmipaddress: { label: 'Nexus 1000v IP Address', validation: { @@ -12478,42 +12566,41 @@ //hypervisor==VMWare ends here } }, - - action: function(args) { - var array1 = []; + + action: function (args) { + var array1 =[]; array1.push("&zoneId=" + args.data.zoneid); array1.push("&hypervisor=" + args.data.hypervisor); - + var clusterType; if (args.data.hypervisor == "VMware") - clusterType = "ExternalManaged"; - else - clusterType = "CloudManaged"; + clusterType = "ExternalManaged"; else + clusterType = "CloudManaged"; array1.push("&clustertype=" + clusterType); - + array1.push("&podId=" + args.data.podId); - + var clusterName = args.data.name; - + if (args.data.hypervisor == "VMware") { array1.push("&username=" + todb(args.data.vCenterUsername)); array1.push("&password=" + todb(args.data.vCenterPassword)); - + //vSwitch Public Type if (args.data.vSwitchPublicType != "") - array1.push("&publicvswitchtype=" + args.data.vSwitchPublicType); - + array1.push("&publicvswitchtype=" + args.data.vSwitchPublicType); + if (args.data.vSwitchPublicName != "") - array1.push("&publicvswitchname=" + args.data.vSwitchPublicName); - - + array1.push("&publicvswitchname=" + args.data.vSwitchPublicName); + + //vSwitch Guest Type if (args.data.vSwitchGuestType != "") - array1.push("&guestvswitchtype=" + args.data.vSwitchGuestType); - + array1.push("&guestvswitchtype=" + args.data.vSwitchGuestType); + if (args.data.vSwitchGuestName != "") - array1.push("&guestvswitchname=" + args.data.vSwitchGuestName); - + array1.push("&guestvswitchname=" + args.data.vSwitchGuestName); + //Nexus VSM fields if (args.$form.find('.form-item[rel=vsmipaddress]').css('display') != 'none' && args.data.vsmipaddress != null && args.data.vsmipaddress.length > 0) { array1.push('&vsmipaddress=' + args.data.vsmipaddress); @@ -12521,25 +12608,25 @@ if (args.$form.find('.form-item[rel=vsmipaddress_req]').css('display') != 'none' && args.data.vsmipaddress_req != null && args.data.vsmipaddress_req.length > 0) { array1.push('&vsmipaddress=' + args.data.vsmipaddress_req); } - - if(args.$form.find('.form-item[rel=vsmusername]').css('display') != 'none' && args.data.vsmusername != null && args.data.vsmusername.length > 0) { - array1.push('&vsmusername=' + args.data.vsmusername); + + if (args.$form.find('.form-item[rel=vsmusername]').css('display') != 'none' && args.data.vsmusername != null && args.data.vsmusername.length > 0) { + array1.push('&vsmusername=' + args.data.vsmusername); } - if(args.$form.find('.form-item[rel=vsmusername_req]').css('display') != 'none' && args.data.vsmusername_req != null && args.data.vsmusername_req.length > 0) { - array1.push('&vsmusername=' + args.data.vsmusername_req); + if (args.$form.find('.form-item[rel=vsmusername_req]').css('display') != 'none' && args.data.vsmusername_req != null && args.data.vsmusername_req.length > 0) { + array1.push('&vsmusername=' + args.data.vsmusername_req); } - - if(args.$form.find('.form-item[rel=vsmpassword]').css('display') != 'none' && args.data.vsmpassword != null && args.data.vsmpassword.length > 0) { - array1.push('&vsmpassword=' + args.data.vsmpassword); + + if (args.$form.find('.form-item[rel=vsmpassword]').css('display') != 'none' && args.data.vsmpassword != null && args.data.vsmpassword.length > 0) { + array1.push('&vsmpassword=' + args.data.vsmpassword); } - if(args.$form.find('.form-item[rel=vsmpassword_req]').css('display') != 'none' && args.data.vsmpassword_req != null && args.data.vsmpassword_req.length > 0) { - array1.push('&vsmpassword=' + args.data.vsmpassword_req); + if (args.$form.find('.form-item[rel=vsmpassword_req]').css('display') != 'none' && args.data.vsmpassword_req != null && args.data.vsmpassword_req.length > 0) { + array1.push('&vsmpassword=' + args.data.vsmpassword_req); } - - + + var hostname = args.data.vCenterHost; var dcName = args.data.vCenterDatacenter; - + if (hostname.length == 0 && dcName.length == 0) { $.ajax({ url: createURL('listVmwareDcs'), @@ -12547,7 +12634,8 @@ zoneid: args.data.zoneid }, async: false, - success: function(json) { //e.g. json == { "listvmwaredcsresponse" { "count":1 ,"VMwareDC" [ {"id":"c3c2562d-65e9-4fc7-92e2-773c2efe8f37","zoneid":1,"name":"datacenter","vcenter":"10.10.20.20"} ] } } + success: function (json) { + //e.g. json == { "listvmwaredcsresponse" { "count":1 ,"VMwareDC" [ {"id":"c3c2562d-65e9-4fc7-92e2-773c2efe8f37","zoneid":1,"name":"datacenter","vcenter":"10.10.20.20"} ] } } var vmwaredcs = json.listvmwaredcsresponse.VMwareDC; if (vmwaredcs != null) { hostname = vmwaredcs[0].vcenter; @@ -12556,15 +12644,14 @@ } }); } - + var url; if (hostname.indexOf("http://") == -1) - url = "http://" + hostname; - else - url = hostname; + url = "http://" + hostname; else + url = hostname; url += "/" + dcName + "/" + clusterName; array1.push("&url=" + todb(url)); - + clusterName = hostname + "/" + dcName + "/" + clusterName; //override clusterName } array1.push("&clustername=" + todb(clusterName)); @@ -12573,21 +12660,21 @@ url: createURL("addCluster" + array1.join("")), dataType: "json", type: "POST", - success: function(json) { + success: function (json) { var item = json.addclusterresponse.cluster[0]; clusterId = json.addclusterresponse.cluster[0].id; - + //EXPLICIT DEDICATION - var array2 = []; + var array2 =[]; if (args.$form.find('.form-item[rel=isDedicated]').find('input[type=checkbox]').is(':Checked') == true) { if (args.data.accountId != "") - array2.push("&account=" + todb(args.data.accountId)); - + array2.push("&account=" + todb(args.data.accountId)); + if (clusterId != null) { $.ajax({ url: createURL("dedicateCluster&clusterId=" + clusterId + "&domainId=" + args.data.domainId + array2.join("")), dataType: "json", - success: function(json) { + success: function (json) { var jid = json.dedicateclusterresponse.jobid; args.response.success({ _custom: { @@ -12598,14 +12685,13 @@ interval: 4500, desc: "Dedicate Cluster" }, - + data: $.extend(item, { state: 'Enabled' }) }); - }, - error: function(json) { + error: function (json) { args.response.error(parseXMLHttpResponse(XMLHttpResponse)); } }); @@ -12615,15 +12701,15 @@ data: item }); }, - error: function(XMLHttpResponse) { + error: function (XMLHttpResponse) { var errorMsg = parseXMLHttpResponse(XMLHttpResponse); args.response.error(errorMsg); } }); }, - + notification: { - poll: function(args) { + poll: function (args) { args.complete({ actionFilter: clusterActionfilter, data: { @@ -12634,14 +12720,14 @@ } } }, - + detailView: { viewAll: { path: '_zone.hosts', label: 'label.hosts' }, isMaximized: true, - tabFilter: function(args) { + tabFilter: function (args) { var vSwichConfigEnabled, vSwitchPresentOnCluster; $.ajax({ url: createURL('listConfigurations'), @@ -12649,58 +12735,57 @@ name: 'vmware.use.nexus.vswitch' }, async: false, - success: function(json) { + success: function (json) { vSwichConfigEnabled = json.listconfigurationsresponse.configuration[0].value; } }); - + var hypervisorType = args.context.clusters[0].hypervisortype; if (vSwichConfigEnabled != "true" || hypervisorType != 'VMware') { - return ['nexusVswitch']; + return[ 'nexusVswitch']; } - return []; + return[]; }, - + actions: { - + edit: { label: 'label.edit', - action: function(args) { - var array1 = []; - + action: function (args) { + var array1 =[]; + $.ajax({ url: createURL("updateCluster&id=" + args.context.clusters[0].id + array1.join("")), dataType: "json", async: true, - success: function(json) { + success: function (json) { var item = json.updateclusterresponse.cluster; addExtraPropertiesToClusterObject(item); args.response.success({ actionFilter: clusterActionfilter, data: item }); - } }); } }, - + enable: { label: 'label.action.enable.cluster', messages: { - confirm: function(args) { + confirm: function (args) { return 'message.action.enable.cluster'; }, - notification: function(args) { + notification: function (args) { return 'label.action.enable.cluster'; } }, - action: function(args) { + action: function (args) { $.ajax({ url: createURL("updateCluster&id=" + args.context.clusters[0].id + "&allocationstate=Enabled"), dataType: "json", async: true, - success: function(json) { + success: function (json) { var item = json.updateclusterresponse.cluster; args.context.clusters[0].state = item.allocationstate; addExtraPropertiesToClusterObject(item); @@ -12712,28 +12797,28 @@ }); }, notification: { - poll: function(args) { + poll: function (args) { args.complete(); } } }, - + disable: { label: 'label.action.disable.cluster', messages: { - confirm: function(args) { + confirm: function (args) { return 'message.action.disable.cluster'; }, - notification: function(args) { + notification: function (args) { return 'label.action.disable.cluster'; } }, - action: function(args) { + action: function (args) { $.ajax({ url: createURL("updateCluster&id=" + args.context.clusters[0].id + "&allocationstate=Disabled"), dataType: "json", async: true, - success: function(json) { + success: function (json) { var item = json.updateclusterresponse.cluster; args.context.clusters[0].state = item.allocationstate; addExtraPropertiesToClusterObject(item); @@ -12745,19 +12830,19 @@ }); }, notification: { - poll: function(args) { + poll: function (args) { args.complete(); } } }, - + dedicate: { label: 'Dedicate Cluster', messages: { - confirm: function(args) { + confirm: function (args) { return 'Do you really want to dedicate this cluster to a domain/account? '; }, - notification: function(args) { + notification: function (args) { return 'Cluster Dedicated'; } }, @@ -12769,22 +12854,22 @@ validation: { required: true }, - select: function(args) { + select: function (args) { $.ajax({ url: createURL("listDomains&listAll=true"), dataType: "json", async: false, - success: function(json) { + success: function (json) { var domainObjs = json.listdomainsresponse.domain; - var items = []; - - $(domainObjs).each(function() { + var items =[]; + + $(domainObjs).each(function () { items.push({ id: this.id, description: this.name }); }); - + args.response.success({ data: items }); @@ -12801,22 +12886,22 @@ } } }, - action: function(args) { + action: function (args) { //EXPLICIT DEDICATION - var array2 = []; + var array2 =[]; if (args.data.accountId != "") - array2.push("&account=" + todb(args.data.accountId)); + array2.push("&account=" + todb(args.data.accountId)); $.ajax({ url: createURL("dedicateCluster&clusterId=" + - args.context.clusters[0].id + - "&domainId=" + args.data.domainId + array2.join("")), + args.context.clusters[0].id + + "&domainId=" + args.data.domainId + array2.join("")), dataType: "json", - success: function(json) { + success: function (json) { var jid = json.dedicateclusterresponse.jobid; args.response.success({ _custom: { jobId: jid, - getActionFilter: function() { + getActionFilter: function () { return clusterActionfilter; } } @@ -12831,30 +12916,30 @@ release: { label: 'Release Dedicated Cluster', messages: { - confirm: function(args) { + confirm: function (args) { return 'Do you want to release this dedicated cluster ?'; }, - notification: function(args) { + notification: function (args) { return 'Cluster dedication released'; } }, - action: function(args) { + action: function (args) { $.ajax({ url: createURL("releaseDedicatedCluster&clusterid=" + args.context.clusters[0].id), dataType: "json", async: true, - success: function(json) { + success: function (json) { var jid = json.releasededicatedclusterresponse.jobid; args.response.success({ _custom: { jobId: jid, - getActionFilter: function() { + getActionFilter: function () { return clusterActionfilter; } } }); }, - error: function(json) { + error: function (json) { args.response.error(parseXMLHttpResponse(json)); } }); @@ -12863,24 +12948,24 @@ poll: pollAsyncJobResult } }, - - + + manage: { label: 'label.action.manage.cluster', messages: { - confirm: function(args) { + confirm: function (args) { return 'message.action.manage.cluster'; }, - notification: function(args) { + notification: function (args) { return 'label.action.manage.cluster'; } }, - action: function(args) { + action: function (args) { $.ajax({ url: createURL("updateCluster&id=" + args.context.clusters[0].id + "&managedstate=Managed"), dataType: "json", async: true, - success: function(json) { + success: function (json) { var item = json.updateclusterresponse.cluster; addExtraPropertiesToClusterObject(item); args.response.success({ @@ -12891,28 +12976,28 @@ }); }, notification: { - poll: function(args) { + poll: function (args) { args.complete(); } } }, - + unmanage: { label: 'label.action.unmanage.cluster', messages: { - confirm: function(args) { + confirm: function (args) { return 'message.action.unmanage.cluster'; }, - notification: function(args) { + notification: function (args) { return 'label.action.unmanage.cluster'; } }, - action: function(args) { + action: function (args) { $.ajax({ url: createURL("updateCluster&id=" + args.context.clusters[0].id + "&managedstate=Unmanaged"), dataType: "json", async: true, - success: function(json) { + success: function (json) { var item = json.updateclusterresponse.cluster; addExtraPropertiesToClusterObject(item); args.response.success({ @@ -12923,94 +13008,92 @@ }); }, notification: { - poll: function(args) { + poll: function (args) { args.complete(); } } }, - + 'remove': { label: 'label.action.delete.cluster', messages: { - confirm: function(args) { + confirm: function (args) { return 'message.action.delete.cluster'; }, - notification: function(args) { + notification: function (args) { return 'label.action.delete.cluster'; } }, - action: function(args) { + action: function (args) { $.ajax({ url: createURL("deleteCluster&id=" + args.context.clusters[0].id), dataType: "json", async: true, - success: function(json) { + success: function (json) { args.response.success({ - data: {} + data: { + } }); } }); }, notification: { - poll: function(args) { + poll: function (args) { args.complete(); } } } }, - + tabs: { details: { title: 'label.details', - fields: [{ - name: { - label: 'label.name' - } - }, { - id: { - label: 'label.id' - }, - zonename: { - label: 'label.zone' - }, - podname: { - label: 'label.pod' - }, - hypervisortype: { - label: 'label.hypervisor' - }, - clustertype: { - label: 'label.cluster.type' - }, - //allocationstate: { label: 'label.allocation.state' }, - //managedstate: { label: 'Managed State' }, - state: { - label: 'label.state' - } - }, - - { - isdedicated: { - label: 'Dedicated' - }, - domainid: { - label: 'Domain ID' - } + fields:[ { + name: { + label: 'label.name' } - - ], - dataProvider: function(args) { + }, + { + id: { + label: 'label.id' + }, + zonename: { + label: 'label.zone' + }, + podname: { + label: 'label.pod' + }, + hypervisortype: { + label: 'label.hypervisor' + }, + clustertype: { + label: 'label.cluster.type' + }, + //allocationstate: { label: 'label.allocation.state' }, + //managedstate: { label: 'Managed State' }, + state: { + label: 'label.state' + } + }, { + isdedicated: { + label: 'Dedicated' + }, + domainid: { + label: 'Domain ID' + } + }], + dataProvider: function (args) { $.ajax({ url: createURL("listClusters&id=" + args.context.clusters[0].id), dataType: "json", - success: function(json) { + success: function (json) { var item = json.listclustersresponse.cluster[0]; addExtraPropertiesToClusterObject(item); $.ajax({ url: createURL("listDedicatedClusters&clusterid=" + args.context.clusters[0].id), dataType: "json", async: false, - success: function(json) { + success: function (json) { if (json.listdedicatedclustersresponse.dedicatedcluster != undefined) { var clusterItem = json.listdedicatedclustersresponse.dedicatedcluster[0]; if (clusterItem.domainid != null) { @@ -13019,12 +13102,11 @@ }); } } else - $.extend(item, { - isdedicated: 'No' - }) - + $.extend(item, { + isdedicated: 'No' + }) }, - error: function(json) { + error: function (json) { args.response.error(parseXMLHttpResponse(XMLHttpResponse)); } }); @@ -13032,14 +13114,11 @@ actionFilter: clusterActionfilter, data: item }); - }, - - error: function(json) { + + error: function (json) { args.response.error(parseXMLHttpResponse(XMLHttpResponse)); - } - }); } }, @@ -13063,19 +13142,19 @@ enable: { label: 'label.action.enable.nexusVswitch', messages: { - confirm: function(args) { + confirm: function (args) { return 'message.action.enable.nexusVswitch'; }, - notification: function(args) { + notification: function (args) { return 'label.action.enable.nexusVswitch'; } }, - action: function(args) { + action: function (args) { $.ajax({ url: createURL("enableCiscoNexusVSM&id=" + args.context.vSwitches[0].vsmdeviceid), dataType: "json", async: true, - success: function(json) { + success: function (json) { var jid = json.enablecisconexusvsmresponse.jobid; args.response.success({ _custom: { @@ -13092,28 +13171,28 @@ }); }, notification: { - poll: function(args) { + poll: function (args) { args.complete(); } } }, - + disable: { label: 'label.action.disable.nexusVswitch', messages: { - confirm: function(args) { + confirm: function (args) { return 'message.action.disable.nexusVswitch'; }, - notification: function(args) { + notification: function (args) { return 'label.action.disable.nexusVswitch'; } }, - action: function(args) { + action: function (args) { $.ajax({ url: createURL("disableCiscoNexusVSM&id=" + args.context.vSwitches[0].vsmdeviceid), dataType: "json", async: true, - success: function(json) { + success: function (json) { var jid = json.disablecisconexusvsmresponse.jobid; args.response.success({ _custom: { @@ -13130,38 +13209,38 @@ }); }, notification: { - poll: function(args) { + poll: function (args) { args.complete(); } } } - + /* 'remove': { - label: 'label.action.delete.nexusVswitch' , - messages: { - confirm: function(args) { - return 'message.action.delete.nexusVswitch'; - }, - notification: function(args) { - return 'label.action.delete.nexusVswitch'; - } - }, - action: function(args) { - $.ajax({ - url: createURL("deleteCiscoNexusVSM&id=" + args.context.vSwitches[0].vsmdeviceid), - dataType: "json", - async: true, - success: function(json) { - args.response.success({data:{}}); - } - }); - }, - notification: { - poll: function(args) { args.complete(); } - } - }*/ + label: 'label.action.delete.nexusVswitch' , + messages: { + confirm: function(args) { + return 'message.action.delete.nexusVswitch'; + }, + notification: function(args) { + return 'label.action.delete.nexusVswitch'; + } + }, + action: function(args) { + $.ajax({ + url: createURL("deleteCiscoNexusVSM&id=" + args.context.vSwitches[0].vsmdeviceid), + dataType: "json", + async: true, + success: function(json) { + args.response.success({data:{}}); + } + }); + }, + notification: { + poll: function(args) { args.complete(); } + } + }*/ }, - + tabs: { details: { title: 'label.details', @@ -13188,12 +13267,12 @@ } } }, - - dataProvider: function(args) { + + dataProvider: function (args) { $.ajax({ url: createURL("listCiscoNexusVSMs&clusterid=" + args.context.clusters[0].id), dataType: "json", - success: function(json) { + success: function (json) { var item = json.listcisconexusvsmscmdresponse.cisconexusvsm[0]; addExtraPropertiesToClusterObject(item); args.response.success({ @@ -13201,7 +13280,7 @@ data: item }); }, - error: function(json) { + error: function (json) { args.response.error(parseXMLHttpResponse(json)); } }); @@ -13209,85 +13288,82 @@ } } }, - - dataProvider: function(args) { + + dataProvider: function (args) { $.ajax({ url: createURL("listCiscoNexusVSMs&clusterid=" + args.context.clusters[0].id), dataType: "json", - success: function(json) { + success: function (json) { var item = json.listcisconexusvsmscmdresponse.cisconexusvsm; args.response.success({ actionFilter: nexusActionfilter, data: item - }); }, - error: function(json) { + error: function (json) { // Not generally a real error; means vSwitch still needs setup args.response.success({ - data: [] + data:[] }); } }); } } }, - + // Granular settings for cluster settings: { title: 'Settings', custom: cloudStack.uiCustom.granularSettings({ - dataProvider: function(args) { + dataProvider: function (args) { $.ajax({ url: createURL('listConfigurations&clusterid=' + args.context.clusters[0].id), - data: listViewDataProvider(args, {}, { searchBy: 'name' }), - success: function(json) { + data: listViewDataProvider(args, { + }, + { + searchBy: 'name' + }), + success: function (json) { args.response.success({ data: json.listconfigurationsresponse.configuration - }); - }, - - error: function(json) { + + error: function (json) { args.response.error(parseXMLHttpResponse(json)); - } }); - }, actions: { - edit: function(args) { + edit: function (args) { // call updateClusterLevelParameters - + var data = { name: args.data.jsonObj.name, value: args.data.value }; - + $.ajax({ url: createURL('updateConfiguration&clusterid=' + args.context.clusters[0].id), data: data, - success: function(json) { + success: function (json) { var item = json.updateconfigurationresponse.configuration; - + if (args.data.jsonObj.name == 'cpu.overprovisioning.factor' || args.data.jsonObj.name == 'mem.overprovisioning.factor') { - cloudStack.dialog.notice({ - message: 'Please note - if you are changing the over provisioning factor for a cluster with vms running, please refer to the admin guide to understand the capacity calculation.' - }); + cloudStack.dialog.notice({ + message: 'Please note - if you are changing the over provisioning factor for a cluster with vms running, please refer to the admin guide to understand the capacity calculation.' + }); } args.response.success({ data: item }); }, - - error: function(json) { + + error: function (json) { args.response.error(parseXMLHttpResponse(json)); } - }); - } } }) @@ -13326,35 +13402,36 @@ } } }, - - dataProvider: function(args) { - var array1 = []; + + dataProvider: function (args) { + var array1 =[]; if (args.filterBy != null) { if (args.filterBy.search != null && args.filterBy.search.by != null && args.filterBy.search.value != null) { switch (args.filterBy.search.by) { case "name": - if (args.filterBy.search.value.length > 0) - array1.push("&keyword=" + args.filterBy.search.value); - break; + if (args.filterBy.search.value.length > 0) + array1.push("&keyword=" + args.filterBy.search.value); + break; } } } - - if (!args.context.instances) { + + if (! args.context.instances) { array1.push("&zoneid=" + args.context.zones[0].id); if ("pods" in args.context) - array1.push("&podid=" + args.context.pods[0].id); + array1.push("&podid=" + args.context.pods[0].id); if ("clusters" in args.context) - array1.push("&clusterid=" + args.context.clusters[0].id); - } else { //Instances menu > Instance detailView > View Hosts + array1.push("&clusterid=" + args.context.clusters[0].id); + } else { + //Instances menu > Instance detailView > View Hosts array1.push("&id=" + args.context.instances[0].hostid); } - + $.ajax({ url: createURL("listHosts&type=Routing" + array1.join("") + "&page=" + args.page + "&pagesize=" + pageSize), dataType: "json", async: true, - success: function(json) { + success: function (json) { var items = json.listhostsresponse.host; args.response.success({ actionFilter: hostActionfilter, @@ -13363,11 +13440,11 @@ } }); }, - + actions: { add: { label: 'label.add.host', - + createForm: { title: 'label.add.host', fields: { @@ -13377,21 +13454,21 @@ validation: { required: true }, - select: function(args) { + select: function (args) { var data = args.context.zones ? { id: args.context.zones[0].id - } : { + }: { listAll: true }; - + $.ajax({ url: createURL('listZones'), data: data, - success: function(json) { - var zones = json.listzonesresponse.zone ? json.listzonesresponse.zone : []; - + success: function (json) { + var zones = json.listzonesresponse.zone ? json.listzonesresponse.zone:[]; + args.response.success({ - data: $.map(zones, function(zone) { + data: $.map(zones, function (zone) { return { id: zone.id, description: zone.name @@ -13402,7 +13479,7 @@ }); } }, - + //always appear (begin) podId: { label: 'label.pod', @@ -13411,25 +13488,24 @@ required: true }, dependsOn: 'zoneid', - select: function(args) { + select: function (args) { $.ajax({ url: createURL("listPods&zoneid=" + args.zoneid), dataType: "json", async: true, - success: function(json) { + success: function (json) { var pods = json.listpodsresponse.pod; - var items = []; - $(pods).each(function() { + var items =[]; + $(pods).each(function () { if (("pods" in args.context) && (this.id == args.context.pods[0].id)) - items.unshift({ - id: this.id, - description: this.name - }); - else - items.push({ - id: this.id, - description: this.name - }); + items.unshift({ + id: this.id, + description: this.name + }); else + items.push({ + id: this.id, + description: this.name + }); }); args.response.success({ data: items @@ -13438,7 +13514,7 @@ }); } }, - + clusterId: { label: 'label.cluster', docID: 'helpHostCluster', @@ -13446,64 +13522,63 @@ required: true }, dependsOn: 'podId', - select: function(args) { + select: function (args) { $.ajax({ url: createURL("listClusters&podid=" + args.podId), dataType: "json", async: false, - success: function(json) { + success: function (json) { clusterObjs = json.listclustersresponse.cluster; - var items = []; - $(clusterObjs).each(function() { + var items =[]; + $(clusterObjs).each(function () { if (("clusters" in args.context) && (this.id == args.context.clusters[0].id)) - items.unshift({ - id: this.id, - description: this.name - }); - else - items.push({ - id: this.id, - description: this.name - }); + items.unshift({ + id: this.id, + description: this.name + }); else + items.push({ + id: this.id, + description: this.name + }); }); args.response.success({ data: items }); } }); - - args.$select.change(function() { + + args.$select.change(function () { var $form = $(this).closest('form'); - + var clusterId = $(this).val(); if (clusterId == null) - return; - - var items = []; - $(clusterObjs).each(function() { + return; + + var items =[]; + $(clusterObjs).each(function () { if (this.id == clusterId) { selectedClusterObj = this; return false; //break the $.each() loop } }); if (selectedClusterObj == null) - return; - + return; + if (selectedClusterObj.hypervisortype == "VMware") { //$('li[input_group="general"]', $dialogAddHost).hide(); $form.find('.form-item[rel=hostname]').hide(); $form.find('.form-item[rel=username]').hide(); $form.find('.form-item[rel=password]').hide(); - + //$('li[input_group="vmware"]', $dialogAddHost).show(); $form.find('.form-item[rel=vcenterHost]').css('display', 'inline-block'); - + //$('li[input_group="baremetal"]', $dialogAddHost).hide(); $form.find('.form-item[rel=baremetalCpuCores]').hide(); $form.find('.form-item[rel=baremetalCpu]').hide(); $form.find('.form-item[rel=baremetalMemory]').hide(); $form.find('.form-item[rel=baremetalMAC]').hide(); - + //$('li[input_group="Ovm"]', $dialogAddHost).hide(); $form.find('.form-item[rel=agentUsername]').hide(); $form.find('.form-item[rel=agentPassword]').hide(); @@ -13512,16 +13587,16 @@ $form.find('.form-item[rel=hostname]').css('display', 'inline-block'); $form.find('.form-item[rel=username]').css('display', 'inline-block'); $form.find('.form-item[rel=password]').css('display', 'inline-block'); - + //$('li[input_group="baremetal"]', $dialogAddHost).show(); $form.find('.form-item[rel=baremetalCpuCores]').css('display', 'inline-block'); $form.find('.form-item[rel=baremetalCpu]').css('display', 'inline-block'); $form.find('.form-item[rel=baremetalMemory]').css('display', 'inline-block'); $form.find('.form-item[rel=baremetalMAC]').css('display', 'inline-block'); - + //$('li[input_group="vmware"]', $dialogAddHost).hide(); $form.find('.form-item[rel=vcenterHost]').hide(); - + //$('li[input_group="Ovm"]', $dialogAddHost).hide(); $form.find('.form-item[rel=agentUsername]').hide(); $form.find('.form-item[rel=agentPassword]').hide(); @@ -13530,16 +13605,16 @@ $form.find('.form-item[rel=hostname]').css('display', 'inline-block'); $form.find('.form-item[rel=username]').css('display', 'inline-block'); $form.find('.form-item[rel=password]').css('display', 'inline-block'); - + //$('li[input_group="vmware"]', $dialogAddHost).hide(); $form.find('.form-item[rel=vcenterHost]').hide(); - + //$('li[input_group="baremetal"]', $dialogAddHost).hide(); $form.find('.form-item[rel=baremetalCpuCores]').hide(); $form.find('.form-item[rel=baremetalCpu]').hide(); $form.find('.form-item[rel=baremetalMemory]').hide(); $form.find('.form-item[rel=baremetalMAC]').hide(); - + //$('li[input_group="Ovm"]', $dialogAddHost).show(); $form.find('.form-item[rel=agentUsername]').css('display', 'inline-block'); $form.find('.form-item[rel=agentUsername]').find('input').val("oracle"); @@ -13549,27 +13624,27 @@ $form.find('.form-item[rel=hostname]').css('display', 'inline-block'); $form.find('.form-item[rel=username]').css('display', 'inline-block'); $form.find('.form-item[rel=password]').css('display', 'inline-block'); - + //$('li[input_group="vmware"]', $dialogAddHost).hide(); $form.find('.form-item[rel=vcenterHost]').hide(); - + //$('li[input_group="baremetal"]', $dialogAddHost).hide(); $form.find('.form-item[rel=baremetalCpuCores]').hide(); $form.find('.form-item[rel=baremetalCpu]').hide(); $form.find('.form-item[rel=baremetalMemory]').hide(); $form.find('.form-item[rel=baremetalMAC]').hide(); - + //$('li[input_group="Ovm"]', $dialogAddHost).hide(); $form.find('.form-item[rel=agentUsername]').hide(); $form.find('.form-item[rel=agentPassword]').hide(); } }); - + args.$select.trigger("change"); } }, //always appear (end) - + //input_group="general" starts here hostname: { label: 'label.host.name', @@ -13579,7 +13654,7 @@ }, isHidden: true }, - + username: { label: 'label.username', docID: 'helpHostUsername', @@ -13588,7 +13663,7 @@ }, isHidden: true }, - + password: { label: 'label.password', docID: 'helpHostPassword', @@ -13598,16 +13673,14 @@ isHidden: true, isPassword: true }, - + isDedicated: { label: 'Dedicate', isBoolean: true, isChecked: false, docID: 'helpDedicateResource' - - }, - + domainId: { label: 'Domain', isHidden: true, @@ -13615,32 +13688,29 @@ required: true }, dependsOn: 'isDedicated', - select: function(args) { + select: function (args) { $.ajax({ url: createURL("listDomains&listAll=true"), dataType: "json", - success: function(json) { + success: function (json) { var domainObjs = json.listdomainsresponse.domain; - var items = []; - - $(domainObjs).each(function() { + var items =[]; + + $(domainObjs).each(function () { items.push({ id: this.id, description: this.name }); }); - + args.response.success({ data: items }); } - - }); - } }, - + accountId: { label: 'Account', isHidden: true, @@ -13649,11 +13719,10 @@ validation: { required: false } - }, - + //input_group="general" ends here - + //input_group="VMWare" starts here vcenterHost: { label: 'label.esx.host', @@ -13663,7 +13732,7 @@ isHidden: true }, //input_group="VMWare" ends here - + //input_group="BareMetal" starts here baremetalCpuCores: { label: 'label.num.cpu.cores', @@ -13694,7 +13763,7 @@ isHidden: true }, //input_group="BareMetal" ends here - + //input_group="OVM" starts here agentUsername: { label: 'label.agent.username', @@ -13712,7 +13781,7 @@ isPassword: true }, //input_group="OVM" ends here - + //always appear (begin) hosttags: { label: 'label.host.tags', @@ -13724,8 +13793,8 @@ //always appear (end) } }, - - action: function(args) { + + action: function (args) { var data = { zoneid: args.data.zoneid, podid: args.data.podId, @@ -13734,20 +13803,19 @@ clustertype: selectedClusterObj.clustertype, hosttags: args.data.hosttags }; - + if (selectedClusterObj.hypervisortype == "VMware") { $.extend(data, { username: '', password: '' }); - + var hostname = args.data.vcenterHost; var url; if (hostname.indexOf("http://") == -1) - url = "http://" + hostname; - else - url = hostname; - + url = "http://" + hostname; else + url = hostname; + $.extend(data, { url: url }); @@ -13756,18 +13824,17 @@ username: args.data.username, password: args.data.password }); - + var hostname = args.data.hostname; var url; if (hostname.indexOf("http://") == -1) - url = "http://" + hostname; - else - url = hostname; - + url = "http://" + hostname; else + url = hostname; + $.extend(data, { url: url }); - + if (selectedClusterObj.hypervisortype == "BareMetal") { $.extend(data, { cpunumber: args.data.baremetalCpuCores, @@ -13782,30 +13849,30 @@ }); } } - + var hostId = null; $.ajax({ url: createURL("addHost"), type: "POST", data: data, - success: function(json) { + success: function (json) { var item = json.addhostresponse.host[0]; - + hostId = json.addhostresponse.host[0].id; - + //EXPLICIT DEDICATION - var array2 = []; - + var array2 =[]; + if (args.$form.find('.form-item[rel=isDedicated]').find('input[type=checkbox]').is(':Checked') == true) { if (args.data.accountId != "") - array2.push("&account=" + todb(args.data.accountId)); - - + array2.push("&account=" + todb(args.data.accountId)); + + if (hostId != null) { $.ajax({ url: createURL("dedicateHost&hostId=" + hostId + "&domainId=" + args.data.domainId + array2.join("")), dataType: "json", - success: function(json) { + success: function (json) { var jid = json.dedicatehostresponse.jobid; args.response.success({ _custom: { @@ -13816,14 +13883,12 @@ interval: 4500, desc: "Dedicate Host" }, - + data: item - }); - }, - - error: function(json) { + + error: function (json) { args.response.error(parseXMLHttpResponse(XMLHttpResponse)); } }); @@ -13833,25 +13898,24 @@ data: item }); }, - - error: function(XMLHttpResponse) { + + error: function (XMLHttpResponse) { var errorMsg = parseXMLHttpResponse(XMLHttpResponse); args.response.error(errorMsg); } - }); }, - + notification: { - poll: function(args) { + poll: function (args) { args.complete({ actionFilter: hostActionfilter }); } }, - + messages: { - notification: function(args) { + notification: function (args) { return 'label.add.host'; } } @@ -13866,17 +13930,17 @@ actions: { edit: { label: 'label.edit', - action: function(args) { - var array1 = []; + action: function (args) { + var array1 =[]; array1.push("&hosttags=" + todb(args.data.hosttags)); - + if (args.data.oscategoryid != null && args.data.oscategoryid.length > 0) - array1.push("&osCategoryId=" + args.data.oscategoryid); - + array1.push("&osCategoryId=" + args.data.oscategoryid); + $.ajax({ url: createURL("updateHost&id=" + args.context.hosts[0].id + array1.join("")), dataType: "json", - success: function(json) { + success: function (json) { var item = json.updatehostresponse.host; args.response.success({ actionFilter: hostActionfilter, @@ -13886,14 +13950,14 @@ }); } }, - + dedicate: { label: 'Dedicate Host', messages: { - confirm: function(args) { + confirm: function (args) { return 'Do you really want to dedicate this host to a domain/account? '; }, - notification: function(args) { + notification: function (args) { return 'Host Dedicated'; } }, @@ -13905,22 +13969,22 @@ validation: { required: true }, - select: function(args) { + select: function (args) { $.ajax({ url: createURL("listDomains&listAll=true"), dataType: "json", async: false, - success: function(json) { + success: function (json) { var domainObjs = json.listdomainsresponse.domain; - var items = []; - - $(domainObjs).each(function() { + var items =[]; + + $(domainObjs).each(function () { items.push({ id: this.id, description: this.name }); }); - + args.response.success({ data: items }); @@ -13937,24 +14001,24 @@ } } }, - action: function(args) { + action: function (args) { //EXPLICIT DEDICATION - var array2 = []; + var array2 =[]; if (args.data.accountId != "") - array2.push("&account=" + todb(args.data.accountId)); - + array2.push("&account=" + todb(args.data.accountId)); + $.ajax({ url: createURL("dedicateHost&hostId=" + - args.context.hosts[0].id + - "&domainId=" + args.data.domainId + array2.join("")), + args.context.hosts[0].id + + "&domainId=" + args.data.domainId + array2.join("")), dataType: "json", - success: function(json) { + success: function (json) { var jid = json.dedicatehostresponse.jobid; - + args.response.success({ _custom: { jobId: jid, - getActionFilter: function() { + getActionFilter: function () { return hostActionfilter; } } @@ -13969,30 +14033,30 @@ release: { label: 'Release Dedicated Host', messages: { - confirm: function(args) { + confirm: function (args) { return 'Do you want to release this dedicated host ?'; }, - notification: function(args) { + notification: function (args) { return 'Host dedication released'; } }, - action: function(args) { + action: function (args) { $.ajax({ url: createURL("releaseDedicatedHost&hostid=" + args.context.hosts[0].id), dataType: "json", async: true, - success: function(json) { + success: function (json) { var jid = json.releasededicatedhostresponse.jobid; args.response.success({ _custom: { jobId: jid, - getActionFilter: function() { + getActionFilter: function () { return hostActionfilter; } } }); }, - error: function(json) { + error: function (json) { args.response.error(parseXMLHttpResponse(json)); } }); @@ -14001,24 +14065,24 @@ poll: pollAsyncJobResult } }, - - + + enableMaintenanceMode: { label: 'label.action.enable.maintenance.mode', - action: function(args) { + action: function (args) { $.ajax({ url: createURL("prepareHostForMaintenance&id=" + args.context.hosts[0].id), dataType: "json", async: true, - success: function(json) { + success: function (json) { var jid = json.preparehostformaintenanceresponse.jobid; args.response.success({ _custom: { jobId: jid, - getUpdatedItem: function(json) { + getUpdatedItem: function (json) { return json.queryasyncjobresultresponse.jobresult.host; }, - getActionFilter: function() { + getActionFilter: function () { return hostActionfilter; } } @@ -14027,10 +14091,10 @@ }); }, messages: { - confirm: function(args) { + confirm: function (args) { return 'message.action.host.enable.maintenance.mode'; }, - notification: function(args) { + notification: function (args) { return 'label.action.enable.maintenance.mode'; } }, @@ -14038,23 +14102,23 @@ poll: pollAsyncJobResult } }, - + cancelMaintenanceMode: { label: 'label.action.cancel.maintenance.mode', - action: function(args) { + action: function (args) { $.ajax({ url: createURL("cancelHostMaintenance&id=" + args.context.hosts[0].id), dataType: "json", async: true, - success: function(json) { + success: function (json) { var jid = json.cancelhostmaintenanceresponse.jobid; args.response.success({ _custom: { jobId: jid, - getUpdatedItem: function(json) { + getUpdatedItem: function (json) { return json.queryasyncjobresultresponse.jobresult.host; }, - getActionFilter: function() { + getActionFilter: function () { return hostActionfilter; } } @@ -14063,10 +14127,10 @@ }); }, messages: { - confirm: function(args) { + confirm: function (args) { return 'message.action.cancel.maintenance.mode'; }, - notification: function(args) { + notification: function (args) { return 'label.action.cancel.maintenance.mode'; } }, @@ -14074,23 +14138,23 @@ poll: pollAsyncJobResult } }, - + forceReconnect: { label: 'label.action.force.reconnect', - action: function(args) { + action: function (args) { $.ajax({ url: createURL("reconnectHost&id=" + args.context.hosts[0].id), dataType: "json", async: true, - success: function(json) { + success: function (json) { var jid = json.reconnecthostresponse.jobid; args.response.success({ _custom: { jobId: jid, - getUpdatedItem: function(json) { + getUpdatedItem: function (json) { return json.queryasyncjobresultresponse.jobresult.host; }, - getActionFilter: function() { + getActionFilter: function () { return hostActionfilter; } } @@ -14099,10 +14163,10 @@ }); }, messages: { - confirm: function(args) { + confirm: function (args) { return 'message.confirm.action.force.reconnect'; }, - notification: function(args) { + notification: function (args) { return 'label.action.force.reconnect'; } }, @@ -14110,15 +14174,15 @@ poll: pollAsyncJobResult } }, - + 'remove': { label: 'label.action.remove.host', messages: { - notification: function(args) { + notification: function (args) { return 'label.action.remove.host'; } }, - preFilter: function(args) { + preFilter: function (args) { if (isAdmin()) { args.$form.find('.form-item[rel=isForced]').css('display', 'inline-block'); } @@ -14134,42 +14198,42 @@ } } }, - action: function(args) { - var array1 = []; + action: function (args) { + var array1 =[]; //if(args.$form.find('.form-item[rel=isForced]').css("display") != "none") //uncomment after Brian fix it to include $form in args array1.push("&forced=" + (args.data.isForced == "on")); - + $.ajax({ url: createURL("deleteHost&id=" + args.context.hosts[0].id + array1.join("")), dataType: "json", async: true, - success: function(json) { + success: function (json) { //{ "deletehostresponse" : { "success" : "true"} } args.response.success({ - data: {} + data: { + } }); } }); }, notification: { - poll: function(args) { + poll: function (args) { args.complete(); } } } - }, tabs: { details: { title: 'label.details', - - preFilter: function(args) { - var hiddenFields = []; + + preFilter: function (args) { + var hiddenFields =[]; $.ajax({ url: createURL('listConfigurations&name=ha.tag'), dataType: 'json', async: false, - success: function(json) { + success: function (json) { if (json.listconfigurationsresponse.configuration == null || json.listconfigurationsresponse.configuration[0].value == null || json.listconfigurationsresponse.configuration[0].value.length == 0) { hiddenFields.push('hahost'); } @@ -14177,108 +14241,103 @@ }); return hiddenFields; }, - - fields: [{ - name: { - label: 'label.name' - } - }, { - id: { - label: 'label.id' - }, - resourcestate: { - label: 'label.resource.state' - }, - state: { - label: 'label.state' - }, - type: { - label: 'label.type' - }, - hypervisor: { - label: 'label.hypervisor' - }, - hypervisorversion: { - label: 'label.hypervisor.version' - }, - hosttags: { - label: 'label.host.tags', - isEditable: true - }, - hahost: { - label: 'label.ha.enabled', - converter: cloudStack.converters.toBooleanText - }, - oscategoryid: { - label: 'label.os.preference', - isEditable: true, - select: function(args) { - $.ajax({ - url: createURL("listOsCategories"), - dataType: "json", - async: true, - success: function(json) { - var oscategoryObjs = json.listoscategoriesresponse.oscategory; - var items = [{ - id: '', - description: _l('') - }]; - $(oscategoryObjs).each(function() { - items.push({ - id: this.id, - description: this.name - }); + + fields:[ { + name: { + label: 'label.name' + } + }, + { + id: { + label: 'label.id' + }, + resourcestate: { + label: 'label.resource.state' + }, + state: { + label: 'label.state' + }, + type: { + label: 'label.type' + }, + hypervisor: { + label: 'label.hypervisor' + }, + hypervisorversion: { + label: 'label.hypervisor.version' + }, + hosttags: { + label: 'label.host.tags', + isEditable: true + }, + hahost: { + label: 'label.ha.enabled', + converter: cloudStack.converters.toBooleanText + }, + oscategoryid: { + label: 'label.os.preference', + isEditable: true, + select: function (args) { + $.ajax({ + url: createURL("listOsCategories"), + dataType: "json", + async: true, + success: function (json) { + var oscategoryObjs = json.listoscategoriesresponse.oscategory; + var items =[ { + id: '', + description: _l('') + }]; + $(oscategoryObjs).each(function () { + items.push({ + id: this.id, + description: this.name }); - args.response.success({ - data: items - }); - } - }); - } - }, - zonename: { - label: 'label.zone' - }, - podname: { - label: 'label.pod' - }, - clustername: { - label: 'label.cluster' - }, - ipaddress: { - label: 'label.ip.address' - }, - disconnected: { - label: 'label.last.disconnected' + }); + args.response.success({ + data: items + }); + } + }); } }, - - { - - isdedicated: { - label: 'Dedicated' - }, - domainid: { - label: 'Domain ID' - } - + zonename: { + label: 'label.zone' + }, + podname: { + label: 'label.pod' + }, + clustername: { + label: 'label.cluster' + }, + ipaddress: { + label: 'label.ip.address' + }, + disconnected: { + label: 'label.last.disconnected' } - - - ], - - dataProvider: function(args) { + }, { + + isdedicated: { + label: 'Dedicated' + }, + domainid: { + label: 'Domain ID' + } + }], + + dataProvider: function (args) { $.ajax({ url: createURL("listHosts&id=" + args.context.hosts[0].id), dataType: "json", async: true, - success: function(json) { + success: function (json) { var item = json.listhostsresponse.host[0]; $.ajax({ url: createURL("listDedicatedHosts&hostid=" + args.context.hosts[0].id), dataType: "json", async: false, - success: function(json) { + success: function (json) { if (json.listdedicatedhostsresponse.dedicatedhost != undefined) { var hostItem = json.listdedicatedhostsresponse.dedicatedhost[0]; if (hostItem.domainid != null) { @@ -14287,12 +14346,11 @@ }); } } else - $.extend(item, { - isdedicated: 'No' - }) - + $.extend(item, { + isdedicated: 'No' + }) }, - error: function(json) { + error: function (json) { args.response.error(parseXMLHttpResponse(XMLHttpResponse)); } }); @@ -14300,12 +14358,11 @@ actionFilter: hostActionfilter, data: item }); - } }); } }, - + stats: { title: 'label.statistics', fields: { @@ -14334,23 +14391,23 @@ label: 'label.network.write' } }, - dataProvider: function(args) { + dataProvider: function (args) { $.ajax({ url: createURL("listHosts&id=" + args.context.hosts[0].id), dataType: "json", async: true, - success: function(json) { + success: function (json) { var jsonObj = json.listhostsresponse.host[0]; args.response.success({ data: { totalCPU: jsonObj.cpunumber + " x " + cloudStack.converters.convertHz(jsonObj.cpuspeed), cpuused: jsonObj.cpuused, - cpuallocated: (jsonObj.cpuallocated == null || jsonObj.cpuallocated == 0) ? "N/A" : jsonObj.cpuallocated, - memorytotal: (jsonObj.memorytotal == null || jsonObj.memorytotal == 0) ? "N/A" : cloudStack.converters.convertBytes(jsonObj.memorytotal), - memoryallocated: (jsonObj.memoryallocated == null || jsonObj.memoryallocated == 0) ? "N/A" : cloudStack.converters.convertBytes(jsonObj.memoryallocated), - memoryused: (jsonObj.memoryused == null || jsonObj.memoryused == 0) ? "N/A" : cloudStack.converters.convertBytes(jsonObj.memoryused), - networkkbsread: (jsonObj.networkkbsread == null) ? "N/A" : cloudStack.converters.convertBytes(jsonObj.networkkbsread * 1024), - networkkbswrite: (jsonObj.networkkbswrite == null) ? "N/A" : cloudStack.converters.convertBytes(jsonObj.networkkbswrite * 1024) + cpuallocated: (jsonObj.cpuallocated == null || jsonObj.cpuallocated == 0) ? "N/A": jsonObj.cpuallocated, + memorytotal: (jsonObj.memorytotal == null || jsonObj.memorytotal == 0) ? "N/A": cloudStack.converters.convertBytes(jsonObj.memorytotal), + memoryallocated: (jsonObj.memoryallocated == null || jsonObj.memoryallocated == 0) ? "N/A": cloudStack.converters.convertBytes(jsonObj.memoryallocated), + memoryused: (jsonObj.memoryused == null || jsonObj.memoryused == 0) ? "N/A": cloudStack.converters.convertBytes(jsonObj.memoryused), + networkkbsread: (jsonObj.networkkbsread == null) ? "N/A": cloudStack.converters.convertBytes(jsonObj.networkkbsread * 1024), + networkkbswrite: (jsonObj.networkkbswrite == null) ? "N/A": cloudStack.converters.convertBytes(jsonObj.networkkbswrite * 1024) } }); } @@ -14384,29 +14441,29 @@ label: 'Scope' } }, - - dataProvider: function(args) { - var array1 = []; + + dataProvider: function (args) { + var array1 =[]; if (args.filterBy != null) { if (args.filterBy.search != null && args.filterBy.search.by != null && args.filterBy.search.value != null) { switch (args.filterBy.search.by) { case "name": - if (args.filterBy.search.value.length > 0) - array1.push("&keyword=" + args.filterBy.search.value); - break; + if (args.filterBy.search.value.length > 0) + array1.push("&keyword=" + args.filterBy.search.value); + break; } } } array1.push("&zoneid=" + args.context.zones[0].id); if ("pods" in args.context) - array1.push("&podid=" + args.context.pods[0].id); + array1.push("&podid=" + args.context.pods[0].id); if ("clusters" in args.context) - array1.push("&clusterid=" + args.context.clusters[0].id); + array1.push("&clusterid=" + args.context.clusters[0].id); $.ajax({ url: createURL("listStoragePools&page=" + args.page + "&pagesize=" + pageSize + array1.join("")), dataType: "json", async: true, - success: function(json) { + success: function (json) { var items = json.liststoragepoolsresponse.storagepool; args.response.success({ actionFilter: primarystorageActionfilter, @@ -14415,70 +14472,62 @@ } }); }, - + actions: { add: { label: 'label.add.primary.storage', - + createForm: { title: 'label.add.primary.storage', fields: { scope: { label: 'label.scope', - select: function(args) { - var scope = [{ - id: 'cluster', - description: _l('label.cluster') - }, { - id: 'zone', - description: _l('label.zone.wide') - } - // { id: 'host', description: _l('label.host') } - ]; - + select: function (args) { + var scope =[ { + id: 'cluster', + description: _l('label.cluster') + }, + { + id: 'zone', + description: _l('label.zone.wide') + } + // { id: 'host', description: _l('label.host') }]; + args.response.success({ data: scope }); - - args.$select.change(function() { + + args.$select.change(function () { var $form = $(this).closest('form'); var scope = $(this).val(); - + if (scope == 'zone') { $form.find('.form-item[rel=podId]').hide(); $form.find('.form-item[rel=clusterId]').hide(); $form.find('.form-item[rel=hostId]').hide(); $form.find('.form-item[rel=hypervisor]').css('display', 'inline-block'); - - } else if (scope == 'cluster') { - + $form.find('.form-item[rel=hostId]').hide(); $form.find('.form-item[rel=podId]').css('display', 'inline-block'); $form.find('.form-item[rel=clusterId]').css('display', 'inline-block'); $form.find('.form-item[rel=hypervisor]').hide(); - - } else if (scope == 'host') { $form.find('.form-item[rel=podId]').css('display', 'inline-block'); $form.find('.form-item[rel=clusterId]').css('display', 'inline-block'); $form.find('.form-item[rel=hostId]').css('display', 'inline-block'); $form.find('.form-item[rel=hypervisor]').hide(); - - } - }) - } }, - - + + hypervisor: { label: 'label.hypervisor', isHidden: true, - select: function(args) { - var items = []; + select: function (args) { + var items =[]; items.push({ id: 'KVM', description: _l('KVM') @@ -14487,35 +14536,34 @@ id: 'VMware', description: _l('VMware') }); - + args.response.success({ data: items }); - } }, - + zoneid: { label: 'label.zone', docID: 'helpPrimaryStorageZone', validation: { required: true }, - select: function(args) { + select: function (args) { var data = args.context.zones ? { id: args.context.zones[0].id - } : { + }: { listAll: true }; - + $.ajax({ url: createURL('listZones'), data: data, - success: function(json) { - var zones = json.listzonesresponse.zone ? json.listzonesresponse.zone : []; - + success: function (json) { + var zones = json.listzonesresponse.zone ? json.listzonesresponse.zone:[]; + args.response.success({ - data: $.map(zones, function(zone) { + data: $.map(zones, function (zone) { return { id: zone.id, description: zone.name @@ -14533,15 +14581,15 @@ validation: { required: true }, - select: function(args) { + select: function (args) { $.ajax({ url: createURL("listPods&zoneid=" + args.zoneid), dataType: "json", async: true, - success: function(json) { + success: function (json) { var pods = json.listpodsresponse.pod; - var items = []; - $(pods).each(function() { + var items =[]; + $(pods).each(function () { items.push({ id: this.id, description: this.name @@ -14554,7 +14602,7 @@ }); } }, - + clusterId: { label: 'label.cluster', docID: 'helpPrimaryStorageCluster', @@ -14562,15 +14610,15 @@ required: true }, dependsOn: 'podId', - select: function(args) { + select: function (args) { $.ajax({ url: createURL("listClusters&podid=" + args.podId), dataType: "json", async: false, - success: function(json) { + success: function (json) { clusterObjs = json.listclustersresponse.cluster; - var items = []; - $(clusterObjs).each(function() { + var items =[]; + $(clusterObjs).each(function () { items.push({ id: this.id, description: this.name @@ -14584,24 +14632,24 @@ }); } }, - + hostId: { label: 'label.host', validation: { required: true }, dependsOn: 'clusterId', - select: function(args) { + select: function (args) { $.ajax({ url: createURL('listHosts'), data: { clusterid: args.clusterId }, - success: function(json) { + success: function (json) { var hosts = json.listhostsresponse.host ? - json.listhostsresponse.host : [] + json.listhostsresponse.host:[] args.response.success({ - data: $.map(hosts, function(host) { + data: $.map(hosts, function (host) { return { id: host.id, description: host.name @@ -14612,7 +14660,7 @@ }); } }, - + name: { label: 'label.name', docID: 'helpPrimaryStorageName', @@ -14620,7 +14668,7 @@ required: true } }, - + protocol: { label: 'label.protocol', docID: 'helpPrimaryStorageProtocol', @@ -14628,26 +14676,26 @@ required: true }, dependsOn: 'clusterId', - select: function(args) { + select: function (args) { var clusterId = args.clusterId; if (clusterId == null) - return; - var items = []; - $(clusterObjs).each(function() { + return; + var items =[]; + $(clusterObjs).each(function () { if (this.id == clusterId) { selectedClusterObj = this; return false; //break the $.each() loop } }); if (selectedClusterObj == null) - return; - + return; + if (selectedClusterObj.hypervisortype == "KVM") { - var items = []; + var items =[]; items.push({ id: "nfs", description: "nfs" - }); + }); items.push({ id: "SharedMountPoint", description: "SharedMountPoint" @@ -14664,11 +14712,11 @@ data: items }); } else if (selectedClusterObj.hypervisortype == "XenServer") { - var items = []; + var items =[]; items.push({ id: "nfs", description: "nfs" - }); + }); items.push({ id: "PreSetup", description: "PreSetup" @@ -14681,11 +14729,11 @@ data: items }); } else if (selectedClusterObj.hypervisortype == "VMware") { - var items = []; + var items =[]; items.push({ id: "nfs", description: "nfs" - }); + }); items.push({ id: "vmfs", description: "vmfs" @@ -14694,7 +14742,7 @@ data: items }); } else if (selectedClusterObj.hypervisortype == "Hyperv") { - var items = []; + var items =[]; items.push({ id: "SMB", description: "SMB/CIFS" @@ -14703,11 +14751,11 @@ data: items }); } else if (selectedClusterObj.hypervisortype == "Ovm") { - var items = []; + var items =[]; items.push({ id: "nfs", description: "nfs" - }); + }); items.push({ id: "ocfs2", description: "ocfs2" @@ -14716,11 +14764,11 @@ data: items }); } else if (selectedClusterObj.hypervisortype == "LXC") { - var items = []; + var items =[]; items.push({ id: "nfs", description: "nfs" - }); + }); items.push({ id: "SharedMountPoint", description: "SharedMountPoint" @@ -14730,71 +14778,23 @@ }); } else { args.response.success({ - data: [] + data:[] }); } - - args.$select.change(function() { + + args.$select.change(function () { var $form = $(this).closest('form'); - + var protocol = $(this).val(); if (protocol == null) - return; - - - if (protocol == "nfs") { - $form.find('.form-item[rel=server]').css('display', 'inline-block'); + return; + + + if (protocol == "nfs") { + $form.find('.form-item[rel=server]').css('display', 'inline-block'); $form.find('.form-item[rel=server]').find(".value").find("input").val(""); - $form.find('.form-item[rel=path]').css('display', 'inline-block'); - var $required = $form.find('.form-item[rel=path]').find(".name").find("label span"); - $form.find('.form-item[rel=path]').find(".name").find("label").text("Path:").prepend($required); - - $form.find('.form-item[rel=smbUsername]').hide(); - $form.find('.form-item[rel=smbPassword]').hide(); - $form.find('.form-item[rel=smbDomain]').hide(); - - $form.find('.form-item[rel=iqn]').hide(); - $form.find('.form-item[rel=lun]').hide(); - - $form.find('.form-item[rel=volumegroup]').hide(); - - $form.find('.form-item[rel=vCenterDataCenter]').hide(); - $form.find('.form-item[rel=vCenterDataStore]').hide(); - - $form.find('.form-item[rel=rbdmonitor]').hide(); - $form.find('.form-item[rel=rbdpool]').hide(); - $form.find('.form-item[rel=rbdid]').hide(); - $form.find('.form-item[rel=rbdsecret]').hide(); - } else if (protocol == "SMB") { //"SMB" show almost the same fields as "nfs" does, except 3 more SMB-specific fields. - $form.find('.form-item[rel=server]').css('display', 'inline-block'); - $form.find('.form-item[rel=server]').find(".value").find("input").val(""); - - $form.find('.form-item[rel=path]').css('display', 'inline-block'); - var $required = $form.find('.form-item[rel=path]').find(".name").find("label span"); - $form.find('.form-item[rel=path]').find(".name").find("label").text("Path:").prepend($required); - - $form.find('.form-item[rel=smbUsername]').css('display', 'inline-block'); - $form.find('.form-item[rel=smbPassword]').css('display', 'inline-block'); - $form.find('.form-item[rel=smbDomain]').css('display', 'inline-block'); - - $form.find('.form-item[rel=iqn]').hide(); - $form.find('.form-item[rel=lun]').hide(); - - $form.find('.form-item[rel=volumegroup]').hide(); - - $form.find('.form-item[rel=vCenterDataCenter]').hide(); - $form.find('.form-item[rel=vCenterDataStore]').hide(); - - $form.find('.form-item[rel=rbdmonitor]').hide(); - $form.find('.form-item[rel=rbdpool]').hide(); - $form.find('.form-item[rel=rbdid]').hide(); - $form.find('.form-item[rel=rbdsecret]').hide(); - } else if (protocol == "ocfs2") { //ocfs2 is the same as nfs, except no server field. - $form.find('.form-item[rel=server]').hide(); - $form.find('.form-item[rel=server]').find(".value").find("input").val(""); - - $form.find('.form-item[rel=path]').css('display', 'inline-block'); + $form.find('.form-item[rel=path]').css('display', 'inline-block'); var $required = $form.find('.form-item[rel=path]').find(".name").find("label span"); $form.find('.form-item[rel=path]').find(".name").find("label").text("Path:").prepend($required); @@ -14804,21 +14804,71 @@ $form.find('.form-item[rel=iqn]').hide(); $form.find('.form-item[rel=lun]').hide(); - + $form.find('.form-item[rel=volumegroup]').hide(); $form.find('.form-item[rel=vCenterDataCenter]').hide(); $form.find('.form-item[rel=vCenterDataStore]').hide(); - + $form.find('.form-item[rel=rbdmonitor]').hide(); $form.find('.form-item[rel=rbdpool]').hide(); $form.find('.form-item[rel=rbdid]').hide(); $form.find('.form-item[rel=rbdsecret]').hide(); - } else if (protocol == "PreSetup") { - $form.find('.form-item[rel=server]').hide(); + } else if (protocol == "SMB") { + //"SMB" show almost the same fields as "nfs" does, except 3 more SMB-specific fields. + $form.find('.form-item[rel=server]').css('display', 'inline-block'); + $form.find('.form-item[rel=server]').find(".value").find("input").val(""); + + $form.find('.form-item[rel=path]').css('display', 'inline-block'); + var $required = $form.find('.form-item[rel=path]').find(".name").find("label span"); + $form.find('.form-item[rel=path]').find(".name").find("label").text("Path:").prepend($required); + + $form.find('.form-item[rel=smbUsername]').css('display', 'inline-block'); + $form.find('.form-item[rel=smbPassword]').css('display', 'inline-block'); + $form.find('.form-item[rel=smbDomain]').css('display', 'inline-block'); + + $form.find('.form-item[rel=iqn]').hide(); + $form.find('.form-item[rel=lun]').hide(); + + $form.find('.form-item[rel=volumegroup]').hide(); + + $form.find('.form-item[rel=vCenterDataCenter]').hide(); + $form.find('.form-item[rel=vCenterDataStore]').hide(); + + $form.find('.form-item[rel=rbdmonitor]').hide(); + $form.find('.form-item[rel=rbdpool]').hide(); + $form.find('.form-item[rel=rbdid]').hide(); + $form.find('.form-item[rel=rbdsecret]').hide(); + } else if (protocol == "ocfs2") { + //ocfs2 is the same as nfs, except no server field. + $form.find('.form-item[rel=server]').hide(); + $form.find('.form-item[rel=server]').find(".value").find("input").val(""); + + $form.find('.form-item[rel=path]').css('display', 'inline-block'); + var $required = $form.find('.form-item[rel=path]').find(".name").find("label span"); + $form.find('.form-item[rel=path]').find(".name").find("label").text("Path:").prepend($required); + + $form.find('.form-item[rel=smbUsername]').hide(); + $form.find('.form-item[rel=smbPassword]').hide(); + $form.find('.form-item[rel=smbDomain]').hide(); + + $form.find('.form-item[rel=iqn]').hide(); + $form.find('.form-item[rel=lun]').hide(); + + $form.find('.form-item[rel=volumegroup]').hide(); + + $form.find('.form-item[rel=vCenterDataCenter]').hide(); + $form.find('.form-item[rel=vCenterDataStore]').hide(); + + $form.find('.form-item[rel=rbdmonitor]').hide(); + $form.find('.form-item[rel=rbdpool]').hide(); + $form.find('.form-item[rel=rbdid]').hide(); + $form.find('.form-item[rel=rbdsecret]').hide(); + } else if (protocol == "PreSetup") { + $form.find('.form-item[rel=server]').hide(); $form.find('.form-item[rel=server]').find(".value").find("input").val("localhost"); - - $form.find('.form-item[rel=path]').css('display', 'inline-block'); + + $form.find('.form-item[rel=path]').css('display', 'inline-block'); var $required = $form.find('.form-item[rel=path]').find(".name").find("label span"); $form.find('.form-item[rel=path]').find(".name").find("label").text("SR Name-Label:").prepend($required); @@ -14833,15 +14883,15 @@ $form.find('.form-item[rel=vCenterDataCenter]').hide(); $form.find('.form-item[rel=vCenterDataStore]').hide(); - + $form.find('.form-item[rel=rbdmonitor]').hide(); $form.find('.form-item[rel=rbdpool]').hide(); $form.find('.form-item[rel=rbdid]').hide(); $form.find('.form-item[rel=rbdsecret]').hide(); - } else if (protocol == "iscsi") { - $form.find('.form-item[rel=server]').css('display', 'inline-block'); + } else if (protocol == "iscsi") { + $form.find('.form-item[rel=server]').css('display', 'inline-block'); $form.find('.form-item[rel=server]').find(".value").find("input").val(""); - + $form.find('.form-item[rel=path]').hide(); $form.find('.form-item[rel=smbUsername]').hide(); @@ -14852,18 +14902,18 @@ $form.find('.form-item[rel=lun]').css('display', 'inline-block'); $form.find('.form-item[rel=volumegroup]').hide(); - + $form.find('.form-item[rel=vCenterDataCenter]').hide(); $form.find('.form-item[rel=vCenterDataStore]').hide(); - + $form.find('.form-item[rel=rbdmonitor]').hide(); $form.find('.form-item[rel=rbdpool]').hide(); $form.find('.form-item[rel=rbdid]').hide(); $form.find('.form-item[rel=rbdsecret]').hide(); - } else if ($(this).val() == "clvm") { - $form.find('.form-item[rel=server]').hide(); + } else if ($(this).val() == "clvm") { + $form.find('.form-item[rel=server]').hide(); $form.find('.form-item[rel=server]').find(".value").find("input").val("localhost"); - + $form.find('.form-item[rel=path]').hide(); $form.find('.form-item[rel=smbUsername]').hide(); @@ -14872,20 +14922,20 @@ $form.find('.form-item[rel=iqn]').hide(); $form.find('.form-item[rel=lun]').hide(); - + $form.find('.form-item[rel=volumegroup]').css('display', 'inline-block'); - + $form.find('.form-item[rel=vCenterDataCenter]').hide(); $form.find('.form-item[rel=vCenterDataStore]').hide(); - + $form.find('.form-item[rel=rbdmonitor]').hide(); $form.find('.form-item[rel=rbdpool]').hide(); $form.find('.form-item[rel=rbdid]').hide(); $form.find('.form-item[rel=rbdsecret]').hide(); - } else if (protocol == "vmfs") { - $form.find('.form-item[rel=server]').css('display', 'inline-block'); + } else if (protocol == "vmfs") { + $form.find('.form-item[rel=server]').css('display', 'inline-block'); $form.find('.form-item[rel=server]').find(".value").find("input").val(""); - + $form.find('.form-item[rel=path]').hide(); $form.find('.form-item[rel=smbUsername]').hide(); @@ -14894,18 +14944,19 @@ $form.find('.form-item[rel=iqn]').hide(); $form.find('.form-item[rel=lun]').hide(); - + $form.find('.form-item[rel=volumegroup]').hide(); - + $form.find('.form-item[rel=vCenterDataCenter]').css('display', 'inline-block'); $form.find('.form-item[rel=vCenterDataStore]').css('display', 'inline-block'); - + $form.find('.form-item[rel=rbdmonitor]').hide(); $form.find('.form-item[rel=rbdpool]').hide(); $form.find('.form-item[rel=rbdid]').hide(); $form.find('.form-item[rel=rbdsecret]').hide(); - } else if (protocol == "SharedMountPoint") { //"SharedMountPoint" show the same fields as "nfs" does. - $form.find('.form-item[rel=server]').hide(); + } else if (protocol == "SharedMountPoint") { + //"SharedMountPoint" show the same fields as "nfs" does. + $form.find('.form-item[rel=server]').hide(); $form.find('.form-item[rel=server]').find(".value").find("input").val("localhost"); $form.find('.form-item[rel=path]').css('display', 'inline-block'); @@ -14918,12 +14969,12 @@ $form.find('.form-item[rel=iqn]').hide(); $form.find('.form-item[rel=lun]').hide(); - + $form.find('.form-item[rel=volumegroup]').hide(); $form.find('.form-item[rel=vCenterDataCenter]').hide(); $form.find('.form-item[rel=vCenterDataStore]').hide(); - + $form.find('.form-item[rel=rbdmonitor]').hide(); $form.find('.form-item[rel=rbdpool]').hide(); $form.find('.form-item[rel=rbdid]').hide(); @@ -14931,16 +14982,16 @@ } else if (protocol == "rbd") { $form.find('.form-item[rel=rbdmonitor]').css('display', 'inline-block'); $form.find('.form-item[rel=rbdmonitor]').find(".name").find("label").text("RADOS Monitor:"); - + $form.find('.form-item[rel=rbdpool]').css('display', 'inline-block'); $form.find('.form-item[rel=rbdpool]').find(".name").find("label").text("RADOS Pool:"); - + $form.find('.form-item[rel=rbdid]').css('display', 'inline-block'); $form.find('.form-item[rel=rbdid]').find(".name").find("label").text("RADOS User:"); - + $form.find('.form-item[rel=rbdsecret]').css('display', 'inline-block'); $form.find('.form-item[rel=rbdsecret]').find(".name").find("label").text("RADOS Secret:"); - + $form.find('.form-item[rel=server]').hide(); $form.find('.form-item[rel=iqn]').hide(); $form.find('.form-item[rel=lun]').hide(); @@ -14952,18 +15003,18 @@ $form.find('.form-item[rel=smbUsername]').hide(); $form.find('.form-item[rel=smbPassword]').hide(); $form.find('.form-item[rel=smbDomain]').hide(); - } else { - $form.find('.form-item[rel=server]').css('display', 'inline-block'); + } else { + $form.find('.form-item[rel=server]').css('display', 'inline-block'); $form.find('.form-item[rel=server]').find(".value").find("input").val(""); $form.find('.form-item[rel=iqn]').hide(); $form.find('.form-item[rel=lun]').hide(); $form.find('.form-item[rel=volumegroup]').hide(); - + $form.find('.form-item[rel=vCenterDataCenter]').hide(); $form.find('.form-item[rel=vCenterDataStore]').hide(); - + $form.find('.form-item[rel=rbdmonitor]').hide(); $form.find('.form-item[rel=rbdpool]').hide(); $form.find('.form-item[rel=rbdid]').hide(); @@ -14974,12 +15025,12 @@ $form.find('.form-item[rel=smbDomain]').hide(); } }); - + args.$select.trigger("change"); } }, //always appear (end) - + server: { label: 'label.server', docID: 'helpPrimaryStorageServer', @@ -14988,7 +15039,7 @@ }, isHidden: true }, - + //nfs path: { label: 'label.path', @@ -14998,30 +15049,30 @@ }, isHidden: true }, - - //SMB + + //SMB smbUsername: { - label: 'label.smb.username', - validation: { + label: 'label.smb.username', + validation: { required: true }, isHidden: true }, smbPassword: { - label: 'label.smb.password', - isPassword: true, - validation: { + label: 'label.smb.password', + isPassword: true, + validation: { required: true }, isHidden: true }, smbDomain: { - label: 'label.smb.domain', - validation: { + label: 'label.smb.domain', + validation: { required: true }, isHidden: true - }, + }, //iscsi iqn: { @@ -15040,7 +15091,7 @@ }, isHidden: true }, - + //clvm volumegroup: { label: 'label.volgroup', @@ -15049,7 +15100,7 @@ }, isHidden: true }, - + //vmfs vCenterDataCenter: { label: 'label.vcenter.datacenter', @@ -15065,7 +15116,7 @@ }, isHidden: true }, - + // RBD rbdmonitor: { label: 'label.rbd.monitor', @@ -15099,7 +15150,7 @@ }, isHidden: true }, - + //always appear (begin) storageTags: { label: 'label.storage.tags', @@ -15111,66 +15162,63 @@ //always appear (end) } }, - - action: function(args) { - var array1 = []; + + action: function (args) { + var array1 =[]; array1.push("&scope=" + todb(args.data.scope)); - + array1.push("&zoneid=" + args.data.zoneid); - + if (args.data.scope == 'zone') { - + array1.push("&hypervisor=" + args.data.hypervisor); } - + if (args.data.scope == 'cluster') { - + array1.push("&podid=" + args.data.podId); array1.push("&clusterid=" + args.data.clusterId); - } - + if (args.data.scope == 'host') { array1.push("&podid=" + args.data.podId); array1.push("&clusterid=" + args.data.clusterId); array1.push("&hostid=" + args.data.hostId); - } - + array1.push("&name=" + todb(args.data.name)); - + var server = args.data.server; var url = null; - if (args.data.protocol == "nfs") { + if (args.data.protocol == "nfs") { var path = args.data.path; if (path.substring(0, 1) != "/") - path = "/" + path; + path = "/" + path; url = nfsURL(server, path); - - } else if (args.data.protocol == "SMB") { + } else if (args.data.protocol == "SMB") { var path = args.data.path; if (path.substring(0, 1) != "/") - path = "/" + path; - url = smbURL(server, path, args.data.smbUsername, args.data.smbPassword, args.data.smbDomain); - } else if (args.data.protocol == "PreSetup") { + path = "/" + path; + url = smbURL(server, path, args.data.smbUsername, args.data.smbPassword, args.data.smbDomain); + } else if (args.data.protocol == "PreSetup") { var path = args.data.path; if (path.substring(0, 1) != "/") - path = "/" + path; + path = "/" + path; url = presetupURL(server, path); - } else if (args.data.protocol == "ocfs2") { + } else if (args.data.protocol == "ocfs2") { var path = args.data.path; if (path.substring(0, 1) != "/") - path = "/" + path; + path = "/" + path; url = ocfs2URL(server, path); - } else if (args.data.protocol == "SharedMountPoint") { + } else if (args.data.protocol == "SharedMountPoint") { var path = args.data.path; if (path.substring(0, 1) != "/") - path = "/" + path; + path = "/" + path; url = SharedMountPointURL(server, path); - } else if (args.data.protocol == "clvm") { + } else if (args.data.protocol == "clvm") { var vg = args.data.volumegroup; if (vg.substring(0, 1) != "/") - vg = "/" + vg; + vg = "/" + vg; url = clvmURL(vg); } else if (args.data.protocol == "rbd") { var rbdmonitor = args.data.rbdmonitor; @@ -15178,98 +15226,98 @@ var rbdid = args.data.rbdid; var rbdsecret = args.data.rbdsecret; url = rbdURL(rbdmonitor, rbdpool, rbdid, rbdsecret); - } else if (args.data.protocol == "vmfs") { + } else if (args.data.protocol == "vmfs") { var path = args.data.vCenterDataCenter; if (path.substring(0, 1) != "/") - path = "/" + path; + path = "/" + path; path += "/" + args.data.vCenterDataStore; url = vmfsURL("dummy", path); - } else { + } else { var iqn = args.data.iqn; if (iqn.substring(0, 1) != "/") - iqn = "/" + iqn; + iqn = "/" + iqn; var lun = args.data.lun; url = iscsiURL(server, iqn, lun); } array1.push("&url=" + todb(url)); - + if (args.data.storageTags != null && args.data.storageTags.length > 0) - array1.push("&tags=" + todb(args.data.storageTags)); - + array1.push("&tags=" + todb(args.data.storageTags)); + $.ajax({ url: createURL("createStoragePool" + array1.join("")), dataType: "json", - success: function(json) { + success: function (json) { var item = json.createstoragepoolresponse.storagepool; args.response.success({ data: item }); }, - error: function(XMLHttpResponse) { + error: function (XMLHttpResponse) { var errorMsg = parseXMLHttpResponse(XMLHttpResponse); args.response.error(errorMsg); } }); }, - + notification: { - poll: function(args) { + poll: function (args) { args.complete({ actionFilter: primarystorageActionfilter }); } }, - + messages: { - notification: function(args) { + notification: function (args) { return 'label.add.primary.storage'; } } } }, - + detailView: { name: "Primary storage details", isMaximized: true, actions: { edit: { label: 'label.edit', - action: function(args) { - var array1 = []; + action: function (args) { + var array1 =[]; array1.push("&tags=" + todb(args.data.tags)); - + $.ajax({ url: createURL("updateStoragePool&id=" + args.context.primarystorages[0].id + array1.join("")), dataType: "json", - success: function(json) { + success: function (json) { var item = json.updatestoragepoolresponse.storagepool; args.response.success({ data: item }); }, - error: function(XMLHttpResponse) { + error: function (XMLHttpResponse) { args.response.error(parseXMLHttpResponse(XMLHttpResponse)); } }); } }, - + enableMaintenanceMode: { label: 'label.action.enable.maintenance.mode', - action: function(args) { + action: function (args) { $.ajax({ url: createURL("enableStorageMaintenance&id=" + args.context.primarystorages[0].id), dataType: "json", async: true, - success: function(json) { + success: function (json) { var jid = json.prepareprimarystorageformaintenanceresponse.jobid; args.response.success({ _custom: { jobId: jid, - getUpdatedItem: function(json) { + getUpdatedItem: function (json) { return json.queryasyncjobresultresponse.jobresult.storagepool; }, - getActionFilter: function() { + getActionFilter: function () { return primarystorageActionfilter; } } @@ -15278,10 +15326,10 @@ }); }, messages: { - confirm: function(args) { + confirm: function (args) { return 'message.action.primarystorage.enable.maintenance.mode'; }, - notification: function(args) { + notification: function (args) { return 'label.action.enable.maintenance.mode'; } }, @@ -15289,31 +15337,31 @@ poll: pollAsyncJobResult } }, - + cancelMaintenanceMode: { label: 'label.action.cancel.maintenance.mode', messages: { - confirm: function(args) { + confirm: function (args) { return 'message.action.cancel.maintenance.mode'; }, - notification: function(args) { + notification: function (args) { return 'label.action.cancel.maintenance.mode'; } }, - action: function(args) { + action: function (args) { $.ajax({ url: createURL("cancelStorageMaintenance&id=" + args.context.primarystorages[0].id), dataType: "json", async: true, - success: function(json) { + success: function (json) { var jid = json.cancelprimarystoragemaintenanceresponse.jobid; args.response.success({ _custom: { jobId: jid, - getUpdatedItem: function(json) { + getUpdatedItem: function (json) { return json.queryasyncjobresultresponse.jobresult.storagepool; }, - getActionFilter: function() { + getActionFilter: function () { return primarystorageActionfilter; } } @@ -15325,11 +15373,11 @@ poll: pollAsyncJobResult } }, - + 'remove': { label: 'label.action.delete.primary.storage', messages: { - notification: function(args) { + notification: function (args) { return 'label.action.delete.primary.storage'; } }, @@ -15342,37 +15390,38 @@ } } }, - action: function(args) { - var array1 = []; + action: function (args) { + var array1 =[]; array1.push("&forced=" + (args.data.isForced == "on")); $.ajax({ url: createURL("deleteStoragePool&id=" + args.context.primarystorages[0].id + array1.join("")), dataType: "json", async: true, - success: function(json) { + success: function (json) { args.response.success({ - data: {} + data: { + } }); } }); }, notification: { - poll: function(args) { + poll: function (args) { args.complete(); } } } - }, - + tabs: { details: { title: 'label.details', - fields: [{ + fields:[ { name: { label: 'label.name' } - }, { + }, + { id: { label: 'label.id' }, @@ -15384,7 +15433,7 @@ isEditable: true }, zonename: { - label: 'label.zone' + label: 'label.zone' }, podname: { label: 'label.pod' @@ -15403,39 +15452,36 @@ }, disksizetotal: { label: 'label.disk.total', - converter: function(args) { + converter: function (args) { if (args == null || args == 0) - return ""; - else - return cloudStack.converters.convertBytes(args); + return ""; else + return cloudStack.converters.convertBytes(args); } }, disksizeallocated: { label: 'label.disk.allocated', - converter: function(args) { + converter: function (args) { if (args == null || args == 0) - return ""; - else - return cloudStack.converters.convertBytes(args); + return ""; else + return cloudStack.converters.convertBytes(args); } }, capacityiops: { label: 'label.disk.iops.total', - converter: function(args) { + converter: function (args) { if (args == null || args == 0) - return ""; - else - return args; + return ""; else + return args; } } }], - - dataProvider: function(args) { + + dataProvider: function (args) { $.ajax({ url: createURL("listStoragePools&id=" + args.context.primarystorages[0].id), dataType: "json", async: true, - success: function(json) { + success: function (json) { var item = json.liststoragepoolsresponse.storagepool[0]; args.response.success({ actionFilter: primarystorageActionfilter, @@ -15445,55 +15491,53 @@ }); } }, - + // Granular settings for storage pool settings: { title: 'Settings', custom: cloudStack.uiCustom.granularSettings({ - dataProvider: function(args) { - + dataProvider: function (args) { + $.ajax({ url: createURL('listConfigurations&storageid=' + args.context.primarystorages[0].id), - data: listViewDataProvider(args, {}, { searchBy: 'name' }), - success: function(json) { + data: listViewDataProvider(args, { + }, + { + searchBy: 'name' + }), + success: function (json) { args.response.success({ data: json.listconfigurationsresponse.configuration - }); - }, - - error: function(json) { + + error: function (json) { args.response.error(parseXMLHttpResponse(json)); - } }); - }, actions: { - edit: function(args) { + edit: function (args) { // call updateStorageLevelParameters var data = { name: args.data.jsonObj.name, value: args.data.value }; - + $.ajax({ url: createURL('updateConfiguration&storageid=' + args.context.primarystorages[0].id), data: data, - success: function(json) { + success: function (json) { var item = json.updateconfigurationresponse.configuration; args.response.success({ data: item }); }, - - error: function(json) { + + error: function (json) { args.response.error(parseXMLHttpResponse(json)); } - }); - } } }) @@ -15502,7 +15546,7 @@ } } }, - + ucs: { title: 'UCS', id: 'ucs', @@ -15516,47 +15560,49 @@ label: 'label.url' } }, - dataProvider: function(args) { - $.ajax({ - url: createURL('listUcsManagers'), - data: { - zoneid: args.context.physicalResources[0].id - }, - success: function(json) { - //for testing only (begin) - /* - json = - { - "listucsmanagerreponse": { - "count": 1, - "ucsmanager": [ + dataProvider: function (args) { + $.ajax({ + url: createURL('listUcsManagers'), + data: { + zoneid: args.context.physicalResources[0].id + }, + success: function (json) { + //for testing only (begin) + /* + json = { - "id": "07b5b813-83ed-4859-952c-c95cafb63ac4", - "name": "ucsmanager", - "url": "10.223.184.2", - "zoneid": "54c9a65c-ba89-4380-96e9-1d429c5372e3" + "listucsmanagerreponse": { + "count": 1, + "ucsmanager": [ + { + "id": "07b5b813-83ed-4859-952c-c95cafb63ac4", + "name": "ucsmanager", + "url": "10.223.184.2", + "zoneid": "54c9a65c-ba89-4380-96e9-1d429c5372e3" } - ] - } - }; - */ - //for testing only (end) - - var items = json.listucsmanagerreponse.ucsmanager; - args.response.success({ data: items }); - } - }); + ] + } + }; + */ + //for testing only (end) + + var items = json.listucsmanagerreponse.ucsmanager; + args.response.success({ + data: items + }); + } + }); }, actions: { add: { label: 'Add UCS Manager', - + messages: { - notification: function(args) { + notification: function (args) { return 'Add UCS Manager'; } }, - + createForm: { title: 'Add UCS Manager', fields: { @@ -15587,8 +15633,8 @@ } } }, - - action: function(args) { + + action: function (args) { var data = { zoneid: args.context.physicalResources[0].id, url: args.data.url, @@ -15600,62 +15646,63 @@ name: args.data.name }); } - + $.ajax({ url: createURL('addUcsManager'), data: data, type: "POST", - success: function(json) { //e.g. json == { "addUcsManagerResponse" : { "ucsmanager" : {"id":"11","name":"ucsmanager","url":"10.223.184.2","zoneid":"2"} } } + success: function (json) { + //e.g. json == { "addUcsManagerResponse" : { "ucsmanager" : {"id":"11","name":"ucsmanager","url":"10.223.184.2","zoneid":"2"} } } var item = json.addUcsManagerResponse.ucsmanager; args.response.success({ data: item }); }, - error: function(data) { + error: function (data) { args.response.error(parseXMLHttpResponse(data)); } }); }, - + notification: { - poll: function(args) { + poll: function (args) { args.complete(); } } } }, - + detailView: { isMaximized: true, noCompact: true, actions: { - remove: { + remove: { label: 'Delete UCS Manager', messages: { - confirm: function(args) { + confirm: function (args) { return 'Please confirm that you want to delete UCS Manager'; }, - notification: function(args) { + notification: function (args) { return 'Delete UCS Manager'; } }, - action: function(args) { + action: function (args) { var data = { - ucsmanagerid: args.context.ucsManagers[0].id + ucsmanagerid: args.context.ucsManagers[0].id }; $.ajax({ url: createURL('deleteUcsManager'), data: data, - success: function(json) { + success: function (json) { args.response.success(); }, - error: function(data) { + error: function (data) { args.response.error(parseXMLHttpResponse(data)); } }); }, notification: { - poll: function(args) { + poll: function (args) { args.complete(); } } @@ -15664,12 +15711,13 @@ tabs: { details: { title: 'label.details', - - fields: [{ + + fields:[ { name: { label: 'label.name' } - }, { + }, + { id: { label: 'label.id' }, @@ -15677,33 +15725,33 @@ label: 'label.url' } }], - - dataProvider: function(args) { + + dataProvider: function (args) { $.ajax({ - url: createURL('listUcsManagers'), - data: { - id: args.context.ucsManagers[0].id - }, - success: function(json) { + url: createURL('listUcsManagers'), + data: { + id: args.context.ucsManagers[0].id + }, + success: function (json) { //for testing only (begin) - /* - json = - { - "listucsmanagerreponse": { + /* + json = + { + "listucsmanagerreponse": { "count": 1, "ucsmanager": [ - { - "id": "07b5b813-83ed-4859-952c-c95cafb63ac4", - "name": "ucsmanager", - "url": "10.223.184.2", - "zoneid": "54c9a65c-ba89-4380-96e9-1d429c5372e3" - } + { + "id": "07b5b813-83ed-4859-952c-c95cafb63ac4", + "name": "ucsmanager", + "url": "10.223.184.2", + "zoneid": "54c9a65c-ba89-4380-96e9-1d429c5372e3" + } ] - } - }; - */ - //for testing only (end) - + } + }; + */ + //for testing only (end) + var item = json.listucsmanagerreponse.ucsmanager[0]; args.response.success({ data: item @@ -15712,7 +15760,7 @@ }); } }, - + blades: { title: 'Blades', listView: { @@ -15729,181 +15777,181 @@ label: 'Associated Profile' } }, - dataProvider: function(args) { + dataProvider: function (args) { $.ajax({ url: createURL('listUcsBlades'), data: { ucsmanagerid: args.context.ucsManagers[0].id }, - success: function(json) { + success: function (json) { //for testing only (begin) - /* - json = { - "listucsbladeresponse": { - "count": 4, - "ucsblade": [ - { - "id": "84edb958-cf8a-4e71-99c6-190ccc3fe2bd", - "ucsmanagerid": "07b5b813-83ed-4859-952c-c95cafb63ac4", - "bladedn": "sys/chassis-1/blade-1", - "profiledn": "org-root/ls-profile-for-blade-1" - }, - { - "id": "524a3e55-5b61-4561-9464-1b19e3543189", - "ucsmanagerid": "07b5b813-83ed-4859-952c-c95cafb63ac4", - "bladedn": "sys/chassis-1/blade-2", - "profiledn": "org-root/ls-profile-for-blade-2" - }, - { - "id": "4828f560-6191-46e6-8a4c-23d1d7d017f0", - "ucsmanagerid": "07b5b813-83ed-4859-952c-c95cafb63ac4", - "bladedn": "sys/chassis-1/blade-3" - }, - { - "id": "80ab25c8-3dcf-400e-8849-84dc5e1e6594", - "ucsmanagerid": "07b5b813-83ed-4859-952c-c95cafb63ac4", - "bladedn": "sys/chassis-1/blade-4" - } - ] - } + /* + json = { + "listucsbladeresponse": { + "count": 4, + "ucsblade": [ + { + "id": "84edb958-cf8a-4e71-99c6-190ccc3fe2bd", + "ucsmanagerid": "07b5b813-83ed-4859-952c-c95cafb63ac4", + "bladedn": "sys/chassis-1/blade-1", + "profiledn": "org-root/ls-profile-for-blade-1" + }, + { + "id": "524a3e55-5b61-4561-9464-1b19e3543189", + "ucsmanagerid": "07b5b813-83ed-4859-952c-c95cafb63ac4", + "bladedn": "sys/chassis-1/blade-2", + "profiledn": "org-root/ls-profile-for-blade-2" + }, + { + "id": "4828f560-6191-46e6-8a4c-23d1d7d017f0", + "ucsmanagerid": "07b5b813-83ed-4859-952c-c95cafb63ac4", + "bladedn": "sys/chassis-1/blade-3" + }, + { + "id": "80ab25c8-3dcf-400e-8849-84dc5e1e6594", + "ucsmanagerid": "07b5b813-83ed-4859-952c-c95cafb63ac4", + "bladedn": "sys/chassis-1/blade-4" + } + ] + } }; - */ - //for testing only (end) - - var items = json.listucsbladeresponse.ucsblade ? json.listucsbladeresponse.ucsblade : []; + */ + //for testing only (end) + + var items = json.listucsbladeresponse.ucsblade ? json.listucsbladeresponse.ucsblade:[]; for (var i = 0; i < items.length; i++) { - addExtraPropertiesToUcsBladeObject(items[i]); + addExtraPropertiesToUcsBladeObject(items[i]); } args.response.success({ - actionFilter: bladeActionfilter, + actionFilter: bladeActionfilter, data: items }); } }); }, actions: { - refreshUcsBlades: { - isHeader: true, + refreshUcsBlades: { + isHeader: true, label: 'Refresh Blades', messages: { - confirm: function(args) { + confirm: function (args) { return 'Please confirm that you want to refresh blades.'; }, - notification: function(args) { + notification: function (args) { return 'Refresh Blades'; } }, - action: function(args) { + action: function (args) { $.ajax({ url: createURL('refreshUcsBlades'), data: { - ucsmanagerid: args.context.ucsManagers[0].id + ucsmanagerid: args.context.ucsManagers[0].id }, - success: function(json) { - //for testing only (begin) - /* - json = { - "refreshucsbladesresponse": { - "count": 7, - "ucsblade": [ - { - "id": "6c6a2d2c-575e-41ac-9782-eee51b0b80f8", - "ucsmanagerid": "9a34c186-12fa-4bbc-af04-5f1a2bf7ae4a", - "bladedn": "sys/chassis-1/blade-5" - }, - { - "id": "d371d470-a51f-489c-aded-54a63dfd76c7", - "ucsmanagerid": "9a34c186-12fa-4bbc-af04-5f1a2bf7ae4a", - "bladedn": "sys/chassis-1/blade-6" - }, - { - "id": "c0f64591-4a80-4083-bb7b-576220b436a2", - "ucsmanagerid": "9a34c186-12fa-4bbc-af04-5f1a2bf7ae4a", - "bladedn": "sys/chassis-1/blade-7" - }, - { - "id": "74b9b69a-cb16-42f5-aad6-06391ebdd759", - "ucsmanagerid": "9a34c186-12fa-4bbc-af04-5f1a2bf7ae4a", - "bladedn": "sys/chassis-1/blade-1" - }, - { - "id": "713a5adb-0136-484f-9acb-d9203af497be", - "ucsmanagerid": "9a34c186-12fa-4bbc-af04-5f1a2bf7ae4a", - "bladedn": "sys/chassis-1/blade-2" - }, - { - "id": "da633578-21cb-4678-9eb4-981a53198b41", - "ucsmanagerid": "9a34c186-12fa-4bbc-af04-5f1a2bf7ae4a", - "bladedn": "sys/chassis-1/blade-4" - }, - { - "id": "3d491c6e-f0b6-40b0-bf6e-f89efdd73c30", - "ucsmanagerid": "9a34c186-12fa-4bbc-af04-5f1a2bf7ae4a", - "bladedn": "sys/chassis-1/blade-3" - } - ] - } - }; - */ - //for testing only (end) - - /* - var item = json.refreshucsbladesresponse.ucsblade[0]; - addExtraPropertiesToUcsBladeObject(item); + success: function (json) { + //for testing only (begin) + /* + json = { + "refreshucsbladesresponse": { + "count": 7, + "ucsblade": [ + { + "id": "6c6a2d2c-575e-41ac-9782-eee51b0b80f8", + "ucsmanagerid": "9a34c186-12fa-4bbc-af04-5f1a2bf7ae4a", + "bladedn": "sys/chassis-1/blade-5" + }, + { + "id": "d371d470-a51f-489c-aded-54a63dfd76c7", + "ucsmanagerid": "9a34c186-12fa-4bbc-af04-5f1a2bf7ae4a", + "bladedn": "sys/chassis-1/blade-6" + }, + { + "id": "c0f64591-4a80-4083-bb7b-576220b436a2", + "ucsmanagerid": "9a34c186-12fa-4bbc-af04-5f1a2bf7ae4a", + "bladedn": "sys/chassis-1/blade-7" + }, + { + "id": "74b9b69a-cb16-42f5-aad6-06391ebdd759", + "ucsmanagerid": "9a34c186-12fa-4bbc-af04-5f1a2bf7ae4a", + "bladedn": "sys/chassis-1/blade-1" + }, + { + "id": "713a5adb-0136-484f-9acb-d9203af497be", + "ucsmanagerid": "9a34c186-12fa-4bbc-af04-5f1a2bf7ae4a", + "bladedn": "sys/chassis-1/blade-2" + }, + { + "id": "da633578-21cb-4678-9eb4-981a53198b41", + "ucsmanagerid": "9a34c186-12fa-4bbc-af04-5f1a2bf7ae4a", + "bladedn": "sys/chassis-1/blade-4" + }, + { + "id": "3d491c6e-f0b6-40b0-bf6e-f89efdd73c30", + "ucsmanagerid": "9a34c186-12fa-4bbc-af04-5f1a2bf7ae4a", + "bladedn": "sys/chassis-1/blade-3" + } + ] + } + }; + */ + //for testing only (end) + + /* + var item = json.refreshucsbladesresponse.ucsblade[0]; + addExtraPropertiesToUcsBladeObject(item); args.response.success({ - data: item + data: item }); - */ - $(window).trigger('cloudStack.fullRefresh'); + */ + $(window).trigger('cloudStack.fullRefresh'); } }); }, notification: { - poll: function(args) { + poll: function (args) { args.complete(); } - } - }, - + } + }, + associateTemplateToBlade: { label: 'Instanciate Template and Associate Profile to Blade', addRow: 'false', messages: { - notification: function(args) { + notification: function (args) { return 'Instanciate Template and Associate Profile to Blade'; } }, createForm: { title: 'Instanciate Template and Associate Profile to Blade', fields: { - templatedn: { + templatedn: { label: 'Select Template', - select: function(args) { - var items = []; - + select: function (args) { + var items =[]; + $.ajax({ url: createURL('listUcsTemplates'), data: { ucsmanagerid: args.context.ucsManagers[0].id }, async: false, - success: function(json) { + success: function (json) { //for testing only (begin) - /* - json = { - "listucstemplatesresponse": { - "count": 1, - "ucstemplate": [ - { - "ucsdn": "org-root/ls-test" - } - ] - } - }; - */ - //for testing only (end) - - var ucstemplates = json.listucstemplatesresponse.ucstemplate; + /* + json = { + "listucstemplatesresponse": { + "count": 1, + "ucstemplate": [ + { + "ucsdn": "org-root/ls-test" + } + ] + } + }; + */ + //for testing only (end) + + var ucstemplates = json.listucstemplatesresponse.ucstemplate; if (ucstemplates != null) { for (var i = 0; i < ucstemplates.length; i++) { items.push({ @@ -15914,80 +15962,79 @@ } } }); - + args.response.success({ data: items }); - }, validation: { required: true } }, profilename: { - label: 'Profile' + label: 'Profile' } } }, - action: function(args) { - var data = { - ucsmanagerid: args.context.ucsManagers[0].id, - templatedn: args.data.templatedn, - bladeid: args.context.blades[0].id + action: function (args) { + var data = { + ucsmanagerid: args.context.ucsManagers[0].id, + templatedn: args.data.templatedn, + bladeid: args.context.blades[0].id }; - - if (args.data.profilename != null && args.data.profilename.length > 0) { - $.extend(data, { - profilename: args.data.profilename - }); - } - + + if (args.data.profilename != null && args.data.profilename.length > 0) { + $.extend(data, { + profilename: args.data.profilename + }); + } + $.ajax({ - url: createURL('instantiateUcsTemplateAndAssocaciateToBlade'), + url: createURL('instantiateUcsTemplateAndAssocaciateToBlade'), data: data, - success: function(json) { - //for testing only (begin) - /* - json = { - "instantiateucstemplateandassociatetobladeresponse": { - "jobid": "cd9d0282-4dae-463f-80b6-451e168e2e92" - } - } - */ - //for testing only (end) - - var jid = json.instantiateucstemplateandassociatetobladeresponse.jobid; + success: function (json) { + //for testing only (begin) + /* + json = { + "instantiateucstemplateandassociatetobladeresponse": { + "jobid": "cd9d0282-4dae-463f-80b6-451e168e2e92" + } + } + */ + //for testing only (end) + + var jid = json.instantiateucstemplateandassociatetobladeresponse.jobid; args.response.success({ _custom: { jobId: jid, - getUpdatedItem: function(json) { - //for testing only (begin) - /* - json = { - "queryasyncjobresultresponse": { - "accountid": "970b694a-2f8c-11e3-a77d-000c29b36ff5", - "userid": "970b7b4f-2f8c-11e3-a77d-000c29b36ff5", - "cmd": "org.apache.cloudstack.api.InstantiateUcsTemplateAndAssociateToBladeCmd", - "jobstatus": 1, - "jobprocstatus": 0, - "jobresultcode": 0, - "jobresulttype": "object", - "jobresult": { - "ucsblade": { - "id": "3d491c6e-f0b6-40b0-bf6e-f89efdd73c30", - "ucsmanagerid": "9a34c186-12fa-4bbc-af04-5f1a2bf7ae4a", - "bladedn": "sys/chassis-1/blade-3", - "profiledn": "org-root/ls-xxxx" - } - }, - "created": "2013-10-10T17:29:00-0700", - "jobid": "cd9d0282-4dae-463f-80b6-451e168e2e92" - } + getUpdatedItem: function (json) { + //for testing only (begin) + /* + json = { + "queryasyncjobresultresponse": { + "accountid": "970b694a-2f8c-11e3-a77d-000c29b36ff5", + "userid": "970b7b4f-2f8c-11e3-a77d-000c29b36ff5", + "cmd": "org.apache.cloudstack.api.InstantiateUcsTemplateAndAssociateToBladeCmd", + "jobstatus": 1, + "jobprocstatus": 0, + "jobresultcode": 0, + "jobresulttype": "object", + "jobresult": { + "ucsblade": { + "id": "3d491c6e-f0b6-40b0-bf6e-f89efdd73c30", + "ucsmanagerid": "9a34c186-12fa-4bbc-af04-5f1a2bf7ae4a", + "bladedn": "sys/chassis-1/blade-3", + "profiledn": "org-root/ls-xxxx" + } + }, + "created": "2013-10-10T17:29:00-0700", + "jobid": "cd9d0282-4dae-463f-80b6-451e168e2e92" + } }; - */ - //for testing only (end) - - addExtraPropertiesToUcsBladeObject(json.queryasyncjobresultresponse.jobresult.ucsblade); + */ + //for testing only (end) + + addExtraPropertiesToUcsBladeObject(json.queryasyncjobresultresponse.jobresult.ucsblade); return json.queryasyncjobresultresponse.jobresult.ucsblade; } } @@ -15999,74 +16046,74 @@ poll: pollAsyncJobResult } }, - + disassociateProfileFromBlade: { label: 'Disassociate Profile from Blade', addRow: 'false', messages: { - notification: function(args) { + notification: function (args) { return 'Disassociate Profile from Blade'; } }, createForm: { - title: 'Disassociate Profile from Blade', - fields: { - deleteprofile: { + title: 'Disassociate Profile from Blade', + fields: { + deleteprofile: { label: 'Delete Profile', isBoolean: true, isChecked: true } - } + } }, - action: function(args) { + action: function (args) { $.ajax({ url: createURL('disassociateUcsProfileFromBlade'), data: { bladeid: args.context.blades[0].id, - deleteprofile: (args.data.deleteprofile == 'on'? true: false) + deleteprofile: (args.data.deleteprofile == 'on' ? true: false) }, - success: function(json) { - //for testing only (begin) - /* - json = { - "disassociateucsprofilefrombladeresponse": { - "jobid": "e371592e-31be-4e53-9346-a5c565d420df" - } - } - */ - //for testing only (end) - - var jid = json.disassociateucsprofilefrombladeresponse.jobid; + success: function (json) { + //for testing only (begin) + /* + json = { + "disassociateucsprofilefrombladeresponse": { + "jobid": "e371592e-31be-4e53-9346-a5c565d420df" + } + } + */ + //for testing only (end) + + var jid = json.disassociateucsprofilefrombladeresponse.jobid; args.response.success({ _custom: { jobId: jid, - getUpdatedItem: function(json) { - //for testing only (begin) - /* - json = { - "queryasyncjobresultresponse": { - "accountid": "835fb2d5-0b76-11e3-9350-f4f3e49b5dfe", - "userid": "835fc0e5-0b76-11e3-9350-f4f3e49b5dfe", - "cmd": "org.apache.cloudstack.api.DisassociateUcsProfileCmd", - "jobstatus": 1, - "jobprocstatus": 0, - "jobresultcode": 0, - "jobresulttype": "object", - "jobresult": { - "ucsblade": { - "id": "f8d08575-7a1c-4f79-a588-d129c38bcc4f", - "ucsmanagerid": "0d87c1a6-5664-425c-9024-2ddd9605d260", - "bladedn": "sys/chassis-1/blade-1" - } - }, - "created": "2013-09-13T22:17:29-0700", - "jobid": "2c3698a8-39ac-43e6-8ade-86eb2d3726a0" - } + getUpdatedItem: function (json) { + //for testing only (begin) + /* + json = { + "queryasyncjobresultresponse": { + "accountid": "835fb2d5-0b76-11e3-9350-f4f3e49b5dfe", + "userid": "835fc0e5-0b76-11e3-9350-f4f3e49b5dfe", + "cmd": "org.apache.cloudstack.api.DisassociateUcsProfileCmd", + "jobstatus": 1, + "jobprocstatus": 0, + "jobresultcode": 0, + "jobresulttype": "object", + "jobresult": { + "ucsblade": { + "id": "f8d08575-7a1c-4f79-a588-d129c38bcc4f", + "ucsmanagerid": "0d87c1a6-5664-425c-9024-2ddd9605d260", + "bladedn": "sys/chassis-1/blade-1" + } + }, + "created": "2013-09-13T22:17:29-0700", + "jobid": "2c3698a8-39ac-43e6-8ade-86eb2d3726a0" + } }; - */ - //for testing only (end) - - addExtraPropertiesToUcsBladeObject(json.queryasyncjobresultresponse.jobresult.ucsblade); + */ + //for testing only (end) + + addExtraPropertiesToUcsBladeObject(json.queryasyncjobresultresponse.jobresult.ucsblade); return json.queryasyncjobresultresponse.jobresult.ucsblade; } } @@ -16085,7 +16132,7 @@ } } }, - + 'secondary-storage': { title: 'label.secondary.storage', id: 'secondarystorages', @@ -16102,85 +16149,88 @@ fields: { name: { label: 'label.name' - }, + }, protocol: { label: 'label.protocol' } }, - - - dataProvider: function(args) { - var array1 = []; - if(args.filterBy != null) { - if(args.filterBy.search != null && args.filterBy.search.by != null && args.filterBy.search.value != null) { - switch(args.filterBy.search.by) { - case "name": - if(args.filterBy.search.value.length > 0) - array1.push("&keyword=" + args.filterBy.search.value); + + + dataProvider: function (args) { + var array1 =[]; + if (args.filterBy != null) { + if (args.filterBy.search != null && args.filterBy.search.by != null && args.filterBy.search.value != null) { + switch (args.filterBy.search.by) { + case "name": + if (args.filterBy.search.value.length > 0) + array1.push("&keyword=" + args.filterBy.search.value); break; } } } array1.push("&zoneid=" + args.context.zones[0].id); - + $.ajax({ url: createURL("listImageStores&page=" + args.page + "&pagesize=" + pageSize + array1.join("")), dataType: "json", async: true, - success: function(json) { + success: function (json) { var items = json.listimagestoresresponse.imagestore; args.response.success({ actionFilter: secondarystorageActionfilter, - data:items + data: items }); } }); }, - + actions: { add: { label: 'label.add.secondary.storage', - + createForm: { title: 'label.add.secondary.storage', - + fields: { name: { label: 'label.name' }, provider: { label: 'Provider', - select: function(args) { - /* - UI no longer gets providers from "listStorageProviders&type=image" because: - (1) Not all of returned values are handled by UI (e.g. Provider "NetApp" is not handled by UI). - (2) Provider "SMB" which is handled by UI is not returned from "listStorageProviders&type=image" - */ - var items = [{ - id: 'NFS', - description: 'NFS' - }, { - id: 'SMB', - description: 'SMB/CIFS' - }, { - id: 'S3', - description: 'S3' - }, { - id: 'Swift', - description: 'Swift' - }]; - - args.response.success({ + select: function (args) { + /* + UI no longer gets providers from "listStorageProviders&type=image" because: + (1) Not all of returned values are handled by UI (e.g. Provider "NetApp" is not handled by UI). + (2) Provider "SMB" which is handled by UI is not returned from "listStorageProviders&type=image" + */ + var items =[ { + id: 'NFS', + description: 'NFS' + }, + { + id: 'SMB', + description: 'SMB/CIFS' + }, + { + id: 'S3', + description: 'S3' + }, + { + id: 'Swift', + description: 'Swift' + }]; + + args.response.success({ data: items }); - - args.$select.change(function() { + + args.$select.change(function () { var $form = $(this).closest('form'); if ($(this).val() == "NFS") { - //NFS, SMB + //NFS, SMB $form.find('.form-item[rel=zoneid]').css('display', 'inline-block'); $form.find('.form-item[rel=nfsServer]').css('display', 'inline-block'); - $form.find('.form-item[rel=path]').css('display', 'inline-block'); + $form.find('.form-item[rel=path]').css('display', 'inline-block'); //SMB $form.find('.form-item[rel=smbUsername]').hide(); @@ -16196,23 +16246,23 @@ $form.find('.form-item[rel=connectiontimeout]').hide(); $form.find('.form-item[rel=maxerrorretry]').hide(); $form.find('.form-item[rel=sockettimeout]').hide(); - + $form.find('.form-item[rel=createNfsCache]').find('input').removeAttr('checked'); $form.find('.form-item[rel=createNfsCache]').hide(); $form.find('.form-item[rel=nfsCacheZoneid]').hide(); $form.find('.form-item[rel=nfsCacheNfsServer]').hide(); $form.find('.form-item[rel=nfsCachePath]').hide(); - + //Swift $form.find('.form-item[rel=url]').hide(); $form.find('.form-item[rel=account]').hide(); $form.find('.form-item[rel=username]').hide(); - $form.find('.form-item[rel=key]').hide(); - } else if ($(this).val() == "SMB") { - //NFS, SMB + $form.find('.form-item[rel=key]').hide(); + } else if ($(this).val() == "SMB") { + //NFS, SMB $form.find('.form-item[rel=zoneid]').css('display', 'inline-block'); $form.find('.form-item[rel=nfsServer]').css('display', 'inline-block'); - $form.find('.form-item[rel=path]').css('display', 'inline-block'); + $form.find('.form-item[rel=path]').css('display', 'inline-block'); //SMB $form.find('.form-item[rel=smbUsername]').css('display', 'inline-block'); @@ -16228,23 +16278,23 @@ $form.find('.form-item[rel=connectiontimeout]').hide(); $form.find('.form-item[rel=maxerrorretry]').hide(); $form.find('.form-item[rel=sockettimeout]').hide(); - + $form.find('.form-item[rel=createNfsCache]').find('input').removeAttr('checked'); $form.find('.form-item[rel=createNfsCache]').hide(); $form.find('.form-item[rel=nfsCacheZoneid]').hide(); $form.find('.form-item[rel=nfsCacheNfsServer]').hide(); $form.find('.form-item[rel=nfsCachePath]').hide(); - + //Swift $form.find('.form-item[rel=url]').hide(); $form.find('.form-item[rel=account]').hide(); $form.find('.form-item[rel=username]').hide(); - $form.find('.form-item[rel=key]').hide(); + $form.find('.form-item[rel=key]').hide(); } else if ($(this).val() == "S3") { - //NFS, SMB + //NFS, SMB $form.find('.form-item[rel=zoneid]').hide(); $form.find('.form-item[rel=nfsServer]').hide(); - $form.find('.form-item[rel=path]').hide(); + $form.find('.form-item[rel=path]').hide(); //SMB $form.find('.form-item[rel=smbUsername]').hide(); @@ -16260,25 +16310,25 @@ $form.find('.form-item[rel=connectiontimeout]').css('display', 'inline-block'); $form.find('.form-item[rel=maxerrorretry]').css('display', 'inline-block'); $form.find('.form-item[rel=sockettimeout]').css('display', 'inline-block'); - + $form.find('.form-item[rel=createNfsCache]').find('input').attr('checked', 'checked'); //$form.find('.form-item[rel=createNfsCache]').find('input').attr('disabled', 'disabled'); //This checkbox should not be disabled any more because NFS staging (of a zone) might already exist (from "NFS secondary storage => Prepare Object Store Migration => NFS staging") $form.find('.form-item[rel=createNfsCache]').css('display', 'inline-block'); $form.find('.form-item[rel=nfsCacheZoneid]').css('display', 'inline-block'); $form.find('.form-item[rel=nfsCacheNfsServer]').css('display', 'inline-block'); $form.find('.form-item[rel=nfsCachePath]').css('display', 'inline-block'); - - + + //Swift $form.find('.form-item[rel=url]').hide(); $form.find('.form-item[rel=account]').hide(); $form.find('.form-item[rel=username]').hide(); $form.find('.form-item[rel=key]').hide(); } else if ($(this).val() == "Swift") { - //NFS, SMB + //NFS, SMB $form.find('.form-item[rel=zoneid]').hide(); $form.find('.form-item[rel=nfsServer]').hide(); - $form.find('.form-item[rel=path]').hide(); + $form.find('.form-item[rel=path]').hide(); //SMB $form.find('.form-item[rel=smbUsername]').hide(); @@ -16294,13 +16344,13 @@ $form.find('.form-item[rel=connectiontimeout]').hide(); $form.find('.form-item[rel=maxerrorretry]').hide(); $form.find('.form-item[rel=sockettimeout]').hide(); - + $form.find('.form-item[rel=createNfsCache]').find('input').removeAttr('checked'); $form.find('.form-item[rel=createNfsCache]').hide(); $form.find('.form-item[rel=nfsCacheZoneid]').hide(); $form.find('.form-item[rel=nfsCacheNfsServer]').hide(); $form.find('.form-item[rel=nfsCachePath]').hide(); - + //Swift $form.find('.form-item[rel=url]').css('display', 'inline-block'); $form.find('.form-item[rel=account]').css('display', 'inline-block'); @@ -16308,12 +16358,12 @@ $form.find('.form-item[rel=key]').css('display', 'inline-block'); } }); - - args.$select.change(); + + args.$select.change(); } }, - - + + //NFS, SMB (begin) zoneid: { label: 'Zone', @@ -16321,18 +16371,19 @@ validation: { required: true }, - select: function(args) { + select: function (args) { $.ajax({ url: createURL('listZones'), data: { listAll: true }, - success: function(json) { - var zones = json.listzonesresponse.zone ? json.listzonesresponse.zone : []; - - if (zones != null) { //$.map(items, fn) - items can not be null + success: function (json) { + var zones = json.listzonesresponse.zone ? json.listzonesresponse.zone:[]; + + if (zones != null) { + //$.map(items, fn) - items can not be null args.response.success({ - data: $.map(zones, function(zone) { + data: $.map(zones, function (zone) { return { id: zone.id, description: zone.name @@ -16361,33 +16412,33 @@ validation: { required: true } - }, + }, //NFS, SMB (end) - //SMB (begin) + //SMB (begin) smbUsername: { - label: 'label.smb.username', - validation: { + label: 'label.smb.username', + validation: { required: true } }, smbPassword: { - label: 'label.smb.password', - isPassword: true, - validation: { + label: 'label.smb.password', + isPassword: true, + validation: { required: true } }, smbDomain: { - label: 'label.smb.domain', - validation: { + label: 'label.smb.domain', + validation: { required: true } }, //SMB (end) - - + + //S3 (begin) accesskey: { label: 'label.s3.access_key', @@ -16433,7 +16484,7 @@ label: 'label.s3.socket_timeout', docID: 'helpS3SocketTimeout' }, - + createNfsCache: { label: 'label.create.nfs.secondary.staging.store', isBoolean: true, @@ -16445,18 +16496,19 @@ validation: { required: true }, - select: function(args) { + select: function (args) { $.ajax({ url: createURL('listZones'), data: { listAll: true }, - success: function(json) { + success: function (json) { var zones = json.listzonesresponse.zone; - - if (zones != null) { //$.map(items, fn) - items can not be null + + if (zones != null) { + //$.map(items, fn) - items can not be null args.response.success({ - data: $.map(zones, function(zone) { + data: $.map(zones, function (zone) { return { id: zone.id, description: zone.name @@ -16489,8 +16541,8 @@ } }, //S3 (end) - - + + //Swift (begin) url: { label: 'label.url', @@ -16510,67 +16562,68 @@ //Swift (end) } }, - - action: function(args) { - var data = {}; + + action: function (args) { + var data = { + }; if (args.data.name != null && args.data.name.length > 0) { $.extend(data, { name: args.data.name }); } - + if (args.data.provider == 'NFS') { var zoneid = args.data.zoneid; var nfs_server = args.data.nfsServer; var path = args.data.path; var url = nfsURL(nfs_server, path); - + $.extend(data, { provider: args.data.provider, zoneid: zoneid, url: url }); - + $.ajax({ url: createURL('addImageStore'), data: data, - success: function(json) { + success: function (json) { var item = json.addimagestoreresponse.imagestore; args.response.success({ data: item }); }, - error: function(XMLHttpResponse) { + error: function (XMLHttpResponse) { var errorMsg = parseXMLHttpResponse(XMLHttpResponse); args.response.error(errorMsg); } - }); + }); } else if (args.data.provider == 'SMB') { - var zoneid = args.data.zoneid; + var zoneid = args.data.zoneid; var nfs_server = args.data.nfsServer; var path = args.data.path; var url = smbURL(nfs_server, path, args.data.smbUsername, args.data.smbPassword, args.data.smbDomain); - + $.extend(data, { provider: args.data.provider, zoneid: zoneid, url: url }); - + $.ajax({ url: createURL('addImageStore'), data: data, - success: function(json) { + success: function (json) { var item = json.addimagestoreresponse.imagestore; args.response.success({ data: item }); }, - error: function(XMLHttpResponse) { + error: function (XMLHttpResponse) { var errorMsg = parseXMLHttpResponse(XMLHttpResponse); args.response.error(errorMsg); } - }); + }); } else if (args.data.provider == 'S3') { $.extend(data, { provider: args.data.provider, @@ -16581,66 +16634,66 @@ 'details[2].key': 'bucket', 'details[2].value': args.data.bucket, 'details[3].key': 'usehttps', - 'details[3].value': (args.data.usehttps != null && args.data.usehttps == 'on' ? 'true' : 'false') + 'details[3].value': (args.data.usehttps != null && args.data.usehttps == 'on' ? 'true': 'false') }); - + var index = 4; if (args.data.endpoint != null && args.data.endpoint.length > 0) { - data['details[' + index.toString() + '].key'] = 'endpoint'; - data['details[' + index.toString() + '].value'] = args.data.endpoint; + data[ 'details[' + index.toString() + '].key'] = 'endpoint'; + data[ 'details[' + index.toString() + '].value'] = args.data.endpoint; index++; } if (args.data.connectiontimeout != null && args.data.connectiontimeout.length > 0) { - data['details[' + index.toString() + '].key'] = 'connectiontimeout'; - data['details[' + index.toString() + '].value'] = args.data.connectiontimeout; + data[ 'details[' + index.toString() + '].key'] = 'connectiontimeout'; + data[ 'details[' + index.toString() + '].value'] = args.data.connectiontimeout; index++; } if (args.data.maxerrorretry != null && args.data.maxerrorretry.length > 0) { - data['details[' + index.toString() + '].key'] = 'maxerrorretry'; - data['details[' + index.toString() + '].value'] = args.data.maxerrorretry; + data[ 'details[' + index.toString() + '].key'] = 'maxerrorretry'; + data[ 'details[' + index.toString() + '].value'] = args.data.maxerrorretry; index++; } if (args.data.sockettimeout != null && args.data.sockettimeout.length > 0) { - data['details[' + index.toString() + '].key'] = 'sockettimeout'; - data['details[' + index.toString() + '].value'] = args.data.sockettimeout; + data[ 'details[' + index.toString() + '].key'] = 'sockettimeout'; + data[ 'details[' + index.toString() + '].value'] = args.data.sockettimeout; index++; } - + $.ajax({ url: createURL('addImageStore'), data: data, - success: function(json) { + success: function (json) { g_regionsecondaryenabled = true; - + var item = json.addimagestoreresponse.imagestore; args.response.success({ data: item }); }, - error: function(json) { + error: function (json) { args.response.error(parseXMLHttpResponse(json)); } }); - + if (args.data.createNfsCache == 'on') { var zoneid = args.data.nfsCacheZoneid; var nfs_server = args.data.nfsCacheNfsServer; var path = args.data.nfsCachePath; var url = nfsURL(nfs_server, path); - + var nfsCacheData = { provider: 'NFS', zoneid: zoneid, url: url }; - + $.ajax({ url: createURL('createSecondaryStagingStore'), data: nfsCacheData, - success: function(json) { + success: function (json) { //do nothing }, - error: function(json) { + error: function (json) { args.response.error(parseXMLHttpResponse(json)); } }); @@ -16650,114 +16703,114 @@ provider: args.data.provider, url: args.data.url }); - + var index = 0; if (args.data.account != null && args.data.account.length > 0) { - data['details[' + index.toString() + '].key'] = 'account'; - data['details[' + index.toString() + '].value'] = args.data.account; + data[ 'details[' + index.toString() + '].key'] = 'account'; + data[ 'details[' + index.toString() + '].value'] = args.data.account; index++; } if (args.data.username != null && args.data.username.length > 0) { - data['details[' + index.toString() + '].key'] = 'username'; - data['details[' + index.toString() + '].value'] = args.data.username; + data[ 'details[' + index.toString() + '].key'] = 'username'; + data[ 'details[' + index.toString() + '].value'] = args.data.username; index++; } if (args.data.key != null && args.data.key.length > 0) { - data['details[' + index.toString() + '].key'] = 'key'; - data['details[' + index.toString() + '].value'] = args.data.key; + data[ 'details[' + index.toString() + '].key'] = 'key'; + data[ 'details[' + index.toString() + '].value'] = args.data.key; index++; } $.ajax({ url: createURL('addImageStore'), data: data, - success: function(json) { + success: function (json) { g_regionsecondaryenabled = true; - + var item = json.addimagestoreresponse.imagestore; args.response.success({ data: item }); }, - error: function(json) { + error: function (json) { args.response.error(parseXMLHttpResponse(json)); } }); } }, - + notification: { - poll: function(args) { + poll: function (args) { args.complete({ actionFilter: secondarystorageActionfilter }); } }, - + messages: { - notification: function(args) { + notification: function (args) { return 'label.add.secondary.storage'; } } } }, - + detailView: { name: 'Secondary storage details', isMaximized: true, - actions: { - prepareObjectStoreMigration: { + actions: { + prepareObjectStoreMigration: { label: 'Prepare Object Store Migration', messages: { - confirm: function(args) { + confirm: function (args) { return 'Please confirm you want to prepare migration of secondary storage to object store.'; }, - notification: function(args) { + notification: function (args) { return 'Prepare Object Store Migration'; } }, - action: function(args) { + action: function (args) { $.ajax({ url: createURL('prepareSecondaryStorageForMigration'), data: { id: args.context.secondaryStorage[0].id - }, - success: function(json) { - var jid = json.preparesecondarystorageformigrationresponse.jobid; + }, + success: function (json) { + var jid = json.preparesecondarystorageformigrationresponse.jobid; args.response.success({ _custom: { jobId: jid } - }); + }); } }); }, notification: { poll: pollAsyncJobResult } - }, - + }, + remove: { label: 'label.action.delete.secondary.storage', messages: { - confirm: function(args) { + confirm: function (args) { return 'message.action.delete.secondary.storage'; }, - notification: function(args) { + notification: function (args) { return 'label.action.delete.secondary.storage'; } }, - action: function(args) { + action: function (args) { $.ajax({ url: createURL("deleteImageStore&id=" + args.context.secondaryStorage[0].id), dataType: "json", async: true, - success: function(json) { + success: function (json) { args.response.success(); } }); }, notification: { - poll: function(args) { + poll: function (args) { args.complete({ data: { resourcestate: 'Destroyed' @@ -16766,16 +16819,16 @@ } } } - }, tabs: { details: { title: 'label.details', - fields: [{ + fields:[ { name: { label: 'label.name' } - }, { + }, + { url: { label: 'label.url' }, @@ -16793,13 +16846,13 @@ }, details: { label: 'label.details', - converter: function(array1) { + converter: function (array1) { var string1 = ''; if (array1 != null) { for (var i = 0; i < array1.length; i++) { if (i > 0) - string1 += ', '; - + string1 += ', '; + string1 += array1[i].name + ': ' + array1[i].value; } } @@ -16810,15 +16863,15 @@ label: 'label.id' } }], - - dataProvider: function(args) { + + dataProvider: function (args) { $.ajax({ url: createURL("listImageStores&id=" + args.context.secondaryStorage[0].id), dataType: "json", async: true, - success: function(json) { - var item = json.listimagestoresresponse.imagestore[0]; - processPropertiesInImagestoreObject(item); + success: function (json) { + var item = json.listimagestoresresponse.imagestore[0]; + processPropertiesInImagestoreObject(item); args.response.success({ actionFilter: secondarystorageActionfilter, data: item @@ -16827,27 +16880,27 @@ }); } } - + // Granular settings for storage pool for secondary storage is not required /* settings: { - title: 'label.menu.global.settings', - custom: cloudStack.uiCustom.granularSettings({ - dataProvider: function(args) { - args.response.success({ - data: [ - { name: 'config.param.1', value: 1 }, - { name: 'config.param.2', value: 2 } - ] - }); - }, - actions: { - edit: function(args) { - // call updateStorageLevelParameters - args.response.success(); - } - } - }) - } */ + title: 'label.menu.global.settings', + custom: cloudStack.uiCustom.granularSettings({ + dataProvider: function(args) { + args.response.success({ + data: [ + { name: 'config.param.1', value: 1 }, + { name: 'config.param.2', value: 2 } + ] + }); + }, + actions: { + edit: function(args) { + // call updateStorageLevelParameters + args.response.success(); + } + } + }) + } */ } } } @@ -16869,37 +16922,37 @@ label: 'Provider' } }, - + /* - dataProvider: function(args) { //being replaced with dataProvider in line 6898 - var array1 = []; - if(args.filterBy != null) { - if(args.filterBy.search != null && args.filterBy.search.by != null && args.filterBy.search.value != null) { - switch(args.filterBy.search.by) { - case "name": - if(args.filterBy.search.value.length > 0) - array1.push("&keyword=" + args.filterBy.search.value); - break; - } - } - } - array1.push("&zoneid=" + args.context.zones[0].id); - - $.ajax({ - url: createURL("listImageStores&page=" + args.page + "&pagesize=" + pageSize + array1.join("")), - dataType: "json", - async: true, - success: function(json) { - var items = json.listimagestoreresponse.imagestore; - args.response.success({ - actionFilter: secondarystorageActionfilter, - data:items - }); - } - }); - }, - */ - + dataProvider: function(args) { //being replaced with dataProvider in line 6898 + var array1 = []; + if(args.filterBy != null) { + if(args.filterBy.search != null && args.filterBy.search.by != null && args.filterBy.search.value != null) { + switch(args.filterBy.search.by) { + case "name": + if(args.filterBy.search.value.length > 0) + array1.push("&keyword=" + args.filterBy.search.value); + break; + } + } + } + array1.push("&zoneid=" + args.context.zones[0].id); + + $.ajax({ + url: createURL("listImageStores&page=" + args.page + "&pagesize=" + pageSize + array1.join("")), + dataType: "json", + async: true, + success: function(json) { + var items = json.listimagestoreresponse.imagestore; + args.response.success({ + actionFilter: secondarystorageActionfilter, + data:items + }); + } + }); + }, + */ + actions: { add: { label: 'Add NFS Secondary Staging Store', @@ -16911,18 +16964,19 @@ validation: { required: true }, - select: function(args) { + select: function (args) { $.ajax({ url: createURL('listZones'), data: { listAll: true }, - success: function(json) { - var zones = json.listzonesresponse.zone ? json.listzonesresponse.zone : []; - - if (zones != null) { //$.map(items, fn) - items can not be null + success: function (json) { + var zones = json.listzonesresponse.zone ? json.listzonesresponse.zone:[]; + + if (zones != null) { + //$.map(items, fn) - items can not be null args.response.success({ - data: $.map(zones, function(zone) { + data: $.map(zones, function (zone) { return { id: zone.id, description: zone.name @@ -16952,7 +17006,7 @@ } } }, - action: function(args) { + action: function (args) { var data = { provider: 'NFS', zoneid: args.data.zoneid, @@ -16961,62 +17015,62 @@ $.ajax({ url: createURL('createSecondaryStagingStore'), data: data, - success: function(json) { + success: function (json) { var item = json.createsecondarystagingstoreresponse.secondarystorage; args.response.success({ data: item }); }, - error: function(json) { + error: function (json) { args.response.error(parseXMLHttpResponse(json)); } }); }, notification: { - poll: function(args) { + poll: function (args) { args.complete(); } }, messages: { - notification: function(args) { + notification: function (args) { return 'Add NFS Secondary Staging Store'; } } } }, - + detailView: { name: 'Secondary Staging Store details', isMaximized: true, actions: { - remove: { + remove: { label: 'Delete Secondary Staging Store', messages: { - confirm: function(args) { + confirm: function (args) { return 'Please confirm you want to delete Secondary Staging Store.'; }, - notification: function(args) { + notification: function (args) { return 'Delete Secondary Staging Store'; } }, - action: function(args) { + action: function (args) { var data = { - id: args.context.cacheStorage[0].id + id: args.context.cacheStorage[0].id }; $.ajax({ url: createURL('deleteSecondaryStagingStore'), data: data, async: true, - success: function(json) { + success: function (json) { args.response.success(); }, - error: function(data) { + error: function (data) { args.response.error(parseXMLHttpResponse(data)); } }); }, notification: { - poll: function(args) { + poll: function (args) { args.complete(); } } @@ -17025,11 +17079,12 @@ tabs: { details: { title: 'label.details', - fields: [{ + fields:[ { name: { label: 'label.name' } - }, { + }, + { url: { label: 'label.url' }, @@ -17044,13 +17099,13 @@ }, details: { label: 'label.details', - converter: function(array1) { + converter: function (array1) { var string1 = ''; if (array1 != null) { for (var i = 0; i < array1.length; i++) { if (i > 0) - string1 += ', '; - + string1 += ', '; + string1 += array1[i].name + ': ' + array1[i].value; } } @@ -17061,53 +17116,53 @@ label: 'label.id' } }], - - dataProvider: function(args) { + + dataProvider: function (args) { $.ajax({ url: createURL('listSecondaryStagingStores'), data: { id: args.context.cacheStorage[0].id }, async: false, - success: function(json) { + success: function (json) { var item = json.listsecondarystagingstoreresponse.imagestore[0]; args.response.success({ data: item }); - } }); } } - + // Granular settings for storage pool for secondary storage is not required /* settings: { - title: 'label.menu.global.settings', - custom: cloudStack.uiCustom.granularSettings({ - dataProvider: function(args) { - args.response.success({ - data: [ - { name: 'config.param.1', value: 1 }, - { name: 'config.param.2', value: 2 } - ] - }); - }, - actions: { - edit: function(args) { - // call updateStorageLevelParameters - args.response.success(); - } - } - }) - } */ + title: 'label.menu.global.settings', + custom: cloudStack.uiCustom.granularSettings({ + dataProvider: function(args) { + args.response.success({ + data: [ + { name: 'config.param.1', value: 1 }, + { name: 'config.param.2', value: 2 } + ] + }); + }, + actions: { + edit: function(args) { + // call updateStorageLevelParameters + args.response.success(); + } + } + }) + } */ } } } } } }, - - guestIpRanges: { //Advanced zone - Guest traffic type - Network tab - Network detailView - View IP Ranges + + guestIpRanges: { + //Advanced zone - Guest traffic type - Network tab - Network detailView - View IP Ranges title: 'label.guest.ip.range', id: 'guestIpRanges', listView: { @@ -17126,13 +17181,13 @@ label: 'IPv6 End IP' } }, - - dataProvider: function(args) { + + dataProvider: function (args) { $.ajax({ url: createURL("listVlanIpRanges&zoneid=" + selectedZoneObj.id + "&networkid=" + args.context.networks[0].id + "&page=" + args.page + "&pagesize=" + pageSize), dataType: "json", async: true, - success: function(json) { + success: function (json) { var items = json.listvlaniprangesresponse.vlaniprange; args.response.success({ data: items @@ -17140,7 +17195,7 @@ } }); }, - + actions: { add: { label: 'label.add.ip.range', @@ -17160,10 +17215,10 @@ label: 'IPv4 End IP' }, ip6cidr: { - label: 'IPv6 CIDR' + label: 'IPv6 CIDR' }, ip6gateway: { - label: 'IPv6 Gateway' + label: 'IPv6 Gateway' }, startipv6: { label: 'IPv6 Start IP' @@ -17173,83 +17228,84 @@ } } }, - action: function(args) { - var array2 = []; - + action: function (args) { + var array2 =[]; + if (args.data.gateway != null && args.data.gateway.length > 0) - array2.push("&gateway=" + args.data.gateway); + array2.push("&gateway=" + args.data.gateway); if (args.data.netmask != null && args.data.netmask.length > 0) - array2.push("&netmask=" + args.data.netmask); - + array2.push("&netmask=" + args.data.netmask); + if (args.data.startipv4 != null && args.data.startipv4.length > 0) - array2.push("&startip=" + args.data.startipv4); + array2.push("&startip=" + args.data.startipv4); if (args.data.endipv4 != null && args.data.endipv4.length > 0) - array2.push("&endip=" + args.data.endipv4); - + array2.push("&endip=" + args.data.endipv4); + if (args.data.ip6cidr != null && args.data.ip6cidr.length > 0) - array2.push("&ip6cidr=" + args.data.ip6cidr); + array2.push("&ip6cidr=" + args.data.ip6cidr); if (args.data.ip6gateway != null && args.data.ip6gateway.length > 0) - array2.push("&ip6gateway=" + args.data.ip6gateway); - + array2.push("&ip6gateway=" + args.data.ip6gateway); + if (args.data.startipv6 != null && args.data.startipv6.length > 0) - array2.push("&startipv6=" + args.data.startipv6); + array2.push("&startipv6=" + args.data.startipv6); if (args.data.endipv6 != null && args.data.endipv6.length > 0) - array2.push("&endipv6=" + args.data.endipv6); - + array2.push("&endipv6=" + args.data.endipv6); + $.ajax({ url: createURL("createVlanIpRange&forVirtualNetwork=false&networkid=" + args.context.networks[0].id + array2.join("")), dataType: "json", - success: function(json) { + success: function (json) { var item = json.createvlaniprangeresponse.vlan; args.response.success({ data: item }); }, - error: function(XMLHttpResponse) { + error: function (XMLHttpResponse) { var errorMsg = parseXMLHttpResponse(XMLHttpResponse); args.response.error(errorMsg); } }); }, notification: { - poll: function(args) { + poll: function (args) { args.complete(); } }, messages: { - notification: function(args) { + notification: function (args) { return 'label.add.ip.range'; } } }, - + 'remove': { label: 'label.remove.ip.range', messages: { - confirm: function(args) { + confirm: function (args) { return 'message.confirm.remove.IP.range'; }, - notification: function(args) { + notification: function (args) { return 'label.remove.ip.range'; } }, - action: function(args) { + action: function (args) { $.ajax({ url: createURL("deleteVlanIpRange&id=" + args.data.id), dataType: "json", async: true, - success: function(json) { + success: function (json) { args.response.success({ - data: {} + data: { + } }); }, - error: function(json) { + error: function (json) { args.response.error(parseXMLHttpResponse(json)); } }); }, notification: { - poll: function(args) { + poll: function (args) { args.complete(); } } @@ -17259,28 +17315,28 @@ } } }; - + function addBaremetalDhcpDeviceFn(args) { - if (nspMap["BaremetalDhcpProvider"] == null) { + if (nspMap[ "BaremetalDhcpProvider"] == null) { $.ajax({ url: createURL("addNetworkServiceProvider&name=BaremetalDhcpProvider&physicalnetworkid=" + selectedPhysicalNetworkObj.id), dataType: "json", async: true, - success: function(json) { + success: function (json) { var jobId = json.addnetworkserviceproviderresponse.jobid; - var addBaremetalDhcpProviderIntervalID = setInterval(function() { + var addBaremetalDhcpProviderIntervalID = setInterval(function () { $.ajax({ url: createURL("queryAsyncJobResult&jobId=" + jobId), dataType: "json", - success: function(json) { + success: function (json) { var result = json.queryasyncjobresultresponse; if (result.jobstatus == 0) { return; //Job has not completed } else { clearInterval(addBaremetalDhcpProviderIntervalID); if (result.jobstatus == 1) { - nspMap["BaremetalDhcpProvider"] = json.queryasyncjobresultresponse.jobresult.networkserviceprovider; - + nspMap[ "BaremetalDhcpProvider"] = json.queryasyncjobresultresponse.jobresult.networkserviceprovider; + $.ajax({ url: createURL('addBaremetalDhcp'), data: { @@ -17291,12 +17347,12 @@ password: args.data.password }, type: "POST", - success: function(json) { + success: function (json) { var jid = json.addbaremetaldhcpresponse.jobid; args.response.success({ _custom: { jobId: jid, - getUpdatedItem: function(json) { + getUpdatedItem: function (json) { var item = json.queryasyncjobresultresponse.jobresult.baremetaldhcp; return item; } @@ -17309,11 +17365,12 @@ } } }, - error: function(XMLHttpResponse) { + error: function (XMLHttpResponse) { alert(parseXMLHttpResponse(XMLHttpResponse)); } }); - }, g_queryAsyncJobResultInterval); + }, + g_queryAsyncJobResultInterval); } }); } else { @@ -17327,12 +17384,12 @@ password: args.data.password }, type: "POST", - success: function(json) { + success: function (json) { var jid = json.addbaremetaldhcpresponse.jobid; args.response.success({ _custom: { jobId: jid, - getUpdatedItem: function(json) { + getUpdatedItem: function (json) { var item = json.queryasyncjobresultresponse.jobresult.baremetaldhcp; return item; } @@ -17342,28 +17399,28 @@ }); } } - + function addBaremetalPxeDeviceFn(args) { - if (nspMap["BaremetalPxeProvider"] == null) { + if (nspMap[ "BaremetalPxeProvider"] == null) { $.ajax({ url: createURL("addNetworkServiceProvider&name=BaremetalPxeProvider&physicalnetworkid=" + selectedPhysicalNetworkObj.id), dataType: "json", async: true, - success: function(json) { + success: function (json) { var jobId = json.addnetworkserviceproviderresponse.jobid; - var addBaremetalPxeProviderIntervalID = setInterval(function() { + var addBaremetalPxeProviderIntervalID = setInterval(function () { $.ajax({ url: createURL("queryAsyncJobResult&jobId=" + jobId), dataType: "json", - success: function(json) { + success: function (json) { var result = json.queryasyncjobresultresponse; if (result.jobstatus == 0) { return; //Job has not completed } else { clearInterval(addBaremetalPxeProviderIntervalID); if (result.jobstatus == 1) { - nspMap["BaremetalPxeProvider"] = json.queryasyncjobresultresponse.jobresult.networkserviceprovider; - + nspMap[ "BaremetalPxeProvider"] = json.queryasyncjobresultresponse.jobresult.networkserviceprovider; + $.ajax({ url: createURL('addBaremetalPxeKickStartServer'), data: { @@ -17375,12 +17432,12 @@ tftpdir: args.data.tftpdir }, type: "POST", - success: function(json) { + success: function (json) { var jid = json.addbaremetalpxeresponse.jobid; args.response.success({ _custom: { jobId: jid, - getUpdatedItem: function(json) { + getUpdatedItem: function (json) { var item = json.queryasyncjobresultresponse.jobresult.baremetalpxeserver; return item; } @@ -17393,11 +17450,12 @@ } } }, - error: function(XMLHttpResponse) { + error: function (XMLHttpResponse) { alert(parseXMLHttpResponse(XMLHttpResponse)); } }); - }, g_queryAsyncJobResultInterval); + }, + g_queryAsyncJobResultInterval); } }); } else { @@ -17412,12 +17470,12 @@ tftpdir: args.data.tftpdir }, type: "POST", - success: function(json) { + success: function (json) { var jid = json.addbaremetalpxeresponse.jobid; args.response.success({ _custom: { jobId: jid, - getUpdatedItem: function(json) { + getUpdatedItem: function (json) { var item = json.queryasyncjobresultresponse.jobresult.baremetalpxeserver; return item; } @@ -17427,28 +17485,28 @@ }); } } - + function addExternalLoadBalancer(args, physicalNetworkObj, apiCmd, apiCmdRes, apiCmdObj) { - var array1 = []; + var array1 =[]; array1.push("&physicalnetworkid=" + physicalNetworkObj.id); array1.push("&username=" + todb(args.data.username)); array1.push("&password=" + todb(args.data.password)); array1.push("&networkdevicetype=" + todb(args.data.networkdevicetype)); - + if (apiCmd == "addNetscalerLoadBalancer") { array1.push("&gslbprovider=" + (args.data.gslbprovider == "on")); array1.push("&gslbproviderpublicip=" + todb(args.data.gslbproviderpublicip)); array1.push("&gslbproviderprivateip=" + todb(args.data.gslbproviderprivateip)); } - + //construct URL starts here - var url = []; - + var url =[]; + var ip = args.data.ip; url.push("https://" + ip); - + var isQuestionMarkAdded = false; - + var publicInterface = args.data.publicinterface; if (publicInterface != null && publicInterface.length > 0) { if (isQuestionMarkAdded == false) { @@ -17459,7 +17517,7 @@ } url.push("publicinterface=" + publicInterface); } - + var privateInterface = args.data.privateinterface; if (privateInterface != null && privateInterface.length > 0) { if (isQuestionMarkAdded == false) { @@ -17470,7 +17528,7 @@ } url.push("privateinterface=" + privateInterface); } - + var numretries = args.data.numretries; if (numretries != null && numretries.length > 0) { if (isQuestionMarkAdded == false) { @@ -17481,7 +17539,7 @@ } url.push("numretries=" + numretries); } - + var isInline = args.data.inline; if (isInline != null && isInline.length > 0) { if (isQuestionMarkAdded == false) { @@ -17492,7 +17550,7 @@ } url.push("inline=" + isInline); } - + var capacity = args.data.capacity; if (capacity != null && capacity.length > 0) { if (isQuestionMarkAdded == false) { @@ -17503,8 +17561,9 @@ } url.push("lbdevicecapacity=" + capacity); } - - var dedicated = (args.data.dedicated == "on"); //boolean (true/false) + + var dedicated = (args.data.dedicated == "on"); + //boolean (true/false) if (isQuestionMarkAdded == false) { url.push("?"); isQuestionMarkAdded = true; @@ -17512,23 +17571,23 @@ url.push("&"); } url.push("lbdevicededicated=" + dedicated.toString()); - - + + array1.push("&url=" + todb(url.join(""))); //construct URL ends here - + $.ajax({ url: createURL(apiCmd + array1.join("")), dataType: "json", type: "POST", - success: function(json) { + success: function (json) { var jid = json[apiCmdRes].jobid; args.response.success({ _custom: { jobId: jid, - getUpdatedItem: function(json) { + getUpdatedItem: function (json) { var item = json.queryasyncjobresultresponse.jobresult[apiCmdObj]; - + return item; } } @@ -17536,22 +17595,22 @@ } }); } - + function addExternalFirewall(args, physicalNetworkObj, apiCmd, apiCmdRes, apiCmdObj) { - var array1 = []; + var array1 =[]; array1.push("&physicalnetworkid=" + physicalNetworkObj.id); array1.push("&username=" + todb(args.data.username)); array1.push("&password=" + todb(args.data.password)); array1.push("&networkdevicetype=" + todb(args.data.networkdevicetype)); - + //construct URL starts here - var url = []; - + var url =[]; + var ip = args.data.ip; url.push("https://" + ip); - + var isQuestionMarkAdded = false; - + var publicInterface = args.data.publicinterface; if (publicInterface != null && publicInterface.length > 0) { if (isQuestionMarkAdded == false) { @@ -17562,7 +17621,7 @@ } url.push("publicinterface=" + publicInterface); } - + var privateInterface = args.data.privateinterface; if (privateInterface != null && privateInterface.length > 0) { if (isQuestionMarkAdded == false) { @@ -17573,7 +17632,7 @@ } url.push("privateinterface=" + privateInterface); } - + var usageInterface = args.data.usageinterface; if (usageInterface != null && usageInterface.length > 0) { if (isQuestionMarkAdded == false) { @@ -17584,7 +17643,7 @@ } url.push("usageinterface=" + usageInterface); } - + var numretries = args.data.numretries; if (numretries != null && numretries.length > 0) { if (isQuestionMarkAdded == false) { @@ -17595,7 +17654,7 @@ } url.push("numretries=" + numretries); } - + var timeout = args.data.timeout; if (timeout != null && timeout.length > 0) { if (isQuestionMarkAdded == false) { @@ -17606,7 +17665,7 @@ } url.push("timeout=" + timeout); } - + var isInline = args.data.inline; if (isInline != null && isInline.length > 0) { if (isQuestionMarkAdded == false) { @@ -17617,7 +17676,7 @@ } url.push("inline=" + isInline); } - + var publicNetwork = args.data.publicnetwork; if (publicNetwork != null && publicNetwork.length > 0) { if (isQuestionMarkAdded == false) { @@ -17628,7 +17687,7 @@ } url.push("publicnetwork=" + publicNetwork); } - + var privateNetwork = args.data.privatenetwork; if (privateNetwork != null && privateNetwork.length > 0) { if (isQuestionMarkAdded == false) { @@ -17639,7 +17698,7 @@ } url.push("privatenetwork=" + privateNetwork); } - + var capacity = args.data.capacity; if (capacity != null && capacity.length > 0) { if (isQuestionMarkAdded == false) { @@ -17650,8 +17709,9 @@ } url.push("fwdevicecapacity=" + capacity); } - - var dedicated = (args.data.dedicated == "on"); //boolean (true/false) + + var dedicated = (args.data.dedicated == "on"); + //boolean (true/false) if (isQuestionMarkAdded == false) { url.push("?"); isQuestionMarkAdded = true; @@ -17659,60 +17719,57 @@ url.push("&"); } url.push("fwdevicededicated=" + dedicated.toString()); - + // START - Palo Alto Specific Fields var externalVirtualRouter = args.data.pavr; - if(externalVirtualRouter != null && externalVirtualRouter.length > 0) { - if(isQuestionMarkAdded == false) { + if (externalVirtualRouter != null && externalVirtualRouter.length > 0) { + if (isQuestionMarkAdded == false) { url.push("?"); isQuestionMarkAdded = true; - } - else { + } else { url.push("&"); } url.push("pavr=" + encodeURIComponent(externalVirtualRouter)); } - + var externalThreatProfile = args.data.patp; - if(externalThreatProfile != null && externalThreatProfile.length > 0) { - if(isQuestionMarkAdded == false) { + if (externalThreatProfile != null && externalThreatProfile.length > 0) { + if (isQuestionMarkAdded == false) { url.push("?"); isQuestionMarkAdded = true; - } - else { + } else { url.push("&"); } url.push("patp=" + encodeURIComponent(externalThreatProfile)); } - + var externalLogProfile = args.data.palp; - if(externalLogProfile != null && externalLogProfile.length > 0) { - if(isQuestionMarkAdded == false) { + if (externalLogProfile != null && externalLogProfile.length > 0) { + if (isQuestionMarkAdded == false) { url.push("?"); isQuestionMarkAdded = true; - } - else { + } else { url.push("&"); } url.push("palp=" + encodeURIComponent(externalLogProfile)); } // END - Palo Alto Specific Fields - + array1.push("&url=" + todb(url.join(""))); //construct URL ends here - + $.ajax({ url: createURL(apiCmd + array1.join("")), dataType: "json", type: "POST", - success: function(json) { + success: function (json) { var jid = json[apiCmdRes].jobid; args.response.success({ _custom: { jobId: jid, - getUpdatedItem: function(json) { + getUpdatedItem: function (json) { var item = json.queryasyncjobresultresponse.jobresult[apiCmdObj]; - + return item; } } @@ -17720,32 +17777,32 @@ } }); } - + function addNiciraNvpDevice(args, physicalNetworkObj, apiCmd, apiCmdRes, apiCmdObj) { - var array1 = []; + var array1 =[]; array1.push("&physicalnetworkid=" + physicalNetworkObj.id); array1.push("&username=" + todb(args.data.username)); array1.push("&password=" + todb(args.data.password)); array1.push("&hostname=" + todb(args.data.host)); array1.push("&transportzoneuuid=" + todb(args.data.transportzoneuuid)); - + var l3GatewayServiceUuid = args.data.l3gatewayserviceuuid; if (l3GatewayServiceUuid != null && l3GatewayServiceUuid.length > 0) { array1.push("&l3gatewayserviceuuid=" + todb(args.data.l3gatewayserviceuuid)); } - + $.ajax({ url: createURL(apiCmd + array1.join("")), dataType: "json", type: "POST", - success: function(json) { + success: function (json) { var jid = json[apiCmdRes].jobid; args.response.success({ _custom: { jobId: jid, - getUpdatedItem: function(json) { + getUpdatedItem: function (json) { var item = json.queryasyncjobresultresponse.jobresult[apiCmdObj]; - + return item; } } @@ -17753,23 +17810,23 @@ } }); } - + function addBigSwitchVnsDevice(args, physicalNetworkObj, apiCmd, apiCmdRes, apiCmdObj) { - var array1 = []; + var array1 =[]; array1.push("&physicalnetworkid=" + physicalNetworkObj.id); array1.push("&hostname=" + todb(args.data.host)); - + $.ajax({ url: createURL(apiCmd + array1.join("")), dataType: "json", - success: function(json) { + success: function (json) { var jid = json[apiCmdRes].jobid; args.response.success({ _custom: { jobId: jid, - getUpdatedItem: function(json) { + getUpdatedItem: function (json) { var item = json.queryasyncjobresultresponse.jobresult[apiCmdObj]; - + return item; } } @@ -17777,18 +17834,18 @@ } }); } - - var afterCreateZonePhysicalNetworkTrafficTypes = function(args, newZoneObj, newPhysicalnetwork) { + + var afterCreateZonePhysicalNetworkTrafficTypes = function (args, newZoneObj, newPhysicalnetwork) { $.ajax({ url: createURL("updatePhysicalNetwork&state=Enabled&id=" + newPhysicalnetwork.id), dataType: "json", - success: function(json) { + success: function (json) { var jobId = json.updatephysicalnetworkresponse.jobid; - var enablePhysicalNetworkIntervalID = setInterval(function() { + var enablePhysicalNetworkIntervalID = setInterval(function () { $.ajax({ url: createURL("queryAsyncJobResult&jobId=" + jobId), dataType: "json", - success: function(json) { + success: function (json) { var result = json.queryasyncjobresultresponse; if (result.jobstatus == 0) { return; //Job has not completed @@ -17796,14 +17853,14 @@ clearInterval(enablePhysicalNetworkIntervalID); if (result.jobstatus == 1) { //alert("updatePhysicalNetwork succeeded."); - + // get network service provider ID of Virtual Router var virtualRouterProviderId; $.ajax({ url: createURL("listNetworkServiceProviders&name=VirtualRouter&physicalNetworkId=" + newPhysicalnetwork.id), dataType: "json", async: false, - success: function(json) { + success: function (json) { var items = json.listnetworkserviceprovidersresponse.networkserviceprovider; if (items != null && items.length > 0) { virtualRouterProviderId = items[0].id; @@ -17814,13 +17871,13 @@ alert("error: listNetworkServiceProviders API doesn't return VirtualRouter provider ID"); return; } - + var virtualRouterElementId; $.ajax({ url: createURL("listVirtualRouterElements&nspid=" + virtualRouterProviderId), dataType: "json", async: false, - success: function(json) { + success: function (json) { var items = json.listvirtualrouterelementsresponse.virtualrouterelement; if (items != null && items.length > 0) { virtualRouterElementId = items[0].id; @@ -17831,18 +17888,18 @@ alert("error: listVirtualRouterElements API doesn't return Virtual Router Element Id"); return; } - + $.ajax({ url: createURL("configureVirtualRouterElement&enabled=true&id=" + virtualRouterElementId), dataType: "json", async: false, - success: function(json) { + success: function (json) { var jobId = json.configurevirtualrouterelementresponse.jobid; - var enableVirtualRouterElementIntervalID = setInterval(function() { + var enableVirtualRouterElementIntervalID = setInterval(function () { $.ajax({ url: createURL("queryAsyncJobResult&jobId=" + jobId), dataType: "json", - success: function(json) { + success: function (json) { var result = json.queryasyncjobresultresponse; if (result.jobstatus == 0) { return; //Job has not completed @@ -17850,18 +17907,18 @@ clearInterval(enableVirtualRouterElementIntervalID); if (result.jobstatus == 1) { //alert("configureVirtualRouterElement succeeded."); - + $.ajax({ url: createURL("updateNetworkServiceProvider&state=Enabled&id=" + virtualRouterProviderId), dataType: "json", async: false, - success: function(json) { + success: function (json) { var jobId = json.updatenetworkserviceproviderresponse.jobid; - var enableVirtualRouterProviderIntervalID = setInterval(function() { + var enableVirtualRouterProviderIntervalID = setInterval(function () { $.ajax({ url: createURL("queryAsyncJobResult&jobId=" + jobId), dataType: "json", - success: function(json) { + success: function (json) { var result = json.queryasyncjobresultresponse; if (result.jobstatus == 0) { return; //Job has not completed @@ -17869,16 +17926,17 @@ clearInterval(enableVirtualRouterProviderIntervalID); if (result.jobstatus == 1) { //alert("Virtual Router Provider is enabled"); - + if (newZoneObj.networktype == "Basic") { - if (args.data["security-groups-enabled"] == "on") { //need to Enable security group provider first + if (args.data[ "security-groups-enabled"] == "on") { + //need to Enable security group provider first // get network service provider ID of Security Group var securityGroupProviderId; $.ajax({ url: createURL("listNetworkServiceProviders&name=SecurityGroupProvider&physicalNetworkId=" + newPhysicalnetwork.id), dataType: "json", async: false, - success: function(json) { + success: function (json) { var items = json.listnetworkserviceprovidersresponse.networkserviceprovider; if (items != null && items.length > 0) { securityGroupProviderId = items[0].id; @@ -17889,18 +17947,18 @@ alert("error: listNetworkServiceProviders API doesn't return security group provider ID"); return; } - + $.ajax({ url: createURL("updateNetworkServiceProvider&state=Enabled&id=" + securityGroupProviderId), dataType: "json", async: false, - success: function(json) { + success: function (json) { var jobId = json.updatenetworkserviceproviderresponse.jobid; - var enableSecurityGroupProviderIntervalID = setInterval(function() { + var enableSecurityGroupProviderIntervalID = setInterval(function () { $.ajax({ url: createURL("queryAsyncJobResult&jobId=" + jobId), dataType: "json", - success: function(json) { + success: function (json) { var result = json.queryasyncjobresultresponse; if (result.jobstatus == 0) { return; //Job has not completed @@ -17908,9 +17966,9 @@ clearInterval(enableSecurityGroupProviderIntervalID); if (result.jobstatus == 1) { //alert("Security group provider is enabled"); - + //create network (for basic zone only) - var array2 = []; + var array2 =[]; array2.push("&zoneid=" + newZoneObj.id); array2.push("&name=guestNetworkForBasicZone"); array2.push("&displaytext=guestNetworkForBasicZone"); @@ -17919,27 +17977,26 @@ url: createURL("createNetwork" + array2.join("")), dataType: "json", async: false, - success: function(json) { + success: function (json) { //create pod - var array3 = []; + var array3 =[]; array3.push("&zoneId=" + newZoneObj.id); array3.push("&name=" + todb(args.data.podName)); array3.push("&gateway=" + todb(args.data.podGateway)); array3.push("&netmask=" + todb(args.data.podNetmask)); array3.push("&startIp=" + todb(args.data.podStartIp)); - + var endip = args.data.podEndIp; //optional if (endip != null && endip.length > 0) - array3.push("&endIp=" + todb(endip)); - + array3.push("&endIp=" + todb(endip)); + $.ajax({ url: createURL("createPod" + array3.join("")), dataType: "json", async: false, - success: function(json) { - + success: function (json) { }, - error: function(XMLHttpResponse) { + error: function (XMLHttpResponse) { var errorMsg = parseXMLHttpResponse(XMLHttpResponse); alert("createPod failed. Error: " + errorMsg); } @@ -17951,17 +18008,18 @@ } } }, - error: function(XMLHttpResponse) { + error: function (XMLHttpResponse) { var errorMsg = parseXMLHttpResponse(XMLHttpResponse); alert("updateNetworkServiceProvider failed. Error: " + errorMsg); } }); - }, g_queryAsyncJobResultInterval); + }, + g_queryAsyncJobResultInterval); } }); } else { //create network (for basic zone only) - var array2 = []; + var array2 =[]; array2.push("&zoneid=" + newZoneObj.id); array2.push("&name=guestNetworkForBasicZone"); array2.push("&displaytext=guestNetworkForBasicZone"); @@ -17970,27 +18028,26 @@ url: createURL("createNetwork" + array2.join("")), dataType: "json", async: false, - success: function(json) { + success: function (json) { //create pod - var array3 = []; + var array3 =[]; array3.push("&zoneId=" + newZoneObj.id); array3.push("&name=" + todb(args.data.podName)); array3.push("&gateway=" + todb(args.data.podGateway)); array3.push("&netmask=" + todb(args.data.podNetmask)); array3.push("&startIp=" + todb(args.data.podStartIp)); - + var endip = args.data.podEndIp; //optional if (endip != null && endip.length > 0) - array3.push("&endIp=" + todb(endip)); - + array3.push("&endIp=" + todb(endip)); + $.ajax({ url: createURL("createPod" + array3.join("")), dataType: "json", async: false, - success: function(json) { - + success: function (json) { }, - error: function(XMLHttpResponse) { + error: function (XMLHttpResponse) { var errorMsg = parseXMLHttpResponse(XMLHttpResponse); alert("createPod failed. Error: " + errorMsg); } @@ -17998,27 +18055,27 @@ } }); } - } else { //Advanced zone + } else { + //Advanced zone //create pod - var array3 = []; + var array3 =[]; array3.push("&zoneId=" + newZoneObj.id); array3.push("&name=" + todb(args.data.podName)); array3.push("&gateway=" + todb(args.data.podGateway)); array3.push("&netmask=" + todb(args.data.podNetmask)); array3.push("&startIp=" + todb(args.data.podStartIp)); - + var endip = args.data.podEndIp; //optional if (endip != null && endip.length > 0) - array3.push("&endIp=" + todb(endip)); - + array3.push("&endIp=" + todb(endip)); + $.ajax({ url: createURL("createPod" + array3.join("")), dataType: "json", async: false, - success: function(json) { - + success: function (json) { }, - error: function(XMLHttpResponse) { + error: function (XMLHttpResponse) { var errorMsg = parseXMLHttpResponse(XMLHttpResponse); alert("createPod failed. Error: " + errorMsg); } @@ -18029,12 +18086,13 @@ } } }, - error: function(XMLHttpResponse) { + error: function (XMLHttpResponse) { var errorMsg = parseXMLHttpResponse(XMLHttpResponse); alert("updateNetworkServiceProvider failed. Error: " + errorMsg); } }); - }, g_queryAsyncJobResultInterval); + }, + g_queryAsyncJobResultInterval); } }); } else if (result.jobstatus == 2) { @@ -18042,12 +18100,13 @@ } } }, - error: function(XMLHttpResponse) { + error: function (XMLHttpResponse) { var errorMsg = parseXMLHttpResponse(XMLHttpResponse); alert("configureVirtualRouterElement failed. Error: " + errorMsg); } }); - }, g_queryAsyncJobResultInterval); + }, + g_queryAsyncJobResultInterval); } }); } else if (result.jobstatus == 2) { @@ -18055,144 +18114,140 @@ } } }, - error: function(XMLHttpResponse) { + error: function (XMLHttpResponse) { var errorMsg = parseXMLHttpResponse(XMLHttpResponse); alert("updatePhysicalNetwork failed. Error: " + errorMsg); } }); - }, g_queryAsyncJobResultInterval); + }, + g_queryAsyncJobResultInterval); } }); }; - + //action filters (begin) - var zoneActionfilter = function(args) { + var zoneActionfilter = function (args) { var jsonObj = args.context.item; - var allowedActions = ['enableSwift']; - + var allowedActions =[ 'enableSwift']; + if (jsonObj.vmwaredcId == null) - allowedActions.push('addVmwareDc'); - else - allowedActions.push('removeVmwareDc'); - + allowedActions.push('addVmwareDc'); else + allowedActions.push('removeVmwareDc'); + if (jsonObj.domainid != null) - allowedActions.push("releaseDedicatedZone"); - else - allowedActions.push("dedicateZone"); - + allowedActions.push("releaseDedicatedZone"); else + allowedActions.push("dedicateZone"); + allowedActions.push("edit"); - + if (jsonObj.allocationstate == "Disabled") - allowedActions.push("enable"); - else if (jsonObj.allocationstate == "Enabled") - allowedActions.push("disable"); - + allowedActions.push("enable"); else if (jsonObj.allocationstate == "Enabled") + allowedActions.push("disable"); + allowedActions.push("remove"); return allowedActions; } - - - var nexusActionfilter = function(args) { + + + var nexusActionfilter = function (args) { var nexusObj = args.context.item; - var allowedActions = []; + var allowedActions =[]; allowedActions.push("edit"); if (nexusObj.vsmdevicestate == "Disabled") - allowedActions.push("enable"); - else if (nexusObj.vsmdevicestate == "Enabled") - allowedActions.push("disable"); + allowedActions.push("enable"); else if (nexusObj.vsmdevicestate == "Enabled") + allowedActions.push("disable"); allowedActions.push("remove"); return allowedActions; } - - var podActionfilter = function(args) { + + var podActionfilter = function (args) { var podObj = args.context.item; var dedicatedPodObj = args.context.podItem; - var allowedActions = []; - + var allowedActions =[]; + if (podObj.domainid != null) - allowedActions.push("release"); - else - allowedActions.push("dedicate"); - - + allowedActions.push("release"); else + allowedActions.push("dedicate"); + + allowedActions.push("edit"); if (podObj.allocationstate == "Disabled") - allowedActions.push("enable"); - else if (podObj.allocationstate == "Enabled") - allowedActions.push("disable"); + allowedActions.push("enable"); else if (podObj.allocationstate == "Enabled") + allowedActions.push("disable"); allowedActions.push("remove"); - + /* - var selectedZoneObj; - $(zoneObjs).each(function(){ - if(this.id == podObj.zoneid) { + var selectedZoneObj; + $(zoneObjs).each(function(){ + if(this.id == podObj.zoneid) { selectedZoneObj = this; return false; //break the $.each() loop - } - }); - */ - - if (selectedZoneObj.networktype == "Basic") { //basic-mode network (pod-wide VLAN) + } + }); + */ + + if (selectedZoneObj.networktype == "Basic") { + //basic-mode network (pod-wide VLAN) //$("#tab_ipallocation, #add_iprange_button, #tab_network_device, #add_network_device_button").show(); allowedActions.push("addIpRange"); allowedActions.push("addNetworkDevice"); - } else if (selectedZoneObj.networktype == "Advanced") { //advanced-mode network (zone-wide VLAN) + } else if (selectedZoneObj.networktype == "Advanced") { + //advanced-mode network (zone-wide VLAN) //$("#tab_ipallocation, #add_iprange_button, #tab_network_device, #add_network_device_button").hide(); } - + return allowedActions; } - - var networkDeviceActionfilter = function(args) { + + var networkDeviceActionfilter = function (args) { var jsonObj = args.context.item; - var allowedActions = []; + var allowedActions =[]; return allowedActions; } - - var clusterActionfilter = function(args) { + + var clusterActionfilter = function (args) { var jsonObj = args.context.item; - var allowedActions = []; - + var allowedActions =[]; + if (jsonObj.domainid != null) - allowedActions.push("release"); - else - allowedActions.push("dedicate"); - - if (jsonObj.state == "Enabled") { //managed, allocation enabled + allowedActions.push("release"); else + allowedActions.push("dedicate"); + + if (jsonObj.state == "Enabled") { + //managed, allocation enabled allowedActions.push("unmanage"); allowedActions.push("disable"); //allowedActions.push("edit"); // No fields to edit - - } else if (jsonObj.state == "Disabled") { //managed, allocation disabled + } else if (jsonObj.state == "Disabled") { + //managed, allocation disabled allowedActions.push("unmanage"); allowedActions.push("enable"); //allowedActions.push("edit"); // No fields to edit - - } else { //Unmanaged, PrepareUnmanaged , PrepareUnmanagedError + } else { + //Unmanaged, PrepareUnmanaged , PrepareUnmanagedError allowedActions.push("manage"); } - + allowedActions.push("remove"); - + return allowedActions; } - - var hostActionfilter = function(args) { + + var hostActionfilter = function (args) { var jsonObj = args.context.item; - var allowedActions = []; - + var allowedActions =[]; + if (jsonObj.domainid != null) - allowedActions.push("release"); - else - allowedActions.push("dedicate"); - - + allowedActions.push("release"); else + allowedActions.push("dedicate"); + + if (jsonObj.resourcestate == "Enabled") { allowedActions.push("edit"); allowedActions.push("enableMaintenanceMode"); - + if (jsonObj.state != "Disconnected") - allowedActions.push("forceReconnect"); + allowedActions.push("forceReconnect"); } else if (jsonObj.resourcestate == "ErrorInMaintenance") { allowedActions.push("edit"); allowedActions.push("enableMaintenanceMode"); @@ -18208,20 +18263,20 @@ allowedActions.push("edit"); allowedActions.push("remove"); } - + if ((jsonObj.state == "Down" || jsonObj.state == "Alert" || jsonObj.state == "Disconnected") && ($.inArray("remove", allowedActions) == -1)) { allowedActions.push("remove"); } - + return allowedActions; } - - var primarystorageActionfilter = function(args) { + + var primarystorageActionfilter = function (args) { var jsonObj = args.context.item; - var allowedActions = []; - + var allowedActions =[]; + allowedActions.push("edit"); - + if (jsonObj.state == 'Up' || jsonObj.state == "Connecting") { allowedActions.push("enableMaintenanceMode"); } else if (jsonObj.state == 'Down') { @@ -18242,92 +18297,94 @@ } return allowedActions; } - - var secondarystorageActionfilter = function(args) { + + var secondarystorageActionfilter = function (args) { var jsonObj = args.context.item; - var allowedActions = []; + var allowedActions =[]; allowedActions.push("remove"); - + if (jsonObj.providername == 'NFS') { - allowedActions.push("prepareObjectStoreMigration"); + allowedActions.push("prepareObjectStoreMigration"); } return allowedActions; } - - var routerActionfilter = cloudStack.sections.system.routerActionFilter = function(args) { + + var routerActionfilter = cloudStack.sections.system.routerActionFilter = function (args) { var jsonObj = args.context.item; - var allowedActions = []; - - if(jsonObj.requiresupgrade == true) { + var allowedActions =[]; + + if (jsonObj.requiresupgrade == true) { allowedActions.push('upgradeRouterToUseNewerTemplate'); } if (jsonObj.state == 'Running') { allowedActions.push("stop"); - + //when systemVm is running, scaleUp is not supported for KVM and XenServer. //however, listRouters API doesn't return hypervisor property.... /* if (jsonObj.hypervisor != 'KVM' && jsonObj.hypervisor != 'XenServer') { - allowedActions.push("scaleUp"); - } - */ allowedActions.push("scaleUp"); - + } + */ + allowedActions.push("scaleUp"); + allowedActions.push("restart"); - + allowedActions.push("viewConsole"); if (isAdmin()) - allowedActions.push("migrate"); + allowedActions.push("migrate"); } else if (jsonObj.state == 'Stopped') { allowedActions.push("start"); - allowedActions.push("scaleUp"); //when vm is stopped, scaleUp is supported for all hypervisors + allowedActions.push("scaleUp"); + //when vm is stopped, scaleUp is supported for all hypervisors allowedActions.push("remove"); } return allowedActions; } - - var internallbinstanceActionfilter = function(args) { + + var internallbinstanceActionfilter = function (args) { var jsonObj = args.context.item; - var allowedActions = []; - + var allowedActions =[]; + if (jsonObj.state == 'Running') { allowedActions.push("stop"); - + allowedActions.push("viewConsole"); if (isAdmin()) - allowedActions.push("migrate"); + allowedActions.push("migrate"); } else if (jsonObj.state == 'Stopped') { allowedActions.push("start"); } return allowedActions; } - - var systemvmActionfilter = function(args) { + + var systemvmActionfilter = function (args) { var jsonObj = args.context.item; - var allowedActions = []; - + var allowedActions =[]; + if (jsonObj.state == 'Running') { allowedActions.push("stop"); allowedActions.push("restart"); allowedActions.push("remove"); - + //when systemVm is running, scaleUp is not supported for KVM and XenServer. //however, listSystemVms API doesn't return hypervisor property.... /* if (jsonObj.hypervisor != 'KVM' && jsonObj.hypervisor != 'XenServer') { - allowedActions.push("scaleUp"); - } - */ allowedActions.push("scaleUp"); - + } + */ + allowedActions.push("scaleUp"); + allowedActions.push("viewConsole"); if (isAdmin()) - allowedActions.push("migrate"); + allowedActions.push("migrate"); } else if (jsonObj.state == 'Stopped') { allowedActions.push("start"); - allowedActions.push("scaleUp"); //when vm is stopped, scaleUp is supported for all hypervisors + allowedActions.push("scaleUp"); + //when vm is stopped, scaleUp is supported for all hypervisors allowedActions.push("remove"); } else if (jsonObj.state == 'Error') { allowedActions.push("remove"); @@ -18335,315 +18392,329 @@ return allowedActions; } - var routerGroupActionfilter = function(args) { + var routerGroupActionfilter = function (args) { var jsonObj = args.context.item; - var allowedActions = []; + var allowedActions =[]; if (jsonObj.routerRequiresUpgrade > 0) { - allowedActions.push("upgradeRouterToUseNewerTemplate"); - } - return allowedActions; - } - - var bladeActionfilter = function(args) { - var jsonObj = args.context.item; - var allowedActions = []; - if(jsonObj.profiledn == null) { - allowedActions.push("associateTemplateToBlade"); - } else { - allowedActions.push("disassociateProfileFromBlade"); + allowedActions.push("upgradeRouterToUseNewerTemplate"); } return allowedActions; } - + + var bladeActionfilter = function (args) { + var jsonObj = args.context.item; + var allowedActions =[]; + if (jsonObj.profiledn == null) { + allowedActions.push("associateTemplateToBlade"); + } else { + allowedActions.push("disassociateProfileFromBlade"); + } + return allowedActions; + } + //action filters (end) - - var networkProviderActionFilter = function(id) { - return function(args) { - var allowedActions = []; + + var networkProviderActionFilter = function (id) { + return function (args) { + var allowedActions =[]; var jsonObj = nspMap[id] ? - nspMap[id] : {}; - + nspMap[id]: { + }; + if (jsonObj.state) { if (jsonObj.state == "Enabled") - allowedActions.push("disable"); - else if (jsonObj.state == "Disabled") - allowedActions.push("enable"); + allowedActions.push("disable"); else if (jsonObj.state == "Disabled") + allowedActions.push("enable"); allowedActions.push("destroy"); } - + allowedActions.push('add'); - + return allowedActions; } }; - - var addExtraPropertiesToClusterObject = function(jsonObj) { + + var addExtraPropertiesToClusterObject = function (jsonObj) { if (jsonObj.managedstate == "Managed") { jsonObj.state = jsonObj.allocationstate; //jsonObj.state == Enabled, Disabled } else { jsonObj.state = jsonObj.managedstate; //jsonObj.state == Unmanaged, PrepareUnmanaged, PrepareUnmanagedError } } - - var addExtraPropertiesToRouterInstanceObject = function(jsonObj) { + + var addExtraPropertiesToRouterInstanceObject = function (jsonObj) { if (jsonObj.isredundantrouter == true) { - jsonObj["redundantRouterState"] = jsonObj.redundantstate; + jsonObj[ "redundantRouterState"] = jsonObj.redundantstate; } else { - jsonObj["redundantRouterState"] = ""; + jsonObj[ "redundantRouterState"] = ""; } } - - var refreshNspData = function(nspName) { - var array1 = []; + + var refreshNspData = function (nspName) { + var array1 =[]; if (nspName != null) - array1.push("&name=" + nspName); - + array1.push("&name=" + nspName); + $.ajax({ url: createURL("listNetworkServiceProviders&physicalnetworkid=" + selectedPhysicalNetworkObj.id + array1.join("")), dataType: "json", async: false, - success: function(json) { - nspMap = {}; //reset - + success: function (json) { + nspMap = { + }; + //reset + var items = json.listnetworkserviceprovidersresponse.networkserviceprovider; if (items != null) { for (var i = 0; i < items.length; i++) { switch (items[i].name) { case "VirtualRouter": - nspMap["virtualRouter"] = items[i]; - break; + nspMap[ "virtualRouter"] = items[i]; + break; case "InternalLbVm": - nspMap["InternalLbVm"] = items[i]; - break; + nspMap[ "InternalLbVm"] = items[i]; + break; case "VpcVirtualRouter": - nspMap["vpcVirtualRouter"] = items[i]; - break; + nspMap[ "vpcVirtualRouter"] = items[i]; + break; case "Netscaler": - nspMap["netscaler"] = items[i]; - break; + nspMap[ "netscaler"] = items[i]; + break; case "MidoNet": - nspMap["midoNet"] = items[i]; - break; + nspMap[ "midoNet"] = items[i]; + break; case "BaremetalDhcpProvider": - nspMap["BaremetalDhcpProvider"] = items[i]; - break; + nspMap[ "BaremetalDhcpProvider"] = items[i]; + break; case "BaremetalPxeProvider": - nspMap["BaremetalPxeProvider"] = items[i]; - break; + nspMap[ "BaremetalPxeProvider"] = items[i]; + break; case "F5BigIp": - nspMap["f5"] = items[i]; - break; + nspMap[ "f5"] = items[i]; + break; case "JuniperSRX": - nspMap["srx"] = items[i]; - break; + nspMap[ "srx"] = items[i]; + break; case "PaloAlto": - nspMap["pa"] = items[i]; - break; + nspMap[ "pa"] = items[i]; + break; case "SecurityGroupProvider": - nspMap["securityGroups"] = items[i]; - break; + nspMap[ "securityGroups"] = items[i]; + break; case "NiciraNvp": - nspMap["niciraNvp"] = items[i]; - break; + nspMap[ "niciraNvp"] = items[i]; + break; case "BigSwitchVns": - nspMap["bigswitchVns"] = items[i]; - break; + nspMap[ "bigswitchVns"] = items[i]; + break; case "Ovs": - nspMap["Ovs"] = items[i]; - break; + nspMap[ "Ovs"] = items[i]; + break; } } } } }); - - nspHardcodingArray = [{ + + nspHardcodingArray =[ { id: 'netscaler', name: 'NetScaler', - state: nspMap.netscaler ? nspMap.netscaler.state : 'Disabled' - }, { + state: nspMap.netscaler ? nspMap.netscaler.state: 'Disabled' + }, + { id: 'virtualRouter', name: 'Virtual Router', - state: nspMap.virtualRouter ? nspMap.virtualRouter.state : 'Disabled' - }, { + state: nspMap.virtualRouter ? nspMap.virtualRouter.state: 'Disabled' + }, + { id: 'niciraNvp', name: 'Nicira Nvp', - state: nspMap.niciraNvp ? nspMap.niciraNvp.state : 'Disabled' - }, { + state: nspMap.niciraNvp ? nspMap.niciraNvp.state: 'Disabled' + }, + { id: 'bigswitchVns', name: 'BigSwitch Vns', - state: nspMap.bigswitchVns ? nspMap.bigswitchVns.state : 'Disabled' - }, { + state: nspMap.bigswitchVns ? nspMap.bigswitchVns.state: 'Disabled' + }, + { id: 'BaremetalDhcpProvider', name: 'Baremetal DHCP', - state: nspMap.BaremetalDhcpProvider ? nspMap.BaremetalDhcpProvider.state : 'Disabled' - }, { + state: nspMap.BaremetalDhcpProvider ? nspMap.BaremetalDhcpProvider.state: 'Disabled' + }, + { id: 'BaremetalPxeProvider', name: 'Baremetal PXE', - state: nspMap.BaremetalPxeProvider ? nspMap.BaremetalPxeProvider.state : 'Disabled' - }, { + state: nspMap.BaremetalPxeProvider ? nspMap.BaremetalPxeProvider.state: 'Disabled' + }, + { id: 'Ovs', name: 'Ovs', - state: nspMap.Ovs ? nspMap.Ovs.state : 'Disabled' + state: nspMap.Ovs ? nspMap.Ovs.state: 'Disabled' }]; - + $(window).trigger('cloudStack.system.serviceProviders.makeHarcodedArray', { nspHardcodingArray: nspHardcodingArray, selectedZoneObj: selectedZoneObj, selectedPhysicalNetworkObj: selectedPhysicalNetworkObj }); - + if (selectedZoneObj.networktype == "Basic") { nspHardcodingArray.push({ id: 'securityGroups', name: 'Security Groups', - state: nspMap.securityGroups ? nspMap.securityGroups.state : 'Disabled' + state: nspMap.securityGroups ? nspMap.securityGroups.state: 'Disabled' }); } else if (selectedZoneObj.networktype == "Advanced") { nspHardcodingArray.push({ id: 'midoNet', name: 'MidoNet', - state: nspMap.midoNet ? nspMap.midoNet.state : 'Disabled' + state: nspMap.midoNet ? nspMap.midoNet.state: 'Disabled' }); - + nspHardcodingArray.push({ id: 'InternalLbVm', name: 'Internal LB VM', - state: nspMap.InternalLbVm ? nspMap.InternalLbVm.state : 'Disabled' + state: nspMap.InternalLbVm ? nspMap.InternalLbVm.state: 'Disabled' }); - + nspHardcodingArray.push({ id: 'vpcVirtualRouter', name: 'VPC Virtual Router', - state: nspMap.vpcVirtualRouter ? nspMap.vpcVirtualRouter.state : 'Disabled' + state: nspMap.vpcVirtualRouter ? nspMap.vpcVirtualRouter.state: 'Disabled' }); nspHardcodingArray.push({ id: 'f5', name: 'F5', - state: nspMap.f5 ? nspMap.f5.state : 'Disabled' + state: nspMap.f5 ? nspMap.f5.state: 'Disabled' }); nspHardcodingArray.push({ id: 'srx', name: 'SRX', - state: nspMap.srx ? nspMap.srx.state : 'Disabled' + state: nspMap.srx ? nspMap.srx.state: 'Disabled' }); nspHardcodingArray.push({ id: 'pa', name: 'Palo Alto', - state: nspMap.pa ? nspMap.pa.state : 'Disabled' + state: nspMap.pa ? nspMap.pa.state: 'Disabled' }); } }; - - cloudStack.actionFilter.physicalNetwork = function(args) { + + cloudStack.actionFilter.physicalNetwork = function (args) { var state = args.context.item.state; - + if (state != 'Destroyed') { - return ['remove']; + return[ 'remove']; } - - return []; + + return[]; }; - function addExtraPropertiesToGroupbyObjects(groupbyObjs, groupbyId) { - for (var i = 0; i < groupbyObjs.length; i++) { - addExtraPropertiesToGroupbyObject(groupbyObjs[i], groupbyId); - } + function addExtraPropertiesToGroupbyObjects(groupbyObjs, groupbyId) { + for (var i = 0; i < groupbyObjs.length; i++) { + addExtraPropertiesToGroupbyObject(groupbyObjs[i], groupbyId); + } } - - function addExtraPropertiesToGroupbyObject(groupbyObj, groupbyId) { - var currentPage = 1; - - var listRoutersData = { - listAll: true, - pagesize: pageSize //global variable - }; - listRoutersData[groupbyId] = groupbyObj.id; - - $.ajax({ - url: createURL('listRouters'), - data: $.extend({}, listRoutersData, { - page: currentPage - }), - async: false, - success: function(json) { - if (json.listroutersresponse.count != undefined) { - var routerCountFromAllPages = json.listroutersresponse.count; - var routerCountFromFirstPageToCurrentPage = json.listroutersresponse.router.length; - var routerRequiresUpgrade = 0; - - $.ajax({ - url: createURL('listRouters'), - data: $.extend({}, listRoutersData, { - page: currentPage, - projectid: -1 - }), - async: false, - success: function(json) { - if (json.listroutersresponse.count != undefined) { - routerCountFromAllPages += json.listroutersresponse.count; - groupbyObj.routerCount = routerCountFromAllPages; - - routerCountFromFirstPageToCurrentPage += json.listroutersresponse.router.length; - } - } - }); - - var callListApiWithPage = function() { - $.ajax({ - url: createURL('listRouters'), - async: false, - data: $.extend({}, listRoutersData, { - page: currentPage - }), - success: function(json) { - routerCountFromFirstPageToCurrentPage += json.listroutersresponse.router.length; - var items = json.listroutersresponse.router; - for (var k = 0; k < items.length; k++) { - if (items[k].requiresupgrade) { - routerRequiresUpgrade++; - } - } - - $.ajax({ - url: createURL('listRouters'), - async: false, - data: $.extend({}, listRoutersData, { - page: currentPage, - projectid: -1 - }), - success: function(json) { - routerCountFromFirstPageToCurrentPage += json.listroutersresponse.router.length; - var items = json.listroutersresponse.router; - for (var k = 0; k < items.length; k++) { - if (items[k].requiresupgrade) { - routerRequiresUpgrade++; - } - } - } - }); - - if (routerCountFromFirstPageToCurrentPage < routerCountFromAllPages) { - currentPage++; - callListApiWithPage(); - } - } - }); - } - - if (routerCountFromFirstPageToCurrentPage < routerCountFromAllPages) { - currentPage++; - callListApiWithPage(); - } - - groupbyObj.routerRequiresUpgrade = routerRequiresUpgrade; - - } else { - groupbyObj.routerCount = 0; - groupbyObj.routerRequiresUpgrade = 0; - } - } - }); - } -})($, cloudStack); + function addExtraPropertiesToGroupbyObject(groupbyObj, groupbyId) { + var currentPage = 1; + + var listRoutersData = { + listAll: true, + pagesize: pageSize //global variable + }; + listRoutersData[groupbyId] = groupbyObj.id; + + $.ajax({ + url: createURL('listRouters'), + data: $.extend({ + }, + listRoutersData, { + page: currentPage + }), + async: false, + success: function (json) { + if (json.listroutersresponse.count != undefined) { + var routerCountFromAllPages = json.listroutersresponse.count; + var routerCountFromFirstPageToCurrentPage = json.listroutersresponse.router.length; + var routerRequiresUpgrade = 0; + + $.ajax({ + url: createURL('listRouters'), + data: $.extend({ + }, + listRoutersData, { + page: currentPage, + projectid: -1 + }), + async: false, + success: function (json) { + if (json.listroutersresponse.count != undefined) { + routerCountFromAllPages += json.listroutersresponse.count; + groupbyObj.routerCount = routerCountFromAllPages; + + routerCountFromFirstPageToCurrentPage += json.listroutersresponse.router.length; + } + } + }); + + var callListApiWithPage = function () { + $.ajax({ + url: createURL('listRouters'), + async: false, + data: $.extend({ + }, + listRoutersData, { + page: currentPage + }), + success: function (json) { + routerCountFromFirstPageToCurrentPage += json.listroutersresponse.router.length; + var items = json.listroutersresponse.router; + for (var k = 0; k < items.length; k++) { + if (items[k].requiresupgrade) { + routerRequiresUpgrade++; + } + } + + $.ajax({ + url: createURL('listRouters'), + async: false, + data: $.extend({ + }, + listRoutersData, { + page: currentPage, + projectid: -1 + }), + success: function (json) { + routerCountFromFirstPageToCurrentPage += json.listroutersresponse.router.length; + var items = json.listroutersresponse.router; + for (var k = 0; k < items.length; k++) { + if (items[k].requiresupgrade) { + routerRequiresUpgrade++; + } + } + } + }); + + if (routerCountFromFirstPageToCurrentPage < routerCountFromAllPages) { + currentPage++; + callListApiWithPage(); + } + } + }); + } + + if (routerCountFromFirstPageToCurrentPage < routerCountFromAllPages) { + currentPage++; + callListApiWithPage(); + } + + groupbyObj.routerRequiresUpgrade = routerRequiresUpgrade; + } else { + groupbyObj.routerCount = 0; + groupbyObj.routerRequiresUpgrade = 0; + } + } + }); + } +})($, cloudStack); \ No newline at end of file