[ARVADOS-WORKBENCH2] updated: 1.2.0-231-ge53e6f1

Git user git at public.curoverse.com
Tue Sep 4 01:38:53 EDT 2018


Summary of changes:
 src/store/trash/trash-actions.ts                        | 10 ++++++++++
 .../context-menu/action-sets/trash-action-set.ts        |  4 ++--
 src/views/trash-panel/trash-panel.tsx                   | 17 ++++++++---------
 3 files changed, 20 insertions(+), 11 deletions(-)

       via  e53e6f1efe7b156934514b51fd5f956262f6f9af (commit)
      from  88ce683068f65862b3b5e753e55989902be5f1a9 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit e53e6f1efe7b156934514b51fd5f956262f6f9af
Author: Daniel Kos <daniel.kos at contractors.roche.com>
Date:   Tue Sep 4 07:38:49 2018 +0200

    Add generic trash action
    
    Feature #13828
    
    Arvados-DCO-1.1-Signed-off-by: Daniel Kos <daniel.kos at contractors.roche.com>

diff --git a/src/store/trash/trash-actions.ts b/src/store/trash/trash-actions.ts
index 06e1648..cd6df55 100644
--- a/src/store/trash/trash-actions.ts
+++ b/src/store/trash/trash-actions.ts
@@ -9,6 +9,7 @@ import { snackbarActions } from "~/store/snackbar/snackbar-actions";
 import { trashPanelActions } from "~/store/trash-panel/trash-panel-action";
 import { activateSidePanelTreeItem, loadSidePanelTreeProjects } from "~/store/side-panel-tree/side-panel-tree-actions";
 import { projectPanelActions } from "~/store/project-panel/project-panel-action";
+import { ResourceKind, TrashableResource } from "~/models/resource";
 
 export const toggleProjectTrashed = (uuid: string, ownerUuid: string, isTrashed: boolean) =>
     async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository): Promise<any> => {
@@ -54,3 +55,12 @@ export const toggleCollectionTrashed = (uuid: string, isTrashed: boolean) =>
             }));
         }
     };
+
+export const toggleTrashed = (kind: ResourceKind, uuid: string, ownerUuid: string, isTrashed: boolean) =>
+    (dispatch: Dispatch) => {
+        if (kind === ResourceKind.PROJECT) {
+            dispatch<any>(toggleProjectTrashed(uuid, ownerUuid, isTrashed!!));
+        } else if (kind === ResourceKind.COLLECTION) {
+            dispatch<any>(toggleCollectionTrashed(uuid, isTrashed!!));
+        }
+    };
diff --git a/src/views-components/context-menu/action-sets/trash-action-set.ts b/src/views-components/context-menu/action-sets/trash-action-set.ts
index 3a5c530..fafd5fe 100644
--- a/src/views-components/context-menu/action-sets/trash-action-set.ts
+++ b/src/views-components/context-menu/action-sets/trash-action-set.ts
@@ -4,13 +4,13 @@
 
 import { ContextMenuActionSet } from "../context-menu-action-set";
 import { ToggleTrashAction } from "~/views-components/context-menu/actions/trash-action";
-import { toggleCollectionTrashed } from "~/store/trash/trash-actions";
+import { toggleTrashed } from "~/store/trash/trash-actions";
 
 export const trashActionSet: ContextMenuActionSet = [[
     {
         component: ToggleTrashAction,
         execute: (dispatch, resource) => {
-            dispatch<any>(toggleCollectionTrashed(resource.uuid, resource.isTrashed!!));
+            dispatch<any>(toggleTrashed(resource.kind, resource.uuid, resource.ownerUuid, resource.isTrashed!!));
         }
     },
 ]];
diff --git a/src/views/trash-panel/trash-panel.tsx b/src/views/trash-panel/trash-panel.tsx
index dadfabb..08df05c 100644
--- a/src/views/trash-panel/trash-panel.tsx
+++ b/src/views/trash-panel/trash-panel.tsx
@@ -17,7 +17,7 @@ import { RestoreFromTrashIcon, TrashIcon } from '~/components/icon/icon';
 import { TRASH_PANEL_ID } from "~/store/trash-panel/trash-panel-action";
 import { getProperty } from "~/store/properties/properties";
 import { PROJECT_PANEL_CURRENT_UUID } from "~/store/project-panel/project-panel-action";
-import { ContextMenuResource, openContextMenu } from "~/store/context-menu/context-menu-actions";
+import { openContextMenu } from "~/store/context-menu/context-menu-actions";
 import { getResource, ResourcesState } from "~/store/resources/resources";
 import {
     ResourceDeleteDate,
@@ -28,7 +28,7 @@ import {
 } from "~/views-components/data-explorer/renderers";
 import { navigateTo } from "~/store/navigation/navigation-action";
 import { loadDetailsPanel } from "~/store/details-panel/details-panel-action";
-import { toggleCollectionTrashed, toggleProjectTrashed } from "~/store/trash/trash-actions";
+import { toggleCollectionTrashed, toggleProjectTrashed, toggleTrashed } from "~/store/trash/trash-actions";
 import { ContextMenuKind } from "~/views-components/context-menu/context-menu";
 import { Dispatch } from "redux";
 
@@ -63,13 +63,12 @@ export const ResourceRestore =
     })((props: { resource?: TrashableResource, dispatch?: Dispatch<any> }) =>
         <IconButton onClick={() => {
             if (props.resource && props.dispatch) {
-                const res = props.resource;
-
-                if (props.resource.kind === ResourceKind.PROJECT) {
-                    props.dispatch(toggleProjectTrashed(res.uuid, res.ownerUuid, res.isTrashed));
-                } else if (props.resource.kind === ResourceKind.COLLECTION) {
-                    props.dispatch(toggleCollectionTrashed(res.uuid, res.isTrashed));
-                }
+                props.dispatch(toggleTrashed(
+                    props.resource.kind,
+                    props.resource.uuid,
+                    props.resource.ownerUuid,
+                    props.resource.isTrashed
+                ));
             }
         }}>
             <RestoreFromTrashIcon/>

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list