diff --git a/platform/app/src/routes/WorkList/WorkList.tsx b/platform/app/src/routes/WorkList/WorkList.tsx index 5111d0d0d..7156b5451 100644 --- a/platform/app/src/routes/WorkList/WorkList.tsx +++ b/platform/app/src/routes/WorkList/WorkList.tsx @@ -336,47 +336,56 @@ function WorkList({ : [] } > - {appConfig.loadedModes.map((mode, i) => { - const isFirst = i === 0; +
+ {appConfig.loadedModes.map((mode, i) => { + const isFirst = i === 0; - const modalitiesToCheck = modalities.replaceAll('/', '\\'); + const modalitiesToCheck = modalities.replaceAll('/', '\\'); - const isValidMode = mode.isValidMode({ - modalities: modalitiesToCheck, - study, - }); - // TODO: Modes need a default/target route? We mostly support a single one for now. - // We should also be using the route path, but currently are not - // mode.routeName - // mode.routes[x].path - // Don't specify default data source, and it should just be picked up... (this may not currently be the case) - // How do we know which params to pass? Today, it's just StudyInstanceUIDs and configUrl if exists - const query = new URLSearchParams(); - if (filterValues.configUrl) { - query.append('configUrl', filterValues.configUrl); - } - query.append('StudyInstanceUIDs', studyInstanceUid); - return ( - - {/* TODO revisit the completely rounded style of buttons used for launching a mode from the worklist later - for now use LegacyButton*/} - } // launch-arrow | launch-info - className={classnames({ 'ml-2': !isFirst })} - onClick={() => {}} + const isValidMode = mode.isValidMode({ + modalities: modalitiesToCheck, + study, + }); + // TODO: Modes need a default/target route? We mostly support a single one for now. + // We should also be using the route path, but currently are not + // mode.routeName + // mode.routes[x].path + // Don't specify default data source, and it should just be picked up... (this may not currently be the case) + // How do we know which params to pass? Today, it's just StudyInstanceUIDs and configUrl if exists + const query = new URLSearchParams(); + if (filterValues.configUrl) { + query.append('configUrl', filterValues.configUrl); + } + query.append('StudyInstanceUIDs', studyInstanceUid); + return ( + { + // In case any event bubbles up for an invalid mode, prevent the navigation. + // For example, the event bubbles up when the icon embedded in the disabled button is clicked. + if (!isValidMode) { + event.preventDefault(); + } + }} + // to={`${mode.routeName}/dicomweb?StudyInstanceUIDs=${studyInstanceUid}`} > - {t(`Modes:${mode.displayName}`)} - - - ); - })} + {/* TODO revisit the completely rounded style of buttons used for launching a mode from the worklist later - for now use LegacyButton*/} + } // launch-arrow | launch-info + onClick={() => {}} + > + {t(`Modes:${mode.displayName}`)} + + + ); + })} +
), onClickRow: () =>