Skip to content

Commit

Permalink
✨ add cancel for multiple analyses
Browse files Browse the repository at this point in the history
Signed-off-by: MiriSafra <[email protected]>
  • Loading branch information
MiriSafra committed Sep 18, 2024
1 parent f389539 commit 09d2827
Showing 1 changed file with 26 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,9 @@ export const ApplicationsTable: React.FC = () => {
const [applicationsToDelete, setApplicationsToDelete] = useState<
DecoratedApplication[]
>([]);

const [applicationsToCancel, setApplicationsToCancel] = useState<
DecoratedApplication[]
>([]);
const [assessmentToDiscard, setAssessmentToDiscard] =
useState<DecoratedApplication | null>(null);

Expand Down Expand Up @@ -575,6 +577,21 @@ export const ApplicationsTable: React.FC = () => {
>
{t("actions.delete")}
</DropdownItem>,
...(tasksReadAccess &&
tasksWriteAccess &&
selectedRows.every((application) => isTaskCancellable(application))
? [
<DropdownItem
key="applications-bulk-cancel"
isDisabled={selectedRows.length < 1}
onClick={() => {
handleCancelBulkAnalysis(selectedRows);
}}
>
{t("actions.cancelAnalysis")}
</DropdownItem>,
]
: []),
...(credentialsReadAccess
? [
<DropdownItem
Expand Down Expand Up @@ -638,7 +655,14 @@ export const ApplicationsTable: React.FC = () => {
})
);
};

const handleCancelBulkAnalysis = async (
selectedRows: DecoratedApplication[]
) => {
setApplicationsToCancel(selectedRows);
selectedRows.map((application) => {
cancelAnalysis(application);
});
};
const assessSelectedApp = async (application: DecoratedApplication) => {
setApplicationToAssess(application);

Expand Down

0 comments on commit 09d2827

Please sign in to comment.