X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/1baec2d74e64375ce1b410f6a66fc8c8c9848307..5c6e7a1fcb3e951c09e4a794f92a80a35f4db2ee:/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 622c5d8264..b75b37aab5 100644
--- a/src/views/project-panel/project-panel.tsx
+++ b/src/views/project-panel/project-panel.tsx
@@ -10,6 +10,7 @@ import { DataColumns } from '~/components/data-table/data-table';
 import { RouteComponentProps } from 'react-router';
 import { RootState } from '~/store/store';
 import { DataTableFilterItem } from '~/components/data-table-filters/data-table-filters';
+import { ContainerRequestState } from '~/models/container-request';
 import { SortDirection } from '~/components/data-table/data-column';
 import { ResourceKind } from '~/models/resource';
 import { resourceLabel } from '~/common/labels';
@@ -17,16 +18,15 @@ import { ArvadosTheme } from '~/common/custom-theme';
 import { ResourceFileSize, ResourceLastModifiedDate, ProcessStatus, ResourceType, ResourceOwner } from '~/views-components/data-explorer/renderers';
 import { ProjectIcon } from '~/components/icon/icon';
 import { ResourceName } from '~/views-components/data-explorer/renderers';
-import { ResourcesState } from '~/store/resources/resources';
+import { ResourcesState, getResource } from '~/store/resources/resources';
 import { loadDetailsPanel } from '~/store/details-panel/details-panel-action';
 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';
 import { PROJECT_PANEL_CURRENT_UUID } from '~/store/project-panel/project-panel-action';
 import { openCollectionCreateDialog } from '../../store/collections/collection-create-actions';
 import { openProjectCreateDialog } from '~/store/projects/project-create-actions';
-import { ContainerRequestState } from "~/models/container-request";
-import { ProjectResource } from "~/models/project";
 
 type CssRules = 'root' | "toolbar" | "button";
 
@@ -58,46 +58,28 @@ export interface ProjectPanelFilter extends DataTableFilterItem {
     type: ResourceKind | ContainerRequestState;
 }
 
-export const projectPanelColumns: DataColumns<ProjectResource, ProjectPanelFilter> = [
+export const projectPanelColumns: DataColumns<string, ProjectPanelFilter> = [
     {
         name: ProjectPanelColumnNames.NAME,
         selected: true,
         configurable: true,
         sortDirection: SortDirection.ASC,
         filters: [],
-        render: res => <ResourceName uuid={res.uuid} />,
+        render: uuid => <ResourceName uuid={uuid} />,
         width: "450px"
     },
     {
         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
-            }
-        ],
-        render: res => <ProcessStatus uuid={res.uuid} />,
+        filters: [],
+        render: uuid => <ProcessStatus uuid={uuid} />,
         width: "75px"
     },
     {
         name: ProjectPanelColumnNames.TYPE,
         selected: true,
         configurable: true,
-        sortDirection: SortDirection.NONE,
         filters: [
             {
                 name: resourceLabel(ResourceKind.COLLECTION),
@@ -115,25 +97,23 @@ export const projectPanelColumns: DataColumns<ProjectResource, ProjectPanelFilte
                 type: ResourceKind.PROJECT
             }
         ],
-        render: res => <ResourceType uuid={res.uuid} />,
+        render: uuid => <ResourceType uuid={uuid} />,
         width: "125px"
     },
     {
         name: ProjectPanelColumnNames.OWNER,
         selected: true,
         configurable: true,
-        sortDirection: SortDirection.NONE,
         filters: [],
-        render: res => <ResourceOwner uuid={res.uuid} />,
+        render: uuid => <ResourceOwner uuid={uuid} />,
         width: "200px"
     },
     {
         name: ProjectPanelColumnNames.FILE_SIZE,
         selected: true,
         configurable: true,
-        sortDirection: SortDirection.NONE,
         filters: [],
-        render: res => <ResourceFileSize uuid={res.uuid} />,
+        render: uuid => <ResourceFileSize uuid={uuid} />,
         width: "50px"
     },
     {
@@ -142,7 +122,7 @@ export const projectPanelColumns: DataColumns<ProjectResource, ProjectPanelFilte
         configurable: true,
         sortDirection: SortDirection.NONE,
         filters: [],
-        render: res => <ResourceLastModifiedDate uuid={res.uuid} />,
+        render: uuid => <ResourceLastModifiedDate uuid={uuid} />,
         width: "150px"
     }
 ];
@@ -183,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>;
             }
 
@@ -195,15 +176,17 @@ export const ProjectPanel = withStyles(styles)(
                 this.props.dispatch<any>(openCollectionCreateDialog(this.props.currentItemId));
             }
 
-            handleContextMenu = (event: React.MouseEvent<HTMLElement>, resource: ProjectResource) => {
-                const kind = resourceKindToContextMenuKind(resource.uuid);
-                if (kind) {
+            handleContextMenu = (event: React.MouseEvent<HTMLElement>, resourceUuid: string) => {
+                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
+                        kind: resource.kind,
+                        menuKind
                     }));
                 }
             }
