From 4b3994e788b79fc4810ad9861fd644c357874362 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Felipe=20de=20Medeiros=20Moreira?= Date: Mon, 8 Jul 2019 16:29:59 -0300 Subject: [PATCH] feat(StudyList): Disable study list link/route using 'showStudyList' config property (#597) fix #574 --- public/config/default.js | 1 + public/config/demo.js | 1 + public/config/docker_nginx-orthanc.js | 1 + .../docker_openresty-orthanc-keycloak.js | 1 + public/config/docker_openresty-orthanc.js | 1 + public/config/local_dcm4chee.js | 1 + public/config/netlify.js | 1 + public/config/public_dicomweb.js | 1 + src/OHIFStandaloneViewer.js | 26 +++++++++++++------ src/components/Header/Header.js | 6 ++++- 10 files changed, 31 insertions(+), 9 deletions(-) diff --git a/public/config/default.js b/public/config/default.js index 2c7c92018..527867bf6 100644 --- a/public/config/default.js +++ b/public/config/default.js @@ -3,6 +3,7 @@ window.config = { routerBasename: '/', // default: '' relativeWebWorkerScriptsPath: '', + showStudyList: true, servers: { dicomWeb: [ { diff --git a/public/config/demo.js b/public/config/demo.js index 23fc3a805..fd0c0a3df 100644 --- a/public/config/demo.js +++ b/public/config/demo.js @@ -1,5 +1,6 @@ window.config = { routerBasename: '/', + showStudyList: true, servers: { dicomWeb: [ { diff --git a/public/config/docker_nginx-orthanc.js b/public/config/docker_nginx-orthanc.js index b200b4b9f..3aa5e1cae 100644 --- a/public/config/docker_nginx-orthanc.js +++ b/public/config/docker_nginx-orthanc.js @@ -1,5 +1,6 @@ window.config = { routerBasename: '/', + showStudyList: true, relativeWebWorkerScriptsPath: '', servers: { dicomWeb: [ diff --git a/public/config/docker_openresty-orthanc-keycloak.js b/public/config/docker_openresty-orthanc-keycloak.js index 595cdf323..df19b3566 100644 --- a/public/config/docker_openresty-orthanc-keycloak.js +++ b/public/config/docker_openresty-orthanc-keycloak.js @@ -1,5 +1,6 @@ window.config = { routerBasename: '/', + showStudyList: true, relativeWebWorkerScriptsPath: '', servers: { // This is an array, but we'll only use the first entry for now diff --git a/public/config/docker_openresty-orthanc.js b/public/config/docker_openresty-orthanc.js index 65ed5297f..b483e2e79 100644 --- a/public/config/docker_openresty-orthanc.js +++ b/public/config/docker_openresty-orthanc.js @@ -1,5 +1,6 @@ window.config = { routerBasename: '/', + showStudyList: true, relativeWebWorkerScriptsPath: '', servers: { // This is an array, but we'll only use the first entry for now diff --git a/public/config/local_dcm4chee.js b/public/config/local_dcm4chee.js index be7d02d20..7abddc0cf 100644 --- a/public/config/local_dcm4chee.js +++ b/public/config/local_dcm4chee.js @@ -2,6 +2,7 @@ window.config = { // default: '/' routerBasename: '/', // default: '' + showStudyList: true, relativeWebWorkerScriptsPath: '', servers: { dicomWeb: [ diff --git a/public/config/netlify.js b/public/config/netlify.js index caaab22d6..d33d402dd 100644 --- a/public/config/netlify.js +++ b/public/config/netlify.js @@ -1,5 +1,6 @@ window.config = { routerBasename: '/demo', + showStudyList: true, servers: { dicomWeb: [ { diff --git a/public/config/public_dicomweb.js b/public/config/public_dicomweb.js index 1359bcdab..825f7fc0d 100644 --- a/public/config/public_dicomweb.js +++ b/public/config/public_dicomweb.js @@ -1,5 +1,6 @@ window.config = { routerBasename: '/', + showStudyList: true, servers: { dicomWeb: [ { diff --git a/src/OHIFStandaloneViewer.js b/src/OHIFStandaloneViewer.js index 5b0f031da..d933a5de3 100644 --- a/src/OHIFStandaloneViewer.js +++ b/src/OHIFStandaloneViewer.js @@ -42,6 +42,9 @@ class OHIFStandaloneViewer extends Component { static propTypes = { history: PropTypes.object.isRequired, user: PropTypes.object, + setContext: PropTypes.func, + userManager: PropTypes.object, + location: PropTypes.object, }; componentDidMount() { @@ -93,14 +96,6 @@ class OHIFStandaloneViewer extends Component { * See http://reactcommunity.org/react-transition-group/with-react-router/ */ const routes = [ - { - path: '/', - Component: StudyListRouting, - }, - { - path: '/studylist', - Component: StudyListRouting, - }, { path: '/viewer', Component: StandaloneRouting, @@ -119,6 +114,21 @@ class OHIFStandaloneViewer extends Component { }, ]; + const showStudyList = + window.config.showStudyList !== undefined + ? window.config.showStudyList + : true; + if (showStudyList) { + routes.push({ + path: '/studylist', + Component: StudyListRouting, + }); + routes.push({ + path: '/', + Component: StudyListRouting, + }); + } + const currentPath = this.props.location.pathname; const noMatchingRoutes = !routes.find(r => matchPath(currentPath, { diff --git a/src/components/Header/Header.js b/src/components/Header/Header.js index 5f65a04be..2cd0c04d6 100644 --- a/src/components/Header/Header.js +++ b/src/components/Header/Header.js @@ -71,6 +71,10 @@ class Header extends Component { render() { const { t } = this.props; + const showStudyList = + window.config.showStudyList !== undefined + ? window.config.showStudyList + : true; return (
@@ -85,7 +89,7 @@ class Header extends Component { {this.props.children} - {!this.props.home && ( + {showStudyList && !this.props.home && (