feat: add customization to PanelStudyBrowser dbl click callback (#4871)

This commit is contained in:
Pedro Köhler authored and GitHub committed 2025-03-20 12:06:26 -04:00
1 parent f73c485821
commit 01c3726ced
4 files changed
+154 -27

No files matched your search

@@ -27,13 +27,18 @@ export interface ComponentCustomization extends BaseCustomization {
content: (...props: any) => React.JSX.Element;
}
export interface CallbackCustomization extends BaseCustomization {
callbacks: Array<(...props: any) => any>;
}
export type Customization =
| React.ComponentType
| BaseCustomization
| LabelCustomization
| CommandCustomization
| CodeCustomization
| ComponentCustomization;
| ComponentCustomization
| CallbackCustomization;
export default Customization;
@@ -1476,6 +1476,94 @@ window.config = {
},
},
],
};
`,
},
{
id: 'studyBrowser.thumbnailDoubleClickCallback',
description:
'Defines the callback function for when the user double clicks a series on the study browser.',
default: `{
callback: ({
activeViewportId,
servicesManager,
isHangingProtocolLayout
}) =>
async displaySetInstanceUID => {
const {
hangingProtocolService,
viewportGridService,
uiNotificationService
} =
servicesManager.services;
let updatedViewports = [];
const viewportId = activeViewportId;
try {
updatedViewports = hangingProtocolService.getViewportsRequireUpdate(
viewportId,
displaySetInstanceUID,
isHangingProtocolLayout
);
} catch (error) {
console.warn(error);
uiNotificationService.show({
title: 'Thumbnail Double Click',
message: 'The selected display sets could not be added to the viewport.',
type: 'error',
duration: 3000,
});
}
viewportGridService.setDisplaySetsForViewports(updatedViewports);
},
}`,
configuration: `
window.config = {
// rest of window config
customizationService: [{
'studyBrowser.thumbnailDoubleClickCallback': {
callback: ({
activeViewportId,
commandsManager,
servicesManager,
isHangingProtocolLayout
}) =>
async displaySetInstanceUID => {
const {
hangingProtocolService,
viewportGridService,
uiNotificationService
} =
servicesManager.services;
let updatedViewports = [];
const viewportId = activeViewportId;
// Changing original function here:
if (isBlacklistedModality(displaySetInstanceUID)) {
return;
}
try {
updatedViewports = hangingProtocolService.getViewportsRequireUpdate(
viewportId,
displaySetInstanceUID,
isHangingProtocolLayout
);
} catch (error) {
console.warn(error);
uiNotificationService.show({
title: 'Thumbnail Double Click',
message: 'The selected display sets could not be added to the viewport.',
type: 'error',
duration: 3000,
});
}
viewportGridService.setDisplaySetsForViewports(updatedViewports);
};
},
}],
};
`,
},