diff --git a/apps/jumpserver/conf.py b/apps/jumpserver/conf.py index 0df26d149..9bd2953f2 100644 --- a/apps/jumpserver/conf.py +++ b/apps/jumpserver/conf.py @@ -393,6 +393,7 @@ defaults = { 'FLOWER_URL': "127.0.0.1:5555", 'DEFAULT_ORG_SHOW_ALL_USERS': True, 'PERIOD_TASK_ENABLED': True, + 'FORCE_SCRIPT_NAME': '', } diff --git a/apps/jumpserver/context_processor.py b/apps/jumpserver/context_processor.py index 91a720fd7..8ddb07701 100644 --- a/apps/jumpserver/context_processor.py +++ b/apps/jumpserver/context_processor.py @@ -18,6 +18,7 @@ def jumpserver_processor(request): 'COPYRIGHT': 'FIT2CLOUD 飞致云' + ' © 2014-2019', 'SECURITY_COMMAND_EXECUTION': settings.SECURITY_COMMAND_EXECUTION, 'SECURITY_MFA_VERIFY_TTL': settings.SECURITY_MFA_VERIFY_TTL, + 'FORCE_SCRIPT_NAME': settings.FORCE_SCRIPT_NAME, } return context diff --git a/apps/jumpserver/settings.py b/apps/jumpserver/settings.py index 6088358f1..3ac458065 100644 --- a/apps/jumpserver/settings.py +++ b/apps/jumpserver/settings.py @@ -654,3 +654,4 @@ CHANNEL_LAYERS = { # Enable internal period task PERIOD_TASK_ENABLED = CONFIG.PERIOD_TASK_ENABLED +FORCE_SCRIPT_NAME = CONFIG.FORCE_SCRIPT_NAME diff --git a/apps/static/js/jumpserver.js b/apps/static/js/jumpserver.js index 1105561e6..faea30dc2 100644 --- a/apps/static/js/jumpserver.js +++ b/apps/static/js/jumpserver.js @@ -137,14 +137,18 @@ function setAjaxCSRFToken() { }); } -function activeNav() { - var url_array = document.location.pathname.split("/"); - var app = url_array[1]; - var resource = url_array[2]; +function activeNav(prefix) { + var path = document.location.pathname; + if (prefix) { + path = path.replace(prefix, ''); + } + var urlArray = path.split("/"); + var app = urlArray[1]; + var resource = urlArray[2]; if (app === '') { $('#index').addClass('active'); } else if (app === 'xpack' && resource === 'cloud') { - var item = url_array[3]; + var item = urlArray[3]; $("#" + app).addClass('active'); $('#' + app + ' #' + resource).addClass('active'); $('#' + app + ' #' + resource + ' #' + item + ' a').css('color', '#ffffff'); diff --git a/apps/templates/_foot_js.html b/apps/templates/_foot_js.html index b33fb814f..6a1062887 100644 --- a/apps/templates/_foot_js.html +++ b/apps/templates/_foot_js.html @@ -9,7 +9,7 @@