summaryrefslogtreecommitdiffstats
path: root/gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexFiles.js
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/js/ApexFiles.js
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/js/ApexFiles.js')
-rw-r--r--gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexFiles.js17
1 files changed, 13 insertions, 4 deletions
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};