feat(Mode): Ability to overwrite mode configuration and small improvements (#3580)
This commit is contained in:
1 parent
58d38495f0
commit
0493a0d587
9 files changed
+77
-11
No files matched your search
@@ -108,12 +108,12 @@ async function appInit(appConfigOrFunc, defaultExtensions, defaultModes) {
|
||||
|
||||
if (mode.modeFactory) {
|
||||
// If the appConfig contains configuration for this mode, use it.
|
||||
const modeConfig =
|
||||
appConfig.modeConfig && appConfig.modeConfig[i]
|
||||
? appConfig.modeConfig[id]
|
||||
const modeConfiguration =
|
||||
appConfig.modesConfiguration && appConfig.modesConfiguration[id]
|
||||
? appConfig.modesConfiguration[id]
|
||||
: {};
|
||||
|
||||
mode = mode.modeFactory(modeConfig);
|
||||
mode = mode.modeFactory({ modeConfiguration });
|
||||
}
|
||||
|
||||
if (modesById.has(id)) continue;
|
||||
|
||||
@@ -5,6 +5,7 @@ import PropTypes from 'prop-types';
|
||||
import { DicomMetadataStore, ServicesManager, utils } from '@ohif/core';
|
||||
import { DragAndDropProvider, ImageViewerProvider } from '@ohif/ui';
|
||||
import { useSearchParams } from '@hooks';
|
||||
import { useAppConfig } from '@state';
|
||||
import ViewportGrid from '@components/ViewportGrid';
|
||||
import Compose from './Compose';
|
||||
import getStudies from './studiesList';
|
||||
@@ -93,6 +94,8 @@ export default function ModeRoute({
|
||||
commandsManager,
|
||||
hotkeysManager,
|
||||
}) {
|
||||
const [appConfig] = useAppConfig();
|
||||
|
||||
// Parse route params/querystring
|
||||
const location = useLocation();
|
||||
|
||||
@@ -313,6 +316,7 @@ export default function ModeRoute({
|
||||
servicesManager,
|
||||
extensionManager,
|
||||
commandsManager,
|
||||
appConfig,
|
||||
});
|
||||
|
||||
// use the URL hangingProtocolId if it exists, otherwise use the one
|
||||
@@ -403,6 +407,7 @@ export default function ModeRoute({
|
||||
mode?.onModeExit?.({
|
||||
servicesManager,
|
||||
extensionManager,
|
||||
appConfig,
|
||||
});
|
||||
} catch (e) {
|
||||
console.warn('mode exit failure', e);
|
||||
|
||||
@@ -361,7 +361,7 @@ function WorkList({
|
||||
query.append('configUrl', filterValues.configUrl);
|
||||
}
|
||||
query.append('StudyInstanceUIDs', studyInstanceUid);
|
||||
return (
|
||||
return mode.displayName && (
|
||||
<Link
|
||||
className={isValidMode ? '' : 'cursor-not-allowed'}
|
||||
key={i}
|
||||
|
||||
Reference in new issue
Block a user