From ff68eb9b009c1d7bb367cc7879c5e052cdd8e42d Mon Sep 17 00:00:00 2001 From: pkupczyk <piotr.kupczyk@id.ethz.ch> Date: Wed, 18 Nov 2020 12:14:51 +0100 Subject: [PATCH] NG_UI : urls : SSDM-10428 - maintain the application path in URL --- openbis_ng_ui/src/js/common/url.js | 10 ++++++++++ openbis_ng_ui/src/js/store/history.js | 3 ++- openbis_ng_ui/webpack.config.dev.js | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 openbis_ng_ui/src/js/common/url.js diff --git a/openbis_ng_ui/src/js/common/url.js b/openbis_ng_ui/src/js/common/url.js new file mode 100644 index 00000000000..eead0cf228f --- /dev/null +++ b/openbis_ng_ui/src/js/common/url.js @@ -0,0 +1,10 @@ +function getApplicationPath() { + return window.location.pathname.substr( + 0, + window.location.pathname.lastIndexOf('/') + 1 + ) +} + +export default { + getApplicationPath +} diff --git a/openbis_ng_ui/src/js/store/history.js b/openbis_ng_ui/src/js/store/history.js index f8127a63380..a37412205f6 100644 --- a/openbis_ng_ui/src/js/store/history.js +++ b/openbis_ng_ui/src/js/store/history.js @@ -1,9 +1,10 @@ import { createBrowserHistory } from 'history' import actions from '@src/js/store/actions/actions.js' import routes from '@src/js/common/consts/routes.js' +import url from '@src/js/common/url.js' let history = createBrowserHistory({ - basename: '#' + basename: url.getApplicationPath() + '#' }) history.configure = store => { diff --git a/openbis_ng_ui/webpack.config.dev.js b/openbis_ng_ui/webpack.config.dev.js index 1505b8b8962..a532153ccc0 100644 --- a/openbis_ng_ui/webpack.config.dev.js +++ b/openbis_ng_ui/webpack.config.dev.js @@ -20,6 +20,7 @@ module.exports = { aggregateTimeout: 300, poll: 1000 }, + publicPath: '/ng-ui-path/', proxy: { '/openbis': { target: 'http://localhost:8888', -- GitLab