From eeaff3c673d68a412a3743aabfcbd94fe143fc1f Mon Sep 17 00:00:00 2001 From: Lisa Knox Date: Tue, 14 May 2024 11:58:45 -0400 Subject: [PATCH] 21535: replaced deleteWorkflow with removeWorkflowPermanently for consistency Arvados-DCO-1.1-Signed-off-by: Lisa Knox --- services/workbench2/cypress/e2e/workflow.cy.js | 1 + .../store/workflow-panel/workflow-panel-actions.ts | 11 ++--------- .../context-menu/action-sets/workflow-action-set.ts | 4 ++-- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/services/workbench2/cypress/e2e/workflow.cy.js b/services/workbench2/cypress/e2e/workflow.cy.js index 9e3c5eac56..8cfd87eb5b 100644 --- a/services/workbench2/cypress/e2e/workflow.cy.js +++ b/services/workbench2/cypress/e2e/workflow.cy.js @@ -242,6 +242,7 @@ describe('Registered workflow panel tests', function() { cy.goToPath(`/projects/${activeUser.user.uuid}`); cy.get('[data-cy=project-panel] table tbody').contains(workflowResource.name).rightclick(); cy.get('[data-cy=context-menu]').contains('Delete Workflow').click(); + cy.get('[data-cy=confirmation-dialog-ok-btn]').should('exist').click(); cy.get('[data-cy=project-panel] table tbody').should('not.contain', workflowResource.name); }); }); diff --git a/services/workbench2/src/store/workflow-panel/workflow-panel-actions.ts b/services/workbench2/src/store/workflow-panel/workflow-panel-actions.ts index 5821d9a05d..ecb0c96b73 100644 --- a/services/workbench2/src/store/workflow-panel/workflow-panel-actions.ts +++ b/services/workbench2/src/store/workflow-panel/workflow-panel-actions.ts @@ -126,14 +126,6 @@ export const getWorkflowDetails = (state: RootState) => { return workflow || undefined; }; -export const deleteWorkflow = (workflowUuid: string, ownerUuid?: string) => - async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => { - if(ownerUuid) dispatch(navigateTo(ownerUuid)); - dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Removing ...', kind: SnackbarKind.INFO })); - await services.workflowService.delete(workflowUuid); - dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Removed.', hideDuration: 2000, kind: SnackbarKind.SUCCESS })); - }; - export const openRemoveWorkflowDialog = (resource: ContextMenuResource, numOfWorkflows: Number) => (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => { const confirmationText = @@ -158,7 +150,7 @@ export const openRemoveWorkflowDialog = export const REMOVE_WORKFLOW_DIALOG = "removeWorkflowDialog"; -export const removeWorkflowPermanently = (uuid: string) => async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => { +export const removeWorkflowPermanently = (uuid: string, ownerUuid?: string) => async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => { const resource = getState().dialog.removeWorkflowDialog.data.resource; const checkedList = getState().multiselect.checkedList; @@ -166,6 +158,7 @@ export const removeWorkflowPermanently = (uuid: string) => async (dispatch: Disp //if no items in checkedlist, default to normal context menu behavior if (!uuidsToRemove.length) uuidsToRemove.push(uuid); + if(ownerUuid) dispatch(navigateTo(ownerUuid)); const workflowsToRemove = uuidsToRemove .map(uuid => getResource(uuid)(getState().resources) as Resource) diff --git a/services/workbench2/src/views-components/context-menu/action-sets/workflow-action-set.ts b/services/workbench2/src/views-components/context-menu/action-sets/workflow-action-set.ts index b71ed93d15..6da6a7102f 100644 --- a/services/workbench2/src/views-components/context-menu/action-sets/workflow-action-set.ts +++ b/services/workbench2/src/views-components/context-menu/action-sets/workflow-action-set.ts @@ -3,7 +3,7 @@ // SPDX-License-Identifier: AGPL-3.0 import { ContextMenuActionSet } from "views-components/context-menu/context-menu-action-set"; -import { openRunProcess, deleteWorkflow } from "store/workflow-panel/workflow-panel-actions"; +import { openRunProcess, openRemoveWorkflowDialog } from "store/workflow-panel/workflow-panel-actions"; import { DetailsIcon, AdvancedIcon, OpenIcon, Link, StartIcon, DeleteForever } from "components/icon/icon"; import { copyToClipboardAction, openInNewTabAction } from "store/open-in-new-tab/open-in-new-tab.actions"; import { toggleDetailsPanel } from "store/details-panel/details-panel-action"; @@ -56,7 +56,7 @@ export const workflowActionSet: ContextMenuActionSet = [ icon: DeleteForever, name: "Delete Workflow", execute: (dispatch, resources) => { - dispatch(deleteWorkflow(resources[0].uuid, resources[0].ownerUuid)); + dispatch(openRemoveWorkflowDialog(resources[0], resources.length)); }, }, ], -- 2.30.2