* fix(SR): Added support for spline and live wire SR items. * Apply suggestion from @greptile-apps[bot] Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> * Add a script to checkout a worktree for test builds * fix: Allow download for testing sr validator * Remove script that wasn't intended to be included * Bump CS3D version. * PR comments - simplify code and use single codepath for download * Allow both download and save buttons for SEG and RTSTRUCT --------- Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> Co-authored-by: Bill Wallace <wayfarer3130@gmail.com>
46 lines
1.2 KiB
TypeScript
46 lines
1.2 KiB
TypeScript
/**
|
|
*
|
|
* @param {*} servicesManager
|
|
*/
|
|
async function createReportAsync({
|
|
servicesManager,
|
|
getReport,
|
|
reportType = 'Measurements',
|
|
successMessage,
|
|
}: withAppTypes) {
|
|
const { displaySetService, uiNotificationService, uiDialogService } = servicesManager.services;
|
|
|
|
try {
|
|
const naturalizedReport = await getReport();
|
|
|
|
if (!naturalizedReport) {
|
|
return;
|
|
}
|
|
|
|
// addInstances is called by the store command (storeMeasurements/storeSegmentation),
|
|
// so the display set should already exist at this point.
|
|
const displaySet = displaySetService.getMostRecentDisplaySet();
|
|
|
|
const displaySetInstanceUID = displaySet.displaySetInstanceUID;
|
|
|
|
uiNotificationService.show({
|
|
title: 'Create Report',
|
|
message: successMessage ?? `${reportType} saved successfully`,
|
|
type: 'success',
|
|
});
|
|
|
|
return [displaySetInstanceUID];
|
|
} catch (error) {
|
|
uiNotificationService.show({
|
|
title: 'Create Report',
|
|
message: error.message || `Failed to store ${reportType}`,
|
|
type: 'error',
|
|
});
|
|
throw new Error(`Failed to store ${reportType}. Error: ${error.message || 'Unknown error'}`);
|
|
} finally {
|
|
uiDialogService.hide('loading-dialog');
|
|
}
|
|
}
|
|
|
|
export default createReportAsync;
|