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
|
||||
const dataSource = dataSources[0];
|
||||
|
||||
const { message } = await DICOMSR.storeMeasurements(
|
||||
trackedMeasurements,
|
||||
dataSource,
|
||||
naturalizedReport => {
|
||||
DisplaySetService.makeDisplaySets([naturalizedReport], {
|
||||
madeInClient: true,
|
||||
});
|
||||
}
|
||||
);
|
||||
const naturalizedReport = await DICOMSR.storeMeasurements(trackedMeasurements, dataSource);
|
||||
|
||||
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) {
|
||||
UINotificationService.show({
|
||||
title: 'STOW SR',
|
||||
|
||||
@ -79,8 +79,9 @@ const generateReport = measurementData => {
|
||||
* @param {object[]} measurementData An array of measurements from the measurements service
|
||||
* that you wish to serialize.
|
||||
* @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,
|
||||
// But it is good enough for now whilst we only have cornerstone as a datasource.
|
||||
log.info('[DICOMSR] storeMeasurements');
|
||||
@ -90,28 +91,22 @@ const storeMeasurements = async (measurementData, dataSource, onSuccess) => {
|
||||
return Promise.reject({});
|
||||
}
|
||||
|
||||
const naturalizedReport = generateReport(measurementData);
|
||||
const { StudyInstanceUID } = naturalizedReport;
|
||||
|
||||
try {
|
||||
const naturalizedReport = generateReport(measurementData);
|
||||
const { StudyInstanceUID } = naturalizedReport;
|
||||
|
||||
await dataSource.store.dicom(naturalizedReport);
|
||||
|
||||
if (StudyInstanceUID) {
|
||||
dataSource.deleteStudyMetadataPromise(StudyInstanceUID);
|
||||
}
|
||||
|
||||
if (onSuccess) {
|
||||
onSuccess(naturalizedReport);
|
||||
}
|
||||
|
||||
return {
|
||||
message: 'Measurements saved successfully',
|
||||
};
|
||||
return naturalizedReport;
|
||||
} catch (error) {
|
||||
log.error(
|
||||
`[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);
|
||||
}
|
||||
|
||||
.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 {
|
||||
from {
|
||||
opacity: 0;
|
||||
|
||||
@ -19,10 +19,12 @@ const SnackbarItem = ({ options, onClose }) => {
|
||||
[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 (
|
||||
<div
|
||||
className={classNames(
|
||||
`${options.visible ? '' : 'sb-hidden'} sb-item`,
|
||||
`${options.visible ? '' : hidden} sb-item`,
|
||||
typeClasses[options.type]
|
||||
)}
|
||||
>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user