chore: recovery 2 (#5014)

Co-authored-by: Dan Rukas <dan.rukas@gmail.com>
Co-authored-by: Tang Cheng <45505657+tctco@users.noreply.github.com>
This commit is contained in:
authored and GitHub committed 2025-06-09 10:58:06 -04:00
1 parent 9a4a40468f
commit 36813e0c2f
69 files changed
+1352 -354

No files matched your search

+2 -2
View File
@@ -37,8 +37,8 @@
"@cornerstonejs/codec-libjpeg-turbo-8bit": "^1.2.2",
"@cornerstonejs/codec-openjpeg": "^1.2.4",
"@cornerstonejs/codec-openjph": "^2.4.5",
"@cornerstonejs/core": "^3.10.1",
"@cornerstonejs/dicom-image-loader": "^3.10.1",
"@cornerstonejs/core": "^3.11.6",
"@cornerstonejs/dicom-image-loader": "^3.11.6",
"@ohif/ui": "3.10.1",
"cornerstone-math": "0.1.9",
"dicom-parser": "^1.8.21"
@@ -215,7 +215,10 @@ class MetadataProvider {
break;
case WADO_IMAGE_LOADER_TAGS.MODALITY_LUT_MODULE:
const { RescaleIntercept, RescaleSlope } = instance;
if (RescaleIntercept === undefined || RescaleSlope === undefined) {
// Early return if RescaleIntercept or RescaleSlope are not
// present (undefined) or explicitly set to null. We use loose
// equality in this case to check for *null* or *undefined*.
if (RescaleIntercept == null || RescaleSlope == null) {
return;
}
@@ -14,6 +14,8 @@ const serviceImplementation = {
console.warn('isEmpty() NOT IMPLEMENTED');
return true;
},
_updatePosition: (id: string, position: { x: number; y: number }) =>
console.warn('updatePosition() NOT IMPLEMENTED'),
_customComponent: null,
};
@@ -63,6 +65,16 @@ class UIDialogService {
return serviceImplementation._isEmpty();
}
/**
* Update the position of a specific dialog by id
*
* @param {string} id - The dialog id to update
* @param {{ x: number; y: number }} position - The new position
*/
updatePosition(id: string, position: { x: number; y: number }): void {
return serviceImplementation._updatePosition(id, position);
}
/**
* This provides flexibility in customizing the Modal's default component
*
@@ -75,7 +87,14 @@ class UIDialogService {
/**
* Set the service implementation
*/
setServiceImplementation({ show, hide, hideAll, isEmpty, customComponent }: any): void {
setServiceImplementation({
show,
hide,
hideAll,
isEmpty,
updatePosition,
customComponent,
}: any): void {
if (show) {
serviceImplementation._show = show;
}
@@ -88,6 +107,9 @@ class UIDialogService {
if (isEmpty) {
serviceImplementation._isEmpty = isEmpty;
}
if (updatePosition) {
serviceImplementation._updatePosition = updatePosition;
}
if (customComponent) {
serviceImplementation._customComponent = customComponent;
}
@@ -60,17 +60,24 @@ class UINotificationService {
* @param {string} [notification.promiseMessages.loading] - Message to show while promise is pending
* @param {string | function} [notification.promiseMessages.success] - Message to show when promise resolves
* @param {string | function} [notification.promiseMessages.error] - Message to show when promise rejects
* @param {object} [notification.action] - Action button configuration
* @param {string} notification.action.label - The label for the action button
* @param {function} notification.action.onClick - The function to call when the action button is clicked
* @returns {string} id - The ID of the created notification
*/
show({
title,
message,
duration = 5000,
duration = 2000,
position = 'bottom-right',
type = 'info',
autoClose = true,
promise,
promiseMessages,
id,
allowDuplicates = false,
deduplicationInterval = 30000,
action,
}: {
title: string;
message: string | ((data?: any) => string);
@@ -90,6 +97,13 @@ class UINotificationService {
success?: string | ((data: any) => string);
error?: string | ((error: any) => string);
};
id?: string;
allowDuplicates?: boolean;
deduplicationInterval?: number;
action?: {
label: string;
onClick: () => void;
};
}): string {
if (promise && promiseMessages) {
const loadingId = serviceImplementation._show({
@@ -98,6 +112,9 @@ class UINotificationService {
type: 'loading',
autoClose: false,
position,
id: id ? `${id}-loading` : undefined,
allowDuplicates,
deduplicationInterval,
});
promise.then(
@@ -114,6 +131,10 @@ class UINotificationService {
duration,
position,
autoClose,
id: id ? `${id}-success` : undefined,
allowDuplicates,
deduplicationInterval,
action,
});
this.hide(loadingId);
},
@@ -130,6 +151,10 @@ class UINotificationService {
duration,
position,
autoClose,
id: id ? `${id}-error` : undefined,
allowDuplicates,
deduplicationInterval,
action,
});
this.hide(loadingId);
}
@@ -145,6 +170,10 @@ class UINotificationService {
position,
type,
autoClose,
id,
allowDuplicates,
deduplicationInterval,
action,
});
}
}