[ARVADOS-WORKBENCH2] created: 1.2.0-846-g5921304
Git user
git at public.curoverse.com
Wed Nov 14 04:39:01 EST 2018
at 59213045f0a135ef97249ff69e1737ea88123007 (commit)
commit 59213045f0a135ef97249ff69e1737ea88123007
Author: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>
Date: Tue Nov 13 14:04:26 2018 +0100
remove-process-permanently
Feature #14461
Arvados-DCO-1.1-Signed-off-by: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>
diff --git a/src/store/processes/processes-actions.ts b/src/store/processes/processes-actions.ts
index 031683a..f9f5ef7 100644
--- a/src/store/processes/processes-actions.ts
+++ b/src/store/processes/processes-actions.ts
@@ -7,8 +7,11 @@ import { RootState } from '~/store/store';
import { ServiceRepository } from '~/services/services';
import { updateResources } from '~/store/resources/resources-actions';
import { FilterBuilder } from '~/services/api/filter-builder';
-import { ContainerRequestResource } from '../../models/container-request';
+import { ContainerRequestResource } from '~/models/container-request';
import { Process } from './process';
+import { dialogActions } from '~/store/dialog/dialog-actions';
+import { snackbarActions } from '~/store/snackbar/snackbar-actions';
+import { projectPanelActions } from '~/store/project-panel/project-panel-action';
export const loadProcess = (containerRequestUuid: string) =>
async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository): Promise<Process> => {
@@ -54,3 +57,28 @@ export const loadContainers = (filters: string) =>
dispatch<any>(updateResources(items));
return items;
};
+
+export const openRemoveProcessDialog = (uuid: string) =>
+ (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+ dispatch(dialogActions.OPEN_DIALOG({
+ id: REMOVE_PROCESS_DIALOG,
+ data: {
+ title: 'Remove process permanently',
+ text: 'Are you sure you want to remove this process?',
+ confirmButtonLabel: 'Remove',
+ uuid
+ }
+ }));
+ };
+
+export const REMOVE_PROCESS_DIALOG = 'removeProcessDialog';
+
+export const removeProcessPermanently = (uuid: string) =>
+ async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) =>{
+ dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Removing ...' }));
+ await services.containerRequestService.delete(uuid);
+ dispatch(projectPanelActions.REQUEST_ITEMS());
+ dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Removed.', hideDuration: 2000 }));
+ };
+
+
diff --git a/src/views-components/context-menu/action-sets/process-resource-action-set.ts b/src/views-components/context-menu/action-sets/process-resource-action-set.ts
index 4a0a83b..be7f756 100644
--- a/src/views-components/context-menu/action-sets/process-resource-action-set.ts
+++ b/src/views-components/context-menu/action-sets/process-resource-action-set.ts
@@ -12,6 +12,7 @@ import { openProcessUpdateDialog } from "~/store/processes/process-update-action
import { openCopyProcessDialog } from '~/store/processes/process-copy-actions';
import { detailsPanelActions } from '~/store/details-panel/details-panel-action';
import { openSharingDialog } from "~/store/sharing-dialog/sharing-dialog-actions";
+import { openRemoveProcessDialog } from "~/store/processes/processes-actions";
export const processResourceActionSet: ContextMenuActionSet = [[
{
@@ -56,12 +57,12 @@ export const processResourceActionSet: ContextMenuActionSet = [[
execute: dispatch => {
dispatch(detailsPanelActions.TOGGLE_DETAILS_PANEL());
}
+ },
+ {
+ name: "Remove",
+ icon: RemoveIcon,
+ execute: (dispatch, resource) => {
+ dispatch<any>(openRemoveProcessDialog(resource.uuid));
+ }
}
- // {
- // icon: RemoveIcon,
- // name: "Remove",
- // execute: (dispatch, resource) => {
- // // add code
- // }
- // }
]];
diff --git a/src/views-components/process-remove-dialog/process-remove-dialog.tsx b/src/views-components/process-remove-dialog/process-remove-dialog.tsx
new file mode 100644
index 0000000..4f6f907
--- /dev/null
+++ b/src/views-components/process-remove-dialog/process-remove-dialog.tsx
@@ -0,0 +1,20 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { Dispatch } from "redux";
+import { connect } from "react-redux";
+import { ConfirmationDialog } from "~/components/confirmation-dialog/confirmation-dialog";
+import { withDialog, WithDialogProps } from "~/store/dialog/with-dialog";
+import { removeProcessPermanently, REMOVE_PROCESS_DIALOG } from "~/store/processes/processes-actions";
+
+ const mapDispatchToProps = (dispatch: Dispatch, props: WithDialogProps<any>) => ({
+ onConfirm: () => {
+ props.closeDialog();
+ dispatch<any>(removeProcessPermanently(props.data.uuid));
+ }
+});
+
+ export const [RemoveProcessDialog] = [ConfirmationDialog]
+ .map(connect(null, mapDispatchToProps) as any)
+ .map(withDialog(REMOVE_PROCESS_DIALOG));
\ No newline at end of file
diff --git a/src/views/workbench/workbench.tsx b/src/views/workbench/workbench.tsx
index 92b2b5b..744526b 100644
--- a/src/views/workbench/workbench.tsx
+++ b/src/views/workbench/workbench.tsx
@@ -35,6 +35,7 @@ import { MoveCollectionDialog } from '~/views-components/dialog-forms/move-colle
import { FilesUploadCollectionDialog } from '~/views-components/dialog-forms/files-upload-collection-dialog';
import { PartialCopyCollectionDialog } from '~/views-components/dialog-forms/partial-copy-collection-dialog';
import { ProcessCommandDialog } from '~/views-components/process-command-dialog/process-command-dialog';
+import { RemoveProcessDialog } from '~/views-components/process-remove-dialog/process-remove-dialog';
import { MainContentBar } from '~/views-components/main-content-bar/main-content-bar';
import { Grid } from '@material-ui/core';
import { TrashPanel } from "~/views/trash-panel/trash-panel";
@@ -140,6 +141,7 @@ export const WorkbenchPanel =
<PartialCopyCollectionDialog />
<ProcessCommandDialog />
<ProcessInputDialog />
+ <RemoveProcessDialog />
<RenameFileDialog />
<RichTextEditorDialog />
<SharingDialog />
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list