X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/b979b48045c915f0ea95bb95d591f8ac306ddf06..1044e0b20884775788bd7878fd0a168a06ef17d7:/src/views/project-panel/project-panel.tsx

diff --git a/src/views/project-panel/project-panel.tsx b/src/views/project-panel/project-panel.tsx
index 01c2602eb4..2573f81813 100644
--- a/src/views/project-panel/project-panel.tsx
+++ b/src/views/project-panel/project-panel.tsx
@@ -20,9 +20,7 @@ import { ProjectIcon } from '~/components/icon/icon';
 import { ResourceName } from '~/views-components/data-explorer/renderers';
 import { ResourcesState, getResource } from '~/store/resources/resources';
 import { loadDetailsPanel } from '~/store/details-panel/details-panel-action';
-import { ContextMenuKind } from '~/views-components/context-menu/context-menu';
-import { contextMenuActions } from '~/store/context-menu/context-menu-actions';
-import { CollectionResource } from '~/models/collection';
+import { resourceKindToContextMenuKind, openContextMenu } from '~/store/context-menu/context-menu-actions';
 import { ProjectResource } from '~/models/project';
 import { navigateTo } from '~/store/navigation/navigation-action';
 import { getProperty } from '~/store/properties/properties';
@@ -74,24 +72,7 @@ export const projectPanelColumns: DataColumns<string, ProjectPanelFilter> = [
         name: "Status",
         selected: true,
         configurable: true,
-        sortDirection: SortDirection.NONE,
-        filters: [
-            {
-                name: ContainerRequestState.COMMITTED,
-                selected: true,
-                type: ContainerRequestState.COMMITTED
-            },
-            {
-                name: ContainerRequestState.FINAL,
-                selected: true,
-                type: ContainerRequestState.FINAL
-            },
-            {
-                name: ContainerRequestState.UNCOMMITTED,
-                selected: true,
-                type: ContainerRequestState.UNCOMMITTED
-            }
-        ],
+        filters: [],
         render: uuid => <ProcessStatus uuid={uuid} />,
         width: "75px"
     },
@@ -99,7 +80,6 @@ export const projectPanelColumns: DataColumns<string, ProjectPanelFilter> = [
         name: ProjectPanelColumnNames.TYPE,
         selected: true,
         configurable: true,
-        sortDirection: SortDirection.NONE,
         filters: [
             {
                 name: resourceLabel(ResourceKind.COLLECTION),
@@ -124,7 +104,6 @@ export const projectPanelColumns: DataColumns<string, ProjectPanelFilter> = [
         name: ProjectPanelColumnNames.OWNER,
         selected: true,
         configurable: true,
-        sortDirection: SortDirection.NONE,
         filters: [],
         render: uuid => <ResourceOwner uuid={uuid} />,
         width: "200px"
@@ -133,7 +112,6 @@ export const projectPanelColumns: DataColumns<string, ProjectPanelFilter> = [
         name: ProjectPanelColumnNames.FILE_SIZE,
         selected: true,
         configurable: true,
-        sortDirection: SortDirection.NONE,
         filters: [],
         render: uuid => <ResourceFileSize uuid={uuid} />,
         width: "50px"
@@ -170,7 +148,7 @@ export const ProjectPanel = withStyles(styles)(
                 return <div className={classes.root}>
                     <div className={classes.toolbar}>
                         <Button color="primary" onClick={this.handleNewCollectionClick} variant="raised" className={classes.button}>
-                            Create a collection
+                            New collection
                         </Button>
                         <Button color="primary" variant="raised" className={classes.button}>
                             Run a process
@@ -185,7 +163,8 @@ export const ProjectPanel = withStyles(styles)(
                         onRowDoubleClick={this.handleRowDoubleClick}
                         onContextMenu={this.handleContextMenu}
                         defaultIcon={ProjectIcon}
-                        defaultMessages={['Your project is empty.', 'Please create a project or create a collection and upload a data.']} />
+                        defaultMessages={['Your project is empty.', 'Please create a project or create a collection and upload a data.']}
+                        contextMenuColumn={true}/>
                 </div>;
             }
 
@@ -198,31 +177,17 @@ export const ProjectPanel = withStyles(styles)(
             }
 
             handleContextMenu = (event: React.MouseEvent<HTMLElement>, resourceUuid: string) => {
-                event.preventDefault();
-                const resource = getResource(resourceUuid)(this.props.resources) as CollectionResource | ProjectResource | undefined;
-                if (resource) {
-                    let kind: ContextMenuKind;
-
-                    if (resource.kind === ResourceKind.PROJECT) {
-                        kind = ContextMenuKind.PROJECT;
-                    } else if (resource.kind === ResourceKind.COLLECTION) {
-                        kind = ContextMenuKind.COLLECTION_RESOURCE;
-                    } else {
-                        kind = ContextMenuKind.RESOURCE;
-                    }
-                    if (kind !== ContextMenuKind.RESOURCE) {
-                        this.props.dispatch(
-                            contextMenuActions.OPEN_CONTEXT_MENU({
-                                position: { x: event.clientX, y: event.clientY },
-                                resource: {
-                                    uuid: resource.uuid,
-                                    name: resource.name || '',
-                                    description: resource.description,
-                                    kind,
-                                }
-                            })
-                        );
-                    }
+                const menuKind = resourceKindToContextMenuKind(resourceUuid);
+                const resource = getResource<ProjectResource>(resourceUuid)(this.props.resources);
+                if (menuKind && resource) {
+                    this.props.dispatch<any>(openContextMenu(event, {
+                        name: resource.name,
+                        uuid: resource.uuid,
+                        ownerUuid: resource.ownerUuid,
+                        isTrashed: resource.isTrashed,
+                        kind: resource.kind,
+                        menuKind
+                    }));
                 }
             }
 
