From 770049ea162573d5afa1aaefed6131fe5e0a77f7 Mon Sep 17 00:00:00 2001 From: danielhanrahan Date: Tue, 15 Feb 2022 18:02:23 +0000 Subject: Refactor apex-editor frontend build Moved frontend from src/main/resources/webapp to src/main/webapp Moved static resources such as jquery-ui to webapp/dist folder Configured jest to exclude webapp/dist from coverage report Removed unused ZIP file assembly Cleaned up POM Issue-ID: POLICY-3896 Signed-off-by: danielhanrahan Change-Id: Ia006eb94a39586219029866eef94aef38912ad65 --- .../src/main/resources/webapp/js/ApexPolicyTab.js | 226 --------------------- 1 file changed, 226 deletions(-) delete mode 100644 gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexPolicyTab.js (limited to 'gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexPolicyTab.js') 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 deleted file mode 100644 index 2aa96e4..0000000 --- a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexPolicyTab.js +++ /dev/null @@ -1,226 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * Copyright (C) 2016-2018 Ericsson. All rights reserved. - * Modifications Copyright (C) 2020-2021 Nordix Foundation. - * Modifications Copyright (C) 2021 Bell Canada. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ - -import {rightClickMenu_scopePreserver} from "./contextMenu"; -import {createTable} from "./ApexTable"; -import {ajax_get} from "./ApexAjax"; -import {apexUtils_removeElement} from "./ApexUtils"; - -function policyTab_reset() { - policyTab_deactivate(); - policyTab_activate(); -} - -function policyTab_activate() { - policyTab_create(); - - var requestURL = window.restRootURL + "/Policy/Get?name=&version="; - - ajax_get(requestURL, function(data) { - $("#policyTableBody").find("tr:gt(0)").remove(); - - for (let value of data.messages.message) { - var policy = JSON.parse(value).apexPolicy; - - var policyRow_tr = document.createElement("tr"); - var policyid = policy.policyKey.name + ":" + policy.policyKey.version; - - var policyTableRow = - "" + - policyid + - "" + - "" + - policy.template + - "" + - "" + - policy.firstState + - ""; - - policyTableRow += ""; - policyTableRow += ""; - - var states = policy.state.entry; - for(var s in states) { - var state = states[s]; - if(state.key == policy.firstState) { - states.splice(s, 1); - states.unshift(state); - break; - } - } - - for (let entry of policy.state.entry) { - var stateName = entry.key; - state = entry.value; - - policyTableRow += - "" + - ""; - - policyTableRow += ""; - - policyTableRow += - "" + - ""; - - policyTableRow += ""; - - policyTableRow += ""; - - - policyTableRow += ""; - - policyTableRow += ""; - } - - policyTableRow += "
StateTriggerReferenced TasksDefault TaskTSLState OutputsState Finsalizer LogicContext Album References
" + - stateName + - "" + - state.trigger.name + ":" + state.trigger.version + - ""; - for (let taskEntry of state.taskReferences.entry) { - var taskKey = taskEntry.key; - var taskRef = taskEntry.value; - - policyTableRow += - "" + - "" + - ""; - } - policyTableRow += "
Task ReferenceOutput TypeOutput
" + - taskKey.name + ":" + taskKey.version + - "" + - taskRef.outputType + - "" + - taskRef.output.localName + - "
" + - state.defaultTask.name + ":" + state.defaultTask.version + - "" + - state.taskSelectionLogic.logicFlavour + - ""; - for (let outputEntry of state.stateOutputs.entry) { - - policyTableRow += - "" + - "" + - ""; - } - policyTableRow += "
NameNext StateEvent
" + - outputEntry.key + - "" + - outputEntry.value.nextState.localName + - "" + - outputEntry.value.outgoingEvent.name + ":" + outputEntry.value.outgoingEvent.version + - "
"; - for (let sflEntry of state.stateFinalizerLogicMap.entry) { - - policyTableRow += - "" + - ""; - } - policyTableRow += "
NameType
" + - sflEntry.key + - "" + - sflEntry.value.logicFlavour + - "
"; - for (let contextAlbumReference of state.contextAlbumReference) { - - policyTableRow += - ""; - } - policyTableRow += "
" + - contextAlbumReference.name + ":" + contextAlbumReference.version + - "
"; - - - policyRow_tr.innerHTML = policyTableRow; - policyRow_tr.addEventListener('contextmenu', rightClickMenu_scopePreserver("policyTabContent", "Policy", policy.policyKey.name, policy.policyKey.version)); - - $("#policyTableBody").append(policyRow_tr); - } - }); -} - -function policyTab_deactivate() { - apexUtils_removeElement("policyTabContent"); -} - -function policyTab_create() { - var policyTab = document.getElementById("policiesTab"); - - //Testing purposes - if(policyTab === null) { - policyTab = document.createElement("policiesTab"); - } - - var policyTabContent = document.getElementById("policyTabContent"); - if (policyTabContent != null) { - return - } - - policyTabContent = document.createElement("policyTabContent"); - policyTab.appendChild(policyTabContent); - policyTabContent.setAttribute("id", "policyTabContent"); - policyTabContent.addEventListener('contextmenu', rightClickMenu_scopePreserver("policyTabContent", "Policy", null, null)); - - var policyTable = createTable("policyTable"); - policyTabContent.appendChild(policyTable); - - var policyTableHeader = document.createElement("thead"); - policyTable.appendChild(policyTableHeader); - policyTableHeader.setAttribute("id", "policyTableHeader"); - - var policyTableHeaderRow = document.createElement("tr"); - policyTableHeader.appendChild(policyTableHeaderRow); - policyTableHeaderRow.setAttribute("id", "policyTableHeaderRow"); - - var policyTableKeyHeader = document.createElement("th"); - policyTableHeaderRow.appendChild(policyTableKeyHeader); - policyTableKeyHeader.setAttribute("id", "policyTableKeyHeader"); - policyTableKeyHeader.appendChild(document.createTextNode("Policy")); - - var policyTableTemplateHeader = document.createElement("th"); - policyTableHeaderRow.appendChild(policyTableTemplateHeader); - policyTableTemplateHeader.setAttribute("id", "policyTableTemplateHeader"); - policyTableTemplateHeader.appendChild(document.createTextNode("Template")); - - var policyTableFirstStateHeader = document.createElement("th"); - policyTableHeaderRow.appendChild(policyTableFirstStateHeader); - policyTableFirstStateHeader.setAttribute("id", "policyTableFirstStateHeader"); - policyTableFirstStateHeader.appendChild(document.createTextNode("First State")); - - var policyTableStatesHeader = document.createElement("th"); - policyTableHeaderRow.appendChild(policyTableStatesHeader); - policyTableStatesHeader.setAttribute("id", "policyTableStatesHeader"); - policyTableStatesHeader.appendChild(document.createTextNode("States")); - - var policyTableBody = document.createElement("tbody"); - policyTable.appendChild(policyTableBody); - policyTable.setAttribute("id", "policyTableBody"); -} - -export { - policyTab_activate, - policyTab_create, - policyTab_deactivate, - policyTab_reset -} -- cgit 1.2.3-korg