diff options
Diffstat (limited to 'gui-editors/gui-editor-apex/src')
18 files changed, 108 insertions, 135 deletions
diff --git a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexAjax.js b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexAjax.js index 79a4ac8..1a63375 100644 --- a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexAjax.js +++ b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexAjax.js @@ -1,7 +1,7 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2020-2021 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexContextAlbumTab.js b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexContextAlbumTab.js index 2b1a5e8..f749b28 100644 --- a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexContextAlbumTab.js +++ b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexContextAlbumTab.js @@ -1,7 +1,7 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2020-2021 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -41,8 +41,6 @@ function contextAlbumTab_activate() { var contextAlbum = JSON.parse(data.messages.message[i]).apexContextAlbum; var contextAlbumRow_tr = document.createElement("tr"); - var contextAlbumid = contextAlbum.key.name + ":" + contextAlbum.key.version; - var contextAlbumTableRow = "<td>" + @@ -84,7 +82,7 @@ function contextAlbumTab_create() { return } - var contextAlbumTabContent = document.createElement("contextAlbumTabContent"); + contextAlbumTabContent = document.createElement("contextAlbumTabContent"); contextAlbumTab.appendChild(contextAlbumTabContent); contextAlbumTabContent.setAttribute("id", "contextAlbumTabContent"); contextAlbumTabContent.addEventListener('contextmenu', rightClickMenu_scopePreserver("contextAlbumTabContent", "contextAlbum",null, null)); diff --git a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexContextSchemaEditForm.js b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexContextSchemaEditForm.js index 197b58b..48b2c33 100644 --- a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexContextSchemaEditForm.js +++ b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexContextSchemaEditForm.js @@ -1,7 +1,7 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2020-2021 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -67,7 +67,6 @@ function editContextSchemaForm_activate(parent, operation, contextSchema) { } apexUtils_emptyElement(parent); - var isedit = false; var createEditOrView = ""; if (!operation) { @@ -76,12 +75,7 @@ function editContextSchemaForm_activate(parent, operation, contextSchema) { createEditOrView = operation.toUpperCase(); } - if (createEditOrView == "CREATE") { - isedit = true; - } else if (createEditOrView == "EDIT" || createEditOrView == "VIEW") { - if (createEditOrView == "EDIT") { - isedit = true; - } + if (createEditOrView == "EDIT" || createEditOrView == "VIEW") { if (!contextSchema) { console.warn("Invalid value (\"" + contextSchema @@ -354,6 +348,8 @@ function editContextSchemaForm_submitPressed() { var name = $('#editContextSchemaFormNameInput').val(); var version = $('#editContextSchemaFormVersionInput').val() + var requestURL; + var jsonString = JSON.stringify({ "name" : name, "version" : version, @@ -364,14 +360,14 @@ function editContextSchemaForm_submitPressed() { }); if (createEditOrView == "CREATE") { - var requestURL = window.restRootURL + "/ContextSchema/Create"; + requestURL = window.restRootURL + "/ContextSchema/Create"; ajax_post(requestURL, jsonString, function(resultData) { apexUtils_removeElement("editContextSchemaFormDiv"); contextSchemaTab_reset(); keyInformationTab_reset() }); } else if (createEditOrView == "EDIT") { - var requestURL = window.restRootURL + "/ContextSchema/Update"; + requestURL = window.restRootURL + "/ContextSchema/Update"; ajax_put(requestURL, jsonString, function(resultData) { apexUtils_removeElement("editContextSchemaFormDiv"); contextSchemaTab_reset(); diff --git a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexContextSchemaTab.js b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexContextSchemaTab.js index 4474f5d..45676b8 100644 --- a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexContextSchemaTab.js +++ b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexContextSchemaTab.js @@ -1,7 +1,7 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2020-2021 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -78,7 +78,7 @@ function contextSchemaTab_create() { return } - var contextSchemaTabContent = document.createElement("contextSchemaTabContent"); + contextSchemaTabContent = document.createElement("contextSchemaTabContent"); contextSchemaTab.appendChild(contextSchemaTabContent); contextSchemaTabContent.setAttribute("id", "contextSchemaTabContent"); contextSchemaTabContent.addEventListener('contextmenu', rightClickMenu_scopePreserver("contextSchemaTabContent", "ContextSchema",null,null)); diff --git a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexEventEditForm.js b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexEventEditForm.js index 58c9b26..ea23895 100644 --- a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexEventEditForm.js +++ b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexEventEditForm.js @@ -1,7 +1,7 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2020-2021 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -69,7 +69,7 @@ function editEventForm_editEvent_inner(formParent, name, version, viewOrEdit) { var requestURL = window.restRootURL + "/Event/Get?name=" + name + "&version=" + version; ajax_getWithKeyInfo(requestURL, "apexEvent", function(event) { // Get all contextSchemas too for event params - var requestURL = window.restRootURL + "/ContextSchema/Get?name=&version="; + requestURL = window.restRootURL + "/ContextSchema/Get?name=&version="; var contextSchemas = new Array(); ajax_get(requestURL, function(data2) { for (var i = 0; i < data2.messages.message.length; i++) { @@ -96,19 +96,14 @@ function editEventForm_activate(parent, operation, event, contextSchemas) { } apexUtils_emptyElement(parent); - var isedit = false; var createEditOrView = ""; if (!operation) { console.warn("No operation specified for EventForm form") } else { createEditOrView = operation.toUpperCase() } - if (createEditOrView == "CREATE") { - isedit = true; - } else if (createEditOrView == "EDIT" || createEditOrView == "VIEW") { - if (createEditOrView == "EDIT") { - isedit = true; - } + + if (createEditOrView == "EDIT" || createEditOrView == "VIEW") { if (!event) { console.warn("Invalid value (\"" + event + "\") passed as a value for \"event\" for EventForm form."); @@ -559,15 +554,17 @@ function editEventForm_submitPressed() { } var jsonString = JSON.stringify(eventbean); + var requestURL; + if (createEditOrView == "CREATE") { - var requestURL = window.restRootURL + "/Event/Create"; + requestURL = window.restRootURL + "/Event/Create"; ajax_post(requestURL, jsonString, function(resultData) { apexUtils_removeElement("editEventFormDiv"); eventTab_reset(); keyInformationTab_reset() }); } else if (createEditOrView == "EDIT") { - var requestURL = window.restRootURL + "/Event/Update"; + requestURL = window.restRootURL + "/Event/Update"; ajax_put(requestURL, jsonString, function(resultData) { apexUtils_removeElement("editEventFormDiv"); eventTab_reset(); diff --git a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexEventTab.js b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexEventTab.js index 56886fb..0192be6 100644 --- a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexEventTab.js +++ b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexEventTab.js @@ -1,7 +1,7 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2020-2021 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -103,7 +103,7 @@ function eventTab_create() { return } - var eventTabContent = document.createElement("eventTabContent"); + eventTabContent = document.createElement("eventTabContent"); eventTab.appendChild(eventTabContent); eventTabContent.setAttribute("id", "eventTabContent"); eventTabContent.addEventListener('contextmenu', rightClickMenu_scopePreserver("eventTabContent", "Event", null, null)); diff --git a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexFiles.js b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexFiles.js index ade1eb3..ef0aacf 100644 --- a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexFiles.js +++ b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexFiles.js @@ -1,7 +1,7 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2020-2021 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,17 +28,17 @@ const {modelFileName} = require("./ApexNewModelForm"); function files_fileOpen() { $('<input type="file">').on('change', function() { var reader = new FileReader(); - var modelFileName = this.files[0].name; + var fileName = this.files[0].name; reader.readAsText(this.files[0]); reader.onload = function(event) { var requestURL = window.restRootURL + "/Model/Load"; ajax_put(requestURL, event.target.result, function(resultData) { localStorage.setItem("apex_model_loaded", true); - var requestURL = window.restRootURL + "/Model/GetKey"; + requestURL = window.restRootURL + "/Model/GetKey"; ajax_get(requestURL, function(data) { var modelKey = JSON.parse(data.messages.message[0]).apexArtifactKey; - pageControl_modelMode(modelKey.name, modelKey.version, modelFileName); + pageControl_modelMode(modelKey.name, modelKey.version, fileName); }); }); }; diff --git a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexKeyInformationTab.js b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexKeyInformationTab.js index 9442ddd..8ca2718 100644 --- a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexKeyInformationTab.js +++ b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexKeyInformationTab.js @@ -1,7 +1,7 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2020-2021 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -72,7 +72,7 @@ function keyInformationTab_create() { return } - var keyInformationTabContent = document.createElement("keyInformationTabContent"); + keyInformationTabContent = document.createElement("keyInformationTabContent"); keyInformationTab.appendChild(keyInformationTabContent); keyInformationTabContent.setAttribute("id", "keyInformationTabContent"); diff --git a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexNewModelForm.js b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexNewModelForm.js index 65b39d9..d7e5ccd 100644 --- a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexNewModelForm.js +++ b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexNewModelForm.js @@ -1,7 +1,7 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2020-2021 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -221,7 +221,7 @@ function newModelForm_submitPressed() { ajax_post(requestURL, jsonString, function(resultData) { apexUtils_removeElement("newModelDivBackground"); - var requestURL = window.restRootURL + "/Model/GetKey"; + requestURL = window.restRootURL + "/Model/GetKey"; ajax_get(requestURL, function(data) { var modelKey = JSON.parse(data.messages.message[0]).apexArtifactKey; diff --git a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexPolicyEditForm.js b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexPolicyEditForm.js index 116cfa4..97e1130 100644 --- a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexPolicyEditForm.js +++ b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexPolicyEditForm.js @@ -1,7 +1,7 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2020-2021 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -129,7 +129,6 @@ function editPolicyForm_activate(parent, operation, policy, tasks, events, conte } apexUtils_emptyElement(parent); - var isedit = false; var createEditOrView = ""; if (!operation) { @@ -138,12 +137,7 @@ function editPolicyForm_activate(parent, operation, policy, tasks, events, conte createEditOrView = operation.toUpperCase(); } - if (createEditOrView == "CREATE") { - isedit = true; - } else if (createEditOrView == "EDIT" || createEditOrView == "VIEW") { - if (createEditOrView == "EDIT") { - isedit = true; - } + if (createEditOrView == "EDIT" || createEditOrView == "VIEW") { if (!policy) { console.warn("Invalid value (\"" + policy + "\") passed as a value for \"policy\" for PolicyForm form."); @@ -306,7 +300,7 @@ function editPolicyForm_activate(parent, operation, policy, tasks, events, conte var firststateoptions = new Array(); var firststateselected = null; if (policy != null && policy.state != null) { - for (i = 0; i < policy.state.entry.length; i++) { + for (var i = 0; i < policy.state.entry.length; i++) { if (policy.state.entry[i] != null && policy.state.entry[i].key != null) { var statename = policy.state.entry[i].key; firststateoptions.push({ @@ -341,7 +335,7 @@ function editPolicyForm_activate(parent, operation, policy, tasks, events, conte if (policy != null && policy.firstState != null && policy.firstState != "" && policy.state != null) { for (i = 0; i < policy.state.entry.length; i++) { if (policy.state.entry[i] != null && policy.state.entry[i].key != null) { - var statename = policy.state.entry[i].key; + statename = policy.state.entry[i].key; var state = policy.state.entry[i].value; if (statename != null && statename == policy.firstState) { triggerevent = { @@ -438,7 +432,7 @@ function editPolicyForm_activate(parent, operation, policy, tasks, events, conte if (policy && policy.state) { var states = policy.state.entry; for ( var s in states) { - var state = states[s]; + state = states[s]; if (state.key == policy.firstState) { states.splice(s, 1); states.unshift(state); @@ -447,8 +441,8 @@ function editPolicyForm_activate(parent, operation, policy, tasks, events, conte } for (i = 0; i < policy.state.entry.length; i++) { var stateEntry = policy.state.entry[i]; - var statename = stateEntry.key; - var state = stateEntry.value; + statename = stateEntry.key; + state = stateEntry.value; var stateLI = editPolicyForm_addState(statename, state, createEditOrView, policy, tasks, events, contextAlbums, contextItemSchemas); statesUL.appendChild(stateLI); @@ -565,7 +559,7 @@ function editPolicyForm_addNewState(statesUL, createEditOrView, policy, tasks, e document.getElementById("editEventFormNewStateInput").value = ""; } if (policy && policy.state) { - for (i = 0; i < policy.state.entry.length; i++) { + for (var i = 0; i < policy.state.entry.length; i++) { if (statename.toUpperCase() == policy.state.entry[i].key.toUpperCase()) { alert("Policy " + policy.policyKey.name + ":" + policy.policyKey.version + " already contains a state called \"" + statename + "\"."); @@ -625,14 +619,14 @@ function editPolicyForm_updateTriggerEventOptions(events) { } } } else { - var triggerSelectDiv = document.getElementById("editEventFormSelectTrigger_dropdownList"); + triggerSelectDiv = document.getElementById("editEventFormSelectTrigger_dropdownList"); triggerSelectDiv.innerHTML = "No Event Selected"; var periodicEventsCheckbox = $("#periodicEventsCheckbox"); if (periodicEventsCheckbox.is(":checked")) { periodicEventsCheckbox.attr("checked", false); } if (createEditOrView == "CREATE") { - var periodicCheckbox = document.getElementById("periodicEventsCheckbox"); + periodicCheckbox = document.getElementById("periodicEventsCheckbox"); if (!periodicCheckbox.hasAttribute("disabled")) { periodicCheckbox.disabled = true; } @@ -641,7 +635,7 @@ function editPolicyForm_updateTriggerEventOptions(events) { if (stateevent) { triggerSelectDiv.innerHTML = stateevent.displaytext; if (stateevent.displaytext.indexOf("PeriodicEvent") == -1) { - var periodicEventsCheckbox = $("#periodicEventsCheckbox"); + periodicEventsCheckbox = $("#periodicEventsCheckbox"); if (periodicEventsCheckbox.is(":checked")) { periodicEventsCheckbox.attr("checked", false); } @@ -741,7 +735,7 @@ function editPolicyForm_submitPressed() { }); } else if (createEditOrView == "EDIT") { var firstStatePeriodic = $("#periodicEventsCheckbox").is(":checked") - var requestURL = window.restRootURL + "/Policy/Update?firstStatePeriodic=" + firstStatePeriodic; + requestURL = window.restRootURL + "/Policy/Update?firstStatePeriodic=" + firstStatePeriodic; ajax_put(requestURL, jsonString, function(resultData) { apexUtils_removeElement("editPolicyFormDiv"); policyTab_reset(); diff --git a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexPolicyEditForm_State.js b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexPolicyEditForm_State.js index e9d1118..e9db245 100644 --- a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexPolicyEditForm_State.js +++ b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexPolicyEditForm_State.js @@ -1,7 +1,7 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2020-2021 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -165,8 +165,8 @@ function editPolicyForm_State_generateStateDiv(createEditOrView, policy, statena } // Add the tasks if (state && state.taskReferences && $.isArray(state.taskReferences.entry)) { - for (var p = 0; p < state.taskReferences.entry.length; p++) { - var taskEntry = state.taskReferences.entry[p]; + for (var j = 0; j < state.taskReferences.entry.length; j++) { + var taskEntry = state.taskReferences.entry[j]; var taskName = taskEntry.key.name + ":" + taskEntry.key.version; var taskselected = { "name" : taskEntry.key.name, @@ -306,8 +306,8 @@ function editPolicyForm_State_generateStateDiv(createEditOrView, policy, statena } } if (state && state.stateOutputs && $.isArray(state.stateOutputs.entry)) { - for (var p = 0; p < state.stateOutputs.entry.length; p++) { - var outputEntry = state.stateOutputs.entry[p]; + for (var h = 0; h < state.stateOutputs.entry.length; h++) { + var outputEntry = state.stateOutputs.entry[h]; var outputName = outputEntry.key; var nextState = null; var nxtst = outputEntry.value.nextState.localName; @@ -391,10 +391,10 @@ function editPolicyForm_State_generateStateDiv(createEditOrView, policy, statena var logic_outputstable_body = document.createElement("tbody"); logic_outputstable.appendChild(logic_outputstable_body); if (state && state.stateFinalizerLogicMap && $.isArray(state.stateFinalizerLogicMap.entry)) { - for (var p = 0; p < state.stateFinalizerLogicMap.entry.length; p++) { - var outputEntry = state.stateFinalizerLogicMap.entry[p]; - var outputName = outputEntry.key; - var logic = null; + for (var f = 0; f < state.stateFinalizerLogicMap.entry.length; f++) { + outputEntry = state.stateFinalizerLogicMap.entry[f]; + outputName = outputEntry.key; + logic = null; if (outputEntry.value != null && outputEntry.value.logic != null) { logic = outputEntry.value.logic; } @@ -487,10 +487,6 @@ function editPolicyForm_State_addStateLogicOutput(parentTBody, disabled, statena finalizerlogicLabel.setAttribute("for", "editEventFormfinalizerLogicInput" + "_" + statename + "_" + random_suffix); finalizerlogicLabel.innerHTML = "Logic: "; - var logicString = ""; - if (logic != null) { - logicString = logic; - } var edit_readOnly = disabled; var textarea = showHideTextarea("editEventFormfinalizerLogicInput" + "_" + statename + "_" + random_suffix, logic, false, !edit_readOnly, false); @@ -752,8 +748,8 @@ function editPolicyForm_State_addPolicyTask(parentTBody, disabled, isdefault, st } var logic_outputOptions = new Array(); if (state != null && state.stateFinalizerLogicMap != null && $.isArray(state.stateFinalizerLogicMap.entry)) { - for (var p = 0; p < state.stateFinalizerLogicMap.entry.length; p++) { - var outputEntry = state.stateFinalizerLogicMap.entry[p].key; + for (var l = 0; l < state.stateFinalizerLogicMap.entry.length; l++) { + outputEntry = state.stateFinalizerLogicMap.entry[l].key; logic_outputOptions.push({ "name" : outputEntry, "displaytext" : outputEntry @@ -911,15 +907,15 @@ function editPolicyForm_State_getStateBean(statename) { // ignore (2) top // row and bottom // row - for (var i = 1; i < outputstablerows.length - 1; i++) { - var outputTR = outputstablerows[i]; + for (var k = 1; k < outputstablerows.length - 1; k++) { + var outputTR = outputstablerows[k]; if (outputTR && outputTR.getAttribute("output_id")) { var output_id = outputTR.getAttribute("output_id"); var outputlocalname = document.getElementById("editPolicyFormDirectOutputNameValue_" + statename + "_" + output_id).value; if (outputlocalname == null || outputlocalname == "") { - console.error("No Local Name entered for Direct Output Mapping #" + i + " for state " + statename); - alert("No Local Name entered for Direct Output Mapping #" + i + " for state " + statename); + console.error("No Local Name entered for Direct Output Mapping #" + k + " for state " + statename); + alert("No Local Name entered for Direct Output Mapping #" + k + " for state " + statename); return null; } var nextstatevalue = document.getElementById("editPolicyFormOutputNextStateValue_" + statename + "_" @@ -968,16 +964,16 @@ function editPolicyForm_State_getStateBean(statename) { // row and // bottom // row - for (var i = 1; i < finalizerstablerows.length - 1; i++) { - var finalizerTR = finalizerstablerows[i]; + for (var g = 1; g < finalizerstablerows.length - 1; g++) { + var finalizerTR = finalizerstablerows[g]; if (finalizerTR && finalizerTR.getAttribute("finalizer_id")) { var finalizer_id = finalizerTR.getAttribute("finalizer_id"); var finalizerlocalname = document.getElementById("editPolicyFormLogicOutputNameValue_" + statename + "_" + finalizer_id).value; if (finalizerlocalname == null || finalizerlocalname == "") { - console.error("No Local Name entered for Logic-based Output Mapping #" + i + " for state " + console.error("No Local Name entered for Logic-based Output Mapping #" + g + " for state " + statename); - alert("No Local Name entered for Logic-based Output Mapping #" + i + " for state " + statename); + alert("No Local Name entered for Logic-based Output Mapping #" + g + " for state " + statename); return null; } @@ -1017,15 +1013,15 @@ function editPolicyForm_State_getStateBean(statename) { console.error("No tasks selected for state " + statename); return null; } else { // has head so just ignore (2) top row and bottom row - for (var i = 1; i < taskstablerows.length - 1; i++) { - var taskTR = taskstablerows[i]; + for (var h = 1; h < taskstablerows.length - 1; h++) { + var taskTR = taskstablerows[h]; if (taskTR && taskTR.getAttribute("task_id")) { var task_id = taskTR.getAttribute("task_id"); var tasklocalname = document.getElementById("editPolicyFormTaskLocalNameValue_" + statename + "_" + task_id).value; if (tasklocalname == "") { - console.error("No Local Name entered for task #" + i + " for state " + statename); - alert("No Local Name entered for task #" + i + " for state " + statename); + console.error("No Local Name entered for task #" + h + " for state " + statename); + alert("No Local Name entered for task #" + h + " for state " + statename); return null; } if (statebean_tasks[tasklocalname] != null) { diff --git a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexPolicyTab.js b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexPolicyTab.js index e3a1765..045eb6d 100644 --- a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexPolicyTab.js +++ b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexPolicyTab.js @@ -1,7 +1,7 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2020-2021 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -67,9 +67,9 @@ function policyTab_activate() { } } - for (var s = 0; s < policy.state.entry.length; s++) { - var stateName = policy.state.entry[s].key; - var state = policy.state.entry[s].value; + for (var p = 0; p < policy.state.entry.length; p++) { + var stateName = policy.state.entry[p].key; + state = policy.state.entry[p].value; policyTableRow += "<tr><td>" + @@ -179,7 +179,7 @@ function policyTab_create() { return } - var policyTabContent = document.createElement("policyTabContent"); + policyTabContent = document.createElement("policyTabContent"); policyTab.appendChild(policyTabContent); policyTabContent.setAttribute("id", "policyTabContent"); policyTabContent.addEventListener('contextmenu', rightClickMenu_scopePreserver("policyTabContent", "Policy", null, null)); diff --git a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexTaskEditForm.js b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexTaskEditForm.js index 56ba578..7ae7747 100644 --- a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexTaskEditForm.js +++ b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexTaskEditForm.js @@ -1,7 +1,7 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2020-2021 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -42,11 +42,11 @@ function editTaskForm_createTask(formParent) { contextSchemas.push(dt); } // Get all contextAlbums too for task context album references - var requestURL = window.restRootURL + "/ContextAlbum/Get?name=&version="; + requestURL = window.restRootURL + "/ContextAlbum/Get?name=&version="; var contextAlbums = new Array(); ajax_get(requestURL, function(data3) { - for (var i = 0; i < data3.messages.message.length; i++) { - var contextAlbum = JSON.parse(data3.messages.message[i]).apexContextAlbum; + for (var y = 0; y < data3.messages.message.length; y++) { + var contextAlbum = JSON.parse(data3.messages.message[y]).apexContextAlbum; var ca = { "name" : contextAlbum.key.name, "version" : contextAlbum.key.version, @@ -84,7 +84,7 @@ function editTaskForm_editTask_inner(formParent, name, version, viewOrEdit) { var requestURL = window.restRootURL + "/Task/Get?name=" + name + "&version=" + version; ajax_getWithKeyInfo(requestURL, "apexTask", function(task) { // Get all contextSchemas too for task inputfields - var requestURL = window.restRootURL + "/ContextSchema/Get?name=&version="; + requestURL = window.restRootURL + "/ContextSchema/Get?name=&version="; var contextSchemas = new Array(); ajax_get(requestURL, function(data2) { for (var i = 0; i < data2.messages.message.length; i++) { @@ -97,11 +97,11 @@ function editTaskForm_editTask_inner(formParent, name, version, viewOrEdit) { }); } // Get all contextAlbums too for task context album references - var requestURL = window.restRootURL + "/ContextAlbum/Get?name=&version="; + requestURL = window.restRootURL + "/ContextAlbum/Get?name=&version="; var contextAlbums = new Array(); ajax_get(requestURL, function(data3) { - for (var i = 0; i < data3.messages.message.length; i++) { - var contextAlbum = JSON.parse(data3.messages.message[i]).apexContextAlbum; + for (var y = 0; y < data3.messages.message.length; y++) { + var contextAlbum = JSON.parse(data3.messages.message[y]).apexContextAlbum; var ca = { "name" : contextAlbum.key.name, "version" : contextAlbum.key.version, @@ -126,7 +126,6 @@ function editTaskForm_activate(parent, operation, task, contextSchemas, contextA } apexUtils_emptyElement(parent); - var isedit = false; var createEditOrView = ""; if (!operation) { @@ -135,12 +134,7 @@ function editTaskForm_activate(parent, operation, task, contextSchemas, contextA createEditOrView = operation.toUpperCase(); } - if (createEditOrView == "CREATE") { - isedit = true; - } else if (createEditOrView == "EDIT" || createEditOrView == "VIEW") { - if (createEditOrView == "EDIT") { - isedit = true; - } + if (createEditOrView == "EDIT" || createEditOrView == "VIEW") { if (!task) { console.warn("Invalid value (\"" + task + "\") passed as a value for \"task\" for TaskForm form."); @@ -361,9 +355,9 @@ function editTaskForm_activate(parent, operation, task, contextSchemas, contextA outputfieldstable.appendChild(outputfieldstable_body); // Add the outputfields if (task && task.outputFields && task.outputFields.entry) { - for (var p = 0; p < task.outputFields.entry.length; p++) { - var outputfieldEntry = task.outputFields.entry[p]; - var contextSchema = outputfieldEntry.value.fieldSchemaKey; + for (var y = 0; y < task.outputFields.entry.length; y++) { + var outputfieldEntry = task.outputFields.entry[y]; + contextSchema = outputfieldEntry.value.fieldSchemaKey; contextSchema["displaytext"] = contextSchema.name + ":" + contextSchema.version; editTaskForm_addTaskOutputField(outputfieldstable_body, (createEditOrView == "VIEW"), outputfieldEntry.key, outputfieldEntry.value.optional, contextSchema, contextSchemas); @@ -453,8 +447,8 @@ function editTaskForm_activate(parent, operation, task, contextSchemas, contextA paramstable.appendChild(paramstable_body); // Add the params if (task && task.taskParameters && task.taskParameters.entry) { - for (var p = 0; p < task.taskParameters.entry.length; p++) { - var paramEntry = task.taskParameters.entry[p]; + for (var k = 0; k < task.taskParameters.entry.length; k++) { + var paramEntry = task.taskParameters.entry[k]; var paramName = paramEntry.key; var paramValue = paramEntry.value.defaultValue; editTaskForm_addTaskParameter(paramstable_body, (createEditOrView == "VIEW"), paramName, paramValue); @@ -503,8 +497,8 @@ function editTaskForm_activate(parent, operation, task, contextSchemas, contextA contextstable.appendChild(contextstable_body); // Add the contexts if (task && task.contextAlbumReference && $.isArray(task.contextAlbumReference)) { - for (var p = 0; p < task.contextAlbumReference.length; p++) { - var contextEntry = task.contextAlbumReference[p]; + for (var l = 0; l < task.contextAlbumReference.length; l++) { + var contextEntry = task.contextAlbumReference[l]; var contextName = contextEntry.name + ":" + contextEntry.version; var ce = { "name" : contextEntry.name, @@ -887,8 +881,8 @@ function editTaskForm_submitPressed() { var outputfieldstablerows = document.getElementById("editTaskFormOutputFieldsTable").rows; if (outputfieldstablerows && outputfieldstablerows.length > 2) { taskbean_outputfields = new Object(); - for (var i = 1; i < outputfieldstablerows.length - 1; i++) { - var outputfieldTR = outputfieldstablerows[i]; + for (var g = 1; g < outputfieldstablerows.length - 1; g++) { + var outputfieldTR = outputfieldstablerows[g]; if (outputfieldTR && outputfieldTR.getAttribute("outputfield_id")) { var outputfield_id = outputfieldTR.getAttribute("outputfield_id"); var outputfieldname = document.getElementById("editTaskFormOutputFieldName" + "_" + outputfield_id).value; @@ -933,8 +927,8 @@ function editTaskForm_submitPressed() { var paramstablerows = document.getElementById("editTaskFormParamsTable").rows; if (paramstablerows && paramstablerows.length > 2) { taskbean_parameters = new Object(); - for (var i = 1; i < paramstablerows.length - 1; i++) { - var paramTR = paramstablerows[i]; + for (var h = 1; h < paramstablerows.length - 1; h++) { + var paramTR = paramstablerows[h]; if (paramTR && paramTR.getAttribute("param_id")) { var param_id = paramTR.getAttribute("param_id"); var paramname = document.getElementById("editTaskFormParamName" + "_" + param_id).value; @@ -955,8 +949,8 @@ function editTaskForm_submitPressed() { var contextstablerows = document.getElementById("editTaskFormContextsTable").rows; if (contextstablerows && contextstablerows.length > 2) { taskbean_context = new Array(); - for (var i = 1; i < contextstablerows.length - 1; i++) { - var contextTR = contextstablerows[i]; + for (var s = 1; s < contextstablerows.length - 1; s++) { + var contextTR = contextstablerows[s]; if (contextTR && contextTR.getAttribute("context_id")) { var context_id = contextTR.getAttribute("context_id"); var contextalbumvalue = document.getElementById("editTaskFormContextValue" + "_" + context_id @@ -1004,7 +998,7 @@ function editTaskForm_submitPressed() { keyInformationTab_reset() }); } else if (createEditOrView == "EDIT") { - var requestURL = window.restRootURL + "/Task/Update"; + requestURL = window.restRootURL + "/Task/Update"; ajax_put(requestURL, jsonString, function(resultData) { apexUtils_removeElement("editTaskFormDiv"); taskTab_reset(); diff --git a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexTaskTab.js b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexTaskTab.js index cb442be..28d9379 100644 --- a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexTaskTab.js +++ b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexTaskTab.js @@ -1,7 +1,7 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2020-2021 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -41,7 +41,6 @@ function taskTab_activate() { const task = JSON.parse(data.messages.message[i]).apexTask; const taskRow_tr = document.createElement("tr"); - const taskid = task.key.name + ":" + task.key.version; var taskTableRow = "<td>" + @@ -68,8 +67,8 @@ function taskTab_activate() { taskTableRow += "</tbody></table></td>"; taskTableRow += "<td><table class='ebTable'><thead><tr class='headerRow'><th>Field Name</th><th>Field Type/Schema</th><th>Optional</th></tr></thead><tbody>"; - for (var f = 0; f < task.outputFields.entry.length; f++) { - var fieldEntry = task.outputFields.entry[f]; + for (var t = 0; t < task.outputFields.entry.length; t++) { + fieldEntry = task.outputFields.entry[t]; taskTableRow += "<tr><td>" + @@ -134,7 +133,7 @@ function taskTab_create() { return } - var taskTabContent = document.createElement("taskTabContent"); + taskTabContent = document.createElement("taskTabContent"); taskTab.appendChild(taskTabContent); taskTabContent.setAttribute("id", "taskTabContent"); taskTabContent.addEventListener('contextmenu', rightClickMenu_scopePreserver("taskTabContent", "Task", null, null)); diff --git a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/dropdownList.js b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/dropdownList.js index 497bd68..3657fd4 100644 --- a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/dropdownList.js +++ b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/dropdownList.js @@ -1,7 +1,7 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2020-2021 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -55,9 +55,9 @@ function dropdownList_display_hide(optionDiv) { } function dropdownList_filter(optionDiv, optionUl) { var input, filter, ul; - var input = document.getElementById(optionDiv + "_search"); - var filter = input.value.toUpperCase(); - var ul = document.getElementById(optionDiv + "_options_list_ul"); + input = document.getElementById(optionDiv + "_search"); + filter = input.value.toUpperCase(); + ul = document.getElementById(optionDiv + "_options_list_ul"); var lis = ul.querySelectorAll("#" + ul.id + " > li"); // get li direct // child elements for (var i = 0; i < lis.length; i++) { diff --git a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/fileMenu.js b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/fileMenu.js index 0c94f96..b917af1 100644 --- a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/fileMenu.js +++ b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/fileMenu.js @@ -1,7 +1,7 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2020-2021 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -139,7 +139,7 @@ $.fn.fileMenu = function(options) { return this.each(function() { - var fm = new $.fileMenu(this, options); + new $.fileMenu(this, options); }); }; diff --git a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/showhideElement.js b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/showhideElement.js index ca74e9b..d7259b1 100644 --- a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/showhideElement.js +++ b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/showhideElement.js @@ -1,7 +1,7 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2020-2021 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -57,5 +57,5 @@ function showHideElement(id_prefix, element, _initialhide, _showText, _hideText, } showHideElement_display(showhide, element, _showstyle, _hidestyle, undefined, undefined); return retdiv; -}; +} diff --git a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/showhideTextarea.js b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/showhideTextarea.js index 353b4e9..0a3058e 100644 --- a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/showhideTextarea.js +++ b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/showhideTextarea.js @@ -1,7 +1,7 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2020 Nordix Foundation. + * Modifications Copyright (C) 2020-2021 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -75,9 +75,8 @@ function _showHideTextarea_display_show(txtarea, showhide) { */ function showHideTextarea(id_prefix, content, _initialshow, _editable, _disabled, _showText, _hideText) { - var initialshow = (_initialshow != null ? _initialshow : false); + var editable = (_editable != null ? _editable : true); - var callback; var retdiv = document.createElement("div"); var divname = id_prefix; @@ -101,7 +100,7 @@ function showHideTextarea(id_prefix, content, _initialshow, _editable, _disabled } if (!editable) { - textArea.readOnly = (!editable); + textArea.readOnly = true; textArea.style.cursor = "text"; textArea.style["border-color"] = "#E3E3E3"; textArea.style["background-color"] = "#F0F0F0"; @@ -122,7 +121,7 @@ function showHideTextarea(id_prefix, content, _initialshow, _editable, _disabled }); return retdiv; -}; +} export { showHideTextarea, |