fix: Add support for showStudyList configuration setting (#3009)
I followed suit with how it was implemented in the v2 branch, on the 404 page I just hit the link back to the study list if we're not configured to display it. See PR #2131
This commit is contained in:
parent
2a9e1e65a2
commit
4c5d14c624
@ -202,6 +202,7 @@ function ViewerLayout({
|
|||||||
<div>
|
<div>
|
||||||
<Header
|
<Header
|
||||||
menuOptions={menuOptions}
|
menuOptions={menuOptions}
|
||||||
|
isReturnEnabled={!!appConfig.showStudyList}
|
||||||
onClickReturnButton={onClickReturnButton}
|
onClickReturnButton={onClickReturnButton}
|
||||||
WhiteLabeling={appConfig.whiteLabeling}
|
WhiteLabeling={appConfig.whiteLabeling}
|
||||||
>
|
>
|
||||||
|
|||||||
@ -50,7 +50,13 @@ function App({ config, defaultExtensions, defaultModes }) {
|
|||||||
|
|
||||||
// Set appConfig
|
// Set appConfig
|
||||||
const appConfigState = init.appConfig;
|
const appConfigState = init.appConfig;
|
||||||
const { routerBasename, modes, dataSources, oidc } = appConfigState;
|
const {
|
||||||
|
routerBasename,
|
||||||
|
modes,
|
||||||
|
dataSources,
|
||||||
|
oidc,
|
||||||
|
showStudyList,
|
||||||
|
} = appConfigState;
|
||||||
|
|
||||||
const {
|
const {
|
||||||
UIDialogService,
|
UIDialogService,
|
||||||
@ -92,6 +98,7 @@ function App({ config, defaultExtensions, defaultModes }) {
|
|||||||
commandsManager,
|
commandsManager,
|
||||||
hotkeysManager,
|
hotkeysManager,
|
||||||
routerBasename,
|
routerBasename,
|
||||||
|
showStudyList,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (oidc) {
|
if (oidc) {
|
||||||
|
|||||||
@ -2,15 +2,20 @@ import React from 'react';
|
|||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
|
|
||||||
|
import { useAppConfig } from '@state';
|
||||||
|
|
||||||
const NotFound = ({
|
const NotFound = ({
|
||||||
message = 'Sorry, this page does not exist.',
|
message = 'Sorry, this page does not exist.',
|
||||||
showGoBackButton = true,
|
showGoBackButton = true,
|
||||||
}) => {
|
}) => {
|
||||||
|
const [appConfig] = useAppConfig();
|
||||||
|
const { showStudyList } = appConfig;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="w-full h-full flex justify-center items-center text-white">
|
<div className="w-full h-full flex justify-center items-center text-white">
|
||||||
<div>
|
<div>
|
||||||
<h4>{message}</h4>
|
<h4>{message}</h4>
|
||||||
{showGoBackButton && (
|
{showGoBackButton && showStudyList && (
|
||||||
<h5>
|
<h5>
|
||||||
<Link to={'/'}>Go back to the Study List</Link>
|
<Link to={'/'}>Go back to the Study List</Link>
|
||||||
</h5>
|
</h5>
|
||||||
|
|||||||
@ -13,12 +13,6 @@ import PrivateRoute from './PrivateRoute';
|
|||||||
// TODO: Include "routes" debug route if dev build
|
// TODO: Include "routes" debug route if dev build
|
||||||
const bakedInRoutes = [
|
const bakedInRoutes = [
|
||||||
// WORK LIST
|
// WORK LIST
|
||||||
{
|
|
||||||
path: '/',
|
|
||||||
children: DataSourceWrapper,
|
|
||||||
private: true,
|
|
||||||
props: { children: WorkList },
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
path: '/local',
|
path: '/local',
|
||||||
children: Local,
|
children: Local,
|
||||||
@ -27,6 +21,12 @@ const bakedInRoutes = [
|
|||||||
|
|
||||||
// NOT FOUND (404)
|
// NOT FOUND (404)
|
||||||
const notFoundRoute = { component: NotFound };
|
const notFoundRoute = { component: NotFound };
|
||||||
|
const WorkListRoute = {
|
||||||
|
path: '/',
|
||||||
|
children: DataSourceWrapper,
|
||||||
|
private: true,
|
||||||
|
props: { children: WorkList },
|
||||||
|
};
|
||||||
|
|
||||||
const createRoutes = ({
|
const createRoutes = ({
|
||||||
modes,
|
modes,
|
||||||
@ -36,6 +36,7 @@ const createRoutes = ({
|
|||||||
commandsManager,
|
commandsManager,
|
||||||
hotkeysManager,
|
hotkeysManager,
|
||||||
routerBasename,
|
routerBasename,
|
||||||
|
showStudyList,
|
||||||
}) => {
|
}) => {
|
||||||
const routes =
|
const routes =
|
||||||
buildModeRoutes({
|
buildModeRoutes({
|
||||||
@ -54,6 +55,7 @@ const createRoutes = ({
|
|||||||
);
|
);
|
||||||
const allRoutes = [
|
const allRoutes = [
|
||||||
...routes,
|
...routes,
|
||||||
|
...(showStudyList ? [WorkListRoute] : []),
|
||||||
...(customRoutes?.routes || []),
|
...(customRoutes?.routes || []),
|
||||||
...bakedInRoutes,
|
...bakedInRoutes,
|
||||||
customRoutes?.notFoundRoute || notFoundRoute,
|
customRoutes?.notFoundRoute || notFoundRoute,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user