summaryrefslogtreecommitdiffstats
path: root/gui-editors/gui-editor-apex/src/main/resources/webapp
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@est.tech>2020-09-11 14:28:32 +0100
committerliamfallon <liam.fallon@est.tech>2020-09-11 14:37:24 +0100
commit9a9127b65920580de8b4a69479a9983481c8faf8 (patch)
tree35c6449e4850b661f86a639a33684e079beb836d /gui-editors/gui-editor-apex/src/main/resources/webapp
parentafcf92da0d813028b48ea781df33148bc6f000b6 (diff)
Add TOSCA support to Apex editor
The APEX editor now loads, saves, and downloads files in TOSCA format, the same as the apex-pdp does. The non-standard TOSCA handling for file upload has been refactored to be aligned with the Policy Frameowkr TOSCA support. Issue-ID: POLICY-2621 Change-Id: I1ec7475cbcc6ffc23de92687c9f284ac7dfbdd80 Signed-off-by: liamfallon <liam.fallon@est.tech>
Diffstat (limited to 'gui-editors/gui-editor-apex/src/main/resources/webapp')
-rw-r--r--gui-editors/gui-editor-apex/src/main/resources/webapp/css/upload/dialog.css56
-rw-r--r--gui-editors/gui-editor-apex/src/main/resources/webapp/dist/bundle.js1
-rw-r--r--gui-editors/gui-editor-apex/src/main/resources/webapp/index.html11
-rw-r--r--gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexConfig.js62
-rw-r--r--gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexContextSchemaEditForm.js5
-rw-r--r--gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexFiles.js17
-rw-r--r--gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexMain.js2
-rw-r--r--gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexUpload.js61
-rw-r--r--gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexUser.js32
-rw-r--r--gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexConfig.test.js43
-rw-r--r--gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexUser.test.js31
-rw-r--r--gui-editors/gui-editor-apex/src/main/resources/webapp/js/lib/pubsub/ba-tiny-pubsub.min.js4
-rw-r--r--gui-editors/gui-editor-apex/src/main/resources/webapp/package-lock.json42
-rw-r--r--gui-editors/gui-editor-apex/src/main/resources/webapp/upload/dialog.html68
14 files changed, 55 insertions, 380 deletions
diff --git a/gui-editors/gui-editor-apex/src/main/resources/webapp/css/upload/dialog.css b/gui-editors/gui-editor-apex/src/main/resources/webapp/css/upload/dialog.css
deleted file mode 100644
index 95f29b1..0000000
--- a/gui-editors/gui-editor-apex/src/main/resources/webapp/css/upload/dialog.css
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2020 Nordix Foundation
- * ================================================================================
- * 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=========================================================
- */
-
-.upload-dialog {
- font-size: 16px;
- line-height: 19px;
-}
-
-.upload-dialog .ui-button {
- position: relative;
- display: inline-block;
- vertical-align: middle;
- color: #333333;
- background-color: #ffffff;
- border: none;
- min-width: 60px;
- box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2);
- border-radius: 3px;
- -moz-box-sizing: border-box;
- box-sizing: border-box;
- background-image: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.1) 100%);
- padding: 0 8px;
- height: 2.4rem;
- font-size: 1.2rem;
- white-space: nowrap;
- text-decoration: none;
- text-align: center;
- cursor: pointer;
-}
-
-.upload-dialog #upload-form {
- width: 100%;
- font-size: 16px;
- line-height: 19px;
-}
-
-.upload-dialog #upload-form input {
- width: 100%;
-} \ No newline at end of file
diff --git a/gui-editors/gui-editor-apex/src/main/resources/webapp/dist/bundle.js b/gui-editors/gui-editor-apex/src/main/resources/webapp/dist/bundle.js
deleted file mode 100644
index 46c8469..0000000
--- a/gui-editors/gui-editor-apex/src/main/resources/webapp/dist/bundle.js
+++ /dev/null
@@ -1 +0,0 @@
-!function(e){var t={};function a(o){if(t[o])return t[o].exports;var n=t[o]={i:o,l:!1,exports:{}};return e[o].call(n.exports,n,n.exports,a),n.l=!0,n.exports}a.m=e,a.c=t,a.d=function(e,t,o){a.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.t=function(e,t){if(1&t&&(e=a(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(a.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)a.d(o,n,function(t){return e[t]}.bind(null,n));return o},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.p="",a(a.s=0)}([function(e,t){var a=null;function o(){localStorage.removeItem("apex_session"),localStorage.removeItem("apex_model_loaded"),localStorage.removeItem("apex_tab_index")}$("#menu").fileMenu({slideSpeed:200}),$(document).ready((function(){pageControl_noModelMode(),function(){var e=location.protocol+"//"+window.location.hostname+(location.port?":"+location.port:"")+(location.pathname.endsWith("/editor/")?location.pathname.substring(0,location.pathname.indexOf("editor/")):location.pathname);if(localStorage.getItem("apex_session")){a=e+"apexservices/editor/"+localStorage.getItem("apex_session"),ajax_get(a+"/Model/GetKey",(function(e){if($("#statusMessageTable").append("<tr><td> REST root URL set to: "+a+"</td></tr>"),localStorage.getItem("apex_model_loaded")){var t=JSON.parse(e.messages.message[0]).apexArtifactKey;pageControl_modelMode(t.name,t.version,null),localStorage.getItem("apex_tab_index")&&$("#mainTabs").tabs({active:localStorage.getItem("apex_tab_index")})}}))}else{ajax_get(e+"apexservices/editor/-1/Session/Create",(function(t){localStorage.setItem("apex_session",t.messages.message[0]),a=e+"apexservices/editor/"+localStorage.getItem("apex_session"),$("#statusMessageTable").append("<tr><td> REST root URL set to: "+a+"</td></tr>")}))}}()})),$("#menu li").not(".emptyMessage").click((function(){switch(this.id){case"menuFileNew":newModelForm_activate(document.getElementById("mainArea"));break;case"menuFileOpen":files_fileOpen();break;case"menuFileDownload":files_fileDownload();break;case"menuFileUpload":uploadPlugin.openDialog();break;case"menuFileClear":if(confirm("Clear the current model?"))ajax_delete(a+"/Model/Delete",(function(e){localStorage.removeItem("apex_model_loaded"),localStorage.removeItem("apex_tab_index"),$("#mainTabs").tabs("option","active",0),pageControl_noModelMode()}));break;case"menuFileNewSession":o(),location.reload();break;case"menuFileClose":confirm("Close Apex Editor?")&&(o(),window.location.href=window.location.href+"close.html");break;case"menuModelAnalyse":modelHandling_analyse();break;case"menuModelValidate":modelHandling_validate();break;case"menuConceptsContextSchemas":$("#mainTabs").tabs("option","active",0);break;case"menuConceptsEvents":$("#mainTabs").tabs("option","active",1);break;case"menuConceptsContextAlbums":$("#mainTabs").tabs("option","active",2);break;case"menuConceptsTasks":$("#mainTabs").tabs("option","active",3);break;case"menuConceptsPolicies":$("#mainTabs").tabs("option","active",4);break;case"menuConceptsKeyInformation":$("#mainTabs").tabs("option","active",5)}}));var n=$(".ebInlineMessage").height();$(".ebInlineMessage").mouseenter((function(e){e.stopPropagation(),$(this).stop();var t=$(this).children(".ebInlineMessage-contentHolder").height();t>n&&$(".ebInlineMessage").animate({height:t+12},200)})),$(".ebInlineMessage").mouseleave((function(e){e.stopPropagation(),$(this).stop(),$(".ebInlineMessage").animate({height:n},200)})),$(document).ready((function(){$(".content").fadeIn()})),t.restRootURL={restRootURL:a}}]); \ No newline at end of file
diff --git a/gui-editors/gui-editor-apex/src/main/resources/webapp/index.html b/gui-editors/gui-editor-apex/src/main/resources/webapp/index.html
index 7aa3508..d131d22 100644
--- a/gui-editors/gui-editor-apex/src/main/resources/webapp/index.html
+++ b/gui-editors/gui-editor-apex/src/main/resources/webapp/index.html
@@ -43,8 +43,6 @@
<!-- interface style -->
<link rel="stylesheet" type="text/css" href="css/interfaceAssets.css">
-<link rel="stylesheet" type="text/css" href="css/upload/dialog.css" />
-
<!-- JQuery style -->
<link rel="stylesheet" href="js/jquery-ui-1.12.1/jquery-ui.css">
@@ -216,9 +214,9 @@
<!-- edit area JS file -->
<script language="javascript" type="text/javascript"
src="js/edit_area/edit_area_full.js"></script>
- <!-- simple jquery pub/sub library -->
- <script type="text/javascript" src="js/lib/pubsub/ba-tiny-pubsub.min.js"></script>
<!-- Apex JS files -->
+ <script type="text/javascript" src="js/ApexFiles.js"></script>
+ <script type="text/javascript" src="js/ApexAjax.js"></script>
<script type="text/javascript" src="js/ApexTable.js"></script>
<script type="text/javascript" src="js/ApexContextSchemaTab.js"></script>
<script type="text/javascript" src="js/ApexContextSchemaEditForm.js"></script>
@@ -232,17 +230,12 @@
<script type="text/javascript" src="js/ApexPolicyEditForm_State.js"></script>
<script type="text/javascript" src="js/ApexPolicyEditForm.js"></script>
<script type="text/javascript" src="js/ApexKeyInformationTab.js"></script>
- <script type="text/javascript" src="js/ApexAjax.js"></script>
<script type="text/javascript" src="js/ApexPageControl.js"></script>
- <script type="text/javascript" src="js/ApexFiles.js"></script>
<script type="text/javascript" src="js/ApexFormUtils.js"></script>
<script type="text/javascript" src="js/ApexNewModelForm.js"></script>
<script type="text/javascript" src="js/ApexResultForm.js"></script>
<script type="text/javascript" src="js/ApexModelHandling.js"></script>
- <script type="text/javascript" src="js/ApexConfig.js"></script>
- <script type="text/javascript" src="js/ApexUpload.js"></script>
<script type="text/javascript" src="js/ApexMain.js"></script>
- <script type="text/javascript" src="js/ApexUser.js"></script>
</body>
</html>
diff --git a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexConfig.js b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexConfig.js
deleted file mode 100644
index 9a842c2..0000000
--- a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexConfig.js
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2020 Nordix Foundation
- * ================================================================================
- * 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=========================================================
- */
-
-const configObj = {
- configMap: {},
- getConfig: function (configKey) {
- return this.configMap[configKey];
- },
- setConfig: function (configKey, configValue) {
- return this.configMap[configKey] = configValue;
- },
- readySignal: function () {
- $.publish("/config/ready");
- }
-}
-
-$(document).ready(function () {
- load();
-});
-
-const load = function(){
- $("#menuFileUpload").hide();
-
- const rootUrl = location.protocol
- + "//"
- + window.location.hostname
- + (location.port ? ':' + location.port : '');
-
- const configUrl = rootUrl + "/apexservices/editor/config";
-
- function loadConfiguration() {
- ajax_get(configUrl, function (data) {
- for (let i = 0; i < data.messages.message.length; i++) {
- const configEntry = JSON.parse(data.messages.message[i]);
- Object.keys(configEntry).forEach(key => {
- configObj.setConfig(key, configEntry[key]);
- });
- }
- configObj.readySignal();
- });
- }
- loadConfiguration();
-}
-
-module.exports = { configObj, load };
-module.exports.rootUrl = load.rootUrl;
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 dac2e50..7eecb72 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
@@ -19,11 +19,6 @@
* ============LICENSE_END=========================================================
*/
-const {ajax_put} = require("../../../../../target/classes/webapp/js/ApexAjax");
-const {ajax_post} = require("../../../../../target/classes/webapp/js/ApexAjax");
-const {ajax_delete} = require("../../../../../target/classes/webapp/js/ApexAjax");
-const {ajax_getWithKeyInfo} = require("../../../../../target/classes/webapp/js/ApexAjax");
-
function editContextSchemaForm_createContextSchema(formParent) {
return editContextSchemaForm_activate(formParent, "CREATE", 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 9171fd3..a8726e7 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
@@ -19,9 +19,6 @@
* ============LICENSE_END=========================================================
*/
-const {ajax_get} = require("../../../../../target/classes/webapp/js/ApexAjax");
-const {ajax_put} = require("../../../../../target/classes/webapp/js/ApexAjax");
-
function files_fileOpen() {
$('<input type="file">').on('change', function() {
var reader = new FileReader();
@@ -53,4 +50,16 @@ function files_fileDownload() {
document.body.removeChild(downloadLink);
}
-module.exports = {files_fileDownload, files_fileOpen};
+function files_fileUpload() {
+ var requestURL = restRootURL + "/Model/Upload";
+
+ ajax_getOKOrFail(requestURL, function(data) {
+ var uploadResultString = "";
+ for (var i = 0; i < data.messages.message.length; i++) {
+ uploadResultString += (data.messages.message[i] + "\n");
+ }
+ resultForm_activate(document.getElementById("mainArea"), "Model Upload Result", uploadResultString);
+ });
+}
+
+module.exports = {files_fileUpload, files_fileDownload, files_fileOpen};
diff --git a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexMain.js b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexMain.js
index 46d8398..9dea9b5 100644
--- a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexMain.js
+++ b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexMain.js
@@ -44,7 +44,7 @@ $("#menu li").not(".emptyMessage").click(function() {
files_fileDownload();
break;
case "menuFileUpload":
- uploadPlugin.openDialog();
+ files_fileUpload();
break;
case "menuFileClear":
diff --git a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexUpload.js b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexUpload.js
deleted file mode 100644
index a71853c..0000000
--- a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexUpload.js
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2020 Nordix Foundation
- * ================================================================================
- * 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=========================================================
- */
-
-$(document).ready(function () {
- $.subscribe("/config/ready", enableUpload);
-
- function enableUpload() {
- const menuFileUpload = $('#menuFileUpload');
- const isUploadEnabled = configObj.getConfig("plugin.policy.upload.enable");
- if (isUploadEnabled === "true" || isUploadEnabled === true) {
- menuFileUpload.show();
- } else {
- menuFileUpload.hide();
- }
- }
-
-});
-
-const uploadPlugin = {
- dialogDiv: $('#main-dialog'),
- openDialog: function () {
- this.dialogDiv.load('../upload/dialog.html');
- },
-
- upload: function (data, successCallback, errorCallback) {
- const requestURL = restRootURL + "/Model/Upload";
- $.ajax({
- type: 'POST',
- url: requestURL,
- data: data,
- contentType: false,
- processData: false
- }).done(function (data) {
- pageControl_successStatus(data);
- if (typeof successCallback === typeof Function) {
- successCallback(data);
- }
- }).fail(function (jqXHR, textStatus, errorThrown) {
- pageControl_restError(requestURL, jqXHR, textStatus, errorThrown);
- if (typeof errorCallback === typeof Function) {
- errorCallback(jqXHR, textStatus, errorThrown);
- }
- });
- }
-}
diff --git a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexUser.js b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexUser.js
deleted file mode 100644
index e30f5dd..0000000
--- a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexUser.js
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2020 Nordix Foundation.
- * ================================================================================
- * 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=========================================================
- */
-
-const userManager = {
- userId: null
-};
-
-(function () {
- //grabbing the userId
- const urlParams = new URLSearchParams(window.location.search);
- userManager.userId = urlParams.get('userId');
-})();
-
-exports = {userManager}; \ No newline at end of file
diff --git a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexConfig.test.js b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexConfig.test.js
deleted file mode 100644
index 02d8406..0000000
--- a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexConfig.test.js
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2020 Nordix Foundation
- * ================================================================================
- * 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=========================================================
- */
-
-const apexConfig = require('../ApexConfig');
-
-test('configObj called successfully', () => {
- expect(apexConfig.configObj.getConfig()).not.toBeNull();
- expect(apexConfig.configObj.setConfig()).not.toBeNull();
- expect(apexConfig.configObj).toHaveProperty('configMap');
-});
-
-test('load called successfully', () => {
- expect(apexConfig.rootUrl).not.toBe(null);
- const mock = jest.fn(apexConfig.load).mockImplementation(() => {
- function test (data) {
- for (let i = 0; i < data.messages.message.length; i++) {
- const configEntry = JSON.parse(data.messages.message[i]);
- Object.keys(configEntry).forEach(key => {
- configObj.setConfig(key, configEntry[key]);
- });
- }
- configObj.readySignal();
- };
- });
- mock();
- expect(mock).toHaveBeenCalledTimes(1);
-}); \ No newline at end of file
diff --git a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexUser.test.js b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexUser.test.js
deleted file mode 100644
index 1d445c4..0000000
--- a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/__test__/ApexUser.test.js
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * Copyright (C) 2020 Nordix Foundation
- * ================================================================================
- * 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=========================================================
- */
-
-const user = require('../ApexUser');
-
-test('userManager test', () => {
- const userMock = {
- userId: u => {
- return `userId: ${u}`;
- },
- }
- const spy = jest.spyOn(userMock, 'userId');
- expect(userMock.userId('userTest')).toBe('userId: userTest');
- expect(spy).toHaveBeenCalledWith('userTest');
-}); \ No newline at end of file
diff --git a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/lib/pubsub/ba-tiny-pubsub.min.js b/gui-editors/gui-editor-apex/src/main/resources/webapp/js/lib/pubsub/ba-tiny-pubsub.min.js
deleted file mode 100644
index 635ab34..0000000
--- a/gui-editors/gui-editor-apex/src/main/resources/webapp/js/lib/pubsub/ba-tiny-pubsub.min.js
+++ /dev/null
@@ -1,4 +0,0 @@
-/*! Tiny Pub/Sub - v0.7.0 - 2013-01-29
-* https://github.com/cowboy/jquery-tiny-pubsub
-* Copyright (c) 2013 "Cowboy" Ben Alman; Licensed MIT */
-(function(n){var u=n({});n.subscribe=function(){u.on.apply(u,arguments)},n.unsubscribe=function(){u.off.apply(u,arguments)},n.publish=function(){u.trigger.apply(u,arguments)}})(jQuery); \ No newline at end of file
diff --git a/gui-editors/gui-editor-apex/src/main/resources/webapp/package-lock.json b/gui-editors/gui-editor-apex/src/main/resources/webapp/package-lock.json
index 0b398d7..b218308 100644
--- a/gui-editors/gui-editor-apex/src/main/resources/webapp/package-lock.json
+++ b/gui-editors/gui-editor-apex/src/main/resources/webapp/package-lock.json
@@ -83,7 +83,11 @@
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz",
"integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==",
"dev": true,
- "optional": true
+ "optional": true,
+ "requires": {
+ "bindings": "^1.5.0",
+ "nan": "^2.12.1"
+ }
},
"glob-parent": {
"version": "3.1.0",
@@ -2741,6 +2745,16 @@
"dev": true,
"optional": true
},
+ "bindings": {
+ "version": "1.5.0",
+ "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz",
+ "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==",
+ "dev": true,
+ "optional": true,
+ "requires": {
+ "file-uri-to-path": "1.0.0"
+ }
+ },
"bluebird": {
"version": "3.7.2",
"resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz",
@@ -4384,6 +4398,13 @@
"integrity": "sha512-0btnI/H8f2pavGMN8w40mlSKOfTK2SVJmBfBeVIj3kNw0swwgzyRq0d5TJVOwodFmtvpPeWPN/MCcfuWF0Ezbw==",
"dev": true
},
+ "file-uri-to-path": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz",
+ "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==",
+ "dev": true,
+ "optional": true
+ },
"fill-range": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz",
@@ -7440,6 +7461,13 @@
"integrity": "sha1-iZ8R2WhuXgXLkbNdXw5jt3PPyQE=",
"dev": true
},
+ "nan": {
+ "version": "2.14.1",
+ "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.1.tgz",
+ "integrity": "sha512-isWHgVjnFjh2x2yuJ/tj3JbwoHu3UC2dX5G/88Cm24yB6YopVgxvBObDY7n5xW6ExmFhJpSEQqFPvq9zaXc8Jw==",
+ "dev": true,
+ "optional": true
+ },
"nanomatch": {
"version": "1.2.13",
"resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz",
@@ -10150,7 +10178,11 @@
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz",
"integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==",
"dev": true,
- "optional": true
+ "optional": true,
+ "requires": {
+ "bindings": "^1.5.0",
+ "nan": "^2.12.1"
+ }
},
"glob-parent": {
"version": "3.1.0",
@@ -10551,7 +10583,11 @@
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz",
"integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==",
"dev": true,
- "optional": true
+ "optional": true,
+ "requires": {
+ "bindings": "^1.5.0",
+ "nan": "^2.12.1"
+ }
},
"glob-parent": {
"version": "3.1.0",
diff --git a/gui-editors/gui-editor-apex/src/main/resources/webapp/upload/dialog.html b/gui-editors/gui-editor-apex/src/main/resources/webapp/upload/dialog.html
deleted file mode 100644
index 912bec4..0000000
--- a/gui-editors/gui-editor-apex/src/main/resources/webapp/upload/dialog.html
+++ /dev/null
@@ -1,68 +0,0 @@
-<!--
- ~ ============LICENSE_START=======================================================
- ~ Copyright (C) 2020 Nordix Foundation
- ~ ================================================================================
- ~ 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=========================================================
- -->
-
-<!DOCTYPE html>
-<html lang="en">
-<head>
- <meta charset="UTF-8">
- <title>Upload Policy</title>
- <script>
- $(document).ready(function () {
- function upload() {
- const data = new FormData();
- const apexConfigFile = $('#apex-config-file')[0].files[0];
- const toscaTemplateFile = $('#tosca-template-file')[0].files[0];
- data.append('apex-config-file', apexConfigFile);
- data.append('tosca-template-file', toscaTemplateFile);
- data.append('userId', userManager.userId);
- uploadPlugin.upload(data, function () {
- dialog.dialog("close");
- });
- }
-
- const dialog = $('#inner-dialog').dialog({
- height: 300,
- width: 435,
- modal: true,
- dialogClass: 'upload-dialog',
- buttons: {
- "Upload": upload,
- Cancel: function() {
- dialog.dialog("close");
- }
- }
- });
- });
-
- </script>
-</head>
-<body>
-<div id="inner-dialog" title="Upload Policy" class="upload-dialog">
- <p>Provide the following files to compose the policy TOSCA</p>
- <div id="upload-form">
- <label for="apex-config-file">Apex Config</label> <br/>
- <input id="apex-config-file" type="file" required="required" accept="application/json"
- class="ui-widget-content ui-corner-all"/> <br/>
- <label for="tosca-template-file">Tosca Template</label> <br/>
- <input id="tosca-template-file" type="file" required="required" accept="application/json"
- class="ui-widget-content ui-corner-all"/>
- </div>
-</div>
-</body>
-</html>