Skip to content

Commit

Permalink
finalized
Browse files Browse the repository at this point in the history
  • Loading branch information
IbrahimCSAE committed Mar 19, 2024
1 parent 9cbd709 commit 4c079c6
Show file tree
Hide file tree
Showing 10 changed files with 55 additions and 23 deletions.
5 changes: 4 additions & 1 deletion modes/basic-dev-mode/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,10 @@ function modeFactory({ modeConfiguration }) {
const modalities_list = modalities.split('\\');

// Slide Microscopy modality not supported by basic mode yet
return !modalities_list.includes('SM');
return {
valid: !modalities_list.includes('SM'),
description: 'The mode does not support the following modalities: SM',
};
},
routes: [
{
Expand Down
8 changes: 6 additions & 2 deletions modes/basic-test-mode/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,12 @@ function modeFactory() {
const modalities_list = modalities.split('\\');

// Exclude non-image modalities
return !!modalities_list.filter(modality => NON_IMAGE_MODALITIES.indexOf(modality) === -1)
.length;
return {
valid: !!modalities_list.filter(modality => NON_IMAGE_MODALITIES.indexOf(modality) === -1)
.length,
description:
'The mode does not support studies that ONLY include the following modalities: SM, ECG, SR, SEG',
};
},
routes: [
{
Expand Down
8 changes: 6 additions & 2 deletions modes/longitudinal/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,12 @@ function modeFactory({ modeConfiguration }) {
const modalities_list = modalities.split('\\');

// Exclude non-image modalities
return !!modalities_list.filter(modality => NON_IMAGE_MODALITIES.indexOf(modality) === -1)
.length;
return {
valid: !!modalities_list.filter(modality => NON_IMAGE_MODALITIES.indexOf(modality) === -1)
.length,
description:
'The mode does not support studies that ONLY include the following modalities: SM, ECG, SR, SEG, RTSTRUCT',
};
},
routes: [
{
Expand Down
6 changes: 4 additions & 2 deletions modes/microscopy/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,10 @@ function modeFactory({ modeConfiguration }) {
isValidMode: ({ modalities }) => {
const modalities_list = modalities.split('\\');

// Slide Microscopy and ECG modality not supported by basic mode yet
return modalities_list.includes('SM');
return {
valid: modalities_list.includes('SM'),
description: 'Microscopy mode only supports the SM modality',
};
},

routes: [
Expand Down
7 changes: 3 additions & 4 deletions modes/segmentation/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,10 @@ function modeFactory({ modeConfiguration }) {
// Don't show the mode if the selected studies have only one modality
// that is not supported by the mode
const modalitiesArray = modalities.split('\\');
if (modalitiesArray.length === 1) {
return !['SM', 'US', 'MG', 'OT', 'DOC', 'CR'].includes(modalitiesArray[0]);
return {
valid: modalitiesArray.length === 1 ? !['SM', 'US', 'MG', 'OT', 'DOC', 'CR'].includes(modalitiesArray[0]) : true,
description: 'The mode does not support studies that ONLY include the following modalities: SM, US, MG, OT, DOC, CR',

Check failure on line 136 in modes/segmentation/src/index.tsx

View workflow job for this annotation

GitHub Actions / Check for spelling errors

OT ==> TO, OF, OR, NOT
}

return true;
},
/**
* Mode Routes are used to define the mode's behavior. A list of Mode Route
Expand Down
5 changes: 4 additions & 1 deletion modes/tmtv/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,10 @@ function modeFactory({ modeConfiguration }) {
study.studyInstanceUid !== '1.3.6.1.4.1.12842.1.1.14.3.20220915.105557.468.2963630849';

// there should be both CT and PT modalities and the modality should not be SM
return isValid;
return {
valid: isValid,
description: 'The mode requires both PT and CT series in the study',
};
},
routes: [
{
Expand Down
1 change: 1 addition & 0 deletions platform/app/public/config/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ window.config = {
showCPUFallbackMessage: true,
showLoadingIndicator: true,
strictZSpacingForVolumeViewport: true,
groupEnabledModesFirst: true,
maxNumRequests: {
interaction: 100,
thumbnail: 75,
Expand Down
23 changes: 18 additions & 5 deletions platform/app/src/routes/WorkList/WorkList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -350,10 +350,24 @@ function WorkList({
}
>
<div className="flex flex-row gap-2">
{appConfig.loadedModes.map((mode, i) => {
{(appConfig.groupEnabledModesFirst
? appConfig.loadedModes.sort((a, b) => {
const isValidA = a.isValidMode({
modalities: modalities.replaceAll('/', '\\'),
study,
}).valid;
const isValidB = b.isValidMode({
modalities: modalities.replaceAll('/', '\\'),
study,
}).valid;

return isValidB - isValidA;
})
: appConfig.loadedModes
).map((mode, i) => {
const modalitiesToCheck = modalities.replaceAll('/', '\\');

const isValidMode = mode.isValidMode({
const { valid: isValidMode, description: invalidModeDescription } = mode.isValidMode({
modalities: modalitiesToCheck,
study,
});
Expand Down Expand Up @@ -390,11 +404,10 @@ function WorkList({
type={ButtonEnums.type.primary}
size={ButtonEnums.size.medium}
disabled={!isValidMode}
tooltip={
startIconTooltip={
!isValidMode ? (
<div className="font-inter flex w-[206px] whitespace-normal text-left text-xs font-normal text-white ">
This study does not contain modalities supported by {mode.displayName}{' '}
mode
{invalidModeDescription}
</div>
) : null
}
Expand Down
13 changes: 8 additions & 5 deletions platform/ui/src/components/Button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ const Button = ({
name,
className,
onClick,
tooltip = null,
startIconTooltip = null,
endIconTooltip = null,
}) => {
const startIcon = startIconProp && (
<>
Expand Down Expand Up @@ -110,9 +111,9 @@ const Button = ({
onClick={handleOnClick}
data-cy={`${name}-btn`}
>
{tooltip ? <Tooltip content={tooltip}>{startIcon}</Tooltip> : startIcon}
{startIconTooltip ? <Tooltip content={startIconTooltip}>{startIcon}</Tooltip> : startIcon}
{children}
{endIcon}
{endIconTooltip ? <Tooltip content={endIconTooltip}>{endIcon}</Tooltip> : endIcon}
</button>
);
};
Expand Down Expand Up @@ -143,8 +144,10 @@ Button.propTypes = {
endIcon: PropTypes.node,
/** Additional TailwindCSS classnames */
className: PropTypes.string,
/** Tooltip for the button */
tooltip: PropTypes.node,
/** Tooltip for the start icon */
startIconTooltip: PropTypes.node,
/** Tooltip for the end icon */
endIconTooltip: PropTypes.node,
};

export default Button;
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const StudyListTableRow = props => {
className={classnames(
'w-full transition duration-300',
{
'border-primary-light hover:border-secondary-light mb-2 overflow-hidden rounded border':
'border-primary-light hover:border-secondary-light mb-2 overflow-visible rounded border':
isExpanded,
},
{
Expand Down

0 comments on commit 4c079c6

Please sign in to comment.