[ARVADOS-WORKBENCH2] updated: 1.2.0-230-g88ce683

Git user git at public.curoverse.com
Mon Sep 3 17:09:42 EDT 2018


Summary of changes:
 src/index.tsx                                      |  2 ++
 src/models/resource.ts                             |  3 ++-
 src/models/test-utils.ts                           |  2 +-
 src/store/collections/collection-update-actions.ts |  6 +-----
 src/store/context-menu/context-menu-actions.ts     | 17 +++++++++------
 src/store/context-menu/context-menu-reducer.ts     | 11 +---------
 src/store/projects/project-update-actions.ts       |  2 +-
 src/store/trash/trash-actions.ts                   | 20 ++++++++---------
 .../collection-panel-files.ts                      | 20 +++++++++++------
 .../action-sets/collection-action-set.ts           |  2 +-
 .../action-sets/collection-resource-action-set.ts  |  2 +-
 .../context-menu/action-sets/project-action-set.ts |  2 +-
 .../context-menu/action-sets/trash-action-set.ts   | 16 ++++++++++++++
 .../context-menu/context-menu-action-set.ts        |  2 +-
 src/views-components/context-menu/context-menu.tsx |  6 +++---
 src/views/collection-panel/collection-panel.tsx    |  8 ++++---
 src/views/favorite-panel/favorite-panel.tsx        | 19 +++++++++++++---
 src/views/project-panel/project-panel.tsx          |  7 +++---
 src/views/trash-panel/trash-panel.tsx              | 25 +++++++++-------------
 19 files changed, 101 insertions(+), 71 deletions(-)
 create mode 100644 src/views-components/context-menu/action-sets/trash-action-set.ts

       via  88ce683068f65862b3b5e753e55989902be5f1a9 (commit)
      from  ec00e13345fd6731287124ee776e0e4892c1cf13 (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 88ce683068f65862b3b5e753e55989902be5f1a9
Author: Daniel Kos <daniel.kos at contractors.roche.com>
Date:   Mon Sep 3 23:09:35 2018 +0200

    Remove doubled ContextMenuResource, spearate menu for trash view
    
    Feature #13828
    
    Arvados-DCO-1.1-Signed-off-by: Daniel Kos <daniel.kos at contractors.roche.com>

diff --git a/src/index.tsx b/src/index.tsx
index d3115a6..6137e26 100644
--- a/src/index.tsx
+++ b/src/index.tsx
@@ -31,6 +31,7 @@ import { processActionSet } from './views-components/context-menu/action-sets/pr
 import { addRouteChangeHandlers } from './routes/routes';
 import { loadWorkbench } from './store/workbench/workbench-actions';
 import { Routes } from '~/routes/routes';
+import { trashActionSet } from "~/views-components/context-menu/action-sets/trash-action-set";
 
 const getBuildNumber = () => "BN-" + (process.env.REACT_APP_BUILD_NUMBER || "dev");
 const getGitCommit = () => "GIT-" + (process.env.REACT_APP_GIT_COMMIT || "latest").substr(0, 7);
@@ -49,6 +50,7 @@ addMenuActionSet(ContextMenuKind.COLLECTION_FILES_ITEM, collectionFilesItemActio
 addMenuActionSet(ContextMenuKind.COLLECTION, collectionActionSet);
 addMenuActionSet(ContextMenuKind.COLLECTION_RESOURCE, collectionResourceActionSet);
 addMenuActionSet(ContextMenuKind.PROCESS, processActionSet);
+addMenuActionSet(ContextMenuKind.TRASH, trashActionSet);
 
 fetchConfig()
     .then((config) => {
diff --git a/src/models/resource.ts b/src/models/resource.ts
index 3d40b50..4d7031a 100644
--- a/src/models/resource.ts
+++ b/src/models/resource.ts
@@ -10,7 +10,7 @@ export interface Resource {
     modifiedByUserUuid: string;
     modifiedAt: string;
     href: string;
-    kind: string;
+    kind: ResourceKind;
     etag: string;
 }
 
@@ -29,6 +29,7 @@ export enum ResourceKind {
     PROJECT = "arvados#group",
     USER = "arvados#user",
     WORKFLOW = "arvados#workflow",
+    NONE = "arvados#none"
 }
 
 export enum ResourceObjectType {
diff --git a/src/models/test-utils.ts b/src/models/test-utils.ts
index 49eea60..b08ce5a 100644
--- a/src/models/test-utils.ts
+++ b/src/models/test-utils.ts
@@ -34,7 +34,7 @@ export const mockCommonResource = (data: Partial<Resource>): Resource => ({
     createdAt: "",
     etag: "",
     href: "",
-    kind: "",
+    kind: ResourceKind.NONE,
     modifiedAt: "",
     modifiedByClientUuid: "",
     modifiedByUserUuid: "",
diff --git a/src/store/collections/collection-update-actions.ts b/src/store/collections/collection-update-actions.ts
index 03bb72a..bf05d4d 100644
--- a/src/store/collections/collection-update-actions.ts
+++ b/src/store/collections/collection-update-actions.ts
@@ -6,15 +6,11 @@ import { Dispatch } from "redux";
 import { initialize, startSubmit, stopSubmit } from 'redux-form';
 import { RootState } from "~/store/store";
 import { collectionPanelActions } from "~/store/collection-panel/collection-panel-action";
-import { loadDetailsPanel } from "~/store/details-panel/details-panel-action";
 import { dialogActions } from "~/store/dialog/dialog-actions";
-import { dataExplorerActions } from "~/store/data-explorer/data-explorer-action";
-import { snackbarActions } from "~/store/snackbar/snackbar-actions";
-import { ContextMenuResource } from '~/store/context-menu/context-menu-reducer';
-import { PROJECT_PANEL_ID } from "~/views/project-panel/project-panel";
 import { getCommonResourceServiceError, CommonResourceServiceError } from "~/services/common-service/common-resource-service";
 import { ServiceRepository } from "~/services/services";
 import { CollectionResource } from '~/models/collection';
+import { ContextMenuResource } from "~/store/context-menu/context-menu-actions";
 
 export interface CollectionUpdateFormDialogData {
     uuid: string;
diff --git a/src/store/context-menu/context-menu-actions.ts b/src/store/context-menu/context-menu-actions.ts
index 5ec3a84..85e5761 100644
--- a/src/store/context-menu/context-menu-actions.ts
+++ b/src/store/context-menu/context-menu-actions.ts
@@ -3,7 +3,7 @@
 // SPDX-License-Identifier: AGPL-3.0
 
 import { unionize, ofType, UnionOf } from '~/common/unionize';
-import { ContextMenuPosition, ContextMenuResource } from "./context-menu-reducer";
+import { ContextMenuPosition } from "./context-menu-reducer";
 import { ContextMenuKind } from '~/views-components/context-menu/context-menu';
 import { Dispatch } from 'redux';
 import { RootState } from '~/store/store';
@@ -11,7 +11,7 @@ import { getResource } from '../resources/resources';
 import { ProjectResource } from '~/models/project';
 import { UserResource } from '~/models/user';
 import { isSidePanelTreeCategory } from '~/store/side-panel-tree/side-panel-tree-actions';
-import { extractUuidKind, ResourceKind } from '~/models/resource';
+import { extractUuidKind, ResourceKind, TrashableResource } from '~/models/resource';
 
 export const contextMenuActions = unionize({
     OPEN_CONTEXT_MENU: ofType<{ position: ContextMenuPosition, resource: ContextMenuResource }>(),
@@ -25,7 +25,8 @@ export type ContextMenuResource = {
     uuid: string;
     ownerUuid: string;
     description?: string;
-    kind: ContextMenuKind;
+    kind: ResourceKind,
+    menuKind: ContextMenuKind;
     isTrashed?: boolean;
 };
 
@@ -48,7 +49,8 @@ export const openRootProjectContextMenu = (event: React.MouseEvent<HTMLElement>,
                 name: '',
                 uuid: res.uuid,
                 ownerUuid: res.uuid,
-                kind: ContextMenuKind.ROOT_PROJECT,
+                kind: res.kind,
+                menuKind: ContextMenuKind.ROOT_PROJECT,
                 isTrashed: false
             }));
         }
@@ -61,7 +63,8 @@ export const openProjectContextMenu = (event: React.MouseEvent<HTMLElement>, pro
             dispatch<any>(openContextMenu(event, {
                 name: res.name,
                 uuid: res.uuid,
-                kind: ContextMenuKind.PROJECT,
+                kind: res.kind,
+                menuKind: ContextMenuKind.PROJECT,
                 ownerUuid: res.ownerUuid,
                 isTrashed: res.isTrashed
             }));
@@ -84,9 +87,11 @@ export const openProcessContextMenu = (event: React.MouseEvent<HTMLElement>) =>
     (dispatch: Dispatch, getState: () => RootState) => {
         const resource = {
             uuid: '',
+            ownerUuid: '',
+            kind: ResourceKind.PROCESS,
             name: '',
             description: '',
-            kind: ContextMenuKind.PROCESS
+            menuKind: ContextMenuKind.PROCESS
         };
         dispatch<any>(openContextMenu(event, resource));
     };
diff --git a/src/store/context-menu/context-menu-reducer.ts b/src/store/context-menu/context-menu-reducer.ts
index 8026c1d..03d9cc7 100644
--- a/src/store/context-menu/context-menu-reducer.ts
+++ b/src/store/context-menu/context-menu-reducer.ts
@@ -2,7 +2,7 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-import { contextMenuActions, ContextMenuAction } from "./context-menu-actions";
+import { contextMenuActions, ContextMenuAction, ContextMenuResource } from "./context-menu-actions";
 
 export interface ContextMenuState {
     open: boolean;
@@ -15,15 +15,6 @@ export interface ContextMenuPosition {
     y: number;
 }
 
-export interface ContextMenuResource {
-    uuid: string;
-    kind: string;
-    name: string;
-    description?: string;
-    isTrashed?: boolean;
-    ownerUuid?: string;
-}
-
 const initialState = {
     open: false,
     position: { x: 0, y: 0 }
diff --git a/src/store/projects/project-update-actions.ts b/src/store/projects/project-update-actions.ts
index 8e327eb..afa2e35 100644
--- a/src/store/projects/project-update-actions.ts
+++ b/src/store/projects/project-update-actions.ts
@@ -6,10 +6,10 @@ import { Dispatch } from "redux";
 import { initialize, startSubmit, stopSubmit } from 'redux-form';
 import { RootState } from "~/store/store";
 import { dialogActions } from "~/store/dialog/dialog-actions";
-import { ContextMenuResource } from '~/store/context-menu/context-menu-reducer';
 import { getCommonResourceServiceError, CommonResourceServiceError } from "~/services/common-service/common-resource-service";
 import { ServiceRepository } from "~/services/services";
 import { ProjectResource } from '~/models/project';
+import { ContextMenuResource } from "~/store/context-menu/context-menu-actions";
 
 export interface ProjectUpdateFormDialogData {
     uuid: string;
diff --git a/src/store/trash/trash-actions.ts b/src/store/trash/trash-actions.ts
index 4b2000d..06e1648 100644
--- a/src/store/trash/trash-actions.ts
+++ b/src/store/trash/trash-actions.ts
@@ -10,12 +10,12 @@ 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";
 
-export const toggleProjectTrashed = (resource: { uuid: string; name: string, isTrashed?: boolean, ownerUuid?: string }) =>
+export const toggleProjectTrashed = (uuid: string, ownerUuid: string, isTrashed: boolean) =>
     async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository): Promise<any> => {
-        if (resource.isTrashed) {
+        if (isTrashed) {
             dispatch(snackbarActions.OPEN_SNACKBAR({ message: "Restoring from trash..." }));
-            await services.groupsService.untrash(resource.uuid);
-            dispatch<any>(activateSidePanelTreeItem(resource.uuid));
+            await services.groupsService.untrash(uuid);
+            dispatch<any>(activateSidePanelTreeItem(uuid));
             dispatch(trashPanelActions.REQUEST_ITEMS());
             dispatch(snackbarActions.CLOSE_SNACKBAR());
             dispatch(snackbarActions.OPEN_SNACKBAR({
@@ -24,8 +24,8 @@ export const toggleProjectTrashed = (resource: { uuid: string; name: string, isT
             }));
         } else {
             dispatch(snackbarActions.OPEN_SNACKBAR({ message: "Moving to trash..." }));
-            await services.groupsService.trash(resource.uuid);
-            dispatch<any>(loadSidePanelTreeProjects(resource.ownerUuid!!));
+            await services.groupsService.trash(uuid);
+            dispatch<any>(loadSidePanelTreeProjects(ownerUuid));
             dispatch(snackbarActions.CLOSE_SNACKBAR());
             dispatch(snackbarActions.OPEN_SNACKBAR({
                 message: "Added to trash",
@@ -34,11 +34,11 @@ export const toggleProjectTrashed = (resource: { uuid: string; name: string, isT
         }
     };
 
-export const toggleCollectionTrashed = (resource: { uuid: string; name: string, isTrashed?: boolean, ownerUuid?: string }) =>
+export const toggleCollectionTrashed = (uuid: string, isTrashed: boolean) =>
     async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository): Promise<any> => {
-        if (resource.isTrashed) {
+        if (isTrashed) {
             dispatch(snackbarActions.OPEN_SNACKBAR({ message: "Restoring from trash..." }));
-            await services.collectionService.untrash(resource.uuid);
+            await services.collectionService.untrash(uuid);
             dispatch(trashPanelActions.REQUEST_ITEMS());
             dispatch(snackbarActions.OPEN_SNACKBAR({
                 message: "Restored from trash",
@@ -46,7 +46,7 @@ export const toggleCollectionTrashed = (resource: { uuid: string; name: string,
             }));
         } else {
             dispatch(snackbarActions.OPEN_SNACKBAR({ message: "Moving to trash..." }));
-            await services.collectionService.trash(resource.uuid);
+            await services.collectionService.trash(uuid);
             dispatch(projectPanelActions.REQUEST_ITEMS());
             dispatch(snackbarActions.OPEN_SNACKBAR({
                 message: "Added to trash",
diff --git a/src/views-components/collection-panel-files/collection-panel-files.ts b/src/views-components/collection-panel-files/collection-panel-files.ts
index ccb18c8..edc100f 100644
--- a/src/views-components/collection-panel-files/collection-panel-files.ts
+++ b/src/views-components/collection-panel-files/collection-panel-files.ts
@@ -3,18 +3,26 @@
 // SPDX-License-Identifier: AGPL-3.0
 
 import { connect } from "react-redux";
-import { CollectionPanelFiles as Component, CollectionPanelFilesProps } from "~/components/collection-panel-files/collection-panel-files";
+import {
+    CollectionPanelFiles as Component,
+    CollectionPanelFilesProps
+} from "~/components/collection-panel-files/collection-panel-files";
 import { RootState } from "~/store/store";
-import { TreeItemStatus, TreeItem } from "~/components/tree/tree";
-import { CollectionPanelFilesState, CollectionPanelDirectory, CollectionPanelFile } from "~/store/collection-panel/collection-panel-files/collection-panel-files-state";
+import { TreeItem, TreeItemStatus } from "~/components/tree/tree";
+import {
+    CollectionPanelDirectory,
+    CollectionPanelFile,
+    CollectionPanelFilesState
+} from "~/store/collection-panel/collection-panel-files/collection-panel-files-state";
 import { FileTreeData } from "~/components/file-tree/file-tree-data";
 import { Dispatch } from "redux";
 import { collectionPanelFilesAction } from "~/store/collection-panel/collection-panel-files/collection-panel-files-actions";
 import { ContextMenuKind } from "../context-menu/context-menu";
-import { Tree, getNodeChildrenIds, getNode } from "~/models/tree";
+import { getNode, getNodeChildrenIds, Tree } from "~/models/tree";
 import { CollectionFileType } from "~/models/collection-file";
 import { openContextMenu } from '~/store/context-menu/context-menu-actions';
 import { openUploadCollectionFilesDialog } from '~/store/collections/collection-upload-actions';
+import { ResourceKind } from "~/models/resource";
 
 const memoizedMapStateToProps = () => {
     let prevState: CollectionPanelFilesState;
@@ -43,10 +51,10 @@ const mapDispatchToProps = (dispatch: Dispatch): Pick<CollectionPanelFilesProps,
         dispatch(collectionPanelFilesAction.TOGGLE_COLLECTION_FILE_SELECTION({ id: item.id }));
     },
     onItemMenuOpen: (event, item) => {
-        dispatch<any>(openContextMenu(event, { kind: ContextMenuKind.COLLECTION_FILES_ITEM, name: item.data.name, uuid: item.id }));
+        dispatch<any>(openContextMenu(event, { menuKind: ContextMenuKind.COLLECTION_FILES_ITEM, kind: ResourceKind.COLLECTION, name: item.data.name, uuid: item.id, ownerUuid: '' }));
     },
     onOptionsMenuOpen: (event) => {
-        dispatch<any>(openContextMenu(event, { kind: ContextMenuKind.COLLECTION_FILES, name: '', uuid: '' }));
+        dispatch<any>(openContextMenu(event, { menuKind: ContextMenuKind.COLLECTION_FILES, kind: ResourceKind.COLLECTION, name: '', uuid: '', ownerUuid: '' }));
     },
 });
 
diff --git a/src/views-components/context-menu/action-sets/collection-action-set.ts b/src/views-components/context-menu/action-sets/collection-action-set.ts
index a7d16c6..67249fc 100644
--- a/src/views-components/context-menu/action-sets/collection-action-set.ts
+++ b/src/views-components/context-menu/action-sets/collection-action-set.ts
@@ -44,7 +44,7 @@ export const collectionActionSet: ContextMenuActionSet = [[
     {
         component: ToggleTrashAction,
         execute: (dispatch, resource) => {
-            dispatch<any>(toggleCollectionTrashed(resource));
+            dispatch<any>(toggleCollectionTrashed(resource.uuid, resource.isTrashed!!));
         }
     },
     {
diff --git a/src/views-components/context-menu/action-sets/collection-resource-action-set.ts b/src/views-components/context-menu/action-sets/collection-resource-action-set.ts
index f1df0c0..b7d3e64 100644
--- a/src/views-components/context-menu/action-sets/collection-resource-action-set.ts
+++ b/src/views-components/context-menu/action-sets/collection-resource-action-set.ts
@@ -44,7 +44,7 @@ export const collectionResourceActionSet: ContextMenuActionSet = [[
     {
         component: ToggleTrashAction,
         execute: (dispatch, resource) => {
-            dispatch<any>(toggleCollectionTrashed(resource));
+            dispatch<any>(toggleCollectionTrashed(resource.uuid, resource.isTrashed!!));
         }
     },
     {
diff --git a/src/views-components/context-menu/action-sets/project-action-set.ts b/src/views-components/context-menu/action-sets/project-action-set.ts
index eca395b..e5a1915 100644
--- a/src/views-components/context-menu/action-sets/project-action-set.ts
+++ b/src/views-components/context-menu/action-sets/project-action-set.ts
@@ -39,7 +39,7 @@ export const projectActionSet: ContextMenuActionSet = [[
     {
         component: ToggleTrashAction,
         execute: (dispatch, resource) => {
-            dispatch<any>(toggleProjectTrashed(resource));
+            dispatch<any>(toggleProjectTrashed(resource.uuid, resource.ownerUuid, resource.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
new file mode 100644
index 0000000..3a5c530
--- /dev/null
+++ b/src/views-components/context-menu/action-sets/trash-action-set.ts
@@ -0,0 +1,16 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { ContextMenuActionSet } from "../context-menu-action-set";
+import { ToggleTrashAction } from "~/views-components/context-menu/actions/trash-action";
+import { toggleCollectionTrashed } from "~/store/trash/trash-actions";
+
+export const trashActionSet: ContextMenuActionSet = [[
+    {
+        component: ToggleTrashAction,
+        execute: (dispatch, resource) => {
+            dispatch<any>(toggleCollectionTrashed(resource.uuid, resource.isTrashed!!));
+        }
+    },
+]];
diff --git a/src/views-components/context-menu/context-menu-action-set.ts b/src/views-components/context-menu/context-menu-action-set.ts
index cbcc0b7..c89cd3a 100644
--- a/src/views-components/context-menu/context-menu-action-set.ts
+++ b/src/views-components/context-menu/context-menu-action-set.ts
@@ -4,7 +4,7 @@
 
 import { Dispatch } from "redux";
 import { ContextMenuItem } from "~/components/context-menu/context-menu";
-import { ContextMenuResource } from "~/store/context-menu/context-menu-reducer";
+import { ContextMenuResource } from "~/store/context-menu/context-menu-actions";
 
 export interface ContextMenuAction extends ContextMenuItem {
     execute(dispatch: Dispatch, resource: ContextMenuResource): void;
diff --git a/src/views-components/context-menu/context-menu.tsx b/src/views-components/context-menu/context-menu.tsx
index 5d94766..2df776e 100644
--- a/src/views-components/context-menu/context-menu.tsx
+++ b/src/views-components/context-menu/context-menu.tsx
@@ -4,10 +4,9 @@
 
 import { connect } from "react-redux";
 import { RootState } from "~/store/store";
-import { contextMenuActions } from "~/store/context-menu/context-menu-actions";
+import { contextMenuActions, ContextMenuResource } from "~/store/context-menu/context-menu-actions";
 import { ContextMenu as ContextMenuComponent, ContextMenuProps, ContextMenuItem } from "~/components/context-menu/context-menu";
 import { createAnchorAt } from "~/components/popover/helpers";
-import { ContextMenuResource } from "~/store/context-menu/context-menu-reducer";
 import { ContextMenuActionSet, ContextMenuAction } from "./context-menu-action-set";
 import { Dispatch } from "redux";
 
@@ -52,7 +51,7 @@ export const addMenuActionSet = (name: string, itemSet: ContextMenuActionSet) =>
 };
 
 const getMenuActionSet = (resource?: ContextMenuResource): ContextMenuActionSet => {
-    return resource ? menuActionSets.get(resource.kind) || [] : [];
+    return resource ? menuActionSets.get(resource.menuKind) || [] : [];
 };
 
 export enum ContextMenuKind {
@@ -60,6 +59,7 @@ export enum ContextMenuKind {
     PROJECT = "Project",
     RESOURCE = "Resource",
     FAVORITE = "Favorite",
+    TRASH = "Trash",
     COLLECTION_FILES = "CollectionFiles",
     COLLECTION_FILES_ITEM = "CollectionFilesItem",
     COLLECTION = 'Collection',
diff --git a/src/views/collection-panel/collection-panel.tsx b/src/views/collection-panel/collection-panel.tsx
index 8a0e2f8..748151c 100644
--- a/src/views/collection-panel/collection-panel.tsx
+++ b/src/views/collection-panel/collection-panel.tsx
@@ -21,7 +21,7 @@ import { CollectionTagForm } from './collection-tag-form';
 import { deleteCollectionTag } from '~/store/collection-panel/collection-panel-action';
 import { snackbarActions } from '~/store/snackbar/snackbar-actions';
 import { getResource } from '~/store/resources/resources';
-import { contextMenuActions, openContextMenu } from '~/store/context-menu/context-menu-actions';
+import { openContextMenu } from '~/store/context-menu/context-menu-actions';
 import { ContextMenuKind } from '~/views-components/context-menu/context-menu';
 
 type CssRules = 'card' | 'iconHeader' | 'tag' | 'copyIcon' | 'label' | 'value';
@@ -133,12 +133,14 @@ export const CollectionPanel = withStyles(styles)(
             }
 
             handleContextMenu = (event: React.MouseEvent<any>) => {
-                const { uuid, name, description } = this.props.item;
+                const { uuid, ownerUuid, name, description, kind } = this.props.item;
                 const resource = {
                     uuid,
+                    ownerUuid,
                     name,
                     description,
-                    kind: ContextMenuKind.COLLECTION
+                    kind,
+                    menuKind: ContextMenuKind.COLLECTION
                 };
                 this.props.dispatch<any>(openContextMenu(event, resource));
             }
diff --git a/src/views/favorite-panel/favorite-panel.tsx b/src/views/favorite-panel/favorite-panel.tsx
index 003a319..2cb3019 100644
--- a/src/views/favorite-panel/favorite-panel.tsx
+++ b/src/views/favorite-panel/favorite-panel.tsx
@@ -5,7 +5,7 @@
 import * as React from 'react';
 import { StyleRulesCallback, WithStyles, withStyles } from '@material-ui/core';
 import { DataExplorer } from "~/views-components/data-explorer/data-explorer";
-import { DispatchProp, connect } from 'react-redux';
+import { connect, DispatchProp } from 'react-redux';
 import { DataColumns } from '~/components/data-table/data-table';
 import { RouteComponentProps } from 'react-router';
 import { DataTableFilterItem } from '~/components/data-table-filters/data-table-filters';
@@ -14,7 +14,14 @@ import { ResourceKind } from '~/models/resource';
 import { resourceLabel } from '~/common/labels';
 import { ArvadosTheme } from '~/common/custom-theme';
 import { FAVORITE_PANEL_ID } from "~/store/favorite-panel/favorite-panel-action";
-import { ResourceFileSize, ResourceLastModifiedDate, ProcessStatus, ResourceType, ResourceOwner, ResourceName } from '~/views-components/data-explorer/renderers';
+import {
+    ProcessStatus,
+    ResourceFileSize,
+    ResourceLastModifiedDate,
+    ResourceName,
+    ResourceOwner,
+    ResourceType
+} from '~/views-components/data-explorer/renderers';
 import { FavoriteIcon } from '~/components/icon/icon';
 import { Dispatch } from 'redux';
 import { openContextMenu, resourceKindToContextMenuKind } from '~/store/context-menu/context-menu-actions';
@@ -151,7 +158,13 @@ const mapDispatchToProps = (dispatch: Dispatch): FavoritePanelActionProps => ({
     onContextMenu: (event, resourceUuid) => {
         const kind = resourceKindToContextMenuKind(resourceUuid);
         if (kind) {
-            dispatch<any>(openContextMenu(event, { name: '', uuid: resourceUuid, kind }));
+            dispatch<any>(openContextMenu(event, {
+                name: '',
+                uuid: resourceUuid,
+                ownerUuid: '',
+                kind: ResourceKind.NONE,
+                menuKind: kind
+            }));
         }
     },
     onDialogOpen: (ownerUuid: string) => { return; },
diff --git a/src/views/project-panel/project-panel.tsx b/src/views/project-panel/project-panel.tsx
index cfdeec9..1cb72a9 100644
--- a/src/views/project-panel/project-panel.tsx
+++ b/src/views/project-panel/project-panel.tsx
@@ -197,15 +197,16 @@ export const ProjectPanel = withStyles(styles)(
             }
 
             handleContextMenu = (event: React.MouseEvent<HTMLElement>, resourceUuid: string) => {
-                const kind = resourceKindToContextMenuKind(resourceUuid);
+                const menuKind = resourceKindToContextMenuKind(resourceUuid);
                 const resource = getResource<ProjectResource>(resourceUuid)(this.props.resources);
-                if (kind && resource) {
+                if (menuKind && resource) {
                     this.props.dispatch<any>(openContextMenu(event, {
                         name: resource.name,
                         uuid: resource.uuid,
                         ownerUuid: resource.ownerUuid,
                         isTrashed: resource.isTrashed,
-                        kind
+                        kind: resource.kind,
+                        menuKind
                     }));
                 }
             }
diff --git a/src/views/trash-panel/trash-panel.tsx b/src/views/trash-panel/trash-panel.tsx
index 56724ea..dadfabb 100644
--- a/src/views/trash-panel/trash-panel.tsx
+++ b/src/views/trash-panel/trash-panel.tsx
@@ -5,7 +5,7 @@
 import * as React from 'react';
 import { IconButton, StyleRulesCallback, WithStyles, withStyles } from '@material-ui/core';
 import { DataExplorer } from "~/views-components/data-explorer/data-explorer";
-import { DispatchProp, connect } from 'react-redux';
+import { connect, DispatchProp } from 'react-redux';
 import { DataColumns } from '~/components/data-table/data-table';
 import { RootState } from '~/store/store';
 import { DataTableFilterItem } from '~/components/data-table-filters/data-table-filters';
@@ -17,10 +17,9 @@ 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 { openContextMenu, resourceKindToContextMenuKind } from "~/store/context-menu/context-menu-actions";
+import { ContextMenuResource, openContextMenu } from "~/store/context-menu/context-menu-actions";
 import { getResource, ResourcesState } from "~/store/resources/resources";
 import {
-    renderDate,
     ResourceDeleteDate,
     ResourceFileSize,
     ResourceName,
@@ -30,6 +29,7 @@ import {
 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 { ContextMenuKind } from "~/views-components/context-menu/context-menu";
 import { Dispatch } from "redux";
 
 type CssRules = "toolbar" | "button";
@@ -63,17 +63,12 @@ export const ResourceRestore =
     })((props: { resource?: TrashableResource, dispatch?: Dispatch<any> }) =>
         <IconButton onClick={() => {
             if (props.resource && props.dispatch) {
-                const ctxRes = {
-                    name: '',
-                    uuid: props.resource.uuid,
-                    isTrashed: props.resource.isTrashed,
-                    ownerUuid: props.resource.ownerUuid
-                };
+                const res = props.resource;
 
                 if (props.resource.kind === ResourceKind.PROJECT) {
-                    props.dispatch(toggleProjectTrashed(ctxRes));
+                    props.dispatch(toggleProjectTrashed(res.uuid, res.ownerUuid, res.isTrashed));
                 } else if (props.resource.kind === ResourceKind.COLLECTION) {
-                    props.dispatch(toggleCollectionTrashed(ctxRes));
+                    props.dispatch(toggleCollectionTrashed(res.uuid, res.isTrashed));
                 }
             }
         }}>
@@ -180,15 +175,15 @@ export const TrashPanel = withStyles(styles)(
             }
 
             handleContextMenu = (event: React.MouseEvent<HTMLElement>, resourceUuid: string) => {
-                const kind = resourceKindToContextMenuKind(resourceUuid);
-                const resource = getResource(resourceUuid)(this.props.resources) as TrashableResource;
-                if (kind && resource) {
+                const resource = getResource<TrashableResource>(resourceUuid)(this.props.resources);
+                if (resource) {
                     this.props.dispatch<any>(openContextMenu(event, {
                         name: '',
                         uuid: resource.uuid,
                         ownerUuid: resource.ownerUuid,
                         isTrashed: resource.isTrashed,
-                        kind
+                        kind: resource.kind,
+                        menuKind: ContextMenuKind.TRASH
                     }));
                 }
             }

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list