'use strict';
// global constants
var JEngine_Server_URL = window.location.origin;
var InstanceName = window.location.pathname.split('/')[1];
var JUserManagement_Server_URL = window.location.origin;
// vars defining the URIs of the REST-APIs
var JCore_REST_Interface = InstanceName + "/api/interface/v2";
var JConfig_REST_Interface = InstanceName + "/api/config/v2";
var JHistory_REST_Interface = InstanceName + "/api/history/v2";
var JAnalytics_REST_Interface = InstanceName + "/api/analytics/v2";
var JUserManagement_REST_Interface = InstanceName + "/api/interface/v1";

// SSE Event Receiver for reloading the page when an event occurs
var source = new EventSource(JEngine_Server_URL + '/' + InstanceName + '/sse');

(function () {
    var jfrontend = angular.module('jfrontend', [
        'ngRoute',
        'adminConfiguration',
        'ui.bootstrap'
    ]);

    // Defining Routes for the AngularJS App
    jfrontend.config(['$routeProvider',
        function ($routeProvider) {
            $routeProvider.// route for scenario view
            when('/scenario/', {
                templateUrl: 'app/views/scenario.html',
                controller: 'ScenarioController',
                controllerAs: 'scenarioCtrl'
            }).// route for scenario detail view
            when('/scenario/:id/', {
                templateUrl: 'app/views/scenarioDetails.html',
                controller: 'ScenarioController',
                controllerAs: 'scenarioCtrl'
            }).// route for scenario instance detail view
            when('/scenario/:id/instance/:instanceId/', {
                templateUrl: 'app/views/scenarioInstanceDetails.html',
                controller: 'ScenarioInstanceController',
                controllerAs: 'instanceCtrl'
            }).// route for mail task configuration
            when('/admin/mail/', {
                templateUrl: 'app/views/mailConfigDetails.html',
                controller: 'mailConfig',
                controllerAs: 'mailC'
            }).// route for JUserManagemetn configuration
            when('/admin/userMgmt/', {
                templateUrl: 'app/views/userMgmtConfig.html',
                controller: 'userMgmtController',
                controllerAs: 'userMgmtC'
            }).// route for user dashboard
            when('/admin/user/', {
                templateUrl: 'app/views/user.html',
                controller: 'userMgmtController',
                controllerAs: 'userMgmtC'
            }).// default route
            otherwise({redirectTo: '/scenario/'});
        }
    ]);
})();

@@ -76,16 +76,142 @@
 origin;%0A
+// InstanceName is path without leading/trailing slash, e.g. for url with %22/bpt/chimera/#/scenario/%22 it will be %22bpt/chimera%22%0A
 var Inst
@@ -250,21 +250,45 @@
 ame.
-split('/')%5B1%5D
+replace(/%5E%5C//, %22%22).replace(/%5C/$/, %22%22)
 ;%0Ava

Fix api path name for deployments in nested subdirectories