Add error message of generate reportt
This commit is contained in:
parent
d94bc2d5a2
commit
5ca6757b44
@ -136,17 +136,14 @@ function PanelMeasurementTableTracking({ servicesManager, extensionManager }) {
|
|||||||
// Would need some way of saying which one is the "push" dataSource
|
// Would need some way of saying which one is the "push" dataSource
|
||||||
const dataSource = dataSources[0];
|
const dataSource = dataSources[0];
|
||||||
|
|
||||||
const { message } = await DICOMSR.storeMeasurements(
|
const naturalizedReport = await DICOMSR.storeMeasurements(trackedMeasurements, dataSource);
|
||||||
trackedMeasurements,
|
|
||||||
dataSource,
|
|
||||||
naturalizedReport => {
|
|
||||||
DisplaySetService.makeDisplaySets([naturalizedReport], {
|
|
||||||
madeInClient: true,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
UINotificationService.show({ title: 'STOW SR', message, type: 'success' });
|
DisplaySetService.makeDisplaySets([naturalizedReport], { madeInClient: true });
|
||||||
|
UINotificationService.show({
|
||||||
|
title: 'STOW SR',
|
||||||
|
message: 'Measurements saved successfully',
|
||||||
|
type: 'success'
|
||||||
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
UINotificationService.show({
|
UINotificationService.show({
|
||||||
title: 'STOW SR',
|
title: 'STOW SR',
|
||||||
|
|||||||
@ -79,8 +79,9 @@ const generateReport = measurementData => {
|
|||||||
* @param {object[]} measurementData An array of measurements from the measurements service
|
* @param {object[]} measurementData An array of measurements from the measurements service
|
||||||
* that you wish to serialize.
|
* that you wish to serialize.
|
||||||
* @param {object} dataSource The dataSource that you wish to use to persist the data.
|
* @param {object} dataSource The dataSource that you wish to use to persist the data.
|
||||||
|
* @return {object} The naturalized report
|
||||||
*/
|
*/
|
||||||
const storeMeasurements = async (measurementData, dataSource, onSuccess) => {
|
const storeMeasurements = async (measurementData, dataSource) => {
|
||||||
// TODO -> Eventually use the measurements directly and not the dcmjs adapter,
|
// TODO -> Eventually use the measurements directly and not the dcmjs adapter,
|
||||||
// But it is good enough for now whilst we only have cornerstone as a datasource.
|
// But it is good enough for now whilst we only have cornerstone as a datasource.
|
||||||
log.info('[DICOMSR] storeMeasurements');
|
log.info('[DICOMSR] storeMeasurements');
|
||||||
@ -90,28 +91,22 @@ const storeMeasurements = async (measurementData, dataSource, onSuccess) => {
|
|||||||
return Promise.reject({});
|
return Promise.reject({});
|
||||||
}
|
}
|
||||||
|
|
||||||
const naturalizedReport = generateReport(measurementData);
|
|
||||||
const { StudyInstanceUID } = naturalizedReport;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
const naturalizedReport = generateReport(measurementData);
|
||||||
|
const { StudyInstanceUID } = naturalizedReport;
|
||||||
|
|
||||||
await dataSource.store.dicom(naturalizedReport);
|
await dataSource.store.dicom(naturalizedReport);
|
||||||
|
|
||||||
if (StudyInstanceUID) {
|
if (StudyInstanceUID) {
|
||||||
dataSource.deleteStudyMetadataPromise(StudyInstanceUID);
|
dataSource.deleteStudyMetadataPromise(StudyInstanceUID);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (onSuccess) {
|
return naturalizedReport;
|
||||||
onSuccess(naturalizedReport);
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
message: 'Measurements saved successfully',
|
|
||||||
};
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
log.error(
|
log.error(
|
||||||
`[DICOMSR] Error while saving the measurements: ${error.message}`
|
`[DICOMSR] Error while saving the measurements: ${error.message}`
|
||||||
);
|
);
|
||||||
throw new Error('Error while saving the measurements.');
|
throw new Error(error.message || 'Error while saving the measurements.');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -134,20 +134,6 @@
|
|||||||
0 3px 5px -1px rgba(0, 0, 0, 0.14);
|
0 3px 5px -1px rgba(0, 0, 0, 0.14);
|
||||||
}
|
}
|
||||||
|
|
||||||
.sb-item a {
|
|
||||||
color: white;
|
|
||||||
text-decoration: underline;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sb-hidden {
|
|
||||||
padding-top: 0;
|
|
||||||
padding-bottom: 0;
|
|
||||||
margin-bottom: 0;
|
|
||||||
height: 0;
|
|
||||||
opacity: 0;
|
|
||||||
transition: all 300ms ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes fadein {
|
@keyframes fadein {
|
||||||
from {
|
from {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
|
|||||||
@ -19,10 +19,12 @@ const SnackbarItem = ({ options, onClose }) => {
|
|||||||
[SnackbarTypes.ERROR]: 'bg-red-600'
|
[SnackbarTypes.ERROR]: 'bg-red-600'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const hidden = 'duration-300 transition-all ease-in-out h-0 opacity-0 pt-0 mb-0 pb-0';
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={classNames(
|
className={classNames(
|
||||||
`${options.visible ? '' : 'sb-hidden'} sb-item`,
|
`${options.visible ? '' : hidden} sb-item`,
|
||||||
typeClasses[options.type]
|
typeClasses[options.type]
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user