2024-11-06 13:15:27 +01:00
|
|
|
import PROMPT_RESPONSES from '../utils/_shared/PROMPT_RESPONSES';
|
2022-12-29 16:13:06 +01:00
|
|
|
|
2025-02-28 21:17:55 +01:00
|
|
|
export default function CreateReportDialogPrompt({
|
|
|
|
|
title = 'Create Report',
|
|
|
|
|
extensionManager,
|
|
|
|
|
servicesManager,
|
|
|
|
|
}): Promise<{
|
|
|
|
|
value: string;
|
|
|
|
|
dataSourceName: string;
|
2025-04-07 16:05:22 +02:00
|
|
|
series: string;
|
2025-02-28 21:17:55 +01:00
|
|
|
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 16:13:06 +01:00
|
|
|
|
2025-02-28 21:17:55 +01:00
|
|
|
const allowMultipleDataSources = window.config.allowMultiSelectExport;
|
2022-12-29 16:13:06 +01:00
|
|
|
|
2025-02-28 21:17:55 +01:00
|
|
|
return new Promise(function (resolve, reject) {
|
|
|
|
|
uiDialogService.show({
|
|
|
|
|
id: 'report-dialog',
|
|
|
|
|
title,
|
|
|
|
|
content: ReportDialog,
|
|
|
|
|
contentProps: {
|
|
|
|
|
dataSources: allowMultipleDataSources ? dataSources : undefined,
|
2025-04-07 16:05:22 +02:00
|
|
|
onSave: async ({ reportName, dataSource: selectedDataSource, series }) => {
|
2022-12-29 16:13:06 +01:00
|
|
|
resolve({
|
2025-02-28 21:17:55 +01:00
|
|
|
value: reportName,
|
|
|
|
|
dataSourceName: selectedDataSource,
|
2025-04-07 16:05:22 +02:00
|
|
|
series,
|
2024-11-06 13:15:27 +01:00
|
|
|
action: PROMPT_RESPONSES.CREATE_REPORT,
|
2022-12-29 16:13:06 +01:00
|
|
|
});
|
2025-02-28 21:17:55 +01:00
|
|
|
},
|
|
|
|
|
onCancel: () => {
|
2022-12-29 16:13:06 +01:00
|
|
|
resolve({
|
2024-11-06 13:15:27 +01:00
|
|
|
action: PROMPT_RESPONSES.CANCEL,
|
2022-12-29 16:13:06 +01:00
|
|
|
value: undefined,
|
2025-04-07 16:05:22 +02:00
|
|
|
series: undefined,
|
2022-12-29 16:13:06 +01:00
|
|
|
dataSourceName: undefined,
|
|
|
|
|
});
|
|
|
|
|
},
|
2025-03-20 14:22:45 +01:00
|
|
|
defaultValue: title,
|
2022-12-29 16:13:06 +01:00
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|