Merge branch 'main' of github.com:sartography/spiff-arena

This commit is contained in:
jasquat 2022-12-28 12:27:40 -05:00
commit 267b38fe41
3 changed files with 45 additions and 3 deletions

View File

@ -0,0 +1,29 @@
import { ProcessInstanceReport } from '../interfaces';
import HttpService from '../services/HttpService';
import ButtonWithConfirmation from './ButtonWithConfirmation';
type OwnProps = {
onSuccess: (..._args: any[]) => any;
processInstanceReportSelection: ProcessInstanceReport;
};
export default function ProcessInstanceListDeleteReport({
onSuccess,
processInstanceReportSelection,
}: OwnProps) {
const deleteProcessInstanceReport = () => {
HttpService.makeCallToBackend({
path: `/process-instances/reports/${processInstanceReportSelection.id}`,
successCallback: onSuccess,
httpMethod: 'DELETE',
});
};
return (
<ButtonWithConfirmation
description={`Delete Perspective ${processInstanceReportSelection.identifier}?`}
onConfirmation={deleteProcessInstanceReport}
buttonLabel="Delete"
/>
);
}

View File

@ -63,6 +63,7 @@ import {
} from '../interfaces';
import ProcessModelSearch from './ProcessModelSearch';
import ProcessInstanceReportSearch from './ProcessInstanceReportSearch';
import ProcessInstanceListDeleteReport from './ProcessInstanceListDeleteReport';
import ProcessInstanceListSaveAsReport from './ProcessInstanceListSaveAsReport';
import { FormatProcessModelDisplayName } from './MiniComponents';
import { Notification } from './Notification';
@ -681,6 +682,19 @@ export default function ProcessInstanceListTable({
);
};
const onDeleteReportSuccess = () => {
processInstanceReportDidChange({ selectedItem: null });
};
const deleteReportComponent = () => {
return processInstanceReportSelection ? (
<ProcessInstanceListDeleteReport
onSuccess={onDeleteReportSuccess}
processInstanceReportSelection={processInstanceReportSelection}
/>
) : null;
};
const removeColumn = (reportColumn: ReportColumn) => {
if (reportMetadata) {
const reportMetadataCopy = { ...reportMetadata };
@ -1062,6 +1076,7 @@ export default function ProcessInstanceListTable({
</Column>
<Column sm={4} md={4} lg={8}>
{saveAsReportComponent()}
{deleteReportComponent()}
</Column>
</Grid>
</>

View File

@ -31,9 +31,7 @@ export default function ProcessInstanceReportList() {
return (
<tr key={(row as any).id}>
<td>
<Link
to={`/admin/process-instances/reports/${rowToUse.identifier}`}
>
<Link to={`/admin/process-instances?report_id=${rowToUse.id}`}>
{rowToUse.identifier}
</Link>
</td>