aboutsummaryrefslogtreecommitdiffstats
path: root/gui-editors/gui-editor-apex
diff options
context:
space:
mode:
Diffstat (limited to 'gui-editors/gui-editor-apex')
-rw-r--r--gui-editors/gui-editor-apex/src/main/java/org/onap/policy/gui/editors/apex/rest/ApexEditorParameterParser.java2
-rw-r--r--gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexFiles.js9
-rw-r--r--gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexMain.js13
3 files changed, 14 insertions, 10 deletions
diff --git a/gui-editors/gui-editor-apex/src/main/java/org/onap/policy/gui/editors/apex/rest/ApexEditorParameterParser.java b/gui-editors/gui-editor-apex/src/main/java/org/onap/policy/gui/editors/apex/rest/ApexEditorParameterParser.java
index 7487fa0..0c8c648 100644
--- a/gui-editors/gui-editor-apex/src/main/java/org/onap/policy/gui/editors/apex/rest/ApexEditorParameterParser.java
+++ b/gui-editors/gui-editor-apex/src/main/java/org/onap/policy/gui/editors/apex/rest/ApexEditorParameterParser.java
@@ -102,7 +102,7 @@ public class ApexEditorParameterParser {
.longOpt("upload-url")
.desc("the URL to use for uploads. Default value is null")
.hasArg()
- .argName("USERID")
+ .argName("UPLOAD_URL")
.required(false)
.type(String.class)
.build()
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 a002788..de9edf3 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
@@ -58,10 +58,13 @@ function files_fileDownload() {
}
function files_fileUpload() {
- var requestURL = window.restRootURL + "/Model/Upload?userId=" + new URLSearchParams(window.location.search).get('userId');
-
+ let requestURL = window.restRootURL + "/Model/Upload";
+ const userId = new URLSearchParams(window.location.search).get('userId');
+ if (userId) {
+ requestURL = requestURL + "?userId=" + userId;
+ }
ajax_getOKOrFail(requestURL, function(data) {
- var uploadResultString = "";
+ let uploadResultString = "";
for (let value of data.messages.message) {
uploadResultString += (value + "\n");
}
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 d7019d3..ce491ec 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
@@ -111,21 +111,21 @@ $("#menu li").not(".emptyMessage").click(function() {
});
function main_getRestRootURL() {
- var href = location.protocol
+ const href = location.protocol
+ "//"
+ window.location.hostname
+ (location.port ? ':' + location.port : '')
+ (location.pathname.endsWith("/editor/") ? location.pathname.substring(0, location.pathname
.indexOf("editor/")) : location.pathname);
- var restContext = "apexservices/editor/";
+ const restContext = "apexservices/editor/";
if (localStorage.getItem("apex_session")) {
restRootURL = href + restContext + localStorage.getItem("apex_session");
- window.restRootURL = href + restContext + localStorage.getItem("apex_session");
- var requestURL = restRootURL + "/Model/GetKey";
+ window.restRootURL = restRootURL;
+ const requestURL = restRootURL + "/Model/GetKey";
ajax_get(requestURL, function(data) {
$("#statusMessageTable").append("<tr><td> REST root URL set to: " + restRootURL + "</td></tr>");
if (localStorage.getItem("apex_model_loaded")) {
- var modelKey = JSON.parse(data.messages.message[0]).apexArtifactKey;
+ const modelKey = JSON.parse(data.messages.message[0]).apexArtifactKey;
pageControl_modelMode(modelKey.name, modelKey.version, modelFileName);
if (localStorage.getItem("apex_tab_index")) {
$("#mainTabs").tabs({
@@ -135,11 +135,12 @@ function main_getRestRootURL() {
}
});
} else {
- var createSessionURL = href + restContext + "-1/Session/Create";
+ const createSessionURL = href + restContext + "-1/Session/Create";
ajax_get(createSessionURL, function(data) {
localStorage.setItem("apex_session", data.messages.message[0]);
restRootURL = href + restContext + localStorage.getItem("apex_session");
+ window.restRootURL = restRootURL;
$("#statusMessageTable").append("<tr><td> REST root URL set to: " + restRootURL + "</td></tr>");
});
}