fix: showStudyList config (#1647)
* fix: `showStudyList` config * showStudyList should default to true if not defined
This commit is contained in:
parent
b0cfc45f83
commit
d9fc7bbb0e
@ -86,6 +86,7 @@ class App extends Component {
|
|||||||
|
|
||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
config: {
|
config: {
|
||||||
|
showStudyList: true,
|
||||||
whiteLabelling: {},
|
whiteLabelling: {},
|
||||||
oidc: [],
|
oidc: [],
|
||||||
extensions: [],
|
extensions: [],
|
||||||
@ -102,6 +103,7 @@ class App extends Component {
|
|||||||
const { config, defaultExtensions } = props;
|
const { config, defaultExtensions } = props;
|
||||||
|
|
||||||
const appDefaultConfig = {
|
const appDefaultConfig = {
|
||||||
|
showStudyList: true,
|
||||||
cornerstoneExtensionConfig: {},
|
cornerstoneExtensionConfig: {},
|
||||||
extensions: [],
|
extensions: [],
|
||||||
routerBasename: '/',
|
routerBasename: '/',
|
||||||
|
|||||||
@ -1,30 +1,29 @@
|
|||||||
import React, { useState, useEffect } from 'react';
|
import React, { useState, useEffect } from 'react';
|
||||||
import { Link, withRouter } from 'react-router-dom';
|
import { Link, withRouter } from 'react-router-dom';
|
||||||
import { withTranslation } from 'react-i18next';
|
import { withTranslation } from 'react-i18next';
|
||||||
|
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
|
import classNames from 'classnames';
|
||||||
import { Dropdown, AboutContent, withModal } from '@ohif/ui';
|
import { Dropdown, AboutContent, withModal } from '@ohif/ui';
|
||||||
|
//
|
||||||
import { UserPreferences } from './../UserPreferences';
|
import { UserPreferences } from './../UserPreferences';
|
||||||
import OHIFLogo from '../OHIFLogo/OHIFLogo.js';
|
import OHIFLogo from '../OHIFLogo/OHIFLogo.js';
|
||||||
import './Header.css';
|
import './Header.css';
|
||||||
|
|
||||||
// Context
|
|
||||||
import AppContext from './../../context/AppContext';
|
|
||||||
|
|
||||||
function Header(props) {
|
function Header(props) {
|
||||||
const {
|
const {
|
||||||
t,
|
t,
|
||||||
user,
|
user,
|
||||||
userManager,
|
userManager,
|
||||||
modal: { show },
|
modal: { show },
|
||||||
home,
|
useLargeLogo,
|
||||||
|
linkPath,
|
||||||
|
linkText,
|
||||||
location,
|
location,
|
||||||
children,
|
children,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const [options, setOptions] = useState([]);
|
const [options, setOptions] = useState([]);
|
||||||
|
const hasLink = linkText && linkPath;
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const optionsValue = [
|
const optionsValue = [
|
||||||
@ -61,15 +60,12 @@ function Header(props) {
|
|||||||
setOptions(optionsValue);
|
setOptions(optionsValue);
|
||||||
}, [setOptions, show, t, user, userManager]);
|
}, [setOptions, show, t, user, userManager]);
|
||||||
|
|
||||||
const { appConfig = {} } = AppContext;
|
|
||||||
const showStudyList =
|
|
||||||
appConfig.showStudyList !== undefined ? appConfig.showStudyList : true;
|
|
||||||
|
|
||||||
// ANTD -- Hamburger, Drawer, Menu
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="notification-bar">{t('INVESTIGATIONAL USE ONLY')}</div>
|
<div className="notification-bar">{t('INVESTIGATIONAL USE ONLY')}</div>
|
||||||
<div className={`entry-header ${home ? 'header-big' : ''}`}>
|
<div
|
||||||
|
className={classNames('entry-header', { 'header-big': useLargeLogo })}
|
||||||
|
>
|
||||||
<div className="header-left-box">
|
<div className="header-left-box">
|
||||||
{location && location.studyLink && (
|
{location && location.studyLink && (
|
||||||
<Link
|
<Link
|
||||||
@ -82,15 +78,15 @@ function Header(props) {
|
|||||||
|
|
||||||
{children}
|
{children}
|
||||||
|
|
||||||
{showStudyList && !home && (
|
{hasLink && (
|
||||||
<Link
|
<Link
|
||||||
className="header-btn header-studyListLinkSection"
|
className="header-btn header-studyListLinkSection"
|
||||||
to={{
|
to={{
|
||||||
pathname: '/',
|
pathname: linkPath,
|
||||||
state: { studyLink: location.pathname },
|
state: { studyLink: location.pathname },
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{t('Study list')}
|
{t(linkText)}
|
||||||
</Link>
|
</Link>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
@ -105,7 +101,11 @@ function Header(props) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Header.propTypes = {
|
Header.propTypes = {
|
||||||
home: PropTypes.bool.isRequired,
|
// Study list, /
|
||||||
|
linkText: PropTypes.string,
|
||||||
|
linkPath: PropTypes.string,
|
||||||
|
useLargeLogo: PropTypes.bool,
|
||||||
|
//
|
||||||
location: PropTypes.object.isRequired,
|
location: PropTypes.object.isRequired,
|
||||||
children: PropTypes.node,
|
children: PropTypes.node,
|
||||||
t: PropTypes.func.isRequired,
|
t: PropTypes.func.isRequired,
|
||||||
@ -115,7 +115,7 @@ Header.propTypes = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
Header.defaultProps = {
|
Header.defaultProps = {
|
||||||
home: true,
|
useLargeLogo: false,
|
||||||
children: OHIFLogo(),
|
children: OHIFLogo(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -16,6 +16,7 @@ import { extensionManager } from './../App.js';
|
|||||||
// Contexts
|
// Contexts
|
||||||
import WhiteLabellingContext from '../context/WhiteLabellingContext.js';
|
import WhiteLabellingContext from '../context/WhiteLabellingContext.js';
|
||||||
import UserManagerContext from '../context/UserManagerContext';
|
import UserManagerContext from '../context/UserManagerContext';
|
||||||
|
import AppContext from '../context/AppContext';
|
||||||
|
|
||||||
import './Viewer.css';
|
import './Viewer.css';
|
||||||
|
|
||||||
@ -230,10 +231,24 @@ class Viewer extends Component {
|
|||||||
{whiteLabelling => (
|
{whiteLabelling => (
|
||||||
<UserManagerContext.Consumer>
|
<UserManagerContext.Consumer>
|
||||||
{userManager => (
|
{userManager => (
|
||||||
<ConnectedHeader home={false} userManager={userManager}>
|
<AppContext.Consumer>
|
||||||
|
{appContext => (
|
||||||
|
<ConnectedHeader
|
||||||
|
linkText={
|
||||||
|
appContext.appConfig.showStudyList
|
||||||
|
? 'Study List'
|
||||||
|
: undefined
|
||||||
|
}
|
||||||
|
linkPath={
|
||||||
|
appContext.appConfig.showStudyList ? '/' : undefined
|
||||||
|
}
|
||||||
|
userManager={userManager}
|
||||||
|
>
|
||||||
{whiteLabelling.logoComponent}
|
{whiteLabelling.logoComponent}
|
||||||
</ConnectedHeader>
|
</ConnectedHeader>
|
||||||
)}
|
)}
|
||||||
|
</AppContext.Consumer>
|
||||||
|
)}
|
||||||
</UserManagerContext.Consumer>
|
</UserManagerContext.Consumer>
|
||||||
)}
|
)}
|
||||||
</WhiteLabellingContext.Consumer>
|
</WhiteLabellingContext.Consumer>
|
||||||
|
|||||||
@ -45,9 +45,7 @@ const ROUTES_DEF = {
|
|||||||
path: ['/studylist', '/'],
|
path: ['/studylist', '/'],
|
||||||
component: StudyListRouting,
|
component: StudyListRouting,
|
||||||
condition: appConfig => {
|
condition: appConfig => {
|
||||||
return appConfig.showStudyList !== undefined
|
return appConfig.showStudyList;
|
||||||
? appConfig.showStudyList
|
|
||||||
: true;
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
local: {
|
local: {
|
||||||
@ -72,10 +70,7 @@ const ROUTES_DEF = {
|
|||||||
'/projects/:project/locations/:location/datasets/:dataset/dicomStores/:dicomStore',
|
'/projects/:project/locations/:location/datasets/:dataset/dicomStores/:dicomStore',
|
||||||
component: StudyListRouting,
|
component: StudyListRouting,
|
||||||
condition: appConfig => {
|
condition: appConfig => {
|
||||||
const showList =
|
const showList = appConfig.showStudyList;
|
||||||
appConfig.showStudyList !== undefined
|
|
||||||
? appConfig.showStudyList
|
|
||||||
: true;
|
|
||||||
|
|
||||||
return showList && !!appConfig.enableGoogleCloudAdapter;
|
return showList && !!appConfig.enableGoogleCloudAdapter;
|
||||||
},
|
},
|
||||||
|
|||||||
@ -214,7 +214,7 @@ function StudyListRoute(props) {
|
|||||||
<UserManagerContext.Consumer>
|
<UserManagerContext.Consumer>
|
||||||
{userManager => (
|
{userManager => (
|
||||||
<ConnectedHeader
|
<ConnectedHeader
|
||||||
home={true}
|
useLargeLogo={true}
|
||||||
user={user}
|
user={user}
|
||||||
userManager={userManager}
|
userManager={userManager}
|
||||||
>
|
>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user