Files
ohif-viewer/extensions/default/src/Panels/createReportDialogPrompt.tsx
T

46 lines
1.4 KiB
TypeScript
Raw Normal View History

2024-11-06 07:15:27 -05:00
import PROMPT_RESPONSES from '../utils/_shared/PROMPT_RESPONSES';
2022-12-29 10:13:06 -05:00
export default function CreateReportDialogPrompt({
title = 'Create Report',
extensionManager,
servicesManager,
}): Promise<{
value: string;
dataSourceName: string;
series: string;
action: (typeof PROMPT_RESPONSES)[keyof typeof PROMPT_RESPONSES];
}> {
const { uiDialogService, customizationService } = servicesManager.services;
const dataSources = extensionManager.getDataSourcesForUI();
const ReportDialog = customizationService.getCustomization('ohif.createReportDialog');
2022-12-29 10:13:06 -05:00
const allowMultipleDataSources = window.config.allowMultiSelectExport;
2022-12-29 10:13:06 -05:00
return new Promise(function (resolve, reject) {
uiDialogService.show({
id: 'report-dialog',
title,
content: ReportDialog,
contentProps: {
dataSources: allowMultipleDataSources ? dataSources : undefined,
onSave: async ({ reportName, dataSource: selectedDataSource, series }) => {
2022-12-29 10:13:06 -05:00
resolve({
value: reportName,
dataSourceName: selectedDataSource,
series,
2024-11-06 07:15:27 -05:00
action: PROMPT_RESPONSES.CREATE_REPORT,
2022-12-29 10:13:06 -05:00
});
},
onCancel: () => {
2022-12-29 10:13:06 -05:00
resolve({
2024-11-06 07:15:27 -05:00
action: PROMPT_RESPONSES.CANCEL,
2022-12-29 10:13:06 -05:00
value: undefined,
series: undefined,
2022-12-29 10:13:06 -05:00
dataSourceName: undefined,
});
},
defaultValue: title,
2022-12-29 10:13:06 -05:00
},
});
});
}