aboutsummaryrefslogtreecommitdiffstats
path: root/gui-editors
diff options
context:
space:
mode:
authorandre.schmid <andre.schmid@est.tech>2021-10-27 18:39:43 +0100
committerandre.schmid <andre.schmid@est.tech>2021-10-27 18:39:43 +0100
commit95a6260a715cdf46234ced9c797316685d1be918 (patch)
treeb5e8a47b794d56b2595d327baf0bcd6f63627696 /gui-editors
parentaa93fed6146559c521a419a873120bdef479e78f (diff)
Fix APEX policy creation issue
Because of a not initialized javascript variable, the system calls a malformed url to create a APEX policy. This change correctly initializes the window.restRootURL when no apex_session is present in the localStorage. Issue-ID: POLICY-3794 Signed-off-by: andre.schmid <andre.schmid@est.tech> Change-Id: I068bd86a747e7eafc3f17aa0faf5fdc778195711
Diffstat (limited to 'gui-editors')
-rw-r--r--gui-editors/gui-editor-apex/src/main/resources/webapp/js/ApexMain.js13
1 files changed, 7 insertions, 6 deletions
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>");
});
}