Skip to content

Commit

Permalink
added pop-confirmation for process-list delete, todo: fix query error…
Browse files Browse the repository at this point in the history
… for both delete and copy
  • Loading branch information
winniel24 committed Nov 27, 2023
1 parent d7fe35c commit 60191da
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
40 changes: 20 additions & 20 deletions src/management-system-v2/components/process-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import ProcessEditButton from './process-edit-button';
import { toCaslResource } from '@/lib/ability/caslAbility';
import { useDeleteAsset, useInvalidateAsset, usePostAsset } from '@/lib/fetch-data';
import { useUserPreferences } from '@/lib/user-preferences';
import ProcessDeleteModal from './process-delete';
// import ProcessDeleteModal from './process-delete';
// import ProcessDeleteSingleModal from './process-delete-single';
import { useAbilityStore } from '@/lib/abilityStore';
import { AuthCan } from '@/lib/clientAuthComponents';
Expand Down Expand Up @@ -110,19 +110,19 @@ const ProcessList: FC<ProcessListProps> = ({
onSettled: refreshData,
});

// const deleteSelectedProcesses = useCallback(() => {
// selection.forEach((id) => {
// deleteProcess({
// params: {
// path: {
// definitionId: id as string,
// },
// },
// parseAs: 'text',
// });
// });
// setSelection([]);
// }, [deleteProcess, selection]);
const deleteSelectedProcesses = useCallback(() => {
selection.forEach((id) => {
deleteProcess({
params: {
path: {
definitionId: id as string,
},
},
parseAs: 'text',
});
});
setSelection([]);
}, [deleteProcess, selection]);

const actionBarGenerator = useCallback(
(record: ProcessListProcess) => {
Expand Down Expand Up @@ -170,7 +170,7 @@ const ProcessList: FC<ProcessListProps> = ({
{/*
TODO: delete with Popconfirm doesn't work, yet */}

{/* <AuthCan action="delete" resource={toCaslResource('Process', process)}>
<AuthCan action="delete" resource={toCaslResource('Process', process)}>
<Tooltip placement="top" title={'Delete'}>
<Popconfirm
title="Delete Process"
Expand All @@ -183,9 +183,9 @@ const ProcessList: FC<ProcessListProps> = ({
<Button icon={<DeleteOutlined />} type="text" />
</Popconfirm>
</Tooltip>
</AuthCan> */}
</AuthCan>

{ability.can('delete', 'Process') && (
{/* {ability.can('delete', 'Process') && (
<Tooltip placement="top" title={'Delete'}>
<DeleteOutlined
onClick={(e) => {
Expand All @@ -195,7 +195,7 @@ const ProcessList: FC<ProcessListProps> = ({
}}
/>
</Tooltip>
)}
)} */}
</>
);
},
Expand Down Expand Up @@ -546,11 +546,11 @@ const ProcessList: FC<ProcessListProps> = ({
processKeys={copyProcessKeys}
setSelection={setSelection}
/>
<ProcessDeleteModal
{/* <ProcessDeleteModal
setDeleteProcessIds={setDeleteProcessIds}
processKeys={deleteProcessIds}
setSelection={setSelection}
/>
/> */}
</>
);
};
Expand Down
4 changes: 2 additions & 2 deletions src/management-system-v2/components/processes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import {
setTargetNamespace,
setDefinitionsVersionInformation,
} from '@proceed/bpmn-helper';
import ProcessDeleteModal from './process-delete';
//import ProcessDeleteSingleModal from './process-delete-single';
// import ProcessDeleteModal from './process-delete';
// import ProcessDeleteSingleModal from './process-delete-single';
import ProcessCopyModal from './process-copy';
import { copy } from 'fs-extra';
import { useAbilityStore } from '@/lib/abilityStore';
Expand Down

0 comments on commit 60191da

Please sign in to comment.