diff --git a/ui/scripts/accounts.js b/ui/scripts/accounts.js index 6f55b3d54a9..f6fcc27fea9 100644 --- a/ui/scripts/accounts.js +++ b/ui/scripts/accounts.js @@ -17,7 +17,7 @@ (function(cloudStack) { var domainObjs; - + cloudStack.sections.accounts = { title: 'label.accounts', id: 'accounts', @@ -91,7 +91,7 @@ } }, - + addLdapAccount: { label: 'label.add.ldap.account', isHeader: true, @@ -123,7 +123,7 @@ ) } - } + } }, dataProvider: function(args) { @@ -422,11 +422,11 @@ data: data, async: true, success: function(json) { - var resourcecounts= json.updateresourcecountresponse.resourcecount; + var resourcecounts= json.updateresourcecountresponse.resourcecount; //pop up API response in a dialog box since only updateResourceCount API returns resourcecount (listResourceLimits API does NOT return resourcecount) var msg = ''; if (resourcecounts != null) { - for (var i = 0; i < resourcecounts.length; i++) { + for (var i = 0; i < resourcecounts.length; i++) { switch (resourcecounts[i].resourcetype) { case '0': msg += 'Instance'; //vmLimit @@ -443,8 +443,8 @@ case '4': msg += 'Template'; //templateLimit break; - case '5': - continue; //resourcetype 5 is not in use. so, skip to next item. + case '5': + continue; //resourcetype 5 is not in use. so, skip to next item. break; case '6': msg += 'Network'; //networkLimit @@ -463,18 +463,18 @@ break; case '11': msg += 'Secondary Storage'; //secondaryStorageLimit - break; + break; } - + msg += ' Count: ' + resourcecounts[i].resourcecount + '
'; } } - - + + cloudStack.dialog.notice({ message: msg - }); - + }); + args.response.success(); }, error: function(json) { @@ -653,12 +653,12 @@ } }, - + tabFilter: function(args) { var hiddenTabs = []; if(!isAdmin()) { hiddenTabs.push('settings'); - } + } return hiddenTabs; }, @@ -2011,13 +2011,13 @@ if (jsonObj.state == "disabled") allowedActions.push("enable"); allowedActions.push("remove"); - + allowedActions.push("changePassword"); allowedActions.push("generateKeys"); if (g_idpList) { allowedActions.push("configureSamlAuthorization"); } - } + } } return allowedActions; } diff --git a/ui/scripts/accountsWizard.js b/ui/scripts/accountsWizard.js index 03dc65c3c0a..2806bfbcbae 100644 --- a/ui/scripts/accountsWizard.js +++ b/ui/scripts/accountsWizard.js @@ -78,9 +78,9 @@ validation: { required: true }, - select: function(args) { + select: function(args) { $.ajax({ - url: createURL("listDomains"), + url: createURL("listDomains"), success: function(json) { var items = []; domainObjs = json.listdomainsresponse.domain; @@ -227,7 +227,7 @@ } var accountType = args.data.accounttype; - if (accountType == "1") { //if "admin" is selected in account type dropdown + if (accountType == "1") { //if "admin" is selected in account type dropdown if (rootDomainId == undefined || args.data.domainid != rootDomainId ) { //but current login has no visibility to root domain object, or the selected domain is not root domain accountType = "2"; // change accountType from root-domain("1") to domain-admin("2") } @@ -313,6 +313,6 @@ } }); } - } + } }; }(cloudStack, jQuery)); diff --git a/ui/scripts/affinity.js b/ui/scripts/affinity.js index 4f579e108b8..db8b79a0d0b 100644 --- a/ui/scripts/affinity.js +++ b/ui/scripts/affinity.js @@ -206,14 +206,14 @@ } } }; - + var affinitygroupActionfilter = cloudStack.actionFilter.affinitygroupActionfilter = function(args) { var jsonObj = args.context.item; - var allowedActions = []; + var allowedActions = []; if (jsonObj.type != 'ExplicitDedication' || isAdmin()) { - allowedActions.push("remove"); - } + allowedActions.push("remove"); + } return allowedActions; } - + })(cloudStack); diff --git a/ui/scripts/autoscaler.js b/ui/scripts/autoscaler.js index c0c41baaa86..cf39d2cae67 100644 --- a/ui/scripts/autoscaler.js +++ b/ui/scripts/autoscaler.js @@ -1341,7 +1341,7 @@ array1.push("&interval=" + args.data.interval); array1.push("&scaleuppolicyids=" + args.scaleUpPolicyResponse.id); array1.push("&scaledownpolicyids=" + args.scaleDownPolicyResponse.id); - + $.ajax({ url: createURL('createAutoScaleVmGroup' + array1.join("")), dataType: 'json', diff --git a/ui/scripts/cloudStack.js b/ui/scripts/cloudStack.js index 6d08735381f..146f8d1083d 100644 --- a/ui/scripts/cloudStack.js +++ b/ui/scripts/cloudStack.js @@ -136,15 +136,15 @@ dataType: "json", async: false, success: function(json) { - g_capabilities = json.listcapabilitiesresponse.capability; - g_supportELB = json.listcapabilitiesresponse.capability.supportELB.toString(); //convert boolean to string if it's boolean - g_kvmsnapshotenabled = json.listcapabilitiesresponse.capability.kvmsnapshotenabled; //boolean - g_regionsecondaryenabled = json.listcapabilitiesresponse.capability.regionsecondaryenabled; //boolean + g_capabilities = json.listcapabilitiesresponse.capability; + g_supportELB = json.listcapabilitiesresponse.capability.supportELB.toString(); //convert boolean to string if it's boolean + g_kvmsnapshotenabled = json.listcapabilitiesresponse.capability.kvmsnapshotenabled; //boolean + g_regionsecondaryenabled = json.listcapabilitiesresponse.capability.regionsecondaryenabled; //boolean if (json.listcapabilitiesresponse.capability.userpublictemplateenabled != null) { - g_userPublicTemplateEnabled = json.listcapabilitiesresponse.capability.userpublictemplateenabled.toString(); //convert boolean to string if it's boolean + g_userPublicTemplateEnabled = json.listcapabilitiesresponse.capability.userpublictemplateenabled.toString(); //convert boolean to string if it's boolean } g_userProjectsEnabled = json.listcapabilitiesresponse.capability.allowusercreateprojects; - + g_cloudstackversion = json.listcapabilitiesresponse.capability.cloudstackversion; @@ -251,7 +251,7 @@ }); $.cookie('role', g_role, { expires: 1 - }); + }); $.cookie('timezone', g_timezone, { expires: 1 }); @@ -268,14 +268,14 @@ async: false, success: function(json) { g_capabilities = json.listcapabilitiesresponse.capability; - g_supportELB = json.listcapabilitiesresponse.capability.supportELB.toString(); //convert boolean to string if it's boolean - g_kvmsnapshotenabled = json.listcapabilitiesresponse.capability.kvmsnapshotenabled; //boolean - g_regionsecondaryenabled = json.listcapabilitiesresponse.capability.regionsecondaryenabled; //boolean + g_supportELB = json.listcapabilitiesresponse.capability.supportELB.toString(); //convert boolean to string if it's boolean + g_kvmsnapshotenabled = json.listcapabilitiesresponse.capability.kvmsnapshotenabled; //boolean + g_regionsecondaryenabled = json.listcapabilitiesresponse.capability.regionsecondaryenabled; //boolean if (json.listcapabilitiesresponse.capability.userpublictemplateenabled != null) { - g_userPublicTemplateEnabled = json.listcapabilitiesresponse.capability.userpublictemplateenabled.toString(); //convert boolean to string if it's boolean + g_userPublicTemplateEnabled = json.listcapabilitiesresponse.capability.userpublictemplateenabled.toString(); //convert boolean to string if it's boolean } g_userProjectsEnabled = json.listcapabilitiesresponse.capability.allowusercreateprojects; - + g_cloudstackversion = json.listcapabilitiesresponse.capability.cloudstackversion; @@ -300,7 +300,7 @@ args.response.error(); } }); - + // Get project configuration // TEMPORARY -- replace w/ output of capability response, etc., once implemented window.g_projectsInviteRequired = false; @@ -462,6 +462,6 @@ cloudStack.uiCustom.login(loginArgs); - document.title = _l('label.app.name'); + document.title = _l('label.app.name'); }); })(cloudStack, jQuery); diff --git a/ui/scripts/configuration.js b/ui/scripts/configuration.js index 5cb6f8d6468..61f2d1f96ff 100644 --- a/ui/scripts/configuration.js +++ b/ui/scripts/configuration.js @@ -137,7 +137,7 @@ } }, isCustomized: { - label: 'label.custom', + label: 'label.custom', isBoolean: true, isReverse: true, isChecked: false @@ -360,7 +360,7 @@ }, hostTags: { //Only one single host tag is supported at server-side. Multiple host tags are NOT supported at server-side. label: 'Host Tag', - docID: 'helpComputeOfferingHostTags' + docID: 'helpComputeOfferingHostTags' }, cpuCap: { label: 'label.CPU.cap', @@ -410,7 +410,7 @@ var $fields = $form.find('.field'); if ($(this).val() == "ImplicitDedicationPlanner") { $form.find('[rel=plannerMode]').css('display', 'block'); - } else { + } else { $form.find('[rel=plannerMode]').hide(); } }); @@ -596,9 +596,9 @@ provisioningType :args.data.provisioningType, customized: (args.data.isCustomized == "on") }; - + //custom fields (begin) - if (args.data.isCustomized != "on") { + if (args.data.isCustomized != "on") { $.extend(data, { cpuNumber: args.data.cpuNumber }); @@ -608,9 +608,9 @@ $.extend(data, { memory: args.data.memory }); - } + } //custom fields (end) - + if (args.data.deploymentPlanner != null && args.data.deploymentPlanner.length > 0) { $.extend(data, { deploymentplanner: args.data.deploymentPlanner @@ -872,7 +872,7 @@ converter: function(args) { if (args == undefined) return ''; - else + else return cloudStack.converters.convertBytes(args * 1024 * 1024); } }, @@ -936,10 +936,10 @@ }, deploymentplanner: { label: 'label.deployment.planner' - }, + }, plannerMode: { label: 'label.planner.mode' - }, + }, pciDevice: { label: 'label.gpu' }, @@ -972,13 +972,13 @@ async: true, success: function(json) { var item = json.listserviceofferingsresponse.serviceoffering[0]; - + if (item.deploymentplanner != null && item.serviceofferingdetails != null) { if (item.deploymentplanner == 'ImplicitDedicationPlanner' && item.serviceofferingdetails.ImplicitDedicationMode != null) { item.plannerMode = item.serviceofferingdetails.ImplicitDedicationMode; } } - + if (item.serviceofferingdetails != null) { item.pciDevice = item.serviceofferingdetails.pciDevice; item.vgpuType = item.serviceofferingdetails.vgpuType; @@ -1469,7 +1469,7 @@ converter: function(args) { if (args == undefined) return ''; - else + else return cloudStack.converters.convertBytes(args * 1024 * 1024); } }, @@ -1924,7 +1924,7 @@ customized: (args.data.isCustomized == "on") }; - if (args.data.isCustomized != "on") { + if (args.data.isCustomized != "on") { $.extend(data, { disksize: args.data.disksize }); @@ -2556,7 +2556,7 @@ args.$form.find('.form-item[rel=\"service.StaticNat.associatePublicIP\"]').hide(); args.$form.find('.form-item[rel=\"service.StaticNat.associatePublicIP\"]').find('input[type=checkbox]').attr('checked', false); } - + //StretchedL2Subnet checkbox should be displayed only when 'Connectivity' service is checked if (args.$form.find('.form-item[rel=\"service.Connectivity.isEnabled\"]').find('input[type=checkbox]').is(':checked')) { $supportsstrechedl2subnet.css('display', 'inline-block'); @@ -3045,8 +3045,8 @@ inputData['servicecapabilitylist[' + serviceCapabilityIndex + '].capabilitytype'] = 'lbSchemes'; inputData['servicecapabilitylist[' + serviceCapabilityIndex + '].capabilityvalue'] = 'internal'; serviceCapabilityIndex++; - } - } else if (value != '') { // normal data (serviceData.length ==1), e.g. "name", "displayText", "networkRate", "guestIpType", "lbType" (unwanted), "availability" (unwated when value is "Optional"), "egressdefaultpolicy", "state" (unwanted), "status" (unwanted), "allocationstate" (unwanted) + } + } else if (value != '') { // normal data (serviceData.length ==1), e.g. "name", "displayText", "networkRate", "guestIpType", "lbType" (unwanted), "availability" (unwated when value is "Optional"), "egressdefaultpolicy", "state" (unwanted), "status" (unwanted), "allocationstate" (unwanted) if (!(key == "lbType" || (key == "availability" && value == "Optional") || key == "state" || key == "status" || key == "allocationstate" || key == "useVpc" )) { inputData[key] = value; } @@ -3097,21 +3097,21 @@ if (inputData['guestIpType'] == "Shared") { //specifyVlan checkbox is disabled, so inputData won't include specifyVlan inputData['specifyVlan'] = true; //hardcode inputData['specifyVlan'] inputData['specifyIpRanges'] = true; - delete inputData.isPersistent; //if Persistent checkbox is unchecked, do not pass isPersistent parameter to API call since we need to keep API call's size as small as possible (p.s. isPersistent is defaulted as false at server-side) + delete inputData.isPersistent; //if Persistent checkbox is unchecked, do not pass isPersistent parameter to API call since we need to keep API call's size as small as possible (p.s. isPersistent is defaulted as false at server-side) } else if (inputData['guestIpType'] == "Isolated") { //specifyVlan checkbox is shown //inputData['specifyIpRanges'] = false; - delete inputData.specifyIpRanges; //if specifyIpRanges should be false, do not pass specifyIpRanges parameter to API call since we need to keep API call's size as small as possible (p.s. specifyIpRanges is defaulted as false at server-side) + delete inputData.specifyIpRanges; //if specifyIpRanges should be false, do not pass specifyIpRanges parameter to API call since we need to keep API call's size as small as possible (p.s. specifyIpRanges is defaulted as false at server-side) if (inputData['specifyVlan'] == 'on') { //specifyVlan checkbox is checked - inputData['specifyVlan'] = true; + inputData['specifyVlan'] = true; } else { //specifyVlan checkbox is unchecked - delete inputData.specifyVlan; //if specifyVlan checkbox is unchecked, do not pass specifyVlan parameter to API call since we need to keep API call's size as small as possible (p.s. specifyVlan is defaulted as false at server-side) + delete inputData.specifyVlan; //if specifyVlan checkbox is unchecked, do not pass specifyVlan parameter to API call since we need to keep API call's size as small as possible (p.s. specifyVlan is defaulted as false at server-side) } if (inputData['isPersistent'] == 'on') { //It is a persistent network inputData['isPersistent'] = true; } else { //Isolated Network with Non-persistent network - delete inputData.isPersistent; //if Persistent checkbox is unchecked, do not pass isPersistent parameter to API call since we need to keep API call's size as small as possible (p.s. isPersistent is defaulted as false at server-side) + delete inputData.isPersistent; //if Persistent checkbox is unchecked, do not pass isPersistent parameter to API call since we need to keep API call's size as small as possible (p.s. isPersistent is defaulted as false at server-side) } } @@ -4112,5 +4112,5 @@ return allowedActions; }; - + })(cloudStack, jQuery); diff --git a/ui/scripts/dashboard.js b/ui/scripts/dashboard.js index dff6a91a9e8..50dfb22e676 100644 --- a/ui/scripts/dashboard.js +++ b/ui/scripts/dashboard.js @@ -28,7 +28,7 @@ user: { dataProvider: function(args) { var dataFns = { - instances: function(data) { + instances: function(data) { var totalInstanceCount = 0; $.ajax({ url: createURL("listVirtualMachines"), @@ -38,13 +38,13 @@ pageSize: 1 }, async: false, - success: function(json) { + success: function(json) { if (json.listvirtualmachinesresponse.count != undefined) { totalInstanceCount = json.listvirtualmachinesresponse.count; - } + } } }); - + var RunningInstanceCount = 0; $.ajax({ url: createURL("listVirtualMachines"), @@ -55,13 +55,13 @@ state: "Running" }, async: false, - success: function(json) { + success: function(json) { if (json.listvirtualmachinesresponse.count != undefined) { RunningInstanceCount = json.listvirtualmachinesresponse.count; - } + } } }); - + var stoppedInstanceCount = 0; $.ajax({ url: createURL("listVirtualMachines"), @@ -72,18 +72,18 @@ state: "Stopped" }, async: false, - success: function(json) { + success: function(json) { if (json.listvirtualmachinesresponse.count != undefined) { stoppedInstanceCount = json.listvirtualmachinesresponse.count; - } + } } }); - + dataFns.account($.extend(data, { runningInstances: RunningInstanceCount, stoppedInstances: stoppedInstanceCount, totalInstances: totalInstanceCount - })); + })); }, account: function(data) { @@ -103,7 +103,7 @@ data: { listAll: true, page: 1, - pageSize: (pageSize > 4? 4: pageSize) //if default.page.size > 4, show 4 items only (since space on dashboard is limited) + pageSize: (pageSize > 4? 4: pageSize) //if default.page.size > 4, show 4 items only (since space on dashboard is limited) //pageSize: 1 //for testing only }, success: function(json) { @@ -197,7 +197,7 @@ url: createURL('listAlerts'), data: { page: 1, - pageSize: (pageSize > 4? 4: pageSize) //if default.page.size > 4, show 4 items only (since space on dashboard is limited) + pageSize: (pageSize > 4? 4: pageSize) //if default.page.size > 4, show 4 items only (since space on dashboard is limited) }, success: function(json) { var alerts = json.listalertsresponse.alert ? @@ -222,7 +222,7 @@ data: { state: 'Alert', page: 1, - pageSize: (pageSize > 4? 4: pageSize) //if default.page.size > 4, show 4 items only (since space on dashboard is limited) + pageSize: (pageSize > 4? 4: pageSize) //if default.page.size > 4, show 4 items only (since space on dashboard is limited) }, success: function(json) { var hosts = json.listhostsresponse.host ? @@ -247,7 +247,7 @@ fetchLatest: data.fetchLatest, sortBy: 'usage', page: 0, - pageSize: (pageSize > 8? 8: pageSize) + pageSize: (pageSize > 8? 8: pageSize) }, success: function(json) { var capacities = json.listcapacityresponse.capacity ? diff --git a/ui/scripts/domains.js b/ui/scripts/domains.js index e46f104364d..08a53cd7305 100644 --- a/ui/scripts/domains.js +++ b/ui/scripts/domains.js @@ -100,7 +100,7 @@ var domainObj; var data = { - id: args.context.domains[0].id + id: args.context.domains[0].id }; if (args.data.name != null) { //args.data.name == undefined means name field is not editable (when log in as normal user or domain admin) @@ -108,14 +108,14 @@ name: args.data.name }); } - + if (args.data.networkdomain != null) { //args.data.networkdomain == undefined means networkdomain field is not editable (when log in as normal user or domain admin) $.extend(data, { networkdomain: args.data.networkdomain }); } - - if('name' in data || 'networkdomain' in data) { + + if('name' in data || 'networkdomain' in data) { $.ajax({ url: createURL("updateDomain"), async: false, @@ -366,7 +366,7 @@ networkdomain: { label: 'label.network.domain', isEditable: function(args) { - if (isAdmin()) + if (isAdmin()) return true; else return false; @@ -652,8 +652,8 @@ if (jsonObj.level != 0) { //ROOT domain (whose level is 0) is not allowed to delete allowedActions.push("delete"); } - } else if (isDomainAdmin()) { - if (args.context.domains[0].id != g_domainid) { + } else if (isDomainAdmin()) { + if (args.context.domains[0].id != g_domainid) { allowedActions.push("edit"); //merge updateResourceLimit into edit } } diff --git a/ui/scripts/events.js b/ui/scripts/events.js index 92804290095..2fd70dd018d 100644 --- a/ui/scripts/events.js +++ b/ui/scripts/events.js @@ -75,7 +75,7 @@ }, action: function(args) { var events = args.context.events; - + $.ajax({ url: createURL("deleteEvents"), data: { @@ -90,7 +90,7 @@ error:function(data) { args.response.error(parseXMLHttpResponse(data)); } - }); + }); } }, @@ -154,7 +154,7 @@ }); } }, - + archive: { label: 'label.archive.events', isHeader: true, @@ -215,7 +215,7 @@ } }, - + // Archive multiple events archiveMulti: { label: 'label.archive.events', @@ -232,7 +232,7 @@ }, action: function(args) { var events = args.context.events; - + $.ajax({ url: createURL("archiveEvents"), data: { @@ -247,7 +247,7 @@ error:function(data) { args.response.error(parseXMLHttpResponse(data)); } - }); + }); } } @@ -494,7 +494,7 @@ }, action: function(args) { var events = args.context.alerts; - + $.ajax({ url: createURL("deleteAlerts"), data: { @@ -509,10 +509,10 @@ error:function(data) { args.response.error(parseXMLHttpResponse(data)); } - }); + }); } }, - + remove: { label: 'label.delete.alerts', isHeader: true, @@ -593,7 +593,7 @@ }, action: function(args) { var events = args.context.alerts; - + $.ajax({ url: createURL("archiveAlerts"), data: { @@ -608,10 +608,10 @@ error:function(data) { args.response.error(parseXMLHttpResponse(data)); } - }); + }); } }, - + archive: { label: 'label.archive.alerts', isHeader: true, diff --git a/ui/scripts/globalSettings.js b/ui/scripts/globalSettings.js index 2b1fe5c905e..680b0faaf03 100644 --- a/ui/scripts/globalSettings.js +++ b/ui/scripts/globalSettings.js @@ -234,14 +234,14 @@ } } } - }, + }, baremetalRct: { type: 'select', title: 'label.baremetal.rack.configuration', listView: { id: 'baremetalRct', label: 'label.baremetal.rack.configuration', - fields: { + fields: { id: { label: 'label.id' }, @@ -252,19 +252,19 @@ dataProvider: function(args) { var data = {}; listViewDataProvider(args, data); - + $.ajax({ url: createURL("listBaremetalRct"), data: data, - success: function(json) { + success: function(json) { args.response.success({ data: json.listbaremetalrctresponse.baremetalrct }); } - }); + }); }, actions: { add: { label: 'label.add.baremetal.rack.configuration', - messages: { + messages: { notification: function(args) { return 'label.add.baremetal.rack.configuration'; } @@ -280,18 +280,18 @@ } } }, - action: function(args) { + action: function(args) { $.ajax({ url: createURL("addBaremetalRct"), data: { baremetalrcturl: args.data.url }, - success: function(json) { + success: function(json) { var jid = json.addbaremetalrctresponse.jobid args.response.success({ _custom: { jobId: jid, - getUpdatedItem: function(json) { + getUpdatedItem: function(json) { return json.queryasyncjobresultresponse.jobresult.baremetalrct; } } @@ -303,8 +303,8 @@ poll: pollAsyncJobResult } } - }, - + }, + detailView: { name: "details", actions: { @@ -318,7 +318,7 @@ return 'label.delete.baremetal.rack.configuration'; } }, - action: function(args) { + action: function(args) { var data = { id: args.context.baremetalRct[0].id }; @@ -326,12 +326,12 @@ url: createURL('deleteBaremetalRct'), data: data, success: function(json) { - var jid = json.deletebaremetalrctresponse.jobid; + var jid = json.deletebaremetalrctresponse.jobid; args.response.success({ _custom: { jobId: jid } - }); + }); } }); }, @@ -339,7 +339,7 @@ poll: pollAsyncJobResult } } - }, + }, tabs: { details: { title: 'label.details', @@ -351,23 +351,23 @@ label: 'label.url' } }], - dataProvider: function(args) { + dataProvider: function(args) { var data = { id: args.context.baremetalRct[0].id - }; + }; $.ajax({ url: createURL("listBaremetalRct"), data: data, - success: function(json) { + success: function(json) { args.response.success({ data: json.listbaremetalrctresponse.baremetalrct[0] }); } - }); + }); } } - } - } + } + } } - }, + }, hypervisorCapabilities: { type: 'select', title: 'label.hypervisor.capabilities', diff --git a/ui/scripts/instanceWizard.js b/ui/scripts/instanceWizard.js index 3d3f74e56e3..877658aef15 100644 --- a/ui/scripts/instanceWizard.js +++ b/ui/scripts/instanceWizard.js @@ -184,7 +184,7 @@ }); } } - }); + }); $.ajax({ url: createURL("listTemplates&templatefilter=sharedexecutable&zoneid=" + args.currentData.zoneid), dataType: "json", @@ -199,7 +199,7 @@ }); } } - }); + }); } else if (selectedTemplateOrIso == 'select-iso') { $.ajax({ url: createURL("listIsos&isofilter=featured&zoneid=" + args.currentData.zoneid + "&bootable=true"), @@ -248,7 +248,7 @@ sharedIsoObjs = json.listisosresponse.iso; } } - }); + }); } //***** get templates/ISOs (end) ***** @@ -282,19 +282,19 @@ //// return true; // Disabled -- not supported in backend right now //// - + if (selectedTemplateOrIso == 'select-template') { return false; //show Root Disk Size field } else { //selectedTemplateOrIso == 'select-iso' return true; //hide Root Disk Size field - } + } } }); }, // Step 3: Service offering function(args) { - selectedTemplateObj = null; //reset + selectedTemplateObj = null; //reset if (args.currentData["select-template"] == "select-template") { if (featuredTemplateObjs != null && featuredTemplateObjs.length > 0) { for (var i = 0; i < featuredTemplateObjs.length; i++) { @@ -323,7 +323,7 @@ } } } - } + } if (selectedTemplateObj == null) { if (sharedTemplateObjs != null && sharedTemplateObjs.length > 0) { for (var i = 0; i < sharedTemplateObjs.length; i++) { @@ -333,7 +333,7 @@ } } } - } + } if (selectedTemplateObj == null) { alert("unable to find matched template object"); } else { @@ -346,27 +346,27 @@ // if the user is leveraging a template, then we can show custom IOPS, if applicable var canShowCustomIopsForServiceOffering = (args.currentData["select-template"] != "select-iso" ? true : false); - + // get serviceOfferingObjs - $(window).removeData("cloudStack.module.instanceWizard.serviceOfferingObjs"); + $(window).removeData("cloudStack.module.instanceWizard.serviceOfferingObjs"); $(window).trigger("cloudStack.module.instanceWizard.serviceOffering.dataProvider", { context: args.context, currentData: args.currentData - }); - if ($(window).data("cloudStack.module.instanceWizard.serviceOfferingObjs") == undefined) { + }); + if ($(window).data("cloudStack.module.instanceWizard.serviceOfferingObjs") == undefined) { $.ajax({ url: createURL("listServiceOfferings&issystem=false"), dataType: "json", async: false, - success: function(json) { + success: function(json) { serviceOfferingObjs = json.listserviceofferingsresponse.serviceoffering; } - }); - } else { - serviceOfferingObjs = $(window).data("cloudStack.module.instanceWizard.serviceOfferingObjs"); + }); + } else { + serviceOfferingObjs = $(window).data("cloudStack.module.instanceWizard.serviceOfferingObjs"); } - - + + args.response.success({ canShowCustomIops: canShowCustomIopsForServiceOffering, customFlag: 'iscustomized', @@ -375,7 +375,7 @@ data: { serviceOfferings: serviceOfferingObjs } - }); + }); }, // Step 4: Data disk offering @@ -409,9 +409,9 @@ var data = { affinityGroups: affinitygroups }; - + if(selectedZoneObj.domainid != null && selectedZoneObj.affinitygroupid != null) { - var defaultAffinityGroup; + var defaultAffinityGroup; if(affinitygroups != null) { for(var i = 0; i < affinitygroups.length; i++) { if(affinitygroups[i].id == selectedZoneObj.affinitygroupid) { @@ -419,13 +419,13 @@ break; } } - } + } $.extend(data, { selectedObj: defaultAffinityGroup, selectedObjNonEditable: true }); - } - + } + args.response.success({ data: data }); @@ -608,21 +608,21 @@ } } - + // get networkObjsToPopulate - $(window).removeData("cloudStack.module.instanceWizard.networkObjs"); + $(window).removeData("cloudStack.module.instanceWizard.networkObjs"); $(window).trigger("cloudStack.module.instanceWizard.network.dataProvider", { context: args.context, currentData: args.currentData, networkObjsToPopulate: networkObjsToPopulate - }); - if ($(window).data("cloudStack.module.instanceWizard.networkObjs") == undefined) { - //do nothing - } else { - networkObjsToPopulate = $(window).data("cloudStack.module.instanceWizard.networkObjs"); //override networkObjsToPopulate - } - - + }); + if ($(window).data("cloudStack.module.instanceWizard.networkObjs") == undefined) { + //do nothing + } else { + networkObjsToPopulate = $(window).data("cloudStack.module.instanceWizard.networkObjs"); //override networkObjsToPopulate + } + + $.ajax({ url: createURL("listNetworkOfferings"), dataType: "json", @@ -729,49 +729,49 @@ // Create a new VM!!!! var deployVmData = {}; - //step 1 : select zone + //step 1 : select zone $.extend(deployVmData, { zoneid : args.data.zoneid }); - //step 2: select template + //step 2: select template $.extend(deployVmData, { templateid : args.data.templateid }); - + $.extend(deployVmData, { hypervisor : selectedHypervisor }); - + if (args.$wizard.find('input[name=rootDiskSize]').parent().css('display') != 'none') { - if (args.$wizard.find('input[name=rootDiskSize]').val().length > 0) { + if (args.$wizard.find('input[name=rootDiskSize]').val().length > 0) { $.extend(deployVmData, { rootdisksize : args.$wizard.find('input[name=rootDiskSize]').val() }); } } - - //step 3: select service offering + + //step 3: select service offering $.extend(deployVmData, { serviceofferingid : args.data.serviceofferingid }); - + if (args.$wizard.find('input[name=compute-cpu-cores]').parent().parent().css('display') != 'none') { - if (args.$wizard.find('input[name=compute-cpu-cores]').val().length > 0) { + if (args.$wizard.find('input[name=compute-cpu-cores]').val().length > 0) { $.extend(deployVmData, { 'details[0].cpuNumber' : args.$wizard.find('input[name=compute-cpu-cores]').val() }); - } - if (args.$wizard.find('input[name=compute-cpu]').val().length > 0) { + } + if (args.$wizard.find('input[name=compute-cpu]').val().length > 0) { $.extend(deployVmData, { 'details[0].cpuSpeed' : args.$wizard.find('input[name=compute-cpu]').val() }); - } - if (args.$wizard.find('input[name=compute-memory]').val().length > 0) { + } + if (args.$wizard.find('input[name=compute-memory]').val().length > 0) { $.extend(deployVmData, { 'details[0].memory' : args.$wizard.find('input[name=compute-memory]').val() }); - } + } } if (args.$wizard.find('input[name=disk-min-iops]').parent().parent().css('display') != 'none') { @@ -788,12 +788,12 @@ } //step 4: select disk offering - if (args.data.diskofferingid != null && args.data.diskofferingid != "0") { + if (args.data.diskofferingid != null && args.data.diskofferingid != "0") { $.extend(deployVmData, { diskofferingid : args.data.diskofferingid }); - - if (selectedDiskOfferingObj.iscustomized == true) { + + if (selectedDiskOfferingObj.iscustomized == true) { $.extend(deployVmData, { size : args.data.size }); @@ -825,7 +825,7 @@ checkedAffinityGroupIdArray = []; } - if (checkedAffinityGroupIdArray.length > 0) { + if (checkedAffinityGroupIdArray.length > 0) { $.extend(deployVmData, { affinitygroupids : checkedAffinityGroupIdArray.join(",") }); @@ -834,7 +834,7 @@ //step 6: select network if (step6ContainerType == 'select-network' || step6ContainerType == 'select-advanced-sg') { var array2 = []; - var array3 = []; + var array3 = []; var defaultNetworkId = args.data.defaultNetwork; //args.data.defaultNetwork might be equal to string "new-network" or a network ID var checkedNetworkIdArray; @@ -884,58 +884,58 @@ if (defaultNetworkId == null) { cloudStack.dialog.notice({ message: "Please select a default network in Network step." - }); + }); return; - } - + } + if (checkedNetworkIdArray.length > 0) { for (var i = 0; i < checkedNetworkIdArray.length; i++) { - if (checkedNetworkIdArray[i] == defaultNetworkId) { - array2.unshift(defaultNetworkId); - + if (checkedNetworkIdArray[i] == defaultNetworkId) { + array2.unshift(defaultNetworkId); + var ipToNetwork = { networkid: defaultNetworkId - }; + }; if (args.data["new-network"] == "create-new-network") { if (args.data['new-network-ip'] != null && args.data['new-network-ip'].length > 0) { $.extend(ipToNetwork, { ip: args.data['new-network-ip'] - }); + }); } } else { if (args.data["my-network-ips"][i] != null && args.data["my-network-ips"][i].length > 0) { $.extend(ipToNetwork, { ip: args.data["my-network-ips"][i] - }); + }); } } - array3.unshift(ipToNetwork); - - } else { + array3.unshift(ipToNetwork); + + } else { array2.push(checkedNetworkIdArray[i]); - + var ipToNetwork = { networkid: checkedNetworkIdArray[i] - }; + }; if (args.data["my-network-ips"][i] != null && args.data["my-network-ips"][i].length > 0) { $.extend(ipToNetwork, { ip: args.data["my-network-ips"][i] - }); + }); } - array3.push(ipToNetwork); - } + array3.push(ipToNetwork); + } } } - + //deployVmData.push("&networkIds=" + array2.join(",")); //ipToNetworkMap can't be specified along with networkIds or ipAddress - - for (var k = 0; k < array3.length; k++) { - deployVmData["iptonetworklist[" + k + "].networkid"] = array3[k].networkid; - if (array3[k].ip != undefined && array3[k].ip.length > 0) { - deployVmData["iptonetworklist[" + k + "].ip"] = array3[k].ip; + + for (var k = 0; k < array3.length; k++) { + deployVmData["iptonetworklist[" + k + "].networkid"] = array3[k].networkid; + if (array3[k].ip != undefined && array3[k].ip.length > 0) { + deployVmData["iptonetworklist[" + k + "].ip"] = array3[k].ip; } - } - + } + } else if (step6ContainerType == 'select-security-group') { var checkedSecurityGroupIdArray; if (typeof(args.data["security-groups"]) == "object" && args.data["security-groups"].length != null) { //args.data["security-groups"] is an array of string, e.g. ["2375f8cc-8a73-4b8d-9b26-50885a25ffe0", "27c60d2a-de7f-4bb7-96e5-a602cec681df","c6301d77-99b5-4e8a-85e2-3ea2ab31c342"], @@ -947,7 +947,7 @@ checkedSecurityGroupIdArray = []; } - if (checkedSecurityGroupIdArray.length > 0) { + if (checkedSecurityGroupIdArray.length > 0) { $.extend(deployVmData, { securitygroupids : checkedSecurityGroupIdArray.join(",") }); @@ -980,26 +980,26 @@ array2.push(checkedNetworkIdArray[i]); } } - + $.extend(deployVmData, { networkids : array2.join(",") }); } } else if (step6ContainerType == 'nothing-to-select') { - if ("vpc" in args.context) { //from VPC tier - deployVmData["iptonetworklist[0].networkid"] = args.context.networks[0].id; - if (args.data["vpc-specify-ip"] != undefined && args.data["vpc-specify-ip"].length > 0) { - deployVmData["iptonetworklist[0].ip"] = args.data["vpc-specify-ip"]; + if ("vpc" in args.context) { //from VPC tier + deployVmData["iptonetworklist[0].networkid"] = args.context.networks[0].id; + if (args.data["vpc-specify-ip"] != undefined && args.data["vpc-specify-ip"].length > 0) { + deployVmData["iptonetworklist[0].ip"] = args.data["vpc-specify-ip"]; } - + $.extend(deployVmData, { domainid : args.context.vpc[0].domainid }); - if (args.context.vpc[0].account != null) { + if (args.context.vpc[0].account != null) { $.extend(deployVmData, { account : args.context.vpc[0].account - }); - } else if (args.context.vpc[0].projectid != null) { + }); + } else if (args.context.vpc[0].projectid != null) { $.extend(deployVmData, { projectid : args.context.vpc[0].projectid }); @@ -1015,28 +1015,28 @@ } var displayname = args.data.displayname; - if (displayname != null && displayname.length > 0) { + if (displayname != null && displayname.length > 0) { $.extend(deployVmData, { displayname : displayname - }); + }); $.extend(deployVmData, { name : displayname }); } var group = args.data.groupname; - if (group != null && group.length > 0) { + if (group != null && group.length > 0) { $.extend(deployVmData, { group : group }); } - + var keyboard = args.data.keyboardLanguage; - if (keyboard != null && keyboard.length > 0) { //when blank option (default option) is selected => args.data.keyboardLanguage == "" + if (keyboard != null && keyboard.length > 0) { //when blank option (default option) is selected => args.data.keyboardLanguage == "" $.extend(deployVmData, { keyboard : keyboard }); - } + } if (g_hostid != null) { $.extend(deployVmData, { @@ -1050,7 +1050,7 @@ userdata : todb(btoa(userdata)) }); } - + $(window).trigger('cloudStack.deployVirtualMachine', { deployVmData: deployVmData, formData: args.data diff --git a/ui/scripts/instances.js b/ui/scripts/instances.js index 81732d76307..9afb787fae6 100644 --- a/ui/scripts/instances.js +++ b/ui/scripts/instances.js @@ -61,7 +61,7 @@ } args.form.fields.quiescevm.isChecked = true; - + return false; } } @@ -69,7 +69,7 @@ }, action: function(args) { var instances = args.context.instances; - + $(instances).map(function(index, instance) { var array1 = []; array1.push("&snapshotmemory=" + (args.data.snapshotMemory == "on")); @@ -103,7 +103,7 @@ error: function(json) { args.response.error(parseXMLHttpResponse(json)); } - }); + }); }); }, @@ -118,10 +118,10 @@ isMultiSelectAction: true }); } - + return action; - }; - + }; + cloudStack.sections.instances = { title: 'label.instances', id: 'instances', @@ -616,7 +616,7 @@ label: 'label.action.destroy.instance', compactLabel: 'label.destroy', createForm: { - title: 'label.action.destroy.instance', + title: 'label.action.destroy.instance', desc: 'label.action.destroy.instance', isWarning: true, preFilter: function(args) { @@ -633,31 +633,31 @@ isChecked: false } } - }, - messages: { + }, + messages: { notification: function(args) { return 'label.action.destroy.instance'; } }, - action: function(args) { + action: function(args) { var data = { - id: args.context.instances[0].id - }; + id: args.context.instances[0].id + }; if (args.data.expunge == 'on') { $.extend(data, { expunge: true }); - } + } $.ajax({ url: createURL('destroyVirtualMachine'), - data: data, + data: data, success: function(json) { var jid = json.destroyvirtualmachineresponse.jobid; args.response.success({ _custom: { jobId: jid, - getUpdatedItem: function(json) { - if ('virtualmachine' in json.queryasyncjobresultresponse.jobresult) //destroy without expunge + getUpdatedItem: function(json) { + if ('virtualmachine' in json.queryasyncjobresultresponse.jobresult) //destroy without expunge return json.queryasyncjobresultresponse.jobresult.virtualmachine; else //destroy with expunge return { 'toRemove': true }; @@ -765,19 +765,19 @@ url: createURL("restoreVirtualMachine&virtualmachineid=" + args.context.instances[0].id), dataType: "json", async: true, - success: function(json) { - var jid = json.restorevmresponse.jobid; + success: function(json) { + var jid = json.restorevmresponse.jobid; args.response.success({ _custom: { jobId: jid, - getUpdatedItem: function(json) { + getUpdatedItem: function(json) { return json.queryasyncjobresultresponse.jobresult.virtualmachine; }, getActionFilter: function() { return vmActionfilter; } } - }); + }); } }); @@ -951,11 +951,11 @@ }); } }); - - + + //***** addResourceDetail ***** - //XenServer only (starts here) - if(args.$detailView.find('form').find('div .detail-group').find('.xenserverToolsVersion61plus').length > 0) { + //XenServer only (starts here) + if(args.$detailView.find('form').find('div .detail-group').find('.xenserverToolsVersion61plus').length > 0) { $.ajax({ url: createURL('addResourceDetail'), data: { @@ -964,7 +964,7 @@ 'details[0].key': 'hypervisortoolsversion', 'details[0].value': (args.data.xenserverToolsVersion61plus == "on") ? 'xenserver61' : 'xenserver56' }, - success: function(json) { + success: function(json) { var jobId = json.addResourceDetailresponse.jobid; var addResourceDetailIntervalID = setInterval(function() { $.ajax({ @@ -972,33 +972,33 @@ dataType: "json", success: function(json) { var result = json.queryasyncjobresultresponse; - + if (result.jobstatus == 0) { return; //Job has not completed } else { clearInterval(addResourceDetailIntervalID); - if (result.jobstatus == 1) { - //do nothing + if (result.jobstatus == 1) { + //do nothing } else if (result.jobstatus == 2) { cloudStack.dialog.notice({ message: _s(result.jobresult.errortext) - }); + }); } } }, - error: function(XMLHttpResponse) { + error: function(XMLHttpResponse) { cloudStack.dialog.notice({ message: parseXMLHttpResponse(XMLHttpResponse) - }); + }); } }); - }, g_queryAsyncJobResultInterval); + }, g_queryAsyncJobResultInterval); } - }); - } - //XenServer only (ends here) - + }); + } + //XenServer only (ends here) + } }, @@ -1233,17 +1233,17 @@ }, osTypeId: { label: 'label.os.type', - select: function(args) { - if (ostypeObjs == undefined) { + select: function(args) { + if (ostypeObjs == undefined) { $.ajax({ url: createURL("listOsTypes"), dataType: "json", async: false, - success: function(json) { - ostypeObjs = json.listostypesresponse.ostype; + success: function(json) { + ostypeObjs = json.listostypesresponse.ostype; } }); - } + } var items = []; $(ostypeObjs).each(function() { items.push({ @@ -1253,7 +1253,7 @@ }); args.response.success({ data: items - }); + }); } }, isPublic: { @@ -1493,12 +1493,12 @@ createForm: { title: 'label.change.service.offering', desc: function(args) { - var description = ''; - var vmObj = args.jsonObj; + var description = ''; + var vmObj = args.jsonObj; if (vmObj.state == 'Running' && vmObj.hypervisor == 'VMware') { description = 'message.read.admin.guide.scaling.up'; - } - return description; + } + return description; }, fields: { serviceofferingid: { @@ -1511,7 +1511,7 @@ async: true, success: function(json) { serviceofferingObjs = json.listserviceofferingsresponse.serviceoffering; - var items = []; + var items = []; if (serviceofferingObjs != null) { for (var i = 0; i < serviceofferingObjs.length; i++) { items.push({ @@ -1519,33 +1519,33 @@ description: serviceofferingObjs[i].name }); } - } + } args.response.success({ data: items }); } }); - + args.$select.change(function(){ var $form = $(this).closest('form'); - + var serviceofferingid = $(this).val(); if (serviceofferingid == null || serviceofferingid.length == 0) return; - + var items = []; var selectedServiceofferingObj; if (serviceofferingObjs != null) { for (var i = 0; i < serviceofferingObjs.length; i++) { if (serviceofferingObjs[i].id == serviceofferingid) { selectedServiceofferingObj = serviceofferingObjs[i]; - break; + break; } } - } - if (selectedServiceofferingObj == undefined) - return; - + } + if (selectedServiceofferingObj == undefined) + return; + if (selectedServiceofferingObj.iscustomized == true) { $form.find('.form-item[rel=cpuSpeed]').css('display', 'inline-block'); $form.find('.form-item[rel=cpuNumber]').css('display', 'inline-block'); @@ -1557,9 +1557,9 @@ } }); } - }, + }, cpuSpeed: { - label: 'label.cpu.mhz', + label: 'label.cpu.mhz', validation: { required: true, number: true @@ -1567,7 +1567,7 @@ isHidden: true }, cpuNumber: { - label: 'label.num.cpu.cores', + label: 'label.num.cpu.cores', validation: { required: true, number: true @@ -1575,13 +1575,13 @@ isHidden: true }, memory: { - label: 'label.memory.mb', + label: 'label.memory.mb', validation: { required: true, number: true }, isHidden: true - } + } } }, @@ -1589,24 +1589,24 @@ var data = { id: args.context.instances[0].id, serviceofferingid: args.data.serviceofferingid - }; - + }; + if (args.$form.find('.form-item[rel=cpuSpeed]').is(':visible')) { $.extend(data, { - 'details[0].cpuSpeed': args.data.cpuSpeed + 'details[0].cpuSpeed': args.data.cpuSpeed }); - } + } if (args.$form.find('.form-item[rel=cpuNumber]').is(':visible')) { $.extend(data, { 'details[0].cpuNumber': args.data.cpuNumber }); - } + } if (args.$form.find('.form-item[rel=memory]').is(':visible')) { $.extend(data, { 'details[0].memory': args.data.memory }); - } - + } + $.ajax({ url: createURL('scaleVirtualMachine'), data: data, @@ -1640,7 +1640,7 @@ poll: pollAsyncJobResult } }, - + resetSSHKeyForVirtualMachine: { label: 'Reset SSH Key Pair', createForm: { @@ -1732,18 +1732,18 @@ poll: pollAsyncJobResult } }, - + assignVmToAnotherAccount: { label: 'label.assign.instance.another', createForm: { title: 'label.assign.instance.another', - fields: { + fields: { domainid: { label: 'label.domain', validation: { required: true }, - select: function(args) { + select: function(args) { $.ajax({ url: createURL('listDomains'), data: { @@ -1768,7 +1768,7 @@ data: array1 }); } - }); + }); } }, account: { @@ -1776,22 +1776,22 @@ validation: { required: true } - } + } } }, - action: function(args) { + action: function(args) { $.ajax({ url: createURL('assignVirtualMachine'), data: { virtualmachineid: args.context.instances[0].id, domainid: args.data.domainid, account: args.data.account - }, - success: function(json) { - var item = json.assignvirtualmachineresponse.virtualmachine; + }, + success: function(json) { + var item = json.assignvirtualmachineresponse.virtualmachine; args.response.success({ data: item - }); + }); } }); }, @@ -1805,8 +1805,8 @@ args.complete(); } } - }, - + }, + viewConsole: { label: 'label.view.console', action: { @@ -1835,36 +1835,36 @@ } else { hiddenFields = ["hypervisor", 'xenserverToolsVersion61plus']; } - + if ('instances' in args.context && args.context.instances[0].hypervisor != 'XenServer') { hiddenFields.push('xenserverToolsVersion61plus'); } - - if ('instances' in args.context && args.context.instances[0].guestosid != undefined) { + + if ('instances' in args.context && args.context.instances[0].guestosid != undefined) { if (ostypeObjs == undefined) { $.ajax({ url: createURL("listOsTypes"), dataType: "json", async: false, - success: function(json) { - ostypeObjs = json.listostypesresponse.ostype; + success: function(json) { + ostypeObjs = json.listostypesresponse.ostype; } }); - } + } if (ostypeObjs != undefined) { var ostypeName; for (var i = 0; i < ostypeObjs.length; i++) { - if (ostypeObjs[i].id == args.context.instances[0].guestosid) { + if (ostypeObjs[i].id == args.context.instances[0].guestosid) { ostypeName = ostypeObjs[i].description; break; } - } - if (ostypeName == undefined || ostypeName.indexOf("Win") == -1) { + } + if (ostypeName == undefined || ostypeName.indexOf("Win") == -1) { hiddenFields.push('xenserverToolsVersion61plus'); - } + } } } - + if (!args.context.instances[0].publicip) { hiddenFields.push('publicip'); } @@ -1920,17 +1920,17 @@ guestosid: { label: 'label.os.type', isEditable: true, - select: function(args) { - if (ostypeObjs == undefined) { + select: function(args) { + if (ostypeObjs == undefined) { $.ajax({ url: createURL("listOsTypes"), dataType: "json", async: false, - success: function(json) { - ostypeObjs = json.listostypesresponse.ostype; + success: function(json) { + ostypeObjs = json.listostypesresponse.ostype; } }); - } + } var items = []; $(ostypeObjs).each(function() { items.push({ @@ -1959,7 +1959,7 @@ }, converter: cloudStack.converters.toBooleanText }, - + /* isoid: { label: 'label.attached.iso', @@ -2045,7 +2045,7 @@ var jsonObj; if (json.listvirtualmachinesresponse.virtualmachine != null && json.listvirtualmachinesresponse.virtualmachine.length > 0) jsonObj = json.listvirtualmachinesresponse.virtualmachine[0]; - else if (isAdmin()) + else if (isAdmin()) jsonObj = $.extend(args.context.instances[0], { state: "Expunged" }); //after root/domain admin expunge a VM, listVirtualMachines API will no longer returns this expunged VM to all users. @@ -2060,12 +2060,12 @@ else jsonObj.xenserverToolsVersion61plus = false; } - + $(window).trigger('cloudStack.module.sharedFunctions.addExtraProperties', { obj: jsonObj, objType: "UserVM" }); - + args.response.success({ actionFilter: vmActionfilter, data: jsonObj @@ -2100,7 +2100,7 @@ label: 'label.network', select: function(args) { var data1 = { - zoneid: args.context.instances[0].zoneid + zoneid: args.context.instances[0].zoneid }; if (isAdmin()) { $.extend(data1, { @@ -2111,7 +2111,7 @@ account: args.context.instances[0].account, domainid: args.context.instances[0].domainid }); - } + } $.ajax({ url: createURL('listNetworks'), data: data1, @@ -2322,7 +2322,7 @@ secondaryips: secondaryips }) } - + var name = 'NIC ' + (index + 1); if (nic.isdefault) { name += ' (' + _l('label.default') + ')'; @@ -2442,19 +2442,19 @@ } else if (jsonObj.state == 'Running') { allowedActions.push("stop"); allowedActions.push("restart"); - - if ((jsonObj.hypervisor != 'KVM' || g_kvmsnapshotenabled == true) + + if ((jsonObj.hypervisor != 'KVM' || g_kvmsnapshotenabled == true) && (jsonObj.hypervisor != 'LXC')) { allowedActions.push("snapshot"); } - - allowedActions.push("destroy"); + + allowedActions.push("destroy"); allowedActions.push("reinstall"); - + //when userVm is running, scaleUp is not supported for KVM, LXC if (jsonObj.hypervisor != 'KVM' && jsonObj.hypervisor != 'LXC') { allowedActions.push("scaleUp"); - } + } if (isAdmin()) allowedActions.push("migrate"); @@ -2476,13 +2476,13 @@ allowedActions.push("start"); allowedActions.push("destroy"); allowedActions.push("reinstall"); - - if ((jsonObj.hypervisor != 'KVM' || g_kvmsnapshotenabled == true) + + if ((jsonObj.hypervisor != 'KVM' || g_kvmsnapshotenabled == true) && (jsonObj.hypervisor != 'LXC')) { allowedActions.push("snapshot"); } - - 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("changeAffinity"); if (isAdmin()) @@ -2493,11 +2493,11 @@ } else { allowedActions.push("detachISO"); } - allowedActions.push("resetPassword"); + allowedActions.push("resetPassword"); if (jsonObj.hypervisor == "BareMetal") { allowedActions.push("createTemplate"); } - + if (isAdmin() || isDomainAdmin()) { allowedActions.push("assignVmToAnotherAccount"); } diff --git a/ui/scripts/network.js b/ui/scripts/network.js index 4e337fb57e3..5aa5b62bd68 100755 --- a/ui/scripts/network.js +++ b/ui/scripts/network.js @@ -37,7 +37,7 @@ }; //value of Primary IP in subselect dropdown is -1, for single VM selection (API parameter virtualmachineid + vmguestip), e.g. enableStaticNat API, createPortForwardingRule API. - var singleVmSecondaryIPSubselect = function(args) { + var singleVmSecondaryIPSubselect = function(args) { var instance = args.context.instances[0]; var network = args.context.networks[0]; @@ -50,8 +50,8 @@ success: function(json) { var nics = json.listnicsresponse.nic; var ipSelection = []; - - $(nics).map(function(index, nic) { + + $(nics).map(function(index, nic) { var primaryIp = nic.ipaddress; var secondaryIps = nic.secondaryip ? nic.secondaryip : []; var prefix = '[NIC ' + (index + 1) + '] '; @@ -61,7 +61,7 @@ id: nic.networkid + ',-1', description: prefix + primaryIp + ' (Primary)' }); - + // Add secondary IPs $(secondaryIps).map(function(index, secondaryIp) { ipSelection.push({ @@ -69,21 +69,21 @@ description: prefix + secondaryIp.ipaddress }); }); - }); + }); args.response.success({ data: ipSelection }); } }); - - } else { //non-portable IP which has only one NIC + + } else { //non-portable IP which has only one NIC /* var nic = $.grep(instance.nic, function(nic) { return nic.networkid == network.id; })[0]; */ - + // Get NIC IPs $.ajax({ url: createURL('listNics'), @@ -91,18 +91,18 @@ virtualmachineid: instance.id, nicId: instance.nic[0].id }, - success: function(json) { + success: function(json) { var nic = json.listnicsresponse.nic[0]; var primaryIp = nic.ipaddress; var secondaryIps = nic.secondaryip ? nic.secondaryip : []; var ipSelection = []; - + // Add primary IP as default ipSelection.push({ id: primaryIp, description: primaryIp + ' (Primary)' }); - + // Add secondary IPs $(secondaryIps).map(function(index, secondaryIp) { ipSelection.push({ @@ -110,7 +110,7 @@ description: secondaryIp.ipaddress }); }); - + args.response.success({ data: ipSelection }); @@ -120,7 +120,7 @@ }; //value of Primary IP in subselect dropdown is itself (not -1), for multiple VM selection (API parameter vmidipmap), e.g. assignToLoadBalancerRule API. - var multipleVmSecondaryIPSubselect = function(args) { + var multipleVmSecondaryIPSubselect = function(args) { var instance = args.context.instances[0]; var network = args.context.networks[0]; @@ -145,7 +145,7 @@ id: nic.networkid + ',' + primaryIp, description: prefix + primaryIp + ' (Primary)' }); - + // Add secondary IPs $(secondaryIps).map(function(index, secondaryIp) { ipSelection.push({ @@ -153,21 +153,21 @@ description: prefix + secondaryIp.ipaddress }); }); - }); - + }); + args.response.success({ data: ipSelection }); } - }); - - } else { //non-portable IP which has only one NIC + }); + + } else { //non-portable IP which has only one NIC /* var nic = $.grep(instance.nic, function(nic) { return nic.networkid == network.id; })[0]; */ - + // Get NIC IPs $.ajax({ url: createURL('listNics'), @@ -175,7 +175,7 @@ virtualmachineid: instance.id, nicId: instance.nic[0].id }, - success: function(json) { + success: function(json) { var nic = json.listnicsresponse.nic[0]; var primaryIp = nic.ipaddress; var secondaryIps = nic.secondaryip ? nic.secondaryip : []; @@ -207,9 +207,9 @@ }); } }); - } + } }; - + var ipChangeNotice = function() { cloudStack.dialog.confirm({ message: 'message.ip.address.changed', @@ -243,7 +243,7 @@ ipObj.issystem == true) { return []; } - + if (ipObj.issourcenat) { //sourceNAT IP doesn't support staticNAT disallowedActions.push('enableStaticNAT'); disallowedActions.push('disableStaticNAT'); @@ -255,10 +255,10 @@ } else { disallowedActions.push('disableStaticNAT'); } - } + } //***** apply to both Isolated Guest Network IP, VPC IP (end) ***** - - + + if (!('vpc' in args.context)) { //***** Guest Network section > Guest Network page > IP Address page ***** if (args.context.networks[0].networkofferingconservemode == false) { /* @@ -268,7 +268,7 @@ disallowedActions.push('enableStaticNAT'); disallowedActions.push('enableVPN'); } - + /* (2) If IP is non-SourceNat, show StaticNat/VPN/PortForwarding/LoadBalancer at first. 1. Once StaticNat is enabled, hide VPN/PortForwarding/LoadBalancer. @@ -283,7 +283,7 @@ if (ipObj.vpnenabled) { //2. Once VPN is enabled, hide StaticNat/PortForwarding/LoadBalancer. disallowedActions.push('enableStaticNAT'); } - + //3. Once a PortForwarding rule is added, hide StaticNat/VPN/LoadBalancer. $.ajax({ url: createURL('listPortForwardingRules'), @@ -301,7 +301,7 @@ } } }); - + //4. Once a LoadBalancer rule is added, hide StaticNat/VPN/PortForwarding. $.ajax({ url: createURL('listLoadBalancerRules'), @@ -321,7 +321,7 @@ }); } } - + if (ipObj.networkOfferingHavingVpnService == true) { if (ipObj.vpnenabled) { disallowedActions.push('enableVPN'); @@ -332,8 +332,8 @@ disallowedActions.push('disableVPN'); disallowedActions.push('enableVPN'); } - } else { //***** VPC section > Configuration VPC > Router > Public IP Addresses ***** - if (ipObj.issourcenat) { //VPC sourceNAT IP: supports VPN + } else { //***** VPC section > Configuration VPC > Router > Public IP Addresses ***** + if (ipObj.issourcenat) { //VPC sourceNAT IP: supports VPN if (ipObj.vpnenabled) { disallowedActions.push('enableVPN'); } else { @@ -343,7 +343,7 @@ disallowedActions.push('enableVPN'); disallowedActions.push('disableVPN'); } - } + } allowedActions = $.grep(allowedActions, function(item) { return $.inArray(item, disallowedActions) == -1; @@ -487,15 +487,15 @@ }, dependsOn: 'zoneId', docID: 'helpGuestNetworkNetworkOffering', - select: function(args) { + select: function(args) { var data = { zoneid: args.zoneId, guestiptype: 'Isolated', supportedServices: 'SourceNat', state: 'Enabled' }; - - if ('vpc' in args.context) { //from VPC section + + if ('vpc' in args.context) { //from VPC section $.extend(data, { forVpc: true }); @@ -508,10 +508,10 @@ listAll: true }, async: false, - success: function(json) { - vpcs = json.listvpcsresponse.vpc; + success: function(json) { + vpcs = json.listvpcsresponse.vpc; } - }); + }); if (vpcs == null || vpcs.length == 0) { //if there is no VPC in the system $.extend(data, { forVpc: false @@ -519,12 +519,12 @@ } } - if(!isAdmin()) { //normal user is not aware of the VLANs in the system, so normal user is not allowed to create network with network offerings whose specifyvlan = true + if(!isAdmin()) { //normal user is not aware of the VLANs in the system, so normal user is not allowed to create network with network offerings whose specifyvlan = true $.extend(data, { specifyvlan: false }); } - + $.ajax({ url: createURL('listNetworkOfferings'), data: data, @@ -554,7 +554,7 @@ }) }); } - }); + }); } }, @@ -1124,8 +1124,8 @@ var isAdvancedSGZone = false; var hiddenTabs = []; var isSharedNetwork; - - var thisNetwork = args.context.networks[0]; + + var thisNetwork = args.context.networks[0]; if (thisNetwork.vpcid != null) { isVPC = true; } @@ -1157,7 +1157,7 @@ return true; }); } - }); + }); // Get zone data $.ajax({ @@ -1261,7 +1261,7 @@ return _l('label.na'); } }, - + ispersistent: { label: 'label.persistent', converter: cloudStack.converters.toBooleanText @@ -1279,11 +1279,11 @@ vlan: { label: 'label.vnet.id' }, - + broadcasturi: { label: 'label.broadcasturi' }, - + networkofferingid: { label: 'label.network.offering', isEditable: true, @@ -1317,13 +1317,13 @@ }); } }); - + //include currently selected network offeirng to dropdown items.push({ id: args.context.networks[0].networkofferingid, description: args.context.networks[0].networkofferingdisplaytext - }); - + }); + args.response.success({ data: items }); @@ -1390,13 +1390,13 @@ async: true, success: function(json) { var jsonObj = json.listnetworksresponse.network[0]; - addExtraPropertiesToGuestNetworkObject(jsonObj); - + addExtraPropertiesToGuestNetworkObject(jsonObj); + $(window).trigger('cloudStack.module.sharedFunctions.addExtraProperties', { obj: jsonObj, objType: "Network" }); - + args.response.success({ actionFilter: cloudStack.actionFilter.guestNetwork, data: jsonObj @@ -2108,35 +2108,35 @@ if (zoneObj.networktype == 'Basic') { var havingEIP = false, - havingELB = false; - + havingELB = false; + var services = args.context.networks[0].service; if(services != null) { - for(var i = 0; i < services.length; i++) { + for(var i = 0; i < services.length; i++) { var thisService = services[i]; var capabilities = thisService.capability; - if (thisService.name == "StaticNat") { + if (thisService.name == "StaticNat") { if(capabilities != null) { - for(var k = 0; k < capabilities.length; k++) { - if (capabilities[k].name == "ElasticIp" && capabilities[k].value == "true") { + for(var k = 0; k < capabilities.length; k++) { + if (capabilities[k].name == "ElasticIp" && capabilities[k].value == "true") { havingEIP = true; - break; + break; } } - } + } } else if (thisService.name == "Lb") { if(capabilities != null) { - for(var k = 0; k < capabilities.length; k++) { - if (capabilities[k].name == "ElasticLb" && capabilities[k].value == "true") { + for(var k = 0; k < capabilities.length; k++) { + if (capabilities[k].name == "ElasticLb" && capabilities[k].value == "true") { havingELB = true; - break; + break; } } - } - } + } + } } } - + if (havingEIP != true || havingELB != true) { //not EIP-ELB return false; //acquire new IP is not allowed in non-EIP-ELB basic zone } @@ -2155,7 +2155,7 @@ return true; //VPC section, show Acquire IP button } }, - messages: { + messages: { notification: function(args) { return 'label.acquire.new.ip'; } @@ -2163,29 +2163,29 @@ createForm: { title: 'label.acquire.new.ip', desc: 'Please confirm that you want to acquire new IP', - preFilter: function(args) { + preFilter: function(args) { $.ajax({ url: createURL('listRegions'), success: function(json) { var selectedRegionName = $(".region-switcher .title").text(); if ( selectedRegionName == undefined || selectedRegionName.length == 0) { selectedRegionName = "Local"; - } - var items = json.listregionsresponse.region; + } + var items = json.listregionsresponse.region; if(items != null) { - for(var i = 0; i < items.length; i++) { + for(var i = 0; i < items.length; i++) { if(items[i].name == selectedRegionName) { if(items[i].portableipserviceenabled == true) { args.$form.find('.form-item[rel=isportable]').css('display', 'inline-block'); } else { args.$form.find('.form-item[rel=isportable]').hide(); - } + } break; } - } + } } - } - }); + } + }); }, fields: { isportable: { @@ -2209,13 +2209,13 @@ } }, action: function(args) { - var dataObj = {}; + var dataObj = {}; if (args.$form.find('.form-item[rel=isportable]').css("display") != "none") { $.extend(dataObj, { isportable: args.data.isportable - }); + }); } - + if ('vpc' in args.context) { //from VPC section $.extend(dataObj, { vpcid: args.context.vpc[0].id @@ -2266,9 +2266,9 @@ }, dataProvider: function(args) { - var items = []; + var items = []; var data = {}; - listViewDataProvider(args, data); + listViewDataProvider(args, data); if (args.context.networks) { $.extend(data, { associatedNetworkId: args.context.networks[0].id @@ -2278,8 +2278,8 @@ $.extend(data, { vpcid: args.context.vpc[0].id }); - } - + } + $.ajax({ url: createURL('listPublicIpAddresses'), data: $.extend({}, data, { @@ -2288,48 +2288,48 @@ dataType: "json", async: false, success: function(json) { - var ips = json.listpublicipaddressesresponse.publicipaddress; + var ips = json.listpublicipaddressesresponse.publicipaddress; if(ips != null) { - for(var i = 0; i < ips.length; i++) { + for(var i = 0; i < ips.length; i++) { getExtaPropertiesForIpObj(ips[i], args); - items.push(ips[i]); + items.push(ips[i]); } - } + } } }); - - if (g_supportELB == "guest") { + + if (g_supportELB == "guest") { $.ajax({ url: createURL('listPublicIpAddresses'), data: $.extend({}, data, { - forvirtualnetwork: false, // ELB IPs are allocated on guest network + forvirtualnetwork: false, // ELB IPs are allocated on guest network forloadbalancing: true }), dataType: "json", async: false, success: function(json) { - var ips = json.listpublicipaddressesresponse.publicipaddress; + var ips = json.listpublicipaddressesresponse.publicipaddress; if(ips != null) { - for(var i = 0; i < ips.length; i++) { + for(var i = 0; i < ips.length; i++) { getExtaPropertiesForIpObj(ips[i], args); - items.push(ips[i]); + items.push(ips[i]); } - } + } } }); } - + args.response.success({ actionFilter: actionFilters.ipAddress, data: items - }); + }); }, // Detail view detailView: { name: 'IP address detail', tabFilter: function(args) { - var item = args.context.ipAddresses[0]; + var item = args.context.ipAddresses[0]; var disabledTabs = []; var ipAddress = args.context.ipAddresses[0]; @@ -2351,14 +2351,14 @@ if (ipAddress.vpcid != null && ipAddress.issourcenat) { //don't show Configuration(ipRules) tab on VPC sourceNAT IP disableIpRules = true; } - + if (('vpc' in args.context) == false && ipAddress.vpcid != null) { //from Guest Network section, don't show Configuration(ipRules) tab on VPC IP disableIpRules = true; } - if (disableVpn) + if (disableVpn) disabledTabs.push('vpn'); - if (disableIpRules) + if (disableIpRules) disabledTabs.push('ipRules'); return disabledTabs; @@ -2379,12 +2379,12 @@ success: function(data) { args.response.success({ _custom: { - getUpdatedItem: function(json) { + getUpdatedItem: function(json) { var vpnenabledAndRunning = false; if (json.queryasyncjobresultresponse.jobresult.remoteaccessvpn.state == "Running") { vpnenabledAndRunning = true; - } - + } + return { remoteaccessvpn: json.queryasyncjobresultresponse.jobresult.remoteaccessvpn, vpnenabled: vpnenabledAndRunning @@ -2412,10 +2412,10 @@ complete: function(args) { var msg; if (args.remoteaccessvpn.state == "Running") { - msg = _l('message.enabled.vpn') + ' ' + args.remoteaccessvpn.publicip + '.' + '
' + _l('message.enabled.vpn.ip.sec') + '
' + args.remoteaccessvpn.presharedkey; + msg = _l('message.enabled.vpn') + ' ' + args.remoteaccessvpn.publicip + '.' + '
' + _l('message.enabled.vpn.ip.sec') + '
' + args.remoteaccessvpn.presharedkey; } else { msg = "Remote Access VPN configuration has been generated, but it failed to apply. Please check connectivity of the network element, then re-try."; - } + } return msg; } }, @@ -2797,10 +2797,10 @@ }, associatednetworkid: { label: 'label.associated.network.id' - }, + }, associatednetworkname: { label: 'label.network.name' - }, + }, state: { label: 'label.state' }, @@ -2896,7 +2896,7 @@ if (!('vpc' in args.context)) { //from Guest Network section var services = args.context.networks[0].service; if(services != null) { - for(var i = 0; i < services.length; i++) { + for(var i = 0; i < services.length; i++) { var thisService = services[i]; if (thisService.name == "Firewall") havingFirewallService = true; @@ -2905,9 +2905,9 @@ if (thisService.name == "Lb") havingLbService = true; if (thisService.name == "Vpn") - havingVpnService = true; + havingVpnService = true; } - } + } } else { //from VPC section //a VPC network from Guest Network section or from VPC section // Firewall is not supported in IP from VPC section @@ -2929,7 +2929,7 @@ }, async: false, success: function(json) { - var networkObj = json.listnetworksresponse.network[0]; + var networkObj = json.listnetworksresponse.network[0]; var services = networkObj.service; if(services != null) { for(var i = 0; i < services.length; i++) { @@ -2938,8 +2938,8 @@ if (services[i].name == "Lb") havingLbService = true; } - } - + } + if (networkObj.networkofferingconservemode == false) { /* (1) If IP is SourceNat, no StaticNat/VPN/PortForwarding/LoadBalancer can be enabled/added. @@ -3012,11 +3012,11 @@ } }); } - } + } } }); } - } + } return disallowedActions; }, @@ -3368,28 +3368,28 @@ } }, filters: false, - - //when server-side change of adding new parameter "vmidipmap" to assignToLoadBalancerRule API is in, uncomment the following commented 4 lines. + + //when server-side change of adding new parameter "vmidipmap" to assignToLoadBalancerRule API is in, uncomment the following commented 4 lines. subselect: { isMultiple: true, label: 'label.use.vm.ips', - dataProvider: multipleVmSecondaryIPSubselect + dataProvider: multipleVmSecondaryIPSubselect }, - + dataProvider: function(args) { var itemData = $.isArray(args.context.multiRule) && args.context.subItemData ? args.context.subItemData : []; var data = {}; listViewDataProvider(args, data); - + var networkid; if ('vpc' in args.context) { networkid = args.context.multiData.tier; } else { networkid = args.context.ipAddresses[0].associatednetworkid; } - $.extend(data, { - networkid: networkid + $.extend(data, { + networkid: networkid }); if (!args.context.projects) { @@ -3520,7 +3520,7 @@ } }, multipleAdd: true, - + fields: { 'name': { edit: true, @@ -3587,8 +3587,8 @@ buttonLabel: 'label.configure', action: cloudStack.uiCustom.autoscaler(cloudStack.autoscaler) }, - isHidden: function(args) { - if (!('vpc' in args.context)) { //from Guest Network section + isHidden: function(args) { + if (!('vpc' in args.context)) { //from Guest Network section var lbProviderIsNetscaler = false; $.ajax({ url: createURL('listNetworkOfferings'), @@ -3596,8 +3596,8 @@ id: args.context.networks[0].networkofferingid }, async: false, - success: function(json) { - var networkOffering = json.listnetworkofferingsresponse.networkoffering[0]; + success: function(json) { + var networkOffering = json.listnetworkofferingsresponse.networkoffering[0]; var services = networkOffering.service; if (services != null) { for (var i = 0; i < services.length; i++) { @@ -3609,23 +3609,23 @@ lbProviderIsNetscaler = true; break; } - } + } } break; } } } } - }); + }); if (lbProviderIsNetscaler == true) { //AutoScale is only supported on Netscaler (but not on any other provider like VirtualRouter) return false; //show AutoScale button } else { return 2; //hide Autoscale button (both header and form) - } + } } else { //from VPC section //VPC doesn't support autoscale return 2; - } + } } }, @@ -3633,7 +3633,7 @@ label: 'label.add.vms', addButton: true }, - + 'state' : { edit: 'ignore', label: 'label.state' @@ -3669,7 +3669,7 @@ }; var stickyData = $.extend(true, {}, args.data.sticky); - + //***** create new LB rule > Add VMs ***** $.ajax({ url: createURL('createLoadBalancerRule'), @@ -3680,52 +3680,52 @@ var itemData = args.itemData; var jobID = data.createloadbalancerruleresponse.jobid; var lbID = data.createloadbalancerruleresponse.id; - + var inputData = { - id: data.createloadbalancerruleresponse.id - }; - + id: data.createloadbalancerruleresponse.id + }; + /* var inputData = { id: data.createloadbalancerruleresponse.id, virtualmachineids: $.map(itemData, function(elem) { return elem.id; }).join(',') - }; - */ + }; + */ //virtualmachineids parameter has been replaced with vmidipmap parameter, so comment out the 6 lines above. - - - /* + + + /* * e.g. first VM(xxx) has two IPs(10.1.1.~), second VM(yyy) has three IPs(10.2.2.~): - * vmidipmap[0].vmid=xxx vmidipmap[0].vmip=10.1.1.11 - * vmidipmap[1].vmid=xxx vmidipmap[1].vmip=10.1.1.12 - * vmidipmap[2].vmid=yyy vmidipmap[2].vmip=10.2.2.77 - * vmidipmap[3].vmid=yyy vmidipmap[3].vmip=10.2.2.78 - * vmidipmap[4].vmid=yyy vmidipmap[4].vmip=10.2.2.79 + * vmidipmap[0].vmid=xxx vmidipmap[0].vmip=10.1.1.11 + * vmidipmap[1].vmid=xxx vmidipmap[1].vmip=10.1.1.12 + * vmidipmap[2].vmid=yyy vmidipmap[2].vmip=10.2.2.77 + * vmidipmap[3].vmid=yyy vmidipmap[3].vmip=10.2.2.78 + * vmidipmap[4].vmid=yyy vmidipmap[4].vmip=10.2.2.79 */ var selectedVMs = args.itemData; if (selectedVMs != null) { var vmidipmapIndex = 0; - for (var vmIndex = 0; vmIndex < selectedVMs.length; vmIndex++) { + for (var vmIndex = 0; vmIndex < selectedVMs.length; vmIndex++) { var selectedIPs = selectedVMs[vmIndex]._subselect; for (var ipIndex = 0; ipIndex < selectedIPs.length; ipIndex++) { inputData['vmidipmap[' + vmidipmapIndex + '].vmid'] = selectedVMs[vmIndex].id; - + if (args.context.ipAddresses[0].isportable) { - inputData['vmidipmap[' + vmidipmapIndex + '].vmip'] = selectedIPs[ipIndex].split(',')[1]; + inputData['vmidipmap[' + vmidipmapIndex + '].vmip'] = selectedIPs[ipIndex].split(',')[1]; } else { inputData['vmidipmap[' + vmidipmapIndex + '].vmip'] = selectedIPs[ipIndex]; } - + vmidipmapIndex++; - } + } } - } - + } + $.ajax({ url: createURL('assignToLoadBalancerRule'), - data: inputData, + data: inputData, success: function(data) { var jobID = data.assigntoloadbalancerruleresponse.jobid; var lbStickyCreated = false; @@ -3837,36 +3837,36 @@ label: 'label.add.vms.to.lb', action: function(args) { var inputData = { - id: args.multiRule.id - }; - - /* + id: args.multiRule.id + }; + + /* * e.g. first VM(xxx) has two IPs(10.1.1.~), second VM(yyy) has three IPs(10.2.2.~): - * vmidipmap[0].vmid=xxx vmidipmap[0].vmip=10.1.1.11 - * vmidipmap[1].vmid=xxx vmidipmap[1].vmip=10.1.1.12 - * vmidipmap[2].vmid=yyy vmidipmap[2].vmip=10.2.2.77 - * vmidipmap[3].vmid=yyy vmidipmap[3].vmip=10.2.2.78 - * vmidipmap[4].vmid=yyy vmidipmap[4].vmip=10.2.2.79 + * vmidipmap[0].vmid=xxx vmidipmap[0].vmip=10.1.1.11 + * vmidipmap[1].vmid=xxx vmidipmap[1].vmip=10.1.1.12 + * vmidipmap[2].vmid=yyy vmidipmap[2].vmip=10.2.2.77 + * vmidipmap[3].vmid=yyy vmidipmap[3].vmip=10.2.2.78 + * vmidipmap[4].vmid=yyy vmidipmap[4].vmip=10.2.2.79 */ var selectedVMs = args.data; if (selectedVMs != null) { var vmidipmapIndex = 0; - for (var vmIndex = 0; vmIndex < selectedVMs.length; vmIndex++) { + for (var vmIndex = 0; vmIndex < selectedVMs.length; vmIndex++) { var selectedIPs = selectedVMs[vmIndex]._subselect; for (var ipIndex = 0; ipIndex < selectedIPs.length; ipIndex++) { inputData['vmidipmap[' + vmidipmapIndex + '].vmid'] = selectedVMs[vmIndex].id; - + if (args.context.ipAddresses[0].isportable) { - inputData['vmidipmap[' + vmidipmapIndex + '].vmip'] = selectedIPs[ipIndex].split(',')[1]; + inputData['vmidipmap[' + vmidipmapIndex + '].vmip'] = selectedIPs[ipIndex].split(',')[1]; } else { inputData['vmidipmap[' + vmidipmapIndex + '].vmip'] = selectedIPs[ipIndex]; } - + vmidipmapIndex++; - } + } } - } - + } + $.ajax({ url: createURL('assignToLoadBalancerRule'), data: inputData, @@ -3892,21 +3892,21 @@ }, destroy: { label: 'label.remove.vm.from.lb', - action: function(args) { + action: function(args) { var inputData; if (args.item.itemIp == undefined) { inputData = { id: args.multiRule.id, virtualmachineids: args.item.id }; - } else { + } else { inputData = { id: args.multiRule.id, "vmidipmap[0].vmid": args.item.id, - "vmidipmap[0].vmip": args.item.itemIp - }; - } - + "vmidipmap[0].vmip": args.item.itemIp + }; + } + $.ajax({ url: createURL('removeFromLoadBalancerRule'), data: inputData, @@ -3943,12 +3943,12 @@ dataType: 'json', async: true, success: function(data) { - var loadbalancerrules = data.listloadbalancerrulesresponse.loadbalancerrule; - - $(loadbalancerrules).each(function() { + var loadbalancerrules = data.listloadbalancerrulesresponse.loadbalancerrule; + + $(loadbalancerrules).each(function() { var lbRule = this; var stickyData = {}; - + //var lbInstances = []; var itemData = []; @@ -4017,19 +4017,19 @@ data: { listAll: true, lbvmips: true, - id: lbRule.id + id: lbRule.id }, success: function(data) { //when "lbvmips: true" is not passed to API - //lbVMs = data.listloadbalancerruleinstancesresponse.loadbalancerruleinstance; - + //lbVMs = data.listloadbalancerruleinstancesresponse.loadbalancerruleinstance; + //when "lbvmips: true" is passed to API - lbrulevmidips = data.listloadbalancerruleinstancesresponse.lbrulevmidip; - + lbrulevmidips = data.listloadbalancerruleinstancesresponse.lbrulevmidip; + if (lbrulevmidips != null) { for (var k = 0; k < lbrulevmidips.length; k++) { var lbrulevmidip = lbrulevmidips[k]; - var lbVM = lbrulevmidip.loadbalancerruleinstance; + var lbVM = lbrulevmidip.loadbalancerruleinstance; if (lbVM.displayname.indexOf('AutoScale-LB-') > -1) //autoscale VM is not allowed to be deleted manually. So, hide destroy button lbVM._hideActions = ['destroy']; @@ -4037,24 +4037,24 @@ lbVM._itemStateLabel = 'label.service.state'; lbVM._itemState = lbVM.servicestate; } - + if (lbrulevmidip.lbvmipaddresses != null) { for (var m = 0 ; m < lbrulevmidip.lbvmipaddresses.length; m++) { var ip = lbrulevmidip.lbvmipaddresses[m]; itemData.push($.extend({}, lbVM, { itemIp: ip - })); + })); } } else { itemData.push(lbVM); - } + } } - } + } }, error: function(data) { args.response.error(parseXMLHttpResponse(data)); } - }); + }); $.extend(lbRule, { _itemName: 'name', @@ -4160,16 +4160,16 @@ dataProvider: function(args) { var data = {}; listViewDataProvider(args, data); - + var networkid; if ('vpc' in args.context) { networkid = args.context.multiData.tier; } else { networkid = args.context.ipAddresses[0].associatednetworkid; - } + } $.extend(data, { networkid: networkid - }); + }); if (!args.context.projects) { $.extend(data, { @@ -4261,7 +4261,7 @@ virtualmachineid: args.itemData[0].id, openfirewall: false }; - + if (args.context.ipAddresses[0].isportable) { var subselect = args.itemData[0]._subselect.split(','); //var networkid = subselect[0]; @@ -4274,7 +4274,7 @@ } } else if (args.itemData[0]._subselect && args.itemData[0]._subselect != -1) { data.vmguestip = args.itemData[0]._subselect; - } + } if ('vpc' in args.context) { //from VPC section if (args.data.tier == null) { @@ -4297,7 +4297,7 @@ args.response.success({ _custom: { jobId: data.createportforwardingruleresponse.jobid, - getUpdatedItem: function(json) { + getUpdatedItem: function(json) { return json.queryasyncjobresultresponse.jobresult.portforwardingrule; } }, @@ -4378,16 +4378,16 @@ success: function(data) { loadCurrent++; var vms = data.listvirtualmachinesresponse.virtualmachine; - + //if this VM is destroyed, data.listvirtualmachinesresponse.virtualmachine will be undefined for regular-user (CLOUDSTACK-3195) - if (vms == undefined) { + if (vms == undefined) { vms = [{ "id": item.virtualmachineid, "name": item.virtualmachinename, "displayname": item.virtualmachinedisplayname - }]; - } - + }]; + } + $.extend(item, { _itemData: $.map(vms, function(vm) { return $.extend(vm, { @@ -5558,7 +5558,7 @@ return 'message.restart.vpc.remark'; } }, - + preFilter: function(args) { var zoneObj; $.ajax({ @@ -5569,13 +5569,13 @@ zoneObj = json.listzonesresponse.zone[0]; } }); - - + + 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=makeredundant]').find('input').attr('checked', 'checked'); //checked args.$form.find('.form-item[rel=makeredundant]').css('display', 'inline-block'); //shown - + if (Boolean(args.context.vpc[0].redundantvpcrouter)) { args.$form.find('.form-item[rel=makeredundant]').hide(); } else { @@ -6479,18 +6479,18 @@ } }; - function getExtaPropertiesForIpObj(ipObj, args) { - if (!('vpc' in args.context)) { //***** Guest Network section > Guest Network page > IP Address page ***** + function getExtaPropertiesForIpObj(ipObj, args) { + if (!('vpc' in args.context)) { //***** Guest Network section > Guest Network page > IP Address page ***** var services = args.context.networks[0].service; if(services != null) { - for(var i = 0; i < services.length; i++) { - var thisService = services[i]; + for(var i = 0; i < services.length; i++) { + var thisService = services[i]; if (thisService.name == "Vpn") { - ipObj.networkOfferingHavingVpnService = true; + ipObj.networkOfferingHavingVpnService = true; break; } } - } + } if (ipObj.networkOfferingHavingVpnService == true) { $.ajax({ url: createURL('listRemoteAccessVpns'), @@ -6509,9 +6509,9 @@ } } }); - } - } else { //***** VPC section > Configuration VPC > Router > Public IP Addresses ***** - if (ipObj.issourcenat) { //VPC sourceNAT IP: supports VPN + } + } else { //***** VPC section > Configuration VPC > Router > Public IP Addresses ***** + if (ipObj.issourcenat) { //VPC sourceNAT IP: supports VPN $.ajax({ url: createURL('listRemoteAccessVpns'), data: { @@ -6528,8 +6528,8 @@ ipObj.vpnenabled = false; } } - }); - } + }); + } } }; diff --git a/ui/scripts/projects.js b/ui/scripts/projects.js index 86e4f88b052..edfd80a5dbc 100644 --- a/ui/scripts/projects.js +++ b/ui/scripts/projects.js @@ -621,7 +621,7 @@ }, // Project listing data provider - dataProvider: function(args) { + dataProvider: function(args) { var user = args.context.users[0]; var data1 = { accountId: user.userid, @@ -632,20 +632,20 @@ } var array1 = []; - var page = 1; - var getNextPage = function() { + var page = 1; + var getNextPage = function() { var data2 = $.extend({}, data1, { page: page, pageSize: 500 }); - + $.ajax({ url: createURL('listProjects', { ignoreProject: true }), - data: data2, + data: data2, async: false, - success: function(json) { + success: function(json) { var projects = json.listprojectsresponse.project; if (projects != undefined) { for(var i = 0; i < projects.length; i++) { @@ -653,16 +653,16 @@ displayText: projects[i].displaytext })); } - } - if (array1.length < json.listprojectsresponse.count) { + } + if (array1.length < json.listprojectsresponse.count) { page++; getNextPage(); - } + } } }); } - getNextPage(); - args.response.success({ data: array1 }); + getNextPage(); + args.response.success({ data: array1 }); } }; diff --git a/ui/scripts/regions.js b/ui/scripts/regions.js index f7cb8fdaeed..d27719dff30 100644 --- a/ui/scripts/regions.js +++ b/ui/scripts/regions.js @@ -481,32 +481,32 @@ path: 'regions.lbUnderGSLB', label: 'label.gslb.assigned.lb' }, - actions: { + actions: { edit: { label: 'label.edit', - action: function(args) { + action: function(args) { var data = { id: args.context.GSLB[0].id, description: args.data.description, gslblbmethod: args.data.gslblbmethod - }; + }; $.ajax({ url: createURL('updateGlobalLoadBalancerRule'), data: data, - success: function(json) { - var jid = json.updategloballoadbalancerruleresponse.jobid; + success: function(json) { + var jid = json.updategloballoadbalancerruleresponse.jobid; args.response.success({ _custom: { jobId: jid } - }); + }); } }); - }, + }, notification: { poll: pollAsyncJobResult } - }, + }, remove: { label: 'label.gslb.delete', messages: { diff --git a/ui/scripts/sharedFunctions.js b/ui/scripts/sharedFunctions.js index 2dc19d94dcc..cf0b064bcb7 100644 --- a/ui/scripts/sharedFunctions.js +++ b/ui/scripts/sharedFunctions.js @@ -268,7 +268,7 @@ var addGuestNetworkDialog = { if (items != null) { for (var i = 0; i < items.length; i++) { if (items[i].networktype == 'Advanced') { - addGuestNetworkDialog.zoneObjs.push(items[i]); + addGuestNetworkDialog.zoneObjs.push(items[i]); } } } @@ -294,7 +294,7 @@ var addGuestNetworkDialog = { if ('physicalNetworks' in args.context) { //Infrastructure menu > zone detail > guest traffic type > network tab (only shown in advanced zone) > add guest network dialog addGuestNetworkDialog.physicalNetworkObjs = args.context.physicalNetworks; } else { //Network menu > guest network section > add guest network dialog - var selectedZoneId = args.$form.find('.form-item[rel=zoneId]').find('select').val(); + var selectedZoneId = args.$form.find('.form-item[rel=zoneId]').find('select').val(); if (selectedZoneId != undefined && selectedZoneId.length > 0) { $.ajax({ url: createURL('listPhysicalNetworks'), @@ -302,7 +302,7 @@ var addGuestNetworkDialog = { zoneid: selectedZoneId }, async: false, - success: function(json) { + success: function(json) { var items = []; var physicalnetworks = json.listphysicalnetworksresponse.physicalnetwork; if (physicalnetworks != null) { @@ -313,7 +313,7 @@ var addGuestNetworkDialog = { physicalnetworkid: physicalnetworks[i].id }, async: false, - success: function(json) { + success: function(json) { var traffictypes = json.listtraffictypesresponse.traffictype; if (traffictypes != null) { for (var k = 0; k < traffictypes.length; k++) { @@ -322,13 +322,13 @@ var addGuestNetworkDialog = { break; } } - } + } } }); - } - } - - addGuestNetworkDialog.physicalNetworkObjs = items; + } + } + + addGuestNetworkDialog.physicalNetworkObjs = items; } }); } @@ -536,14 +536,14 @@ var addGuestNetworkDialog = { label: 'label.network.offering', docID: 'helpGuestNetworkZoneNetworkOffering', dependsOn: ['zoneId', 'physicalNetworkId', 'scope'], - select: function(args) { + select: function(args) { if(args.$form.find('.form-item[rel=zoneId]').find('select').val() == null || args.$form.find('.form-item[rel=zoneId]').find('select').val().length == 0) { args.response.success({ data: null }); return; } - + var data = { state: 'Enabled', zoneid: args.$form.find('.form-item[rel=zoneId]').find('select').val() @@ -977,7 +977,7 @@ cloudStack.converters = { convertBytes: function(bytes) { if (bytes == undefined) return ''; - + if (bytes < 1024 * 1024) { return (bytes / 1024).toFixed(2) + " KB"; } else if (bytes < 1024 * 1024 * 1024) { @@ -1030,20 +1030,20 @@ cloudStack.converters = { if (g_timezoneoffset != null) { localDate = disconnected.getTimePlusTimezoneOffset(g_timezoneoffset); - } else { + } else { var browserDate = new Date(); - var browserTimezoneoffset = browserDate.getTimezoneOffset(); - if (browserTimezoneoffset == undefined || isNaN(browserTimezoneoffset) ) { + var browserTimezoneoffset = browserDate.getTimezoneOffset(); + if (browserTimezoneoffset == undefined || isNaN(browserTimezoneoffset) ) { localDate = disconnected.toUTCString(); } else { g_timezoneoffset = (browserTimezoneoffset/60) * (-1); localDate = disconnected.getTimePlusTimezoneOffset(g_timezoneoffset); - } + } } } return localDate; }, - toBooleanText: function(booleanValue) { + toBooleanText: function(booleanValue) { var text1; if (booleanValue == true) { text1 = "Yes"; @@ -1052,7 +1052,7 @@ cloudStack.converters = { } else { //booleanValue == undefined text1 = ""; } - return text1; + return text1; }, convertHz: function(hz) { if (hz == null) @@ -1239,13 +1239,13 @@ cloudStack.converters = { } } -function isModuleIncluded(moduleName) { +function isModuleIncluded(moduleName) { for(var moduleIndex = 0; moduleIndex < cloudStack.modules.length; moduleIndex++) { if (cloudStack.modules[moduleIndex] == moduleName) { - return true; - break; + return true; + break; } - } + } return false; } @@ -1313,7 +1313,7 @@ var addExtraPropertiesToGuestNetworkObject = function(jsonObj) { jsonObj.vlan = jsonObj.broadcasturi.replace("vlan://", ""); } if(jsonObj.vxlan == null && jsonObj.broadcasturi != null && jsonObj.broadcasturi.substring(0,8) == "vxlan://") { - jsonObj.vxlan = jsonObj.broadcasturi.replace("vxlan://", ""); + jsonObj.vxlan = jsonObj.broadcasturi.replace("vxlan://", ""); } } @@ -1324,7 +1324,7 @@ var addExtraPropertiesToUcsBladeObject = function(jsonObj) { jsonObj.bladeid = array1[2]; } -var processPropertiesInImagestoreObject = function(jsonObj) { +var processPropertiesInImagestoreObject = function(jsonObj) { if (jsonObj.url != undefined) { var url = jsonObj.url; //e.g. 'cifs://10.1.1.1/aaa/aaa2/aaa3?user=bbb&password=ccc&domain=ddd' var passwordIndex = url.indexOf('&password='); //38 @@ -1332,7 +1332,7 @@ var processPropertiesInImagestoreObject = function(jsonObj) { if (passwordIndex >= 0) { jsonObj.url = url.substring(0, passwordIndex) + url.substring(domainIndex); //remove '&password=ccc' from jsonObj.url } - } + } } //find service object in network object @@ -1390,12 +1390,12 @@ var processPropertiesInImagestoreObject = function(jsonObj) { if (server.indexOf('://') == -1) { url += 'cifs://'; } - + url += (server + path); - + return url; } - + function presetupURL(server, path) { var url; if (server.indexOf("://") == -1) @@ -1499,11 +1499,11 @@ var processPropertiesInImagestoreObject = function(jsonObj) { } return vmName; } - + var timezoneMap = new Object(); timezoneMap["Etc/GMT+12"] = "Etc/GMT+12 [GMT-12:00]"; timezoneMap["Etc/GMT+11"] = "Etc/GMT+11 [GMT-11:00]"; -timezoneMap["Pacific/Midway"] = "Pacific/Midway [Samoa Standard Time]"; +timezoneMap["Pacific/Midway"] = "Pacific/Midway [Samoa Standard Time]"; timezoneMap["Pacific/Niue"] = "Pacific/Niue [Niue Time]"; timezoneMap["Pacific/Pago_Pago"] = "Pacific/Pago_Pago [Samoa Standard Time]"; timezoneMap["Pacific/Samoa"] = "Pacific/Samoa [Samoa Standard Time]"; @@ -2256,7 +2256,7 @@ cloudStack.api = { args.response.error(parseXMLHttpResponse(json)); } }); - } + } } }; } diff --git a/ui/scripts/storage.js b/ui/scripts/storage.js index 9cabaf9a83a..782622dec89 100644 --- a/ui/scripts/storage.js +++ b/ui/scripts/storage.js @@ -330,7 +330,7 @@ }); } - }, + }, diskOffering: { label: 'Custom Disk Offering', docID: 'helpVolumeDiskOffering', @@ -347,7 +347,7 @@ description: '' }]; $(diskofferingObjs).each(function() { - if (this.iscustomized == true) { + if (this.iscustomized == true) { items.push({ id: this.id, description: this.displaytext @@ -360,7 +360,7 @@ } }); } - }, + }, diskOffering: { label: 'Custom Disk Offering', docID: 'helpVolumeDiskOffering', @@ -377,7 +377,7 @@ description: '' }]; $(diskofferingObjs).each(function() { - if (this.iscustomized == true) { + if (this.iscustomized == true) { items.push({ id: this.id, description: this.displaytext @@ -390,7 +390,7 @@ } }); } - }, + }, checksum: { docID: 'helpUploadVolumeChecksum', label: 'label.md5.checksum' @@ -406,12 +406,12 @@ url: args.data.url }; - if (args.data.diskOffering != '' && args.data.diskOffering.length > 0) { + if (args.data.diskOffering != '' && args.data.diskOffering.length > 0) { $.extend(data, { diskofferingid: args.data.diskOffering }); } - + if (args.data.checksum != null && args.data.checksum.length > 0) { $.extend(data, { checksum: args.data.checksum @@ -445,7 +445,7 @@ poll: pollAsyncJobResult } }, - + uploadVolumefromLocal: { isHeader: true, label: 'Upload from Local', @@ -462,7 +462,7 @@ fileUpload: { getURL: function(args) { args.data = args.formData; - + var data = { name: args.data.name, zoneId: args.data.availabilityZone, @@ -475,7 +475,7 @@ checksum: args.data.checksum }); } - + $.ajax({ url: createURL('getUploadParamsForVolume'), data: data, @@ -506,7 +506,7 @@ args.response.success(); } } - }, + }, fields: { volumeFileUpload: { label: 'local file', @@ -584,7 +584,7 @@ notification: { poll: pollAsyncJobResult } - } + } }, advSearchFields: { @@ -686,12 +686,12 @@ $.extend(data, { virtualMachineId: args.context.instances[0].id }); - } + } if ("primarystorages" in args.context) { $.extend(data, { storageid: args.context.primarystorages[0].id }); - } + } } $.ajax({ @@ -804,7 +804,7 @@ isBoolean: true, isHidden: function(args) { if (args.context.volumes[0].quiescevm == true) - return false; + return false; else return true; } @@ -1137,7 +1137,7 @@ hypervisor: args.context.volumes[0].hypervisor }); } - + $(['Running', 'Stopped']).each(function() { $.ajax({ url: createURL('listVirtualMachines'), @@ -1147,11 +1147,11 @@ async: false, success: function(json) { var instanceObjs = json.listvirtualmachinesresponse.virtualmachine; - $(instanceObjs).each(function() { + $(instanceObjs).each(function() { items.push({ id: this.id, description: this.displayname ? this.displayname : this.name - }); + }); }); } }); @@ -1285,12 +1285,12 @@ title: 'label.create.template', preFilter: cloudStack.preFilter.createTemplate, desc: '', - preFilter: function(args) { - if (args.context.volumes[0].hypervisor == "XenServer") { - if (isAdmin()) { + preFilter: function(args) { + if (args.context.volumes[0].hypervisor == "XenServer") { + if (isAdmin()) { args.$form.find('.form-item[rel=xenserverToolsVersion61plus]').css('display', 'inline-block'); - } - } + } + } }, fields: { name: { @@ -1304,24 +1304,24 @@ validation: { required: true } - }, + }, xenserverToolsVersion61plus: { label: 'label.xenserver.tools.version.61.plus', isBoolean: true, - isChecked: function (args) { + isChecked: function (args) { var b = false; - var vmObj; + var vmObj; $.ajax({ url: createURL("listVirtualMachines"), data: { id: args.context.volumes[0].virtualmachineid }, async: false, - success: function(json) { + success: function(json) { vmObj = json.listvirtualmachinesresponse.virtualmachine[0]; - } - }); - if (vmObj == undefined) { //e.g. VM has failed over + } + }); + if (vmObj == undefined) { //e.g. VM has failed over if (isAdmin()) { $.ajax({ url: createURL('listConfigurations'), @@ -1336,18 +1336,18 @@ } }); } - } else { + } else { if ('details' in vmObj && 'hypervisortoolsversion' in vmObj.details) { if (vmObj.details.hypervisortoolsversion == 'xenserver61') b = true; else b = false; } - } + } return b; }, isHidden: true - }, + }, osTypeId: { label: 'label.os.type', select: function(args) { @@ -1406,17 +1406,17 @@ isfeatured: (args.data.isFeatured == "on") }); } - - //XenServer only (starts here) + + //XenServer only (starts here) if (args.$form.find('.form-item[rel=xenserverToolsVersion61plus]').length > 0) { if (args.$form.find('.form-item[rel=xenserverToolsVersion61plus]').css("display") != "none") { $.extend(data, { 'details[0].hypervisortoolsversion': (args.data.xenserverToolsVersion61plus == "on") ? "xenserver61" : "xenserver56" }); } - } - //XenServer only (ends here) - + } + //XenServer only (ends here) + $.ajax({ url: createURL('createTemplate'), data: data, @@ -1580,8 +1580,8 @@ return; var $form = $(this).closest('form'); - - var $shrinkok = $form.find('.form-item[rel=shrinkok]'); + + var $shrinkok = $form.find('.form-item[rel=shrinkok]'); //unit of args.context.volumes[0].size is "byte" //unit of selectedDiskOfferingObj.disksize is "gigabyte" ("GB"), so transfer it into "byte" by multiply (1024 * 1024 * 1024) if (args.context.volumes[0].size > selectedDiskOfferingObj.disksize * (1024 * 1024 * 1024)) { //if original disk size > new disk size @@ -1589,7 +1589,7 @@ } else { $shrinkok.hide(); } - + var $newsize = $form.find('.form-item[rel=newsize]'); if (selectedDiskOfferingObj.iscustomized == true) { $newsize.css('display', 'inline-block'); @@ -1642,11 +1642,11 @@ }, action: function(args) { var array1 = []; - - if(args.$form.find('.form-item[rel=shrinkok]').css("display") != "none") { - array1.push("&shrinkok=" + (args.data.shrinkok == "on")); - } - + + if(args.$form.find('.form-item[rel=shrinkok]').css("display") != "none") { + array1.push("&shrinkok=" + (args.data.shrinkok == "on")); + } + var newDiskOffering = args.data.newdiskoffering; var newSize; if (selectedDiskOfferingObj.iscustomized == true) { @@ -1838,13 +1838,13 @@ dataType: "json", async: true, success: function(json) { - var jsonObj = json.listvolumesresponse.volume[0]; - + var jsonObj = json.listvolumesresponse.volume[0]; + $(window).trigger('cloudStack.module.sharedFunctions.addExtraProperties', { obj: jsonObj, objType: "Volume" }); - + args.response.success({ actionFilter: volumeActionfilter, data: jsonObj @@ -2129,9 +2129,9 @@ validation: { required: true } - }, + }, zoneid: { - label: 'label.availability.zone', + label: 'label.availability.zone', isHidden: true, select: function(args) { $.ajax({ @@ -2139,11 +2139,11 @@ dataType: "json", async: true, success: function(json) { - var zoneObjs = json.listzonesresponse.zone; + var zoneObjs = json.listzonesresponse.zone; var items = [{ id: '', description: '' - }]; + }]; if (zoneObjs != null) { for (i = 0; i < zoneObjs.length; i++) { items.push({ @@ -2151,14 +2151,14 @@ description: zoneObjs[i].name }); } - } - args.response.success({ + } + args.response.success({ data: items }); } }); } - } + } } }, action: function(args) { @@ -2166,13 +2166,13 @@ snapshotid: args.context.snapshots[0].id, name: args.data.name }; - - if (args.$form.find('.form-item[rel=zoneid]').css("display") != "none" && args.data.zoneid != '') { + + if (args.$form.find('.form-item[rel=zoneid]').css("display") != "none" && args.data.zoneid != '') { $.extend(data, { zoneId: args.data.zoneid - }); - } - + }); + } + $.ajax({ url: createURL('createVolume'), data: data, @@ -2329,22 +2329,22 @@ return ["remove"]; } - if (jsonObj.hypervisor != "Ovm" && jsonObj.state == "Ready") { - if (jsonObj.hypervisor == 'KVM') { - if (jsonObj.vmstate == 'Running') { + if (jsonObj.hypervisor != "Ovm" && jsonObj.state == "Ready") { + if (jsonObj.hypervisor == 'KVM') { + if (jsonObj.vmstate == 'Running') { if (g_kvmsnapshotenabled == true) { //"kvm.snapshot.enabled" flag should be taken to account only when snapshot is being created for Running vm (CLOUDSTACK-4428) allowedActions.push("takeSnapshot"); allowedActions.push("recurringSnapshot"); - } + } } else { allowedActions.push("takeSnapshot"); allowedActions.push("recurringSnapshot"); - } + } } else { allowedActions.push("takeSnapshot"); allowedActions.push("recurringSnapshot"); } - + if (jsonObj.type == "DATADISK") { allowedActions.push("resize"); } diff --git a/ui/scripts/system.js b/ui/scripts/system.js index 0f8fe6a9b38..d4dc3020e7b 100644 --- a/ui/scripts/system.js +++ b/ui/scripts/system.js @@ -16,27 +16,27 @@ // under the License. (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) - + // Add router type to virtual router // -- can be either Project, VPC, or System (standard) var mapRouterType = function (index, router) { var routerType = _l('label.menu.system'); - + if (router.projectid) routerType = _l('label.project'); if (router.vpcid) routerType = _l('label.vpc'); - + return $.extend(router, { routerType: routerType }); }; - + cloudStack.publicIpRangeAccount = { dialog: function (args) { return function (args) { @@ -71,7 +71,7 @@ } }; var success = args.response.success; - + if (args.$item) { // Account data is read-only after creation $.ajax({ @@ -82,7 +82,7 @@ }, success: function (json) { var domain = json.listdomainsresponse.domain[0]; - + cloudStack.dialog.notice({ message: '' }); @@ -97,7 +97,7 @@ }, after: function (args) { var data = cloudStack.serializeForm(args.$form); - + success({ data: data }); @@ -107,11 +107,11 @@ }; } }; - + var getTrafficType = function (physicalNetwork, typeID) { var trafficType = { }; - + $.ajax({ url: createURL('listTrafficTypes'), data: { @@ -126,7 +126,7 @@ })[0]; } }); - + if (trafficType.xennetworklabel == null || trafficType.xennetworklabel == 0) trafficType.xennetworklabel = _l( 'label.network.label.display.for.blank.value'); if (trafficType.kvmnetworklabel == null || trafficType.kvmnetworklabel == 0) @@ -141,10 +141,10 @@ trafficType.hypervnetworklabel = _l( 'label.network.label.display.for.blank.value'); if (trafficType.ovm3networklabel == null || trafficType.ovm3networklabel == 0) trafficType.ovm3networklabel = _l( 'label.network.label.display.for.blank.value'); - + return trafficType; }; - + var updateTrafficLabels = function (trafficType, labels, complete) { var array1 =[]; if (labels.xennetworklabel != _l( 'label.network.label.display.for.blank.value')) @@ -161,7 +161,7 @@ array1.push("&hypervnetworklabel=" + labels.hypervnetworklabel); if (labels.ovm3networklabel != _l( 'label.network.label.display.for.blank.value')) array1.push("&ovm3networklabel=" + labels.ovm3networklabel); - + $.ajax({ url: createURL('updateTrafficType' + array1.join("")), data: { @@ -169,7 +169,7 @@ }, success: function (json) { var jobID = json.updatetraffictyperesponse.jobid; - + cloudStack.ui.notifications.add({ desc: 'Update traffic labels', poll: pollAsyncJobResult, @@ -193,7 +193,7 @@ } }) }; - + function virtualRouterProviderActionFilter(args) { var allowedActions =[]; var jsonObj = args.context.item; //args.context.item == nspMap["virtualRouter"] @@ -202,7 +202,7 @@ allowedActions.push("enable"); return allowedActions; }; - + function ovsProviderActionFilter(args) { var allowedActions = []; var jsonObj = args.context.item; //args.context.item == nspMap["virtualRouter"] @@ -212,11 +212,11 @@ allowedActions.push("enable"); return allowedActions; }; - + cloudStack.sections.system = { title: 'label.menu.infrastructure', id: 'system', - + // System dashboard dashboard: { dataProvider: function (args) { @@ -236,7 +236,7 @@ } }); }, - + podCount: function (data) { $.ajax({ url: createURL('listPods'), @@ -251,7 +251,7 @@ } }); }, - + clusterCount: function (data) { $.ajax({ url: createURL('listClusters'), @@ -263,9 +263,9 @@ dataFns.hostCount($.extend(data, { 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 ? @@ -275,7 +275,7 @@ } }); }, - + hostCount: function (data) { var data2 = { type: 'routing', @@ -292,7 +292,7 @@ } }); }, - + primaryStorageCount: function (data) { var data2 = { page: 1, @@ -308,7 +308,7 @@ } }); }, - + secondaryStorageCount: function (data) { var data2 = { page: 1, @@ -324,7 +324,7 @@ } }); }, - + systemVmCount: function (data) { $.ajax({ url: createURL('listSystemVms'), @@ -339,7 +339,7 @@ } }); }, - + virtualRouterCount: function (data) { var data2 = { listAll: true, @@ -352,12 +352,12 @@ success: function (json) { var total1 = json.listroutersresponse.count ? json.listroutersresponse.count: 0; var total2 = 0; //reset - + /* * In project view, the first listRotuers API(without projectid=-1) will return the same objects as the second listRouters API(with projectid=-1), - * because in project view, all API calls are appended with projectid=[projectID]. + * because in project view, all API calls are appended with projectid=[projectID]. * Therefore, we only call the second listRouters API(with projectid=-1) in non-project view. - */ + */ if (cloudStack.context && cloudStack.context.projects == null) { //non-project view var data3 = { listAll: true, @@ -370,39 +370,39 @@ data: data3, async: false, success: function (json) { - total2 = json.listroutersresponse.count ? json.listroutersresponse.count : 0; + total2 = json.listroutersresponse.count ? json.listroutersresponse.count : 0; } }); } - + dataFns.capacity($.extend(data, { virtualRouterCount: (total1 + total2) })); } }); }, - + capacity: function (data) { if (data.zoneCount) { $.ajax({ url: createURL('listCapacity'), success: function (json) { var capacities = json.listcapacityresponse.capacity; - + var capacityTotal = function (id, converter) { var capacity = $.grep(capacities, function (capacity) { return capacity.type == id; })[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), @@ -418,7 +418,7 @@ })); } }, - + socketInfo: function (data) { var socketCount = 0; $.ajax({ @@ -431,8 +431,8 @@ var currentPage = 1; var returnedHostCount = 0; var returnedHostCpusocketsSum = 0; - - var callListHostsWithPage = function() { + + var callListHostsWithPage = function() { $.ajax({ url: createURL('listHosts'), async: false, @@ -446,17 +446,17 @@ if (json.listhostsresponse.count == undefined) { return; } - + 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(); @@ -464,32 +464,32 @@ } }); } - + callListHostsWithPage(); - + socketCount += returnedHostCpusocketsSum; }) }); } }); - + complete($.extend(data, { socketCount: socketCount })); } }; - + var complete = function (data) { args.response.success({ data: data }); }; - + dataFns.zoneCount({ }); } }, - + zoneDashboard: function (args) { $.ajax({ url: createURL('listCapacity'), @@ -500,24 +500,24 @@ var capacities = json.listcapacityresponse.capacity; 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: { @@ -545,7 +545,7 @@ data: nspHardcodingArray }) }, - + detailView: function (args) { return cloudStack.sections.system.naas.networkProviders.types[ args.context.networkProviders[0].id]; @@ -559,7 +559,7 @@ label: 'label.edit', action: function (args) { var trafficType = getTrafficType(selectedPhysicalNetworkObj, 'Public'); - + updateTrafficLabels(trafficType, args.data, function () { args.response.success(); }); @@ -607,7 +607,7 @@ isEditable: true } }], - + dataProvider: function (args) { $.ajax({ url: createURL("listNetworks&listAll=true&trafficType=Public&isSystem=true&zoneId=" + selectedZoneObj.id, { @@ -618,9 +618,9 @@ 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; @@ -636,7 +636,7 @@ }); } }, - + ipAddresses: { title: 'label.ip.ranges', custom: function (args) { @@ -682,25 +682,25 @@ action: function (args) { var array1 =[]; array1.push("&zoneId=" + args.context.zones[0].id); - + if (args.data.vlan != null && args.data.vlan.length > 0) array1.push("&vlan=" + todb(args.data.vlan)); else array1.push("&vlan=untagged"); - + array1.push("&gateway=" + args.data.gateway); array1.push("&netmask=" + args.data.netmask); array1.push("&startip=" + args.data.startip); if (args.data.endip != null && args.data.endip.length > 0) array1.push("&endip=" + args.data.endip); - + if (args.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 - + $.ajax({ url: createURL("createVlanIpRange" + array1.join("")), dataType: "json", @@ -754,7 +754,7 @@ }); } }, - + releaseFromAccount: { label: 'label.release.account', action: function (args) { @@ -779,7 +779,7 @@ }); } }, - + addAccount: { label: 'label.add.account', createForm: { @@ -844,7 +844,7 @@ dataType: "json", success: function (json) { var items = json.listvlaniprangesresponse.vlaniprange; - + args.response.success({ data: $.map(items, function (item) { return $.extend(item, { @@ -865,7 +865,7 @@ } } }, - + 'storage': { detailView: { actions: { @@ -873,7 +873,7 @@ label: 'label.edit', action: function (args) { var trafficType = getTrafficType(selectedPhysicalNetworkObj, 'Storage'); - + updateTrafficLabels(trafficType, args.data, function () { args.response.success(); }); @@ -921,7 +921,7 @@ isEditable: true } }], - + dataProvider: function (args) { $.ajax({ url: createURL("listNetworks&listAll=true&trafficType=Storage&isSystem=true&zoneId=" + selectedZoneObj.id), @@ -931,7 +931,7 @@ 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; @@ -946,7 +946,7 @@ }); } }, - + ipAddresses: { title: 'label.ip.ranges', custom: function (args) { @@ -1009,17 +1009,17 @@ 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("&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); - + $.ajax({ url: createURL("createStorageNetworkIpRange" + array1.join("")), dataType: "json", @@ -1081,7 +1081,7 @@ } } }, - + 'management': { detailView: { actions: { @@ -1089,7 +1089,7 @@ label: 'label.edit', action: function (args) { var trafficType = getTrafficType(selectedPhysicalNetworkObj, 'Management'); - + updateTrafficLabels(trafficType, args.data, function () { args.response.success(); }); @@ -1143,9 +1143,9 @@ dataType: "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; @@ -1215,7 +1215,7 @@ } } }, - + 'guest': { //physical network + Guest traffic type detailView: { @@ -1226,23 +1226,23 @@ var data = { id: selectedPhysicalNetworkObj.id }; - + $.extend(data, { vlan: args.data.vlan }); - + $.extend(data, { tags: args.data.tags }); - + $.ajax({ url: createURL('updatePhysicalNetwork'), data: data, success: function (json) { var jobId = json.updatephysicalnetworkresponse.jobid; - + var trafficType = getTrafficType(selectedPhysicalNetworkObj, 'Guest'); - + updateTrafficLabels(trafficType, args.data, function () { args.response.success({ _custom: { @@ -1258,7 +1258,7 @@ } } }, - + tabFilter: function (args) { var hiddenTabs =[]; if (selectedZoneObj.networktype == 'Basic') { @@ -1270,7 +1270,7 @@ } return hiddenTabs; }, - + tabs: { details: { title: 'label.details', @@ -1341,7 +1341,7 @@ async: true, success: function (json) { selectedPhysicalNetworkObj = json.listphysicalnetworksresponse.physicalnetwork[0]; - + // var startVlan, endVlan; var vlan = selectedPhysicalNetworkObj.vlan; /* if(vlan != null && vlan.length > 0) { @@ -1356,7 +1356,7 @@ selectedPhysicalNetworkObj["startVlan"] = startVlan; selectedPhysicalNetworkObj["endVlan"] = endVlan; }*/ - + //traffic type var xenservertrafficlabel, kvmtrafficlabel, vmwaretrafficlabel; var trafficType = getTrafficType(selectedPhysicalNetworkObj, 'Guest'); @@ -1379,7 +1379,7 @@ }); } }, - + ipAddresses: { title: 'label.ip.ranges', custom: function (args) { @@ -1444,7 +1444,7 @@ 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", @@ -1507,7 +1507,7 @@ }); if (selectedGuestNetworkObj == null) return; - + $.ajax({ url: createURL("listVlanIpRanges&zoneid=" + selectedZoneObj.id + "&networkId=" + selectedGuestNetworkObj.id), dataType: "json", @@ -1522,7 +1522,7 @@ }); } }, - + network: { title: 'label.network', listView: { @@ -1552,7 +1552,7 @@ actions: { add: addGuestNetworkDialog.def }, - + dataProvider: function (args) { var array1 =[]; if (args.filterBy != null) { @@ -1565,7 +1565,7 @@ } } } - + //need to make 2 listNetworks API call to get all guest networks from one physical network in Advanced zone var items =[]; //"listNetworks&projectid=-1": list guest networks under all projects (no matter who the owner is) @@ -1578,13 +1578,13 @@ items = json.listnetworksresponse.network; } }); - + 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("")), @@ -1597,16 +1597,16 @@ }); } }); - + $(items).each(function () { addExtraPropertiesToGuestNetworkObject(this); }); - + args.response.success({ data: items }); }, - + detailView: { name: 'label.guest.network.details', noCompact: true, @@ -1634,15 +1634,15 @@ 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)); - + //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 cloudStack.dialog.confirm({ @@ -1695,7 +1695,7 @@ return; } } - + $.ajax({ url: createURL("updateNetwork&id=" + args.context.networks[0].id + array1.join("")), dataType: "json", @@ -1719,7 +1719,7 @@ poll: pollAsyncJobResult } }, - + 'restart': { label: 'label.restart.network', createForm: { @@ -1774,7 +1774,7 @@ poll: pollAsyncJobResult } }, - + 'remove': { label: 'label.action.delete.network', messages: { @@ -1820,7 +1820,7 @@ hiddenFields.push("gateway"); //hiddenFields.push("netmask"); } - + if (selectedGuestNetworkObj.type == "Isolated") { hiddenFields.push("networkofferingdisplaytext"); hiddenFields.push("networkdomaintext"); @@ -1892,23 +1892,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: 'label.ipv4.gateway' }, @@ -1916,14 +1916,14 @@ cidr: { label: 'label.ipv4.cidr' }, - + ip6gateway: { label: 'label.ipv6.gateway' }, ip6cidr: { label: 'label.ipv6.CIDR' }, - + networkdomaintext: { label: 'label.network.domain' }, @@ -1931,7 +1931,7 @@ label: 'label.network.domain', isEditable: true }, - + domain: { label: 'label.domain' }, @@ -1961,7 +1961,7 @@ listAll: true //pass "&listAll=true" to "listNetworks&id=xxxxxxxx" for now before API gets fixed. }); } - + $.ajax({ url: createURL("listNetworks"), data: data, @@ -1969,12 +1969,12 @@ success: function (json) { selectedGuestNetworkObj = json.listnetworksresponse.network[0]; addExtraPropertiesToGuestNetworkObject(selectedGuestNetworkObj); - + $(window).trigger('cloudStack.module.sharedFunctions.addExtraProperties', { obj: selectedGuestNetworkObj, objType: "Network" }); - + args.response.success({ actionFilter: cloudStack.actionFilter.guestNetwork, data: selectedGuestNetworkObj @@ -1987,7 +1987,7 @@ } } }, - + dedicatedGuestVlanRanges: { title: 'label.dedicated.vlan.vni.ranges', listView: { @@ -2102,7 +2102,7 @@ } } }, - + detailView: { name: 'label.vlan.range.details', actions: { @@ -2139,7 +2139,7 @@ } } }, - + tabs: { details: { title: 'label.details', @@ -2182,7 +2182,7 @@ } } }, - + networks: { listView: { id: 'physicalNetworks', @@ -2206,7 +2206,7 @@ label: 'label.isolation.method' } }, - + actions: { remove: { label: 'label.action.delete.physical.network', @@ -2255,11 +2255,11 @@ }); } }, - + trafficTypes: { dataProvider: function (args) { selectedPhysicalNetworkObj = args.context.physicalNetworks[0]; - + $.ajax({ url: createURL('listTrafficTypes'), data: { @@ -2278,25 +2278,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) { args.response.success(); }, - + disable: function (args) { args.response.success(); } }, - + types: { virtualRouter: { id: 'virtualRouterProviders', @@ -2352,7 +2352,7 @@ }); } }, - + instances: { title: 'label.instances', listView: { @@ -2393,7 +2393,7 @@ } } } - + var data2 = { forvpc: false }; @@ -2404,16 +2404,16 @@ success: function (json) { var items = json.listroutersresponse.router ? json.listroutersresponse.router:[]; - + $(items).map(function (index, item) { routers.push(item); }); - + /* * In project view, the first listRotuers API(without projectid=-1) will return the same objects as the second listRouters API(with projectid=-1), - * because in project view, all API calls are appended with projectid=[projectID]. + * because in project view, all API calls are appended with projectid=[projectID]. * Therefore, we only call the second listRouters API(with projectid=-1) in non-project view. - */ + */ if (cloudStack.context && cloudStack.context.projects == null) { //non-project view $.ajax({ url: createURL("listRouters&zoneid=" + selectedZoneObj.id + "&listAll=true&page=" + args.page + "&pagesize=" + pageSize + array1.join("") + "&projectid=-1"), @@ -2422,14 +2422,14 @@ success: function (json) { var items = json.listroutersresponse.router ? json.listroutersresponse.router:[]; - + $(items).map(function (index, item) { routers.push(item); }); } }); } - + args.response.success({ actionFilter: routerActionfilter, data: $(routers).map(mapRouterType) @@ -2475,7 +2475,7 @@ poll: pollAsyncJobResult } }, - + stop: { label: 'label.action.stop.router', createForm: { @@ -2521,7 +2521,7 @@ poll: pollAsyncJobResult } }, - + 'remove': { label: 'label.destroy.router', messages: { @@ -2551,7 +2551,7 @@ poll: pollAsyncJobResult } }, - + migrate: { label: 'label.action.migrate.router', createForm: { @@ -2631,7 +2631,7 @@ poll: pollAsyncJobResult } }, - + viewConsole: { label: 'label.view.console', action: { @@ -2780,7 +2780,7 @@ async: true, success: function (json) { var jsonObj = json.listroutersresponse.router[0].nic; - + args.response.success({ actionFilter: routerActionfilter, data: $.map(jsonObj, function (nic, index) { @@ -2867,7 +2867,7 @@ } } }, - + InternalLbVm: { id: 'InternalLbVm', label: 'label.internallbvm', @@ -2922,7 +2922,7 @@ }); } }, - + instances: { title: 'label.instances', listView: { @@ -2963,25 +2963,25 @@ } } } - + var routers =[]; $.ajax({ url: createURL("listInternalLoadBalancerVMs&zoneid=" + selectedZoneObj.id + "&listAll=true&page=" + args.page + "&pagesize=" + pageSize + array1.join("")), success: function (json) { var items = json.listinternallbvmssresponse.internalloadbalancervm ? 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) { var items = json.listinternallbvmssresponse.internalloadbalancervm ? json.listinternallbvmssresponse.internalloadbalancervm:[]; - + $(items).map(function (index, item) { routers.push(item); }); @@ -3032,7 +3032,7 @@ poll: pollAsyncJobResult } }, - + stop: { label: 'label.stop.lb.vm', createForm: { @@ -3078,7 +3078,7 @@ poll: pollAsyncJobResult } }, - + migrate: { label: 'label.migrate.lb.vm', createForm: { @@ -3157,7 +3157,7 @@ poll: pollAsyncJobResult } }, - + viewConsole: { label: 'label.view.console', action: { @@ -3306,7 +3306,7 @@ async: true, success: function (json) { var jsonObj = json.listinternallbvmssresponse.internalloadbalancervm[0].nic; - + args.response.success({ actionFilter: internallbinstanceActionfilter, data: $.map(jsonObj, function (nic, index) { @@ -3393,7 +3393,7 @@ } } }, - + vpcVirtualRouter: { id: 'vpcVirtualRouterProviders', label: 'label.vpc.virtual.router', @@ -3448,7 +3448,7 @@ }); } }, - + instances: { title: 'label.instances', listView: { @@ -3489,7 +3489,7 @@ } } } - + var data2 = { forvpc: true }; @@ -3504,12 +3504,12 @@ $(items).map(function (index, item) { routers.push(item); }); - + /* * In project view, the first listRotuers API(without projectid=-1) will return the same objects as the second listRouters API(with projectid=-1), - * because in project view, all API calls are appended with projectid=[projectID]. + * because in project view, all API calls are appended with projectid=[projectID]. * Therefore, we only call the second listRouters API(with projectid=-1) in non-project view. - */ + */ if (cloudStack.context && cloudStack.context.projects == null) { //non-project view $.ajax({ url: createURL("listRouters&zoneid=" + selectedZoneObj.id + "&listAll=true&page=" + args.page + "&pagesize=" + pageSize + array1.join("") + "&projectid=-1"), @@ -3524,7 +3524,7 @@ } }); } - + args.response.success({ actionFilter: routerActionfilter, data: $(routers).map(mapRouterType) @@ -3570,7 +3570,7 @@ poll: pollAsyncJobResult } }, - + stop: { label: 'label.action.stop.router', createForm: { @@ -3616,7 +3616,7 @@ poll: pollAsyncJobResult } }, - + restart: { label: 'label.action.reboot.router', messages: { @@ -3652,7 +3652,7 @@ poll: pollAsyncJobResult } }, - + 'remove': { label: 'label.destroy.router', messages: { @@ -3682,7 +3682,7 @@ poll: pollAsyncJobResult } }, - + migrate: { label: 'label.action.migrate.router', createForm: { @@ -3762,7 +3762,7 @@ poll: pollAsyncJobResult } }, - + viewConsole: { label: 'label.view.console', action: { @@ -3938,7 +3938,7 @@ } } }, - + Ovs: { id: "Ovs", label: "label.ovs", @@ -3947,7 +3947,7 @@ fields: { name: { label: 'label.name' - }, + }, state: { label: 'label.status', indicator: { @@ -3962,10 +3962,10 @@ name: { label: 'label.name' } - }, { + }, { state: { label: 'label.state' - }, + }, supportedServices: { label: 'label.supported.services' }, @@ -4051,8 +4051,8 @@ } } } - }, - + }, + // NetScaler provider detail view netscaler: { type: 'detailView', @@ -4141,7 +4141,7 @@ label: 'label.private.interface', docID: 'helpNetScalerPrivateInterface' }, - + gslbprovider: { label: 'label.gslb.service', isBoolean: true, @@ -4153,7 +4153,7 @@ gslbproviderprivateip: { label: 'label.gslb.service.private.ip' }, - + numretries: { label: 'label.numretries', defaultValue: '2', @@ -4307,7 +4307,7 @@ jobId: jid } }); - + $(window).trigger('cloudStack.fullRefresh'); } }); @@ -4326,7 +4326,7 @@ } } }, - + //Baremetal DHCP provider detail view BaremetalDhcpProvider: { type: 'detailView', @@ -4479,7 +4479,7 @@ jobId: jid } }); - + $(window).trigger('cloudStack.fullRefresh'); } }); @@ -4498,7 +4498,7 @@ } } }, - + //Baremetal PXE provider detail view BaremetalPxeProvider: { type: 'detailView', @@ -4657,7 +4657,7 @@ jobId: jid } }); - + $(window).trigger('cloudStack.fullRefresh'); } }); @@ -4676,7 +4676,7 @@ } } }, - + //f5 provider detail view f5: { type: 'detailView', @@ -4914,7 +4914,7 @@ jobId: jid } }); - + $(window).trigger('cloudStack.fullRefresh'); } }); @@ -4933,7 +4933,7 @@ } } }, - + // SRX provider detailView srx: { type: 'detailView', @@ -5188,7 +5188,7 @@ jobId: jid } }); - + $(window).trigger('cloudStack.fullRefresh'); } }); @@ -5207,7 +5207,7 @@ } } }, - + // Palo Alto provider detailView pa: { type: 'detailView', @@ -5472,7 +5472,7 @@ jobId: jid } }); - + $(window).trigger('cloudStack.fullRefresh'); } }); @@ -5491,7 +5491,7 @@ } } }, - + // Security groups detail view securityGroups: { id: 'securityGroup-providers', @@ -5601,7 +5601,7 @@ } } }, - + fields: { id: { label: 'label.id' @@ -5805,7 +5805,7 @@ jobId: jid } }); - + $(window).trigger('cloudStack.fullRefresh'); } }); @@ -6214,7 +6214,7 @@ jobId: jid } }); - + $(window).trigger('cloudStack.fullRefresh'); } }); @@ -6233,8 +6233,8 @@ } } }, - - + + // MidoNet provider detailView midoNet: { id: 'midoNet', @@ -6354,7 +6354,7 @@ } } }, - + //ovs Ovs: { id: 'ovsProviders', @@ -6410,7 +6410,7 @@ }); } }, - + instances: { title: 'label.instances', listView: { @@ -6451,7 +6451,7 @@ } } } - + var data2 = { forvpc: false }; @@ -6462,11 +6462,11 @@ success: function (json) { var items = 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"), @@ -6474,7 +6474,7 @@ success: function (json) { var items = json.listroutersresponse.router ? json.listroutersresponse.router:[]; - + $(items).map(function (index, item) { routers.push(item); }); @@ -6525,7 +6525,7 @@ poll: pollAsyncJobResult } }, - + stop: { label: 'label.action.stop.router', createForm: { @@ -6571,7 +6571,7 @@ poll: pollAsyncJobResult } }, - + 'remove': { label: 'label.destroy.router', messages: { @@ -6601,7 +6601,7 @@ poll: pollAsyncJobResult } }, - + migrate: { label: 'label.action.migrate.router', createForm: { @@ -6681,7 +6681,7 @@ poll: pollAsyncJobResult } }, - + viewConsole: { label: 'label.view.console', action: { @@ -6830,7 +6830,7 @@ async: true, success: function (json) { var jsonObj = json.listroutersresponse.router[0].nic; - + args.response.success({ actionFilter: routerActionfilter, data: $.map(jsonObj, function (nic, index) { @@ -7141,7 +7141,7 @@ jobId: jid } }); - + $(window).trigger('cloudStack.fullRefresh'); } }); @@ -7434,7 +7434,7 @@ jobId: jid } }); - + $(window).trigger('cloudStack.fullRefresh'); } }); @@ -7696,7 +7696,7 @@ } } }, - + dataProvider: function (args) { var array1 =[]; if (args.filterBy != null) { @@ -7722,7 +7722,7 @@ } }); }, - + actions: { add: { label: 'label.add.zone', @@ -7745,7 +7745,7 @@ } } }, - + detailView: { isMaximized: true, actions: { @@ -7793,7 +7793,7 @@ name: args.data.name, vcenter: args.data.vcenter }; - + if (args.data.username != null && args.data.username.length > 0) { $.extend(data, { username: args.data.username @@ -7804,7 +7804,7 @@ password: args.data.password }) } - + $.ajax({ url: createURL('addVmwareDc'), data: data, @@ -7821,7 +7821,7 @@ } } }, - + removeVmwareDc: { label: 'label.remove.vmware.datacenter', messages: { @@ -7843,9 +7843,9 @@ 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] }); @@ -7862,7 +7862,7 @@ } } }, - + enable: { label: 'label.action.enable.zone', messages: { @@ -7893,7 +7893,7 @@ } } }, - + disable: { label: 'label.action.disable.zone', messages: { @@ -7924,7 +7924,7 @@ } } }, - + dedicateZone: { label: 'label.dedicate.zone', messages: { @@ -7951,7 +7951,7 @@ success: function (json) { var domainObjs = json.listdomainsresponse.domain; var items =[]; - + $(domainObjs).each(function () { items.push({ id: this.id, @@ -7983,7 +7983,7 @@ var array2 =[]; if (args.data.accountId != "") array2.push("&account=" + todb(args.data.accountId)); - + $.ajax({ url: createURL("dedicateZone&zoneId=" + args.context.physicalResources[0].id + @@ -8042,7 +8042,7 @@ poll: pollAsyncJobResult } }, - + 'remove': { label: 'label.action.delete.zone', messages: { @@ -8087,11 +8087,11 @@ //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. @@ -8117,14 +8117,14 @@ tabs: { details: { title: 'label.details', - + preFilter: function (args) { var hiddenFields =[]; if (selectedZoneObj.networktype == "Basic") hiddenFields.push("guestcidraddress"); return hiddenFields; }, - + fields:[ { name: { label: 'label.zone', @@ -8219,12 +8219,12 @@ }, success: function (json) { selectedZoneObj = json.listzonesresponse.zone[0]; - + $(window).trigger('cloudStack.module.sharedFunctions.addExtraProperties', { obj: selectedZoneObj, objType: "Zone" }); - + $.ajax({ url: createURL('listDedicatedZones'), data: { @@ -8250,7 +8250,7 @@ } } }); - + $.ajax({ url: createURL('listApis'), //listVmwareDcs API only exists in non-oss bild, so have to check whether it exists before calling it. data: { @@ -8279,7 +8279,7 @@ } //override default error handling: cloudStack.dialog.notice({ message: parseXMLHttpResponse(XMLHttpResponse)}); }); - + args.response.success({ actionFilter: zoneActionfilter, data: selectedZoneObj @@ -8288,7 +8288,7 @@ }); } }, - + compute: { title: 'label.compute.and.storage', custom: cloudStack.uiCustom.systemChart('compute') @@ -8301,7 +8301,7 @@ title: 'label.resources', custom: cloudStack.uiCustom.systemChart('resources') }, - + systemVMs: { title: 'label.system.vms', listView: { @@ -8349,7 +8349,7 @@ } } } - + var selectedZoneObj = args.context.physicalResources[0]; $.ajax({ url: createURL("listSystemVms&zoneid=" + selectedZoneObj.id + "&page=" + args.page + "&pagesize=" + pageSize + array1.join("")), @@ -8364,7 +8364,7 @@ } }); }, - + detailView: { noCompact: true, name: 'label.system.vm.details', @@ -8404,7 +8404,7 @@ poll: pollAsyncJobResult } }, - + stop: { label: 'label.action.stop.systemvm', messages: { @@ -8440,7 +8440,7 @@ poll: pollAsyncJobResult } }, - + restart: { label: 'label.action.reboot.systemvm', messages: { @@ -8476,7 +8476,7 @@ poll: pollAsyncJobResult } }, - + remove: { label: 'label.action.destroy.systemvm', messages: { @@ -8511,7 +8511,7 @@ poll: pollAsyncJobResult } }, - + migrate: { label: 'label.action.migrate.systemvm', messages: { @@ -8593,7 +8593,7 @@ poll: pollAsyncJobResult } }, - + scaleUp: { label: 'label.change.service.offering', createForm: { @@ -8639,7 +8639,7 @@ } } }, - + action: function (args) { $.ajax({ url: createURL("scaleSystemVm&id=" + args.context.systemVMs[0].id + "&serviceofferingid=" + args.data.serviceOfferingId), @@ -8669,7 +8669,7 @@ return 'message.confirm.scale.up.system.vm'; }, notification: function (args) { - + return 'label.system.vm.scaled.up'; } }, @@ -8677,8 +8677,8 @@ poll: pollAsyncJobResult } }, - - + + viewConsole: { label: 'label.view.console', action: { @@ -8764,7 +8764,7 @@ } } }, - + // Granular settings for zone settings: { title: 'label.settings', @@ -8782,7 +8782,7 @@ data: json.listconfigurationsresponse.configuration }); }, - + error: function (json) { args.response.error(parseXMLHttpResponse(json)); } @@ -8795,7 +8795,7 @@ name: args.data.jsonObj.name, value: args.data.value }; - + $.ajax({ url: createURL('updateConfiguration&zoneid=' + args.context.physicalResources[0].id), data: data, @@ -8805,7 +8805,7 @@ data: item }); }, - + error: function (json) { args.response.error(parseXMLHttpResponse(json)); } @@ -8825,7 +8825,7 @@ var data = { }; listViewDataProvider(args, data); - + $.ajax({ url: createURL('listPods'), data: data, @@ -8839,11 +8839,11 @@ } }); }, - + detailView: { updateContext: function (args) { var zone; - + $.ajax({ url: createURL('listZones'), data: { @@ -8854,16 +8854,16 @@ zone = json.listzonesresponse.zone[0]; } }); - + selectedZoneObj = zone; - + return { zones:[zone] }; } } }); - + return listView; }, clusters: function () { @@ -8874,7 +8874,7 @@ var data = { }; listViewDataProvider(args, data); - + $.ajax({ url: createURL('listClusters'), data: data, @@ -8888,11 +8888,11 @@ } }); }, - + detailView: { updateContext: function (args) { var zone; - + $.ajax({ url: createURL('listZones'), data: { @@ -8903,16 +8903,16 @@ zone = json.listzonesresponse.zone[0]; } }); - + selectedZoneObj = zone; - + return { zones:[zone] }; } } }); - + return listView; }, hosts: function () { @@ -8924,7 +8924,7 @@ type: 'routing' }; listViewDataProvider(args, data); - + $.ajax({ url: createURL('listHosts'), data: data, @@ -8938,11 +8938,11 @@ } }); }, - + detailView: { updateContext: function (args) { var zone; - + $.ajax({ url: createURL('listZones'), data: { @@ -8953,16 +8953,16 @@ zone = json.listzonesresponse.zone[0]; } }); - + selectedZoneObj = zone; - + return { zones:[zone] }; } } }); - + return listView; }, primaryStorage: function () { @@ -8973,7 +8973,7 @@ var data = { }; listViewDataProvider(args, data); - + $.ajax({ url: createURL('listStoragePools'), data: data, @@ -8987,11 +8987,11 @@ } }); }, - + detailView: { updateContext: function (args) { var zone; - + $.ajax({ url: createURL('listZones'), data: { @@ -9002,19 +9002,19 @@ zone = json.listzonesresponse.zone[0]; } }); - + selectedZoneObj = zone; - + return { zones:[zone] }; } } }); - + return listView; }, - + secondaryStorage: function () { var listView = $.extend( true, { @@ -9028,7 +9028,7 @@ type: 'SecondaryStorage' }; listViewDataProvider(args, data); - + $.ajax({ url: createURL('listImageStores'), data: data, @@ -9056,7 +9056,7 @@ var data = { }; listViewDataProvider(args, data); - + $.ajax({ url: createURL('listSecondaryStagingStores'), data: data, @@ -9070,7 +9070,7 @@ } }); } - + /* , detailView: { @@ -9085,7 +9085,7 @@ } } }); - + return listView; }, systemVms: function () { @@ -9096,7 +9096,7 @@ var data = { }; listViewDataProvider(args, data); - + $.ajax({ url: createURL('listSystemVms'), data: data, @@ -9131,11 +9131,11 @@ } }); }, - + detailView: { updateContext: function (args) { var zone; - + $.ajax({ url: createURL('listZones'), data: { @@ -9146,16 +9146,16 @@ zone = json.listzonesresponse.zone[0]; } }); - + selectedZoneObj = zone; - + return { zones:[zone] }; } } }); - + return listView; }, virtualRouters: function () { @@ -9169,9 +9169,9 @@ var data = { }; listViewDataProvider(args, data); - + var routers =[]; - + //get account-owned routers $.ajax({ url: createURL('listRouters'), @@ -9184,22 +9184,22 @@ $(items).map(function (index, item) { routers.push(item); }); - + //if account is specified in advanced search, don't search project-owned routers var accountIsNotSpecifiedInAdvSearch = 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' in args.filterBy.advSearch && args.filterBy.advSearch.account.length > 0) { accountIsNotSpecifiedInAdvSearch = false; //since account and projectid can't be specified together } } } - if (accountIsNotSpecifiedInAdvSearch) { + if (accountIsNotSpecifiedInAdvSearch) { /* * In project view, the first listRotuers API(without projectid=-1) will return the same objects as the second listRouters API(with projectid=-1), - * because in project view, all API calls are appended with projectid=[projectID]. + * because in project view, all API calls are appended with projectid=[projectID]. * Therefore, we only call the second listRouters API(with projectid=-1) in non-project view. - */ + */ if (cloudStack.context && cloudStack.context.projects == null) { //non-project view $.ajax({ url: createURL("listRouters&listAll=true&page=" + args.page + "&pagesize=" + pageSize + "&projectid=-1"), @@ -9211,27 +9211,27 @@ }); } }); - + } } - + args.response.success({ actionFilter: routerActionfilter, data: $(routers).map(mapRouterType) - }); + }); } }); - + args.response.success({ actionFilter: routerActionfilter, data: $(routers).map(mapRouterType) }); }, - + detailView: { updateContext: function (args) { var zone; - + $.ajax({ url: createURL('listZones'), data: { @@ -9242,9 +9242,9 @@ zone = json.listzonesresponse.zone[0]; } }); - + selectedZoneObj = zone; - + return { zones:[zone] }; @@ -9254,10 +9254,10 @@ } } }); - + return listView; }, - + sockets: function () { var listView = { id: 'sockets', @@ -9274,7 +9274,7 @@ }, dataProvider: function (args) { var array1 = []; - + // ***** non XenServer (begin) ***** var hypervisors = ["Hyperv", "KVM", "VMware", "BareMetal", "LXC", "Ovm3"]; @@ -9283,15 +9283,15 @@ "KVM": 1, "VMware": 1, "Ovm3": 1 - }; - + }; + for (var h = 0; h < hypervisors.length; h++) { var totalHostCount = 0; var currentPage = 1; var returnedHostCount = 0; var returnedHostCpusocketsSum = 0; - - var callListHostsWithPage = function() { + + var callListHostsWithPage = function() { $.ajax({ url: createURL('listHosts'), async: false, @@ -9305,17 +9305,17 @@ if (json.listhostsresponse.count == undefined) { return; } - + 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(); @@ -9323,18 +9323,18 @@ } }); } - + callListHostsWithPage(); - - if ((hypervisors[h] in supportSocketHypervisors) == false) { - returnedHostCpusocketsSum = 'N/A'; + + if ((hypervisors[h] in supportSocketHypervisors) == false) { + returnedHostCpusocketsSum = 'N/A'; } - + var hypervisorName = hypervisors[h]; if (hypervisorName == "Hyperv") { hypervisorName = "Hyper-V"; } - + array1.push({ hypervisor: hypervisorName, hosts: totalHostCount, @@ -9342,22 +9342,22 @@ }); } // ***** non XenServer (end) ***** - - + + // ***** XenServer (begin) ***** - var totalHostCount = 0; + var totalHostCount = 0; var currentPage = 1; var returnedHostCount = 0; - - var returnedHostCountForXenServer650 = 0; //'XenServer 6.5.0' - var returnedHostCpusocketsSumForXenServer650 = 0; - - var returnedHostCountForXenServer620 = 0; //'XenServer 6.2.0' - var returnedHostCpusocketsSumForXenServer620 = 0; - + + var returnedHostCountForXenServer650 = 0; //'XenServer 6.5.0' + var returnedHostCpusocketsSumForXenServer650 = 0; + + var returnedHostCountForXenServer620 = 0; //'XenServer 6.2.0' + var returnedHostCpusocketsSumForXenServer620 = 0; + var returnedHostCountForXenServer61x = 0; //'XenServer 6.1.x and before' - - var callListHostsWithPage = function() { + + var callListHostsWithPage = function() { $.ajax({ url: createURL('listHosts'), async: false, @@ -9367,69 +9367,69 @@ page: currentPage, pagesize: pageSize //global variable }, - success: function(json) { - if (json.listhostsresponse.count == undefined) { + success: function(json) { + if (json.listhostsresponse.count == undefined) { return; - } - - totalHostCount = json.listhostsresponse.count; + } + + totalHostCount = json.listhostsresponse.count; returnedHostCount += json.listhostsresponse.host.length; - + var items = json.listhostsresponse.host; - for (var i = 0; i < items.length; i++) { + for (var i = 0; i < items.length; i++) { if (items[i].hypervisorversion == "6.5.0") { returnedHostCountForXenServer650 ++; if (items[i].cpusockets != undefined && isNaN(items[i].cpusockets) == false) { returnedHostCpusocketsSumForXenServer650 += items[i].cpusockets; - } + } } else if (items[i].hypervisorversion == "6.2.0") { returnedHostCountForXenServer620 ++; if (items[i].cpusockets != undefined && isNaN(items[i].cpusockets) == false) { returnedHostCpusocketsSumForXenServer620 += items[i].cpusockets; - } + } } else { returnedHostCountForXenServer61x++; } - } - + } + if (returnedHostCount < totalHostCount) { currentPage++; callListHostsWithPage(); - } + } } - }); + }); } - - callListHostsWithPage(); - + + callListHostsWithPage(); + array1.push({ hypervisor: 'XenServer 6.5.0', hosts: returnedHostCountForXenServer650, - sockets: returnedHostCpusocketsSumForXenServer650 + sockets: returnedHostCpusocketsSumForXenServer650 }); - + array1.push({ hypervisor: 'XenServer 6.2.0', hosts: returnedHostCountForXenServer620, - sockets: returnedHostCpusocketsSumForXenServer620 + sockets: returnedHostCpusocketsSumForXenServer620 }); - + array1.push({ hypervisor: 'XenServer 6.1.x and before', hosts: returnedHostCountForXenServer61x, - sockets: 'N/A' - }); - + sockets: 'N/A' + }); + // ***** XenServer (end) ***** - - + + args.response.success({ data: array1 }); - + } }; - + return listView; } } @@ -9440,18 +9440,18 @@ virtualRouters: { sectionSelect: { label: 'label.select-view', - preFilter: function(args) { + preFilter: function(args) { //Only clicking ViewAll Link("view all Virtual Routers") in "Virtual Routers group by XXXXXXX" detailView will have "routerGroupByXXXXXXX" included in args.context if ("routerGroupByZone" in args.context) { - return ["routerGroupByZone"]; // read-only (i.e. text "group by Zone") + return ["routerGroupByZone"]; // read-only (i.e. text "group by Zone") } else if ( "routerGroupByPod" in args.context) { - return ["routerGroupByPod"]; // read-only (i.e. text "group by Pod") + return ["routerGroupByPod"]; // read-only (i.e. text "group by Pod") } else if ("routerGroupByCluster" in args.context) { - return ["routerGroupByCluster"]; // read-only (i.e. text "group by Cluster") + return ["routerGroupByCluster"]; // read-only (i.e. text "group by Cluster") } else if ("routerGroupByAccount" in args.context) { - return ["routerGroupByAccount"]; // read-only (i.e. text "group by Account") + return ["routerGroupByAccount"]; // read-only (i.e. text "group by Account") } else { - return ["routerNoGroup", "routerGroupByZone", "routerGroupByPod", "routerGroupByCluster", "routerGroupByAccount"]; //editable dropdown + return ["routerNoGroup", "routerGroupByZone", "routerGroupByPod", "routerGroupByCluster", "routerGroupByAccount"]; //editable dropdown } } }, @@ -9502,11 +9502,11 @@ } } } - + var data2 = { // forvpc: false }; - + if (args.context != undefined) { if ("routerGroupByZone" in args.context) { $.extend(data2, { @@ -9526,8 +9526,8 @@ domainid: args.context.routerGroupByAccount[0].domainid }) } - } - + } + var routers =[]; $.ajax({ url: createURL("listRouters&listAll=true&page=" + args.page + "&pagesize=" + pageSize + array1.join("")), @@ -9535,28 +9535,28 @@ success: function (json) { var items = json.listroutersresponse.router ? json.listroutersresponse.router:[]; - + $(items).map(function (index, item) { routers.push(item); }); - + /* * In project view, the first listRotuers API(without projectid=-1) will return the same objects as the second listRouters API(with projectid=-1), - * because in project view, all API calls are appended with projectid=[projectID]. + * because in project view, all API calls are appended with projectid=[projectID]. * Therefore, we only call the second listRouters API(with projectid=-1) in non-project view. - */ + */ if (cloudStack.context && cloudStack.context.projects == null) { //non-project view - /* - * account parameter(account+domainid) and project parameter(projectid) are not allowed to be passed together to listXXXXXXX API. + /* + * account parameter(account+domainid) and project parameter(projectid) are not allowed to be passed together to listXXXXXXX API. * So, remove account parameter(account+domainid) from data2 - */ + */ if ("account" in data2) { delete data2.account; } if ("domainid" in data2) { delete data2.domainid; - } - + } + $.ajax({ url: createURL("listRouters&listAll=true&page=" + args.page + "&pagesize=" + pageSize + array1.join("") + "&projectid=-1"), data: data2, @@ -9564,14 +9564,14 @@ success: function (json) { var items = json.listroutersresponse.router ? json.listroutersresponse.router:[]; - + $(items).map(function (index, item) { routers.push(item); }); } }); } - + args.response.success({ actionFilter: routerActionfilter, data: $(routers).map(mapRouterType) @@ -9617,7 +9617,7 @@ poll: pollAsyncJobResult } }, - + stop: { label: 'label.action.stop.router', createForm: { @@ -9663,7 +9663,7 @@ poll: pollAsyncJobResult } }, - + upgradeRouterToUseNewerTemplate: { label: 'label.upgrade.router.newer.template', messages: { @@ -9696,7 +9696,7 @@ poll: pollAsyncJobResult } }, - + 'remove': { label: 'label.destroy.router', messages: { @@ -9726,7 +9726,7 @@ poll: pollAsyncJobResult } }, - + restart: { label: 'label.action.reboot.router', messages: { @@ -9762,7 +9762,7 @@ poll: pollAsyncJobResult } }, - + migrate: { label: 'label.action.migrate.router', createForm: { @@ -9842,7 +9842,7 @@ poll: pollAsyncJobResult } }, - + scaleUp: { //*** Infrastructure > Virtual Routers > change service offering *** label: 'label.change.service.offering', createForm: { @@ -9887,7 +9887,7 @@ } } }, - + action: function (args) { $.ajax({ url: createURL("scaleSystemVm&id=" + args.context.routers[0].id + "&serviceofferingid=" + args.data.serviceOfferingId), @@ -9917,7 +9917,7 @@ return 'message.confirm.scale.up.router.vm'; }, notification: function (args) { - + return 'label.router.vm.scaled.up'; } }, @@ -9925,8 +9925,8 @@ poll: pollAsyncJobResult } }, - - + + viewConsole: { label: 'label.view.console', action: { @@ -9969,7 +9969,7 @@ } } }); - + return hiddenFields; }, fields:[ { @@ -10098,7 +10098,7 @@ async: true, success: function (json) { var jsonObj = json.listroutersresponse.router[0].nic; - + args.response.success({ actionFilter: routerActionfilter, data: $.map(jsonObj, function (nic, index) { @@ -10144,7 +10144,7 @@ } } }, - + dataProvider: function (args) { var array1 =[]; if (args.filterBy != null) { @@ -10173,11 +10173,11 @@ }); }, detailView: { - name: 'label.virtual.routers.group.zone', + name: 'label.virtual.routers.group.zone', viewAll: { path: '_zone.virtualRouters', label: 'label.virtual.appliances' - }, + }, actions: { upgradeRouterToUseNewerTemplate: { label: 'label.upgrade.router.newer.template', @@ -10233,7 +10233,7 @@ return _l('label.no'); } } - }, + }, numberOfRouterRequiresUpgrade: { label: 'label.total.virtual.routers.upgrade' } @@ -10275,7 +10275,7 @@ } } }, - + dataProvider: function (args) { var array1 =[]; if (args.filterBy != null) { @@ -10304,11 +10304,11 @@ }); }, detailView: { - name: 'label.virtual.routers.group.pod', + name: 'label.virtual.routers.group.pod', viewAll: { path: '_zone.virtualRouters', label: 'label.virtual.appliances' - }, + }, actions: { upgradeRouterToUseNewerTemplate: { label: 'label.upgrade.router.newer.template', @@ -10409,7 +10409,7 @@ } } }, - + dataProvider: function (args) { var array1 =[]; if (args.filterBy != null) { @@ -10438,11 +10438,11 @@ }); }, detailView: { - name: 'label.virtual.routers.group.cluster', + name: 'label.virtual.routers.group.cluster', viewAll: { path: '_zone.virtualRouters', label: 'label.virtual.appliances' - }, + }, actions: { upgradeRouterToUseNewerTemplate: { label: 'label.upgrade.router.newer.template', @@ -10549,7 +10549,7 @@ } } }, - + dataProvider: function (args) { var array1 =[]; if (args.filterBy != null) { @@ -10585,14 +10585,14 @@ var routerCountFromAllPages = json.listroutersresponse.count; var routerCountFromFirstPageToCurrentPage = json.listroutersresponse.router.length; var routerRequiresUpgrade = 0; - + var items = json.listroutersresponse.router; - for (var k = 0; k < items.length; k++) { + for (var k = 0; k < items.length; k++) { if (items[k].requiresupgrade) { routerRequiresUpgrade++; } - } - + } + var callListApiWithPage = function () { $.ajax({ url: createURL('listRouters'), @@ -10607,7 +10607,7 @@ success: function (json) { routerCountFromFirstPageToCurrentPage += json.listroutersresponse.router.length; var items = json.listroutersresponse.router; - for (var k = 0; k < items.length; k++) { + for (var k = 0; k < items.length; k++) { if (items[k].requiresupgrade) { routerRequiresUpgrade++; } @@ -10639,11 +10639,11 @@ }); }, detailView: { - name: 'label.virtual.routers.group.account', + name: 'label.virtual.routers.group.account', viewAll: { path: '_zone.virtualRouters', label: 'label.virtual.appliances' - }, + }, actions: { upgradeRouterToUseNewerTemplate: { label: 'label.upgrade.router.newer.template', @@ -10703,7 +10703,7 @@ return _l('label.no'); } } - }, + }, numberOfRouterRequiresUpgrade: { label: 'label.total.virtual.routers.upgrade' } @@ -10726,14 +10726,14 @@ var routerCountFromAllPages = json.listroutersresponse.count; var routerCountFromFirstPageToCurrentPage = json.listroutersresponse.router.length; var routerRequiresUpgrade = 0; - + var items = json.listroutersresponse.router; - for (var k = 0; k < items.length; k++) { + for (var k = 0; k < items.length; k++) { if (items[k].requiresupgrade) { routerRequiresUpgrade++; } - } - + } + var callListApiWithPage = function () { $.ajax({ url: createURL('listRouters'), @@ -10748,7 +10748,7 @@ success: function (json) { routerCountFromFirstPageToCurrentPage += json.listroutersresponse.router.length; var items = json.listroutersresponse.router; - for (var k = 0; k < items.length; k++) { + for (var k = 0; k < items.length; k++) { if (items[k].requiresupgrade) { routerRequiresUpgrade++; } @@ -10820,7 +10820,7 @@ 'Destroyed': 'off' } }, - + agentstate: { label: 'label.agent.state', indicator: { @@ -10841,7 +10841,7 @@ } } } - + var selectedZoneObj = args.context.physicalResources[0]; $.ajax({ url: createURL("listSystemVms&zoneid=" + selectedZoneObj.id + "&page=" + args.page + "&pagesize=" + pageSize + array1.join("")), @@ -10856,7 +10856,7 @@ } }); }, - + detailView: { name: 'label.system.vm.details', actions: { @@ -10895,7 +10895,7 @@ poll: pollAsyncJobResult } }, - + stop: { label: 'label.action.stop.systemvm', messages: { @@ -10931,7 +10931,7 @@ poll: pollAsyncJobResult } }, - + restart: { label: 'label.action.reboot.systemvm', messages: { @@ -10967,7 +10967,7 @@ poll: pollAsyncJobResult } }, - + remove: { label: 'label.action.destroy.systemvm', messages: { @@ -11002,7 +11002,7 @@ poll: pollAsyncJobResult } }, - + migrate: { label: 'label.action.migrate.systemvm', messages: { @@ -11084,7 +11084,7 @@ poll: pollAsyncJobResult } }, - + scaleUp: { //*** Infrastructure > System VMs (consoleProxy or SSVM) > change service offering *** label: 'label.change.service.offering', createForm: { @@ -11105,7 +11105,7 @@ var data1 = { issystem: 'true', virtualmachineid: args.context.systemVMs[0].id - }; + }; if (args.context.systemVMs[0].systemvmtype == "secondarystoragevm") { $.extend(data1, { systemvmtype: 'secondarystoragevm' @@ -11114,7 +11114,7 @@ else if (args.context.systemVMs[0].systemvmtype == "consoleproxy") { $.extend(data1, { systemvmtype: 'consoleproxy' - }); + }); } $.ajax({ url: createURL('listServiceOfferings'), @@ -11139,7 +11139,7 @@ } } }, - + action: function (args) { $.ajax({ url: createURL("scaleSystemVm&id=" + args.context.systemVMs[0].id + "&serviceofferingid=" + args.data.serviceOfferingId), @@ -11169,7 +11169,7 @@ return 'message.confirm.scale.up.system.vm'; }, notification: function (args) { - + return 'label.system.vm.scaled.up'; } }, @@ -11177,9 +11177,9 @@ poll: pollAsyncJobResult } }, - - - + + + viewConsole: { label: 'label.view.console', action: { @@ -11344,7 +11344,7 @@ privateinterface: { label: 'label.private.interface' }, - + gslbprovider: { label: 'label.gslb.service', isBoolean: true, @@ -11356,7 +11356,7 @@ gslbproviderprivateip: { label: 'label.gslb.service.private.ip' }, - + numretries: { label: 'label.numretries', defaultValue: '2' @@ -11459,7 +11459,7 @@ } }); }, - + error: function (json) { args.response.error(parseXMLHttpResponse(json)); } @@ -11522,7 +11522,7 @@ } } }, - + // Baremetal DHCP devices listView BaremetalDhcpDevices: { id: 'BaremetalDhcpDevices', @@ -11594,7 +11594,7 @@ } } }, - + // Baremetal PXE devices listView BaremetalPxeDevices: { id: 'BaremetalPxeDevices', @@ -11672,7 +11672,7 @@ } } }, - + // F5 devices listView f5Devices: { id: 'f5Devices', @@ -11898,7 +11898,7 @@ } } }, - + //SRX devices listView srxDevices: { id: 'srxDevices', @@ -12135,7 +12135,7 @@ } } }, - + //Palo Alto devices listView paDevices: { id: 'paDevices', @@ -12379,7 +12379,7 @@ } } }, - + // FIXME convert to nicira detailview // NiciraNvp devices listView niciraNvpDevices: { @@ -12468,7 +12468,7 @@ addNiciraNvpDevice(args, selectedPhysicalNetworkObj, "addNiciraNvpDevice", "addniciranvpdeviceresponse", "niciranvpdevice") } }, - + messages: { notification: function (args) { return 'label.added.nicira.nvp.controller'; @@ -12811,7 +12811,7 @@ addBigSwitchBcfDevice(args, selectedPhysicalNetworkObj, "addBigSwitchBcfDevice", "addbigswitchbcfdeviceresponse", "bigswitchbcfdevice") } }, - + messages: { notification: function (args) { return 'label.added.new.bigswitch.bcf.controller'; @@ -13120,7 +13120,7 @@ label: 'label.allocation.state' } }, - + dataProvider: function (args) { var array1 =[]; if (args.filterBy != null) { @@ -13133,7 +13133,7 @@ } } } - + $.ajax({ url: createURL("listPods&zoneid=" + args.context.zones[0].id + "&page=" + args.page + "&pagesize=" + pageSize + array1.join("")), dataType: "json", @@ -13147,11 +13147,11 @@ } }); }, - + actions: { add: { label: 'label.add.pod', - + createForm: { title: 'label.add.pod', fields: { @@ -13165,13 +13165,13 @@ var data = args.context.zones ? { id: args.context.zones[0].id }: {}; - + $.ajax({ url: createURL('listZones'), data: data, success: function (json) { var zones = json.listzonesresponse.zone ? json.listzonesresponse.zone:[]; - + args.response.success({ data: $.map(zones, function (zone) { return { @@ -13219,14 +13219,14 @@ required: false } }, - + isDedicated: { label: 'label.dedicate', isBoolean: true, isChecked: false, docID: 'helpDedicateResource' }, - + domainId: { label: 'label.domain', isHidden: true, @@ -13242,7 +13242,7 @@ success: function (json) { var domainObjs = json.listdomainsresponse.domain; var items =[]; - + $(domainObjs).each(function () { items.push({ id: this.id, @@ -13252,7 +13252,7 @@ items.sort(function(a, b) { return a.description.localeCompare(b.description); }); - + args.response.success({ data: items }); @@ -13260,7 +13260,7 @@ }); } }, - + accountId: { label: 'label.account', isHidden: true, @@ -13272,18 +13272,18 @@ } } }, - + 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)); @@ -13295,13 +13295,13 @@ 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 =[]; if (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("")), @@ -13317,11 +13317,11 @@ interval: 4500, desc: "Dedicate Pod" }, - + data: item }); }, - + error: function (json) { args.response.error(parseXMLHttpResponse(XMLHttpResponse)); } @@ -13338,7 +13338,7 @@ } }); }, - + notification: { poll: function (args) { args.complete({ @@ -13346,7 +13346,7 @@ }); } }, - + messages: { notification: function (args) { return 'label.add.pod'; @@ -13354,7 +13354,7 @@ } } }, - + detailView: { viewAll: { path: '_zone.clusters', @@ -13385,7 +13385,7 @@ array1.push("&endIp=" + todb(args.data.endip)); if (args.data.gateway != null && args.data.gateway.length > 0) array1.push("&gateway=" + todb(args.data.gateway)); - + $.ajax({ url: createURL("updatePod&id=" + args.context.pods[0].id + array1.join("")), dataType: "json", @@ -13402,7 +13402,7 @@ }); } }, - + enable: { label: 'label.action.enable.pod', messages: { @@ -13433,7 +13433,7 @@ } } }, - + dedicate: { label: 'label.dedicate.pod', messages: { @@ -13460,7 +13460,7 @@ success: function (json) { var domainObjs = json.listdomainsresponse.domain; var items =[]; - + $(domainObjs).each(function () { items.push({ id: this.id, @@ -13492,7 +13492,7 @@ var array2 =[]; if (args.data.accountId != "") array2.push("&account=" + todb(args.data.accountId)); - + $.ajax({ url: createURL("dedicatePod&podId=" + args.context.pods[0].id + @@ -13553,8 +13553,8 @@ poll: pollAsyncJobResult } }, - - + + disable: { label: 'label.action.disable.pod', messages: { @@ -13585,7 +13585,7 @@ } } }, - + 'remove': { label: 'label.delete', messages: { @@ -13665,7 +13665,7 @@ label: 'label.allocation.state' } }, { - + isdedicated: { label: 'label.dedicated' }, @@ -13673,15 +13673,15 @@ label: 'label.domain.id' } }], - + dataProvider: function (args) { - + $.ajax({ url: createURL("listPods&id=" + args.context.pods[0].id), success: function (json) { var item = json.listpodsresponse.pod[0]; - - + + $.ajax({ url: createURL("listDedicatedPods&podid=" + args.context.pods[0].id), success: function (json) { @@ -13696,7 +13696,7 @@ $.extend(item, { isdedicated: _l('label.no') }); - + args.response.success({ actionFilter: podActionfilter, data: item @@ -13714,7 +13714,7 @@ }); } }, - + ipAllocations: { title: 'label.ip.allocations', multiple: true, @@ -13781,7 +13781,7 @@ } } }, - + dataProvider: function (args) { var array1 =[]; if (args.filterBy != null) { @@ -13806,7 +13806,7 @@ $(items).each(function () { addExtraPropertiesToClusterObject(this); }); - + args.response.success({ actionFilter: clusterActionfilter, data: items @@ -13814,7 +13814,7 @@ } }); }, - + actions: { add: { label: 'label.add.cluster', @@ -13842,19 +13842,19 @@ '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'); $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 useDvs = false; $.ajax({ url: createURL('listConfigurations'), @@ -13872,7 +13872,7 @@ //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; $.ajax({ url: createURL('listConfigurations'), @@ -13906,11 +13906,11 @@ $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(); } @@ -13921,13 +13921,13 @@ $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(); } - + 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=vSwitchPublicName]').css('display', 'inline-block'); @@ -13935,7 +13935,7 @@ $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=vSwitchGuestName]').css('display', 'inline-block'); @@ -13944,7 +13944,7 @@ $form.find('.form-item[rel=vSwitchGuestName]').css('display', 'none'); } }); - + $form.trigger('click'); }, fields: { @@ -13958,13 +13958,13 @@ var data = args.context.zones ? { id: args.context.zones[0].id }: {}; - + $.ajax({ url: createURL('listZones'), data: data, success: function (json) { var zones = json.listzonesresponse.zone ? json.listzonesresponse.zone:[]; - + args.response.success({ data: $.map(zones, function (zone) { return { @@ -14038,14 +14038,14 @@ required: true } }, - + isDedicated: { label: 'label.dedicate', isBoolean: true, isChecked: false, docID: 'helpDedicateResource' }, - + domainId: { label: 'label.domain', isHidden: true, @@ -14061,7 +14061,7 @@ success: function (json) { var domainObjs = json.listdomainsresponse.domain; var items =[]; - + $(domainObjs).each(function () { items.push({ id: this.id, @@ -14079,7 +14079,7 @@ }); } }, - + accountId: { label: 'label.account', isHidden: true, @@ -14144,7 +14144,7 @@ } //legacy zone - validation not required for new VMware dc model }, - + overridepublictraffic: { label: 'label.override.public.traffic', isBoolean: true, @@ -14152,8 +14152,8 @@ isChecked: false, docID: 'helpOverridePublicNetwork' }, - - + + vSwitchPublicType: { label: 'label.public.traffic.vswitch.type', select: function (args) { @@ -14171,7 +14171,7 @@ } } }); - + if (useNexusDvs) { items.push({ id: "nexusdvs", @@ -14199,19 +14199,19 @@ description: "Cisco Nexus 1000v Distributed Virtual Switch" }); } - + args.response.success({ data: items }); }, isHidden: true }, - + vSwitchPublicName: { label: 'label.public.traffic.vswitch.name', isHidden: true }, - + overrideguesttraffic: { label: 'label.override.guest.traffic', isBoolean: true, @@ -14219,12 +14219,12 @@ isChecked: false, docID: 'helpOverrideGuestNetwork' }, - + vSwitchGuestType: { label: 'label.guest.traffic.vswitch.type', select: function (args) { var items =[] - + var useNexusDvs = false; $.ajax({ url: createURL('listConfigurations'), @@ -14238,8 +14238,8 @@ } } }); - - + + if (useNexusDvs) { items.push({ id: "nexusdvs", @@ -14267,20 +14267,20 @@ description: "Cisco Nexus 1000v Distributed Virtual Switch" }); } - + args.response.success({ data: items }); }, isHidden: true }, - + vSwitchGuestName: { label: 'label.guest.traffic.vswitch.name', isHidden: true }, - - + + vsmipaddress: { label: 'label.cisco.nexus1000v.ip.address', validation: { @@ -14328,20 +14328,20 @@ //hypervisor==VMWare ends here } }, - + 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"; array1.push("&clustertype=" + clusterType); - + array1.push("&podId=" + args.data.podId); - + var clusterName = args.data.name; if (args.data.hypervisor == "Ovm3") { array1.push("&ovm3pool=" + todb(args.data.ovm3pool)); @@ -14351,7 +14351,7 @@ if (args.data.hypervisor == "VMware") { array1.push("&username=" + todb(args.data.vCenterUsername)); array1.push("&password=" + todb(args.data.vCenterPassword)); - + //vSwitch Public Type if (args.$form.find('.form-item[rel=vSwitchPublicType]').css('display') != 'none' && args.data.vSwitchPublicType != "") { array1.push("&publicvswitchtype=" + args.data.vSwitchPublicType); @@ -14359,7 +14359,7 @@ if (args.$form.find('.form-item[rel=vSwitchPublicName]').css('display') != 'none' && args.data.vSwitchPublicName != "") { array1.push("&publicvswitchname=" + args.data.vSwitchPublicName); } - + //vSwitch Guest Type if (args.$form.find('.form-item[rel=vSwitchGuestType]').css('display') != 'none' && args.data.vSwitchGuestType != "") { array1.push("&guestvswitchtype=" + args.data.vSwitchGuestType); @@ -14367,7 +14367,7 @@ if (args.$form.find('.form-item[rel=vSwitchGuestName]').css('display') != 'none' && 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); @@ -14375,25 +14375,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_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_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'), @@ -14411,14 +14411,14 @@ } }); } - + var url; if (hostname.indexOf("http://") == -1) 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)); @@ -14430,13 +14430,13 @@ success: function (json) { var item = json.addclusterresponse.cluster[0]; clusterId = json.addclusterresponse.cluster[0].id; - + //EXPLICIT DEDICATION 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)); - + if (clusterId != null) { $.ajax({ url: createURL("dedicateCluster&clusterId=" + clusterId + "&domainId=" + args.data.domainId + array2.join("")), @@ -14452,7 +14452,7 @@ interval: 4500, desc: "Dedicate Cluster" }, - + data: $.extend(item, { state: 'Enabled' }) @@ -14477,7 +14477,7 @@ } } }, - + detailView: { viewAll: { path: '_zone.hosts', @@ -14496,21 +14496,21 @@ vSwichConfigEnabled = json.listconfigurationsresponse.configuration[0].value; } }); - + var hypervisorType = args.context.clusters[0].hypervisortype; if (vSwichConfigEnabled != "true" || hypervisorType != 'VMware') { return[ 'nexusVswitch']; } return[]; }, - + actions: { - + edit: { label: 'label.edit', action: function (args) { var array1 =[]; - + $.ajax({ url: createURL("updateCluster&id=" + args.context.clusters[0].id + array1.join("")), dataType: "json", @@ -14526,7 +14526,7 @@ }); } }, - + enable: { label: 'label.action.enable.cluster', messages: { @@ -14559,7 +14559,7 @@ } } }, - + disable: { label: 'label.action.disable.cluster', messages: { @@ -14592,7 +14592,7 @@ } } }, - + dedicate: { label: 'label.dedicate.cluster', messages: { @@ -14619,7 +14619,7 @@ success: function (json) { var domainObjs = json.listdomainsresponse.domain; var items =[]; - + $(domainObjs).each(function () { items.push({ id: this.id, @@ -14629,7 +14629,7 @@ items.sort(function(a, b) { return a.description.localeCompare(b.description); }); - + args.response.success({ data: items }); @@ -14708,8 +14708,8 @@ poll: pollAsyncJobResult } }, - - + + manage: { label: 'label.action.manage.cluster', messages: { @@ -14741,7 +14741,7 @@ } } }, - + unmanage: { label: 'label.action.unmanage.cluster', messages: { @@ -14773,7 +14773,7 @@ } } }, - + 'remove': { label: 'label.action.delete.cluster', messages: { @@ -14804,7 +14804,7 @@ } } }, - + tabs: { details: { title: 'label.details', @@ -14875,7 +14875,7 @@ data: item }); }, - + error: function (json) { args.response.error(parseXMLHttpResponse(XMLHttpResponse)); } @@ -14936,7 +14936,7 @@ } } }, - + disable: { label: 'label.action.disable.nexusVswitch', messages: { @@ -14974,7 +14974,7 @@ } } } - + /* 'remove': { label: 'label.action.delete.nexusVswitch' , messages: { @@ -15000,7 +15000,7 @@ } }*/ }, - + tabs: { details: { title: 'label.details', @@ -15027,7 +15027,7 @@ } } }, - + dataProvider: function (args) { $.ajax({ url: createURL("listCiscoNexusVSMs&clusterid=" + args.context.clusters[0].id), @@ -15048,7 +15048,7 @@ } } }, - + dataProvider: function (args) { $.ajax({ url: createURL("listCiscoNexusVSMs&clusterid=" + args.context.clusters[0].id), @@ -15070,7 +15070,7 @@ } } }, - + // Granular settings for cluster settings: { title: 'label.settings', @@ -15088,7 +15088,7 @@ data: json.listconfigurationsresponse.configuration }); }, - + error: function (json) { args.response.error(parseXMLHttpResponse(json)); } @@ -15097,29 +15097,29 @@ actions: { 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) { 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.' }); } - + args.response.success({ data: item }); }, - + error: function (json) { args.response.error(parseXMLHttpResponse(json)); } @@ -15162,7 +15162,7 @@ } } }, - + dataProvider: function (args) { var array1 =[]; if (args.filterBy != null) { @@ -15175,7 +15175,7 @@ } } } - + if (! args.context.instances) { array1.push("&zoneid=" + args.context.zones[0].id); if ("pods" in args.context) @@ -15186,7 +15186,7 @@ //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", @@ -15200,11 +15200,11 @@ } }); }, - + actions: { add: { label: 'label.add.host', - + createForm: { title: 'label.add.host', fields: { @@ -15218,13 +15218,13 @@ var data = args.context.zones ? { id: args.context.zones[0].id }: {}; - + $.ajax({ url: createURL('listZones'), data: data, success: function (json) { var zones = json.listzonesresponse.zone ? json.listzonesresponse.zone:[]; - + args.response.success({ data: $.map(zones, function (zone) { return { @@ -15237,7 +15237,7 @@ }); } }, - + //always appear (begin) podId: { label: 'label.pod', @@ -15272,7 +15272,7 @@ }); } }, - + clusterId: { label: 'label.cluster', docID: 'helpHostCluster', @@ -15304,14 +15304,14 @@ }); } }); - + args.$select.change(function () { var $form = $(this).closest('form'); - + var clusterId = $(this).val(); if (clusterId == null) return; - + var items =[]; $(clusterObjs).each(function () { if (this.id == clusterId) { @@ -15321,22 +15321,22 @@ }); if (selectedClusterObj == null) 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(); @@ -15353,13 +15353,13 @@ $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(); @@ -15379,16 +15379,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"); @@ -15430,16 +15430,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).hide(); $form.find('.form-item[rel=agentUsername]').hide(); $form.find('.form-item[rel=agentPassword]').hide(); @@ -15453,12 +15453,12 @@ $form.find('.form-item[rel=ovm3cluster]').hide(); } }); - + args.$select.trigger("change"); } }, //always appear (end) - + //input_group="general" starts here hostname: { label: 'label.host.name', @@ -15468,7 +15468,7 @@ }, isHidden: true }, - + username: { label: 'label.username', docID: 'helpHostUsername', @@ -15477,7 +15477,7 @@ }, isHidden: true }, - + password: { label: 'label.password', docID: 'helpHostPassword', @@ -15487,14 +15487,14 @@ isHidden: true, isPassword: true }, - + isDedicated: { label: 'label.dedicate', isBoolean: true, isChecked: false, docID: 'helpDedicateResource' }, - + domainId: { label: 'label.domain', isHidden: true, @@ -15509,7 +15509,7 @@ success: function (json) { var domainObjs = json.listdomainsresponse.domain; var items =[]; - + $(domainObjs).each(function () { items.push({ id: this.id, @@ -15519,7 +15519,7 @@ items.sort(function(a, b) { return a.description.localeCompare(b.description); }); - + args.response.success({ data: items }); @@ -15527,7 +15527,7 @@ }); } }, - + accountId: { label: 'label.account', isHidden: true, @@ -15537,9 +15537,9 @@ required: false } }, - + //input_group="general" ends here - + //input_group="VMWare" starts here vcenterHost: { label: 'label.esx.host', @@ -15549,7 +15549,7 @@ isHidden: true }, //input_group="VMWare" ends here - + //input_group="BareMetal" starts here baremetalCpuCores: { label: 'label.num.cpu.cores', @@ -15580,7 +15580,7 @@ isHidden: true }, //input_group="BareMetal" ends here - + //input_group="OVM" starts here agentUsername: { label: 'label.agent.username', @@ -15652,7 +15652,7 @@ //always appear (end) } }, - + action: function (args) { var data = { zoneid: args.data.zoneid, @@ -15662,19 +15662,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; - + $.extend(data, { url: url }); @@ -15683,17 +15683,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; - + $.extend(data, { url: url }); - + if (selectedClusterObj.hypervisortype == "BareMetal") { $.extend(data, { cpunumber: args.data.baremetalCpuCores, @@ -15714,7 +15714,7 @@ }); } } - + var hostId = null; $.ajax({ url: createURL("addHost"), @@ -15722,17 +15722,17 @@ data: data, success: function (json) { var item = json.addhostresponse.host[0]; - + hostId = json.addhostresponse.host[0].id; - + //EXPLICIT DEDICATION 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)); - - + + if (hostId != null) { $.ajax({ url: createURL("dedicateHost&hostId=" + hostId + "&domainId=" + args.data.domainId + array2.join("")), @@ -15748,11 +15748,11 @@ interval: 4500, desc: "Dedicate Host" }, - + data: item }); }, - + error: function (json) { args.response.error(parseXMLHttpResponse(XMLHttpResponse)); } @@ -15763,14 +15763,14 @@ data: item }); }, - + error: function (XMLHttpResponse) { var errorMsg = parseXMLHttpResponse(XMLHttpResponse); args.response.error(errorMsg); } }); }, - + notification: { poll: function (args) { args.complete({ @@ -15778,7 +15778,7 @@ }); } }, - + messages: { notification: function (args) { return 'label.add.host'; @@ -15798,10 +15798,10 @@ 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); - + $.ajax({ url: createURL("updateHost&id=" + args.context.hosts[0].id + array1.join("")), dataType: "json", @@ -15815,7 +15815,7 @@ }); } }, - + dedicate: { label: 'label.dedicate.host', messages: { @@ -15842,7 +15842,7 @@ success: function (json) { var domainObjs = json.listdomainsresponse.domain; var items =[]; - + $(domainObjs).each(function () { items.push({ id: this.id, @@ -15852,7 +15852,7 @@ items.sort(function(a, b) { return a.description.localeCompare(b.description); }); - + args.response.success({ data: items }); @@ -15874,7 +15874,7 @@ var array2 =[]; if (args.data.accountId != "") array2.push("&account=" + todb(args.data.accountId)); - + $.ajax({ url: createURL("dedicateHost&hostId=" + args.context.hosts[0].id + @@ -15882,7 +15882,7 @@ dataType: "json", success: function (json) { var jid = json.dedicatehostresponse.jobid; - + args.response.success({ _custom: { jobId: jid, @@ -15933,8 +15933,8 @@ poll: pollAsyncJobResult } }, - - + + enableMaintenanceMode: { label: 'label.action.enable.maintenance.mode', action: function (args) { @@ -15970,7 +15970,7 @@ poll: pollAsyncJobResult } }, - + cancelMaintenanceMode: { label: 'label.action.cancel.maintenance.mode', action: function (args) { @@ -16006,7 +16006,7 @@ poll: pollAsyncJobResult } }, - + forceReconnect: { label: 'label.action.force.reconnect', action: function (args) { @@ -16042,14 +16042,14 @@ poll: pollAsyncJobResult } }, - + enable: { label: 'label.enable.host', action: function (args) { var data = { id: args.context.hosts[0].id, allocationstate: "Enable" - }; + }; $.ajax({ url: createURL("updateHost"), data: data, @@ -16083,7 +16083,7 @@ var data = { id: args.context.hosts[0].id, allocationstate: "Disable" - }; + }; $.ajax({ url: createURL("updateHost"), data: data, @@ -16110,7 +16110,7 @@ } } }, - + 'remove': { label: 'label.action.remove.host', messages: { @@ -16137,13 +16137,13 @@ action: function (args) { var data = { id: args.context.hosts[0].id - }; + }; if(args.$form.find('.form-item[rel=isForced]').css("display") != "none") { $.extend(data, { forced: (args.data.isForced == "on") - }); + }); } - + $.ajax({ url: createURL("deleteHost"), data: data, @@ -16153,10 +16153,10 @@ data: { } }); - + if (args.context.hosts[0].hypervisor == "XenServer"){ cloudStack.dialog.notice({ message: _s("The host has been deleted. Please eject the host from XenServer Pool") }) - } + } } }); }, @@ -16177,7 +16177,7 @@ tabs: { details: { title: 'label.details', - + preFilter: function (args) { var hiddenFields =[]; $.ajax({ @@ -16192,7 +16192,7 @@ }); return hiddenFields; }, - + fields:[ { name: { label: 'label.name' @@ -16303,7 +16303,7 @@ label: 'label.number.of.cpu.sockets' } }, { - + isdedicated: { label: 'label.dedicated' }, @@ -16311,7 +16311,7 @@ label: 'label.domain.id' } }], - + dataProvider: function (args) { $.ajax({ url: createURL("listHosts&id=" + args.context.hosts[0].id), @@ -16349,7 +16349,7 @@ }); } }, - + stats: { title: 'label.statistics', fields: { @@ -16506,7 +16506,7 @@ label: 'label.scope' } }, - + dataProvider: function (args) { var array1 =[]; if (args.filterBy != null) { @@ -16537,11 +16537,11 @@ } }); }, - + actions: { add: { label: 'label.add.primary.storage', - + createForm: { title: 'label.add.primary.storage', fields: { @@ -16558,22 +16558,22 @@ } // { id: 'host', description: _l('label.host') } ]; - + args.response.success({ data: scope }); - + 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'); @@ -16587,8 +16587,8 @@ }) } }, - - + + hypervisor: { label: 'label.hypervisor', isHidden: true, @@ -16615,7 +16615,7 @@ }); } }, - + zoneid: { label: 'label.zone', docID: 'helpPrimaryStorageZone', @@ -16626,13 +16626,13 @@ var data = args.context.zones ? { id: args.context.zones[0].id }: {}; - + $.ajax({ url: createURL('listZones'), data: data, success: function (json) { var zones = json.listzonesresponse.zone ? json.listzonesresponse.zone:[]; - + args.response.success({ data: $.map(zones, function (zone) { return { @@ -16673,7 +16673,7 @@ }); } }, - + clusterId: { label: 'label.cluster', docID: 'helpPrimaryStorageCluster', @@ -16703,7 +16703,7 @@ }); } }, - + hostId: { label: 'label.host', validation: { @@ -16731,7 +16731,7 @@ }); } }, - + name: { label: 'label.name', docID: 'helpPrimaryStorageName', @@ -16739,7 +16739,7 @@ required: true } }, - + protocol: { label: 'label.protocol', docID: 'helpPrimaryStorageProtocol', @@ -16755,14 +16755,14 @@ }); return; } - + $(clusterObjs).each(function () { if (this.id == clusterId) { selectedClusterObj = this; return false; //break the $.each() loop } }); - + if (selectedClusterObj.hypervisortype == "KVM") { var items =[]; items.push({ @@ -16877,35 +16877,35 @@ data:[] }); } - + 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'); $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(); @@ -16916,23 +16916,23 @@ //"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(); @@ -16943,23 +16943,23 @@ //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(); @@ -16969,23 +16969,23 @@ } 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'); 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); - + $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(); @@ -17019,21 +17019,21 @@ } 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(); $form.find('.form-item[rel=smbPassword]').hide(); $form.find('.form-item[rel=smbDomain]').hide(); - + $form.find('.form-item[rel=iqn]').css('display', 'inline-block'); $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(); @@ -17043,21 +17043,21 @@ } 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(); $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]').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(); @@ -17067,21 +17067,21 @@ } 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(); $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]').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(); @@ -17092,23 +17092,23 @@ //"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'); 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(); @@ -17118,16 +17118,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(); @@ -17135,7 +17135,7 @@ $form.find('.form-item[rel=path]').hide(); $form.find('.form-item[rel=vCenterDataCenter]').hide(); $form.find('.form-item[rel=vCenterDataStore]').hide(); - + $form.find('.form-item[rel=smbUsername]').hide(); $form.find('.form-item[rel=smbPassword]').hide(); $form.find('.form-item[rel=smbDomain]').hide(); @@ -17169,20 +17169,20 @@ } 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(); $form.find('.form-item[rel=rbdsecret]').hide(); - + $form.find('.form-item[rel=smbUsername]').hide(); $form.find('.form-item[rel=smbPassword]').hide(); $form.find('.form-item[rel=smbDomain]').hide(); @@ -17190,12 +17190,12 @@ $form.find('.form-item[rel=glustervolume]').hide(); } }); - + args.$select.trigger("change"); } }, //always appear (end) - + server: { label: 'label.server', docID: 'helpPrimaryStorageServer', @@ -17204,7 +17204,7 @@ }, isHidden: true }, - + //nfs path: { label: 'label.path', @@ -17313,7 +17313,7 @@ }, isHidden: true }, - + //iscsi iqn: { label: 'label.target.iqn', @@ -17331,7 +17331,7 @@ }, isHidden: true }, - + //clvm volumegroup: { label: 'label.volgroup', @@ -17340,7 +17340,7 @@ }, isHidden: true }, - + //vmfs vCenterDataCenter: { label: 'label.vcenter.datacenter', @@ -17356,7 +17356,7 @@ }, isHidden: true }, - + // RBD rbdmonitor: { label: 'label.rbd.monitor', @@ -17443,25 +17443,25 @@ //always appear (end) } }, - + /******************************/ 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); @@ -17564,11 +17564,11 @@ array1.push("&tags=" + todb(args.data.storageTags)); } - if ("custom" in args.response) { - args.response.custom(array1); - return; - } - + if ("custom" in args.response) { + args.response.custom(array1); + return; + } + $.ajax({ url: createURL("createStoragePool" + array1.join("")), dataType: "json", @@ -17584,7 +17584,7 @@ } }); }, - + notification: { poll: function (args) { args.complete({ @@ -17592,7 +17592,7 @@ }); } }, - + messages: { notification: function (args) { return 'label.add.primary.storage'; @@ -17600,7 +17600,7 @@ } } }, - + detailView: { name: "Primary storage details", viewAll: { @@ -17614,7 +17614,7 @@ action: function (args) { var array1 =[]; array1.push("&tags=" + todb(args.data.tags)); - + if (args.data.disksizetotal != null && args.data.disksizetotal.length > 0) { var diskSizeTotal = args.data.disksizetotal.split(",").join(""); @@ -17642,7 +17642,7 @@ }); } }, - + enableMaintenanceMode: { label: 'label.action.enable.maintenance.mode', action: function (args) { @@ -17678,7 +17678,7 @@ poll: pollAsyncJobResult } }, - + cancelMaintenanceMode: { label: 'label.action.cancel.maintenance.mode', messages: { @@ -17714,7 +17714,7 @@ poll: pollAsyncJobResult } }, - + 'remove': { label: 'label.action.delete.primary.storage', messages: { @@ -17753,7 +17753,7 @@ } } }, - + tabs: { details: { title: 'label.details', @@ -17850,7 +17850,7 @@ } } }], - + dataProvider: function (args) { $.ajax({ url: createURL("listStoragePools&id=" + args.context.primarystorages[0].id), @@ -17866,13 +17866,13 @@ }); } }, - + // Granular settings for storage pool settings: { title: 'label.settings', custom: cloudStack.uiCustom.granularSettings({ dataProvider: function (args) { - + $.ajax({ url: createURL('listConfigurations&storageid=' + args.context.primarystorages[0].id), data: listViewDataProvider(args, { @@ -17885,7 +17885,7 @@ data: json.listconfigurationsresponse.configuration }); }, - + error: function (json) { args.response.error(parseXMLHttpResponse(json)); } @@ -17898,7 +17898,7 @@ name: args.data.jsonObj.name, value: args.data.value }; - + $.ajax({ url: createURL('updateConfiguration&storageid=' + args.context.primarystorages[0].id), data: data, @@ -17908,7 +17908,7 @@ data: item }); }, - + error: function (json) { args.response.error(parseXMLHttpResponse(json)); } @@ -17921,7 +17921,7 @@ } } }, - + ucs: { title: 'UCS', id: 'ucs', @@ -17960,7 +17960,7 @@ }; */ //for testing only (end) - + var items = json.listucsmanagerreponse.ucsmanager; args.response.success({ data: items @@ -17971,13 +17971,13 @@ actions: { add: { label: 'label.add.ucs.manager', - + messages: { notification: function (args) { return 'label.add.ucs.manager'; } }, - + createForm: { title: 'label.add.ucs.manager', fields: { @@ -18008,7 +18008,7 @@ } } }, - + action: function (args) { var data = { zoneid: args.context.physicalResources[0].id, @@ -18021,7 +18021,7 @@ name: args.data.name }); } - + $.ajax({ url: createURL('addUcsManager'), data: data, @@ -18038,7 +18038,7 @@ } }); }, - + notification: { poll: function (args) { args.complete(); @@ -18046,7 +18046,7 @@ } } }, - + detailView: { isMaximized: true, noCompact: true, @@ -18086,7 +18086,7 @@ tabs: { details: { title: 'label.details', - + fields:[ { name: { label: 'label.name' @@ -18100,7 +18100,7 @@ label: 'label.url' } }], - + dataProvider: function (args) { $.ajax({ url: createURL('listUcsManagers'), @@ -18126,7 +18126,7 @@ }; */ //for testing only (end) - + var item = json.listucsmanagerreponse.ucsmanager[0]; args.response.success({ data: item @@ -18135,7 +18135,7 @@ }); } }, - + blades: { title: 'label.blades', listView: { @@ -18192,7 +18192,7 @@ }; */ //for testing only (end) - + var items = json.listucsbladeresponse.ucsblade ? json.listucsbladeresponse.ucsblade:[]; for (var i = 0; i < items.length; i++) { addExtraPropertiesToUcsBladeObject(items[i]); @@ -18269,7 +18269,7 @@ }; */ //for testing only (end) - + /* var item = json.refreshucsbladesresponse.ucsblade[0]; addExtraPropertiesToUcsBladeObject(item); @@ -18287,7 +18287,7 @@ } } }, - + associateTemplateToBlade: { label: 'label.instanciate.template.associate.profile.blade', addRow: 'false', @@ -18303,7 +18303,7 @@ label: 'label.select.template', select: function (args) { var items =[]; - + $.ajax({ url: createURL('listUcsTemplates'), data: { @@ -18325,7 +18325,7 @@ }; */ //for testing only (end) - + var ucstemplates = json.listucstemplatesresponse.ucstemplate; if (ucstemplates != null) { for (var i = 0; i < ucstemplates.length; i++) { @@ -18337,7 +18337,7 @@ } } }); - + args.response.success({ data: items }); @@ -18357,13 +18357,13 @@ 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 }); } - + $.ajax({ url: createURL('instantiateUcsTemplateAndAssocaciateToBlade'), data: data, @@ -18377,7 +18377,7 @@ } */ //for testing only (end) - + var jid = json.instantiateucstemplateandassociatetobladeresponse.jobid; args.response.success({ _custom: { @@ -18408,7 +18408,7 @@ }; */ //for testing only (end) - + addExtraPropertiesToUcsBladeObject(json.queryasyncjobresultresponse.jobresult.ucsblade); return json.queryasyncjobresultresponse.jobresult.ucsblade; } @@ -18421,7 +18421,7 @@ poll: pollAsyncJobResult } }, - + disassociateProfileFromBlade: { label: 'label.disassociate.profile.blade', addRow: 'false', @@ -18457,7 +18457,7 @@ } */ //for testing only (end) - + var jid = json.disassociateucsprofilefrombladeresponse.jobid; args.response.success({ _custom: { @@ -18487,7 +18487,7 @@ }; */ //for testing only (end) - + addExtraPropertiesToUcsBladeObject(json.queryasyncjobresultresponse.jobresult.ucsblade); return json.queryasyncjobresultresponse.jobresult.ucsblade; } @@ -18507,7 +18507,7 @@ } } }, - + 'secondary-storage': { title: 'label.secondary.storage', id: 'secondarystorages', @@ -18529,8 +18529,8 @@ label: 'label.protocol' } }, - - + + dataProvider: function (args) { var array1 =[]; if (args.filterBy != null) { @@ -18544,7 +18544,7 @@ } } array1.push("&zoneid=" + args.context.zones[0].id); - + $.ajax({ url: createURL("listImageStores&page=" + args.page + "&pagesize=" + pageSize + array1.join("")), dataType: "json", @@ -18558,14 +18558,14 @@ } }); }, - + actions: { add: { label: 'label.add.secondary.storage', - + createForm: { title: 'label.add.secondary.storage', - + fields: { name: { label: 'label.name' @@ -18594,11 +18594,11 @@ id: 'Swift', description: 'Swift' }]; - + args.response.success({ data: items }); - + args.$select.change(function () { var $form = $(this).closest('form'); if ($(this).val() == "NFS") { @@ -18606,12 +18606,12 @@ $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'); - + //SMB $form.find('.form-item[rel=smbUsername]').hide(); $form.find('.form-item[rel=smbPassword]').hide(); $form.find('.form-item[rel=smbDomain]').hide(); - + //S3 $form.find('.form-item[rel=accesskey]').hide(); $form.find('.form-item[rel=secretkey]').hide(); @@ -18621,13 +18621,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]').hide(); $form.find('.form-item[rel=account]').hide(); @@ -18638,12 +18638,12 @@ $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'); - + //SMB $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'); - + //S3 $form.find('.form-item[rel=accesskey]').hide(); $form.find('.form-item[rel=secretkey]').hide(); @@ -18653,13 +18653,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]').hide(); $form.find('.form-item[rel=account]').hide(); @@ -18670,12 +18670,12 @@ $form.find('.form-item[rel=zoneid]').hide(); $form.find('.form-item[rel=nfsServer]').hide(); $form.find('.form-item[rel=path]').hide(); - + //SMB $form.find('.form-item[rel=smbUsername]').hide(); $form.find('.form-item[rel=smbPassword]').hide(); $form.find('.form-item[rel=smbDomain]').hide(); - + //S3 $form.find('.form-item[rel=accesskey]').css('display', 'inline-block'); $form.find('.form-item[rel=secretkey]').css('display', 'inline-block'); @@ -18685,15 +18685,15 @@ $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(); @@ -18704,12 +18704,12 @@ $form.find('.form-item[rel=zoneid]').hide(); $form.find('.form-item[rel=nfsServer]').hide(); $form.find('.form-item[rel=path]').hide(); - + //SMB $form.find('.form-item[rel=smbUsername]').hide(); $form.find('.form-item[rel=smbPassword]').hide(); $form.find('.form-item[rel=smbDomain]').hide(); - + //S3 $form.find('.form-item[rel=accesskey]').hide(); $form.find('.form-item[rel=secretkey]').hide(); @@ -18719,13 +18719,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'); @@ -18733,12 +18733,12 @@ $form.find('.form-item[rel=key]').css('display', 'inline-block'); } }); - + args.$select.change(); } }, - - + + //NFS, SMB (begin) zoneid: { label: 'label.zone', @@ -18752,7 +18752,7 @@ data: {}, 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({ @@ -18787,8 +18787,8 @@ } }, //NFS, SMB (end) - - + + //SMB (begin) smbUsername: { label: 'label.smb.username', @@ -18856,7 +18856,7 @@ label: 'label.s3.socket_timeout', docID: 'helpS3SocketTimeout' }, - + createNfsCache: { label: 'label.create.nfs.secondary.staging.store', isBoolean: true, @@ -18874,7 +18874,7 @@ data: {}, success: function (json) { var zones = json.listzonesresponse.zone; - + if (zones != null) { //$.map(items, fn) - items can not be null args.response.success({ @@ -18911,8 +18911,8 @@ } }, //S3 (end) - - + + //Swift (begin) url: { label: 'label.url', @@ -18932,7 +18932,7 @@ //Swift (end) } }, - + action: function (args) { var data = { }; @@ -18941,19 +18941,19 @@ 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, @@ -18984,7 +18984,7 @@ 'details[2].key': 'domain', 'details[2].value': args.data.smbDomain }); - + $.ajax({ url: createURL('addImageStore'), data: data, @@ -19011,7 +19011,7 @@ 'details[3].key': 'usehttps', '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'; @@ -19033,13 +19033,13 @@ data[ 'details[' + index.toString() + '].value'] = args.data.sockettimeout; index++; } - + $.ajax({ url: createURL('addImageStore'), data: data, success: function (json) { g_regionsecondaryenabled = true; - + var item = json.addimagestoreresponse.imagestore; args.response.success({ data: item @@ -19049,19 +19049,19 @@ 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, @@ -19078,7 +19078,7 @@ 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'; @@ -19100,7 +19100,7 @@ data: data, success: function (json) { g_regionsecondaryenabled = true; - + var item = json.addimagestoreresponse.imagestore; args.response.success({ data: item @@ -19112,7 +19112,7 @@ }); } }, - + notification: { poll: function (args) { args.complete({ @@ -19120,7 +19120,7 @@ }); } }, - + messages: { notification: function (args) { return 'label.add.secondary.storage'; @@ -19128,11 +19128,11 @@ } } }, - + detailView: { name: 'label.secondary.storage.details', isMaximized: true, - actions: { + actions: { remove: { label: 'label.action.delete.secondary.storage', messages: { @@ -19196,7 +19196,7 @@ for (var i = 0; i < array1.length; i++) { if (i > 0) string1 += ', '; - + string1 += array1[i].name + ': ' + array1[i].value; } } @@ -19207,7 +19207,7 @@ label: 'label.id' } }], - + dataProvider: function (args) { $.ajax({ url: createURL("listImageStores&id=" + args.context.secondaryStorage[0].id), @@ -19224,7 +19224,7 @@ }); } } - + // Granular settings for storage pool for secondary storage is not required /* settings: { title: 'label.menu.global.settings', @@ -19266,7 +19266,7 @@ label: 'label.provider' } }, - + /* dataProvider: function(args) { //being replaced with dataProvider in line 6898 var array1 = []; @@ -19281,7 +19281,7 @@ } } array1.push("&zoneid=" + args.context.zones[0].id); - + $.ajax({ url: createURL("listImageStores&page=" + args.page + "&pagesize=" + pageSize + array1.join("")), dataType: "json", @@ -19296,7 +19296,7 @@ }); }, */ - + actions: { add: { label: 'label.add.nfs.secondary.staging.store', @@ -19314,7 +19314,7 @@ data: {}, 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({ @@ -19380,7 +19380,7 @@ } } }, - + detailView: { name: 'label.secondary.staging.store.details', isMaximized: true, @@ -19447,7 +19447,7 @@ for (var i = 0; i < array1.length; i++) { if (i > 0) string1 += ', '; - + string1 += array1[i].name + ': ' + array1[i].value; } } @@ -19458,7 +19458,7 @@ label: 'label.id' } }], - + dataProvider: function (args) { $.ajax({ url: createURL('listSecondaryStagingStores'), @@ -19475,7 +19475,7 @@ }); } } - + // Granular settings for storage pool for secondary storage is not required /* settings: { title: 'label.menu.global.settings', @@ -19502,7 +19502,7 @@ } } }, - + guestIpRanges: { //Advanced zone - Guest traffic type - Network tab - Network detailView - View IP Ranges title: 'label.guest.ip.range', @@ -19529,7 +19529,7 @@ label: 'label.netmask' } }, - + dataProvider: function (args) { $.ajax({ url: createURL("listVlanIpRanges&zoneid=" + selectedZoneObj.id + "&networkid=" + args.context.networks[0].id + "&page=" + args.page + "&pagesize=" + pageSize), @@ -19543,7 +19543,7 @@ } }); }, - + actions: { add: { label: 'label.add.ip.range', @@ -19578,27 +19578,27 @@ }, action: function (args) { var array2 =[]; - + if (args.data.gateway != null && args.data.gateway.length > 0) array2.push("&gateway=" + args.data.gateway); if (args.data.netmask != null && args.data.netmask.length > 0) array2.push("&netmask=" + args.data.netmask); - + if (args.data.startipv4 != null && args.data.startipv4.length > 0) array2.push("&startip=" + args.data.startipv4); if (args.data.endipv4 != null && args.data.endipv4.length > 0) array2.push("&endip=" + args.data.endipv4); - + if (args.data.ip6cidr != null && args.data.ip6cidr.length > 0) array2.push("&ip6cidr=" + args.data.ip6cidr); if (args.data.ip6gateway != null && args.data.ip6gateway.length > 0) array2.push("&ip6gateway=" + args.data.ip6gateway); - + if (args.data.startipv6 != null && args.data.startipv6.length > 0) array2.push("&startipv6=" + args.data.startipv6); if (args.data.endipv6 != null && args.data.endipv6.length > 0) array2.push("&endipv6=" + args.data.endipv6); - + $.ajax({ url: createURL("createVlanIpRange&forVirtualNetwork=false&networkid=" + args.context.networks[0].id + array2.join("")), dataType: "json", @@ -19625,7 +19625,7 @@ } } }, - + 'remove': { label: 'label.remove.ip.range', messages: { @@ -19663,7 +19663,7 @@ } } }; - + function addBaremetalDhcpDeviceFn(args) { if (nspMap[ "BaremetalDhcpProvider"] == null) { $.ajax({ @@ -19684,7 +19684,7 @@ clearInterval(addBaremetalDhcpProviderIntervalID); if (result.jobstatus == 1) { nspMap[ "BaremetalDhcpProvider"] = json.queryasyncjobresultresponse.jobresult.networkserviceprovider; - + $.ajax({ url: createURL('addBaremetalDhcp'), data: { @@ -19747,7 +19747,7 @@ }); } } - + function addBaremetalPxeDeviceFn(args) { if (nspMap[ "BaremetalPxeProvider"] == null) { $.ajax({ @@ -19768,7 +19768,7 @@ clearInterval(addBaremetalPxeProviderIntervalID); if (result.jobstatus == 1) { nspMap[ "BaremetalPxeProvider"] = json.queryasyncjobresultresponse.jobresult.networkserviceprovider; - + $.ajax({ url: createURL('addBaremetalPxeKickStartServer'), data: { @@ -19833,28 +19833,28 @@ }); } } - + function addExternalLoadBalancer(args, physicalNetworkObj, apiCmd, apiCmdRes, apiCmdObj) { 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 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) { @@ -19865,7 +19865,7 @@ } url.push("publicinterface=" + publicInterface); } - + var privateInterface = args.data.privateinterface; if (privateInterface != null && privateInterface.length > 0) { if (isQuestionMarkAdded == false) { @@ -19876,7 +19876,7 @@ } url.push("privateinterface=" + privateInterface); } - + var numretries = args.data.numretries; if (numretries != null && numretries.length > 0) { if (isQuestionMarkAdded == false) { @@ -19887,7 +19887,7 @@ } url.push("numretries=" + numretries); } - + var isInline = args.data.inline; if (isInline != null && isInline.length > 0) { if (isQuestionMarkAdded == false) { @@ -19898,7 +19898,7 @@ } url.push("inline=" + isInline); } - + var capacity = args.data.capacity; if (capacity != null && capacity.length > 0) { if (isQuestionMarkAdded == false) { @@ -19909,7 +19909,7 @@ } url.push("lbdevicecapacity=" + capacity); } - + var dedicated = (args.data.dedicated == "on"); //boolean (true/false) if (isQuestionMarkAdded == false) { @@ -19919,11 +19919,11 @@ 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", @@ -19935,7 +19935,7 @@ jobId: jid, getUpdatedItem: function (json) { var item = json.queryasyncjobresultresponse.jobresult[apiCmdObj]; - + return item; } } @@ -19943,22 +19943,22 @@ } }); } - + function addExternalFirewall(args, physicalNetworkObj, apiCmd, apiCmdRes, apiCmdObj) { 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 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) { @@ -19969,7 +19969,7 @@ } url.push("publicinterface=" + publicInterface); } - + var privateInterface = args.data.privateinterface; if (privateInterface != null && privateInterface.length > 0) { if (isQuestionMarkAdded == false) { @@ -19980,7 +19980,7 @@ } url.push("privateinterface=" + privateInterface); } - + var usageInterface = args.data.usageinterface; if (usageInterface != null && usageInterface.length > 0) { if (isQuestionMarkAdded == false) { @@ -19991,7 +19991,7 @@ } url.push("usageinterface=" + usageInterface); } - + var numretries = args.data.numretries; if (numretries != null && numretries.length > 0) { if (isQuestionMarkAdded == false) { @@ -20002,7 +20002,7 @@ } url.push("numretries=" + numretries); } - + var timeout = args.data.timeout; if (timeout != null && timeout.length > 0) { if (isQuestionMarkAdded == false) { @@ -20013,7 +20013,7 @@ } url.push("timeout=" + timeout); } - + var isInline = args.data.inline; if (isInline != null && isInline.length > 0) { if (isQuestionMarkAdded == false) { @@ -20024,7 +20024,7 @@ } url.push("inline=" + isInline); } - + var publicNetwork = args.data.publicnetwork; if (publicNetwork != null && publicNetwork.length > 0) { if (isQuestionMarkAdded == false) { @@ -20035,7 +20035,7 @@ } url.push("publicnetwork=" + publicNetwork); } - + var privateNetwork = args.data.privatenetwork; if (privateNetwork != null && privateNetwork.length > 0) { if (isQuestionMarkAdded == false) { @@ -20046,7 +20046,7 @@ } url.push("privatenetwork=" + privateNetwork); } - + var capacity = args.data.capacity; if (capacity != null && capacity.length > 0) { if (isQuestionMarkAdded == false) { @@ -20057,7 +20057,7 @@ } url.push("fwdevicecapacity=" + capacity); } - + var dedicated = (args.data.dedicated == "on"); //boolean (true/false) if (isQuestionMarkAdded == false) { @@ -20067,7 +20067,7 @@ url.push("&"); } url.push("fwdevicededicated=" + dedicated.toString()); - + // START - Palo Alto Specific Fields var externalVirtualRouter = args.data.pavr; if (externalVirtualRouter != null && externalVirtualRouter.length > 0) { @@ -20079,7 +20079,7 @@ } url.push("pavr=" + encodeURIComponent(externalVirtualRouter)); } - + var externalThreatProfile = args.data.patp; if (externalThreatProfile != null && externalThreatProfile.length > 0) { if (isQuestionMarkAdded == false) { @@ -20090,7 +20090,7 @@ } url.push("patp=" + encodeURIComponent(externalThreatProfile)); } - + var externalLogProfile = args.data.palp; if (externalLogProfile != null && externalLogProfile.length > 0) { if (isQuestionMarkAdded == false) { @@ -20102,10 +20102,10 @@ 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", @@ -20117,7 +20117,7 @@ jobId: jid, getUpdatedItem: function (json) { var item = json.queryasyncjobresultresponse.jobresult[apiCmdObj]; - + return item; } } @@ -20125,7 +20125,7 @@ } }); } - + function addNiciraNvpDevice(args, physicalNetworkObj, apiCmd, apiCmdRes, apiCmdObj) { var array1 =[]; array1.push("&physicalnetworkid=" + physicalNetworkObj.id); @@ -20133,12 +20133,12 @@ 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", @@ -20150,7 +20150,7 @@ jobId: jid, getUpdatedItem: function (json) { var item = json.queryasyncjobresultresponse.jobresult[apiCmdObj]; - + return item; } } @@ -20192,7 +20192,7 @@ array1.push("&username=" + todb(args.data.username)); array1.push("&password=" + todb(args.data.password)); array1.push("&url=" + todb(args.data.url)); - + $.ajax({ url: createURL(apiCmd + array1.join("")), dataType: "json", @@ -20204,7 +20204,7 @@ jobId: jid, getUpdatedItem: function (json) { var item = json.queryasyncjobresultresponse.jobresult[apiCmdObj]; - + return item; } } @@ -20212,7 +20212,7 @@ } }); } - + function addBigSwitchBcfDevice(args, physicalNetworkObj, apiCmd, apiCmdRes, apiCmdObj) { var array1 =[]; array1.push("&physicalnetworkid=" + physicalNetworkObj.id); @@ -20231,7 +20231,7 @@ jobId: jid, getUpdatedItem: function (json) { var item = json.queryasyncjobresultresponse.jobresult[apiCmdObj]; - + return item; } } @@ -20239,7 +20239,7 @@ } }); } - + function addNuageVspDevice(args, physicalNetworkObj, apiCmd, apiCmdRes, apiCmdObj) { var array1 = []; array1.push("&physicalnetworkid=" + physicalNetworkObj.id); @@ -20312,7 +20312,7 @@ clearInterval(enablePhysicalNetworkIntervalID); if (result.jobstatus == 1) { //alert("updatePhysicalNetwork succeeded."); - + // get network service provider ID of Virtual Router var virtualRouterProviderId; $.ajax({ @@ -20330,7 +20330,7 @@ alert("error: listNetworkServiceProviders API doesn't return VirtualRouter provider ID"); return; } - + var virtualRouterElementId; $.ajax({ url: createURL("listVirtualRouterElements&nspid=" + virtualRouterProviderId), @@ -20347,7 +20347,7 @@ alert("error: listVirtualRouterElements API doesn't return Virtual Router Element Id"); return; } - + $.ajax({ url: createURL("configureVirtualRouterElement&enabled=true&id=" + virtualRouterElementId), dataType: "json", @@ -20366,7 +20366,7 @@ clearInterval(enableVirtualRouterElementIntervalID); if (result.jobstatus == 1) { //alert("configureVirtualRouterElement succeeded."); - + $.ajax({ url: createURL("updateNetworkServiceProvider&state=Enabled&id=" + virtualRouterProviderId), dataType: "json", @@ -20385,7 +20385,7 @@ 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 @@ -20406,7 +20406,7 @@ alert("error: listNetworkServiceProviders API doesn't return security group provider ID"); return; } - + $.ajax({ url: createURL("updateNetworkServiceProvider&state=Enabled&id=" + securityGroupProviderId), dataType: "json", @@ -20425,7 +20425,7 @@ clearInterval(enableSecurityGroupProviderIntervalID); if (result.jobstatus == 1) { //alert("Security group provider is enabled"); - + //create network (for basic zone only) var array2 =[]; array2.push("&zoneid=" + newZoneObj.id); @@ -20444,11 +20444,11 @@ 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)); - + $.ajax({ url: createURL("createPod" + array3.join("")), dataType: "json", @@ -20495,11 +20495,11 @@ 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)); - + $.ajax({ url: createURL("createPod" + array3.join("")), dataType: "json", @@ -20523,11 +20523,11 @@ 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)); - + $.ajax({ url: createURL("createPod" + array3.join("")), dataType: "json", @@ -20583,31 +20583,31 @@ } }); }; - + //action filters (begin) var zoneActionfilter = cloudStack.actionFilter.zoneActionfilter = function (args) { var jsonObj = args.context.item; var allowedActions =[ 'enableSwift']; - + if (jsonObj.vmwaredcId == null) allowedActions.push('addVmwareDc'); else allowedActions.push('removeVmwareDc'); - + if (jsonObj.domainid != null) 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("remove"); return allowedActions; } - - + + var nexusActionfilter = function (args) { var nexusObj = args.context.item; var allowedActions =[]; @@ -20618,23 +20618,23 @@ allowedActions.push("remove"); return allowedActions; } - + var podActionfilter = function (args) { var podObj = args.context.item; var dedicatedPodObj = args.context.podItem; var allowedActions =[]; - + if (podObj.domainid != null) 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("remove"); - + /* var selectedZoneObj; $(zoneObjs).each(function(){ @@ -20644,7 +20644,7 @@ } }); */ - + if (selectedZoneObj.networktype == "Basic") { //basic-mode network (pod-wide VLAN) //$("#tab_ipallocation, #add_iprange_button, #tab_network_device, #add_network_device_button").show(); @@ -20654,24 +20654,24 @@ //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 jsonObj = args.context.item; var allowedActions =[]; return allowedActions; } - + var clusterActionfilter = function (args) { var jsonObj = args.context.item; var allowedActions =[]; - + if (jsonObj.domainid != null) allowedActions.push("release"); else allowedActions.push("dedicate"); - + if (jsonObj.state == "Enabled") { //managed, allocation enabled allowedActions.push("unmanage"); @@ -20686,26 +20686,26 @@ //Unmanaged, PrepareUnmanaged , PrepareUnmanagedError allowedActions.push("manage"); } - + allowedActions.push("remove"); - + return allowedActions; } - + var hostActionfilter = function (args) { var jsonObj = args.context.item; var allowedActions =[]; - + if (jsonObj.domainid != null) allowedActions.push("release"); else allowedActions.push("dedicate"); - - + + if (jsonObj.resourcestate == "Enabled") { allowedActions.push("edit"); allowedActions.push("enableMaintenanceMode"); - allowedActions.push("disable"); - + allowedActions.push("disable"); + if (jsonObj.state != "Disconnected") allowedActions.push("forceReconnect"); } else if (jsonObj.resourcestate == "ErrorInMaintenance") { @@ -20724,20 +20724,20 @@ allowedActions.push("enable"); 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 jsonObj = args.context.item; var allowedActions =[]; - + allowedActions.push("edit"); - + if (jsonObj.state == 'Up' || jsonObj.state == "Connecting") { allowedActions.push("enableMaintenanceMode"); } else if (jsonObj.state == 'Down') { @@ -20758,53 +20758,53 @@ } return allowedActions; } - + var secondarystorageActionfilter = function (args) { var jsonObj = args.context.item; var allowedActions = []; - allowedActions.push("remove"); + allowedActions.push("remove"); return allowedActions; } - + var routerActionfilter = cloudStack.sections.system.routerActionFilter = function (args) { var jsonObj = args.context.item; var allowedActions =[]; - + if (jsonObj.requiresupgrade == true) { allowedActions.push('upgradeRouterToUseNewerTemplate'); } - + if (jsonObj.state == 'Running') { allowedActions.push("stop"); - + //when router is Running, only VMware support scaleUp(change service offering) if (jsonObj.hypervisor == "VMware") { allowedActions.push("scaleUp"); - } - + } + allowedActions.push("restart"); - + allowedActions.push("viewConsole"); if (isAdmin()) allowedActions.push("migrate"); } else if (jsonObj.state == 'Stopped') { allowedActions.push("start"); - + //when router is Stopped, all hypervisors support scaleUp(change service offering) allowedActions.push("scaleUp"); - + allowedActions.push("remove"); } return allowedActions; } - + var internallbinstanceActionfilter = function (args) { var jsonObj = args.context.item; var allowedActions =[]; - + if (jsonObj.state == 'Running') { allowedActions.push("stop"); - + allowedActions.push("viewConsole"); if (isAdmin()) allowedActions.push("migrate"); @@ -20813,37 +20813,37 @@ } return allowedActions; } - + var systemvmActionfilter = function (args) { var jsonObj = args.context.item; var allowedActions =[]; - + if (jsonObj.state == 'Running') { allowedActions.push("stop"); allowedActions.push("restart"); allowedActions.push("remove"); - + //when systemvm is Running, only VMware support scaleUp(change service offering) if (jsonObj.hypervisor == "VMware") { allowedActions.push("scaleUp"); } - + allowedActions.push("viewConsole"); if (isAdmin()) allowedActions.push("migrate"); } else if (jsonObj.state == 'Stopped') { allowedActions.push("start"); - + //when systemvm is Stopped, all hypervisors support scaleUp(change service offering) allowedActions.push("scaleUp"); - + allowedActions.push("remove"); } else if (jsonObj.state == 'Error') { allowedActions.push("remove"); } return allowedActions; } - + var routerGroupActionfilter = function (args) { var jsonObj = args.context.item; var allowedActions =[]; @@ -20852,7 +20852,7 @@ } return allowedActions; } - + var bladeActionfilter = function (args) { var jsonObj = args.context.item; var allowedActions =[]; @@ -20863,29 +20863,29 @@ } return allowedActions; } - + //action filters (end) - + var networkProviderActionFilter = function (id) { return function (args) { var allowedActions =[]; var jsonObj = nspMap[id] ? nspMap[id]: { }; - + if (jsonObj.state) { if (jsonObj.state == "Enabled") allowedActions.push("disable"); else if (jsonObj.state == "Disabled") allowedActions.push("enable"); allowedActions.push("destroy"); } - + allowedActions.push('add'); - + return allowedActions; } }; - + var addExtraPropertiesToClusterObject = function (jsonObj) { if (jsonObj.managedstate == "Managed") { jsonObj.state = jsonObj.allocationstate; //jsonObj.state == Enabled, Disabled @@ -20893,7 +20893,7 @@ jsonObj.state = jsonObj.managedstate; //jsonObj.state == Unmanaged, PrepareUnmanaged, PrepareUnmanagedError } } - + var addExtraPropertiesToRouterInstanceObject = function (jsonObj) { if (jsonObj.isredundantrouter == true) { jsonObj[ "redundantRouterState"] = jsonObj.redundantstate; @@ -20901,12 +20901,12 @@ jsonObj[ "redundantRouterState"] = ""; } } - + var refreshNspData = function (nspName) { var array1 =[]; if (nspName != null) array1.push("&name=" + nspName); - + $.ajax({ url: createURL("listNetworkServiceProviders&physicalnetworkid=" + selectedPhysicalNetworkObj.id + array1.join("")), dataType: "json", @@ -20915,7 +20915,7 @@ nspMap = { }; //reset - + var items = json.listnetworkserviceprovidersresponse.networkserviceprovider; if (items != null) { for (var i = 0; i < items.length; i++) { @@ -20931,7 +20931,7 @@ break; case "Ovs": nspMap["Ovs"] = items[i]; - break; + break; case "Netscaler": nspMap[ "netscaler"] = items[i]; break; @@ -20982,7 +20982,7 @@ } } }); - + nspHardcodingArray =[ { id: 'netscaler', name: 'NetScaler', @@ -21017,19 +21017,19 @@ id: 'BaremetalPxeProvider', name: 'Baremetal PXE', state: nspMap.BaremetalPxeProvider ? nspMap.BaremetalPxeProvider.state: 'Disabled' - }, + }, { id: 'Opendaylight', name: 'OpenDaylight (Experimental)', state: nspMap.Opendaylight ? nspMap.Opendaylight.state: 'Disabled' }]; - + $(window).trigger('cloudStack.system.serviceProviders.makeHarcodedArray', { nspHardcodingArray: nspHardcodingArray, selectedZoneObj: selectedZoneObj, selectedPhysicalNetworkObj: selectedPhysicalNetworkObj }); - + if (selectedZoneObj.networktype == "Basic") { nspHardcodingArray.push({ id: 'securityGroups', @@ -21048,13 +21048,13 @@ name: 'Nuage Vsp', state: nspMap.nuageVsp ? nspMap.nuageVsp.state : 'Disabled' }); - + nspHardcodingArray.push({ id: 'InternalLbVm', name: 'Internal LB VM', state: nspMap.InternalLbVm ? nspMap.InternalLbVm.state: 'Disabled' }); - + nspHardcodingArray.push({ id: 'vpcVirtualRouter', name: 'VPC Virtual Router', @@ -21080,43 +21080,43 @@ name: 'GloboDNS', state: nspMap.GloboDns ? nspMap.GloboDns.state : 'Disabled' }); - + //CLOUDSTACK-6840: OVS refers to SDN provider. However, we are not supporting SDN in this release. /* nspHardcodingArray.push({ id: 'Ovs', name: 'Ovs', - state: nspMap.Ovs ? nspMap.Ovs.state: 'Disabled' - }); - */ - } + state: nspMap.Ovs ? nspMap.Ovs.state: 'Disabled' + }); + */ + } }; - + cloudStack.actionFilter.physicalNetwork = function (args) { var state = args.context.item.state; - + if (state != 'Destroyed') { return[ 'remove']; } - + return[]; }; - + 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({ @@ -21126,60 +21126,60 @@ }), async: false, success: function(json) { - if (json.listroutersresponse.count != undefined) { - var routerCountFromAllPages = json.listroutersresponse.count; - var routerCountFromFirstPageToCurrentPage = json.listroutersresponse.router.length; - var routerRequiresUpgrade = 0; - + if (json.listroutersresponse.count != undefined) { + var routerCountFromAllPages = json.listroutersresponse.count; + var routerCountFromFirstPageToCurrentPage = json.listroutersresponse.router.length; + var routerRequiresUpgrade = 0; + var items = json.listroutersresponse.router; - for (var k = 0; k < items.length; k++) { + for (var k = 0; k < items.length; k++) { if (items[k].requiresupgrade) { routerRequiresUpgrade++; } - } - + } + $.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; + async: false, + success: function(json) { + if (json.listroutersresponse.count != undefined) { + routerCountFromAllPages += json.listroutersresponse.count; groupbyObj.routerCount = routerCountFromAllPages; - - routerCountFromFirstPageToCurrentPage += json.listroutersresponse.router.length; - + + routerCountFromFirstPageToCurrentPage += json.listroutersresponse.router.length; + var items = json.listroutersresponse.router; - for (var k = 0; k < items.length; k++) { + for (var k = 0; k < items.length; k++) { if (items[k].requiresupgrade) { routerRequiresUpgrade++; } - } + } } else { groupbyObj.routerCount = routerCountFromAllPages; } - } - }); - - var callListApiWithPage = function() { + } + }); + + var callListApiWithPage = function() { $.ajax({ url: createURL('listRouters'), async: false, data: $.extend({}, listRoutersData, { page: currentPage }), - success: function(json) { - routerCountFromFirstPageToCurrentPage += json.listroutersresponse.router.length; + success: function(json) { + routerCountFromFirstPageToCurrentPage += json.listroutersresponse.router.length; var items = json.listroutersresponse.router; - for (var k = 0; k < items.length; k++) { + for (var k = 0; k < items.length; k++) { if (items[k].requiresupgrade) { routerRequiresUpgrade++; } - } - + } + $.ajax({ url: createURL('listRouters'), async: false, @@ -21187,45 +21187,45 @@ page: currentPage, projectid: -1 }), - success: function(json) { - if (json.listroutersresponse.count != undefined) { - routerCountFromAllPages += json.listroutersresponse.count; + success: function(json) { + if (json.listroutersresponse.count != undefined) { + routerCountFromAllPages += json.listroutersresponse.count; groupbyObj.routerCount = routerCountFromAllPages; - - routerCountFromFirstPageToCurrentPage += json.listroutersresponse.router.length; - + + routerCountFromFirstPageToCurrentPage += json.listroutersresponse.router.length; + var items = json.listroutersresponse.router; - for (var k = 0; k < items.length; k++) { + for (var k = 0; k < items.length; k++) { if (items[k].requiresupgrade) { routerRequiresUpgrade++; } - } + } } else { groupbyObj.routerCount = routerCountFromAllPages; } } - }); - + }); + if (routerCountFromFirstPageToCurrentPage < routerCountFromAllPages) { currentPage++; callListApiWithPage(); - } + } } - }); - } - + }); + } + if (routerCountFromFirstPageToCurrentPage < routerCountFromAllPages) { currentPage++; callListApiWithPage(); - } - + } + groupbyObj.routerRequiresUpgrade = routerRequiresUpgrade; groupbyObj.numberOfRouterRequiresUpgrade = routerRequiresUpgrade; } else { groupbyObj.routerCount = 0; groupbyObj.routerRequiresUpgrade = 0; groupbyObj.numberOfRouterRequiresUpgrade = 0; - } + } } }); } diff --git a/ui/scripts/templates.js b/ui/scripts/templates.js index 98861dde42c..915d23ae8a0 100644 --- a/ui/scripts/templates.js +++ b/ui/scripts/templates.js @@ -16,7 +16,7 @@ // under the License. (function(cloudStack, $) { var ostypeObjs; - + cloudStack.sections.templates = { title: 'label.menu.templates', id: 'templates', @@ -131,19 +131,19 @@ validation: { required: true } - }, + }, zone: { label: 'label.zone', docID: 'helpRegisterTemplateZone', - select: function(args) { + select: function(args) { if(g_regionsecondaryenabled == true) { args.response.success({ data: [{ id: -1, description: "All Zones" }] - }); - } else { + }); + } else { $.ajax({ url: createURL("listZones&available=true"), dataType: "json", @@ -184,7 +184,7 @@ var apiCmd; if (args.zone == -1) { //All Zones //apiCmd = "listHypervisors&zoneid=-1"; //"listHypervisors&zoneid=-1" has been changed to return only hypervisors available in all zones (bug 8809) - apiCmd = "listHypervisors"; + apiCmd = "listHypervisors"; } else { apiCmd = "listHypervisors&zoneid=" + args.zone; @@ -215,20 +215,20 @@ $form.find('.form-item[rel=rootDiskControllerType]').css('display', 'inline-block'); $form.find('.form-item[rel=nicAdapterType]').css('display', 'inline-block'); $form.find('.form-item[rel=keyboardType]').css('display', 'inline-block'); - + $form.find('.form-item[rel=xenserverToolsVersion61plus]').hide(); } else if ($(this).val() == "XenServer") { $form.find('.form-item[rel=rootDiskControllerType]').hide(); $form.find('.form-item[rel=nicAdapterType]').hide(); - $form.find('.form-item[rel=keyboardType]').hide(); - + $form.find('.form-item[rel=keyboardType]').hide(); + if (isAdmin()) - $form.find('.form-item[rel=xenserverToolsVersion61plus]').css('display', 'inline-block'); + $form.find('.form-item[rel=xenserverToolsVersion61plus]').css('display', 'inline-block'); } else { $form.find('.form-item[rel=rootDiskControllerType]').hide(); $form.find('.form-item[rel=nicAdapterType]').hide(); $form.find('.form-item[rel=keyboardType]').hide(); - + $form.find('.form-item[rel=xenserverToolsVersion61plus]').hide(); } }); @@ -260,7 +260,7 @@ }, isHidden: true }, - + //fields for hypervisor == "VMware" (starts here) rootDiskControllerType: { label: 'label.root.disk.controller', @@ -419,18 +419,18 @@ osTypeId: { label: 'label.os.type', docID: 'helpRegisterTemplateOSType', - select: function(args) { + select: function(args) { $.ajax({ url: createURL("listOsTypes"), dataType: "json", async: true, - success: function(json) { + success: function(json) { var ostypeObjs = json.listostypesresponse.ostype; args.response.success({ data: ostypeObjs }); } - }); + }); } }, @@ -519,16 +519,16 @@ }); } - - //XenServer only (starts here) + + //XenServer only (starts here) if (args.$form.find('.form-item[rel=xenserverToolsVersion61plus]').css("display") != "none") { $.extend(data, { 'details[0].hypervisortoolsversion': (args.data.xenserverToolsVersion61plus == "on") ? "xenserver61" : "xenserver56" }); } //XenServer only (ends here) - - + + //VMware only (starts here) if (args.$form.find('.form-item[rel=rootDiskControllerType]').css("display") != "none" && args.data.rootDiskControllerType != "") { $.extend(data, { @@ -579,7 +579,7 @@ } } }, - + uploadTemplateFromLocal: { isHeader: true, label: 'Upload from Local', @@ -592,9 +592,9 @@ title: 'Upload Template from Local', preFilter: cloudStack.preFilter.createTemplate, fileUpload: { - getURL: function(args) { + getURL: function(args) { args.data = args.formData; - + var data = { name: args.data.name, displayText: args.data.description, @@ -606,7 +606,7 @@ osTypeId: args.data.osTypeId, hypervisor: args.data.hypervisor }; - + if (args.$form.find('.form-item[rel=isPublic]').css("display") != "none") { $.extend(data, { ispublic: (args.data.isPublic == "on") @@ -630,15 +630,15 @@ isrouting: (args.data.isrouting === 'on') }); } - + $.ajax({ url: createURL('getUploadParamsForTemplate'), data: data, async: false, - success: function(json) { + success: function(json) { var uploadparams = json.postuploadtemplateresponse.getuploadparams; var templateId = uploadparams.id; - + args.response.success({ url: uploadparams.postURL, ajaxPost: true, @@ -647,9 +647,9 @@ 'X-expires': uploadparams.expires, 'X-metadata': uploadparams.metadata } - }); + }); } - }); + }); }, postUpload: function(args) { if(args.error) { @@ -685,7 +685,7 @@ validation: { required: true } - }, + }, zone: { label: 'label.zone', @@ -742,24 +742,24 @@ }); } }, - + format: { label: 'label.format', docID: 'helpRegisterTemplateFormat', dependsOn: 'hypervisor', select: function(args) { var items = []; - if (args.hypervisor == "XenServer") { + if (args.hypervisor == "XenServer") { items.push({ id: 'VHD', description: 'VHD' }); - } else if (args.hypervisor == "VMware") { + } else if (args.hypervisor == "VMware") { items.push({ id: 'OVA', description: 'OVA' }); - } else if (args.hypervisor == "KVM") { + } else if (args.hypervisor == "KVM") { items.push({ id: 'QCOW2', description: 'QCOW2' @@ -776,17 +776,17 @@ id: 'VMDK', description: 'VMDK' }); - } else if (args.hypervisor == "BareMetal") { + } else if (args.hypervisor == "BareMetal") { items.push({ id: 'BareMetal', description: 'BareMetal' }); - } else if (args.hypervisor == "Ovm") { + } else if (args.hypervisor == "Ovm") { items.push({ id: 'RAW', description: 'RAW' }); - } else if (args.hypervisor == "LXC") { + } else if (args.hypervisor == "LXC") { items.push({ id: 'TAR', description: 'TAR' @@ -805,23 +805,23 @@ data: items }); } - }, + }, osTypeId: { label: 'label.os.type', docID: 'helpRegisterTemplateOSType', - select: function(args) { + select: function(args) { $.ajax({ url: createURL("listOsTypes"), dataType: "json", async: true, - success: function(json) { + success: function(json) { var ostypeObjs = json.listostypesresponse.ostype; args.response.success({ data: ostypeObjs }); } - }); + }); } }, @@ -830,40 +830,40 @@ docID: 'helpRegisterTemplateExtractable', isBoolean: true }, - + isPasswordEnabled: { label: "label.password.enabled", docID: 'helpRegisterTemplatePasswordEnabled', isBoolean: true }, - + isdynamicallyscalable: { label: "label.dynamically.scalable", docID: 'helpRegisterTemplateDynamicallyScalable', isBoolean: true - }, - + }, + isPublic: { label: "label.public", docID: 'helpRegisterTemplatePublic', isBoolean: true, isHidden: true - }, - + }, + isFeatured: { label: "label.featured", docID: 'helpRegisterTemplateFeatured', isBoolean: true, isHidden: true }, - + isrouting: { label: 'label.routing', docID: 'helpRegisterTemplateRouting', isBoolean: true, isHidden: true }, - + requireshvm: { label: 'label.hvm', docID: 'helpRegisterTemplateHvm', @@ -934,14 +934,14 @@ success: function(json) { var items = json.listtemplatesresponse.template; var itemsView = []; - + $(items).each(function(index, item) { var existing = $.grep(itemsView, function(it){ return it != null && it.id !=null && it.id == item.id; }); - + if (existing.length == 0) { - itemsView.push($.extend(item, { + itemsView.push($.extend(item, { zones: item.zonename, zoneids: [item.zoneid] })); @@ -950,7 +950,7 @@ existing[0].zones = 'label.multiplezones'; existing[0].zoneids.push(item.zoneid); } - }); + }); args.response.success({ actionFilter: templateActionfilter, @@ -1035,10 +1035,10 @@ } }); - + //***** addResourceDetail ***** - //XenServer only (starts here) - if(args.$detailView.find('form').find('div .detail-group').find('.xenserverToolsVersion61plus').length > 0) { + //XenServer only (starts here) + if(args.$detailView.find('form').find('div .detail-group').find('.xenserverToolsVersion61plus').length > 0) { $.ajax({ url: createURL('addResourceDetail'), data: { @@ -1055,33 +1055,33 @@ dataType: "json", success: function(json) { var result = json.queryasyncjobresultresponse; - + if (result.jobstatus == 0) { return; //Job has not completed } else { clearInterval(addResourceDetailIntervalID); - if (result.jobstatus == 1) { - //do nothing + if (result.jobstatus == 1) { + //do nothing } else if (result.jobstatus == 2) { cloudStack.dialog.notice({ message: "message.XSTools61plus.update.failed" + " " + _s(result.jobresult.errortext) - }); + }); } } }, - error: function(XMLHttpResponse) { + error: function(XMLHttpResponse) { cloudStack.dialog.notice({ message: "message.XSTools61plus.update.failed" + " " + parseXMLHttpResponse(XMLHttpResponse) - }); + }); } }); - }, g_queryAsyncJobResultInterval); + }, g_queryAsyncJobResultInterval); } - }); - } - //XenServer only (ends here) - + }); + } + //XenServer only (ends here) + //***** listTemplates ***** //So, we call listTemplates API to get a complete template object @@ -1162,36 +1162,36 @@ } else { hiddenFields = ["hypervisor", 'xenserverToolsVersion61plus']; } - + if ('templates' in args.context && args.context.templates[0].hypervisor != 'XenServer') { hiddenFields.push('xenserverToolsVersion61plus'); } - + if ('templates' in args.context && args.context.templates[0].ostypeid != undefined) { var ostypeObjs; $.ajax({ url: createURL("listOsTypes"), dataType: "json", async: false, - success: function(json) { - var ostypeObjs = json.listostypesresponse.ostype; + success: function(json) { + var ostypeObjs = json.listostypesresponse.ostype; } }); - + if (ostypeObjs != undefined) { var ostypeName; for (var i = 0; i < ostypeObjs.length; i++) { - if (ostypeObjs[i].id == args.context.templates[0].ostypeid) { + if (ostypeObjs[i].id == args.context.templates[0].ostypeid) { ostypeName = ostypeObjs[i].description; break; } - } - if (ostypeName == undefined || ostypeName.indexOf("Win") == -1) { + } + if (ostypeName == undefined || ostypeName.indexOf("Win") == -1) { hiddenFields.push('xenserverToolsVersion61plus'); - } + } } } - + return hiddenFields; }, @@ -1203,7 +1203,7 @@ required: true } } - }, { + }, { hypervisor: { label: 'label.hypervisor' }, @@ -1217,8 +1217,8 @@ return false; }, converter: cloudStack.converters.toBooleanText - }, - + }, + size: { label: 'label.size', converter: function(args) { @@ -1276,8 +1276,8 @@ return false; }, converter: cloudStack.converters.toBooleanText - }, - + }, + ostypeid: { label: 'label.os.type', isEditable: true, @@ -1287,11 +1287,11 @@ url: createURL("listOsTypes"), dataType: "json", async: false, - success: function(json) { - ostypeObjs = json.listostypesresponse.ostype; + success: function(json) { + ostypeObjs = json.listostypesresponse.ostype; } }); - + var items = []; $(ostypeObjs).each(function() { items.push({ @@ -1315,8 +1315,8 @@ validation: { required: true } - }, - + }, + domain: { label: 'label.domain' }, @@ -1327,11 +1327,11 @@ label: 'label.created', converter: cloudStack.converters.toLocalDate }, - + templatetype: { label: 'label.type' }, - + id: { label: 'label.id' } @@ -1343,7 +1343,7 @@ }), - dataProvider: function(args) { // UI > Templates menu (listing) > select a template from listing > Details tab + dataProvider: function(args) { // UI > Templates menu (listing) > select a template from listing > Details tab $.ajax({ url: createURL("listTemplates"), data: { @@ -1352,14 +1352,14 @@ }, success: function(json) { var jsonObj = json.listtemplatesresponse.template[0]; - + if ('details' in jsonObj && 'hypervisortoolsversion' in jsonObj.details) { if (jsonObj.details.hypervisortoolsversion == 'xenserver61') jsonObj.xenserverToolsVersion61plus = true; else jsonObj.xenserverToolsVersion61plus = false; } - + args.response.success({ actionFilter: templateActionfilter, data: jsonObj @@ -1388,7 +1388,7 @@ hideSearchBar: true, - dataProvider: function(args) { // UI > Templates menu (listing) > select a template from listing > Details tab > Zones tab (listing) + dataProvider: function(args) { // UI > Templates menu (listing) > select a template from listing > Details tab > Zones tab (listing) $.ajax({ url: createURL("listTemplates"), data: { @@ -1397,7 +1397,7 @@ }, success: function(json) { var jsonObjs = json.listtemplatesresponse.template; - + if (jsonObjs != undefined) { for (var i = 0; i < jsonObjs.length; i++) { var jsonObj = jsonObjs[i]; @@ -1408,16 +1408,16 @@ jsonObj.xenserverToolsVersion61plus = false; } } - } - + } + args.response.success({ actionFilter: templateActionfilter, data: jsonObjs }); } - }); + }); }, - + detailView: { noCompact: true, actions: { @@ -1500,18 +1500,18 @@ } } }, - action: function(args) { + action: function(args) { var data = { id: args.context.templates[0].id, destzoneid: args.data.destinationZoneId - }; + }; $.extend(data, { sourcezoneid: args.context.zones[0].zoneid - }); - + }); + $.ajax({ url: createURL('copyTemplate'), - data: data, + data: data, success: function(json) { var jid = json.copytemplateresponse.jobid; args.response.success({ @@ -1532,7 +1532,7 @@ poll: pollAsyncJobResult } } - }, + }, tabs: { details: { @@ -1544,36 +1544,36 @@ } else { hiddenFields = ["hypervisor", 'xenserverToolsVersion61plus']; } - + if ('templates' in args.context && args.context.templates[0].hypervisor != 'XenServer') { hiddenFields.push('xenserverToolsVersion61plus'); } - + if ('templates' in args.context && args.context.templates[0].ostypeid != undefined) { var ostypeObjs; $.ajax({ url: createURL("listOsTypes"), dataType: "json", async: false, - success: function(json) { - ostypeObjs = json.listostypesresponse.ostype; + success: function(json) { + ostypeObjs = json.listostypesresponse.ostype; } }); - + if (ostypeObjs != undefined) { var ostypeName; for (var i = 0; i < ostypeObjs.length; i++) { - if (ostypeObjs[i].id == args.context.templates[0].ostypeid) { + if (ostypeObjs[i].id == args.context.templates[0].ostypeid) { ostypeName = ostypeObjs[i].description; break; } - } - if (ostypeName == undefined || ostypeName.indexOf("Win") == -1) { + } + if (ostypeName == undefined || ostypeName.indexOf("Win") == -1) { hiddenFields.push('xenserverToolsVersion61plus'); - } + } } - } - + } + return hiddenFields; }, @@ -1585,13 +1585,13 @@ required: true } } - }, { + }, { id: { label: 'label.id' }, zonename: { label: 'label.zone.name' - }, + }, zoneid: { label: 'label.zone.id' }, @@ -1616,8 +1616,8 @@ return false; }, converter: cloudStack.converters.toBooleanText - }, - + }, + size: { label: 'label.size', converter: function(args) { @@ -1675,22 +1675,22 @@ return false; }, converter: cloudStack.converters.toBooleanText - }, - + }, + ostypeid: { label: 'label.os.type', isEditable: true, - select: function(args) { + select: function(args) { var ostypeObjs; $.ajax({ url: createURL("listOsTypes"), dataType: "json", async: false, success: function(json) { - ostypeObjs = json.listostypesresponse.ostype; + ostypeObjs = json.listostypesresponse.ostype; } }); - + var items = []; $(ostypeObjs).each(function() { items.push({ @@ -1711,8 +1711,8 @@ validation: { required: true } - }, - + }, + domain: { label: 'label.domain' }, @@ -1723,7 +1723,7 @@ label: 'label.created', converter: cloudStack.converters.toLocalDate }, - + templatetype: { label: 'label.type' } @@ -1736,7 +1736,7 @@ }), - dataProvider: function(args) { // UI > Templates menu (listing) > select a template from listing > Details tab > Zones tab (listing) > select a zone from listing > Details tab + dataProvider: function(args) { // UI > Templates menu (listing) > select a template from listing > Details tab > Zones tab (listing) > select a zone from listing > Details tab var jsonObj = args.context.zones[0]; if ('details' in jsonObj && 'hypervisortoolsversion' in jsonObj.details) { @@ -1749,11 +1749,11 @@ args.response.success({ actionFilter: templateActionfilter, data: jsonObj - }); + }); } } }} - } + } } } } @@ -1838,8 +1838,8 @@ id: -1, description: "All Zones" }] - }); - } else { + }); + } else { $.ajax({ url: createURL("listZones&available=true"), dataType: "json", @@ -1891,7 +1891,7 @@ dataType: "json", async: true, success: function(json) { - var ostypeObjs = json.listostypesresponse.ostype; + var ostypeObjs = json.listostypesresponse.ostype; var items = []; //items.push({id: "", description: "None"}); //shouldn't have None option when bootable is checked $(ostypeObjs).each(function() { @@ -1904,7 +1904,7 @@ data: items }); } - }); + }); } }, @@ -2316,13 +2316,13 @@ label: 'label.os.type', isEditable: true, select: function(args) { - if (ostypeObjs == undefined) { + if (ostypeObjs == undefined) { $.ajax({ url: createURL("listOsTypes"), dataType: "json", async: false, success: function(json) { - ostypeObjs = json.listostypesresponse.ostype; + ostypeObjs = json.listostypesresponse.ostype; } }); } @@ -2412,7 +2412,7 @@ } }); }, - + detailView: { actions: { copyISO: { @@ -2458,17 +2458,17 @@ } } }, - action: function(args) { + action: function(args) { var data = { id: args.context.isos[0].id, destzoneid: args.data.destinationZoneId - }; + }; if (args.context.zones[0].zoneid != undefined) { $.extend(data, { sourcezoneid: args.context.zones[0].zoneid - }); - } - + }); + } + $.ajax({ url: createURL('copyIso'), data: data, @@ -2616,10 +2616,10 @@ dataType: "json", async: false, success: function(json) { - ostypeObjs = json.listostypesresponse.ostype; + ostypeObjs = json.listostypesresponse.ostype; } }); - + var items = []; $(ostypeObjs).each(function() { items.push({ @@ -2629,7 +2629,7 @@ }); args.response.success({ data: items - }); + }); } }, @@ -2689,14 +2689,14 @@ //do nothing } else { allowedActions.push("edit"); - + allowedActions.push("copyTemplate"); /* if(g_regionsecondaryenabled != true) { allowedActions.push("copyTemplate"); } */ - + //allowedActions.push("createVm"); // For Beta2, this simply doesn't work without a network. } diff --git a/ui/scripts/ui-custom/accountsWizard.js b/ui/scripts/ui-custom/accountsWizard.js index 0d416e1ffee..3e2a64665d6 100644 --- a/ui/scripts/ui-custom/accountsWizard.js +++ b/ui/scripts/ui-custom/accountsWizard.js @@ -209,10 +209,10 @@ } ] } - }; - */ + }; + */ //for testing only (end) - + if (json.ldapuserresponse.count > 0) { $(json.ldapuserresponse.LdapUser).each(function() { var $result = $(''); @@ -334,4 +334,4 @@ accountsWizard(args); }; }; -})(jQuery, cloudStack); \ No newline at end of file +})(jQuery, cloudStack); diff --git a/ui/scripts/ui-custom/instanceWizard.js b/ui/scripts/ui-custom/instanceWizard.js index 0a5370e53cb..86901c560e5 100644 --- a/ui/scripts/ui-custom/instanceWizard.js +++ b/ui/scripts/ui-custom/instanceWizard.js @@ -301,7 +301,7 @@ 'select-iso': function($step, formData) { $step.find('.section.custom-size').hide(); - + var originalValues = function(formData) { var $inputs = $step.find('.wizard-step-conditional:visible') .find('input[type=radio]'); @@ -323,7 +323,7 @@ return { response: { - success: function(args) { + success: function(args) { if (formData['select-template']) { $step.find('.wizard-step-conditional').filter(function() { return $(this).hasClass(formData['select-template']); @@ -462,7 +462,7 @@ }, { 'wizard-field': 'service-offering' }) - ); + ); $step.find('input[type=radio]').bind('change', function() { var $target = $(this); @@ -576,7 +576,7 @@ $selectContainer.hide(); // Fix issue with containers always showing after reload - $multiDiskSelect.find('.select-container').attr('style', null); + $multiDiskSelect.find('.select-container').attr('style', null); } else { $selectContainer.show(); $step.find('.content .select-container').append( @@ -618,7 +618,7 @@ // handle removal of custom IOPS controls $step.removeClass('custom-iops-do'); } - + return true; } @@ -1137,19 +1137,19 @@ // Next button if ($target.closest('div.button.next').size()) { //step 2 - select template/ISO - if($activeStep.hasClass('select-iso')) { + if($activeStep.hasClass('select-iso')) { if ($activeStep.find('.content:visible input:checked').size() == 0) { cloudStack.dialog.notice({ message: 'message.step.1.continue' }); return false; - } + } $(window).trigger("cloudStack.module.instanceWizard.clickNextButton", { $form: $form, currentStep: 2 - }); - } - + }); + } + //step 6 - select network if ($activeStep.find('.wizard-step-conditional.select-network:visible').size() > 0) { var data = $activeStep.data('my-networks'); @@ -1277,7 +1277,7 @@ $wizard.find('.tab-view').tabs(); $wizard.find('.slider').each(function() { var $slider = $(this); - + $slider.slider({ min: minCustomDiskSize, max: maxCustomDiskSize, diff --git a/ui/scripts/ui-custom/physicalResources.js b/ui/scripts/ui-custom/physicalResources.js index 2a0ac8547fe..e815fc533f3 100644 --- a/ui/scripts/ui-custom/physicalResources.js +++ b/ui/scripts/ui-custom/physicalResources.js @@ -61,7 +61,7 @@ ); $li.appendTo($socketInfo); - }); + }); } } }); diff --git a/ui/scripts/ui-custom/pluginListing.js b/ui/scripts/ui-custom/pluginListing.js index e679c626526..fce7daaf406 100644 --- a/ui/scripts/ui-custom/pluginListing.js +++ b/ui/scripts/ui-custom/pluginListing.js @@ -53,13 +53,13 @@ $plugin.click(function() { var $mainSection = $('#navigation ul li').filter('.' + plugin.id); - + if ($mainSection.size()) { $mainSection.click(); return; } - + $browser.cloudBrowser('addPanel', { title: plugin.title, $parent: $('.panel:first'), diff --git a/ui/scripts/ui-custom/zoneWizard.js b/ui/scripts/ui-custom/zoneWizard.js index 8344d956892..7e1a2a2767e 100644 --- a/ui/scripts/ui-custom/zoneWizard.js +++ b/ui/scripts/ui-custom/zoneWizard.js @@ -296,21 +296,21 @@ var hypervisor = getData($trafficType.closest('.zone-wizard')).zone.hypervisor; var zoneType = getData($trafficType.closest('.zone-wizard')).zone.networkType; var fields; - + if (hypervisor == 'VMware') { fields = { vSwitchName: { label: 'label.vswitch.name' , defaultValue: trafficData.vSwitchName }, - vlanId: { + vlanId: { label: 'label.vlan.id', defaultValue: trafficData.vlanId - } - }; - + } + }; + if(zoneType == 'Advanced') { - if($trafficType.hasClass('guest') || $trafficType.hasClass('public')) { + if($trafficType.hasClass('guest') || $trafficType.hasClass('public')) { if(trafficData.vSwitchType == null) { var useDvs = false; $.ajax({ @@ -324,9 +324,9 @@ useDvs = true; } } - }); - if (useDvs == true) { - var useNexusDvs = false; + }); + if (useDvs == true) { + var useNexusDvs = false; $.ajax({ url: createURL('listConfigurations'), data: { @@ -345,17 +345,17 @@ } else { trafficData.vSwitchType = 'vmwaredvs'; fields.vSwitchName.defaultValue = 'dvSwitch0'; - } + } } else { //useDvs == false trafficData.vSwitchType = 'vmwaresvs'; fields.vSwitchName.defaultValue = 'vSwitch0'; - } + } } - + $.extend(fields, { vSwitchType: { label: 'label.vSwitch.type', - select: function (args) { + select: function (args) { args.response.success({ data: [{ id: 'nexusdvs', @@ -371,10 +371,10 @@ }, defaultValue: trafficData.vSwitchType } - }); - } + }); + } } - } else { + } else { fields = { label: { label: hypervisor + ' ' + _l('label.traffic.label'), @@ -390,7 +390,7 @@ fields: fields }, - after: function(args) { + after: function(args) { $trafficType.data('traffic-type-data', args.data); } }); diff --git a/ui/scripts/ui/core.js b/ui/scripts/ui/core.js index 7756390b372..f05db2ce397 100644 --- a/ui/scripts/ui/core.js +++ b/ui/scripts/ui/core.js @@ -98,7 +98,7 @@ $navItem.addClass('active'); $browser.cloudBrowser('removeAllPanels'); } - + $browser.cloudBrowser('addPanel', { title: '' + _l(data.title) + '' + '', data: '', @@ -106,7 +106,7 @@ if(!isPlugin) { $breadcrumb.attr('title', _l(data.title)); } - + data.$breadcrumb = $breadcrumb; // Hide breadcrumb if this is the home section diff --git a/ui/scripts/ui/dialog.js b/ui/scripts/ui/dialog.js index cb6fcb52630..6f2b7a83740 100644 --- a/ui/scripts/ui/dialog.js +++ b/ui/scripts/ui/dialog.js @@ -48,11 +48,11 @@ // Description text var formDesc; - if (typeof(args.form.desc) == 'function') { + if (typeof(args.form.desc) == 'function') { formDesc = args.form.desc(args); } else { //typeof(args.form.desc) == 'string' or 'undefined' formDesc = args.form.desc; - } + } $('').addClass('message').prependTo($formContainer).html( _l(formDesc) ); @@ -225,7 +225,7 @@ if ($dependsOn.is('[type=checkbox]')) { var isReverse = false; - + if (args.form.fields[dependsOn]) { isReverse = args.form.fields[dependsOn].isReverse; isChecked = args.form.fields[dependsOn].isChecked; @@ -238,10 +238,10 @@ if (($target.is(':checked') && !isReverse) || ($target.is(':unchecked') && isReverse)) { - + $dependent.css('display', 'inline-block'); //show dependent dropdown field $dependent.change(); //trigger event handler for default option in dependent dropdown field (CLOUDSTACK-7826) - + $dependent.each(function() { if ($(this).data('dialog-select-fn')) { $(this).data('dialog-select-fn')(); @@ -283,7 +283,7 @@ success: function(args) { if (args.data == undefined || args.data.length == 0) { var $option = $('