X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/2fb4478d11d805b9a5654f5656f74d3a0e0da46b..a54420c0b7b6566ecf9d0f04835e6d8a3ef165d9:/src/views/workflow-panel/workflow-panel-view.tsx

diff --git a/src/views/workflow-panel/workflow-panel-view.tsx b/src/views/workflow-panel/workflow-panel-view.tsx
index ec91f3c7..7d9d746d 100644
--- a/src/views/workflow-panel/workflow-panel-view.tsx
+++ b/src/views/workflow-panel/workflow-panel-view.tsx
@@ -2,22 +2,24 @@
 //
 // SPDX-License-Identifier: AGPL-3.0
 
-import * as React from 'react';
-import { DataExplorer } from "~/views-components/data-explorer/data-explorer";
-import { WorkflowIcon } from '~/components/icon/icon';
-import { DataTableDefaultView } from '~/components/data-table-default-view/data-table-default-view';
-import { WORKFLOW_PANEL_ID } from '~/store/workflow-panel/workflow-panel-actions';
+import React from 'react';
+import { DataExplorer } from "views-components/data-explorer/data-explorer";
+import { WorkflowIcon } from 'components/icon/icon';
+import { WORKFLOW_PANEL_ID } from 'store/workflow-panel/workflow-panel-actions';
 import {
     ResourceLastModifiedDate,
-    RosurceWorkflowName,
+    ResourceWorkflowName,
     ResourceWorkflowStatus,
-    ResourceShare
-} from "~/views-components/data-explorer/renderers";
-import { SortDirection } from '~/components/data-table/data-column';
-import { DataColumns } from '~/components/data-table/data-table';
-import { DataTableFilterItem } from '~/components/data-table-filters/data-table-filters';
+    ResourceShare,
+    ResourceRunProcess
+} from "views-components/data-explorer/renderers";
+import { SortDirection } from 'components/data-table/data-column';
+import { DataColumns } from 'components/data-table/data-table';
+import { DataTableFilterItem } from 'components/data-table-filters/data-table-filters';
 import { Grid, Paper } from '@material-ui/core';
 import { WorkflowDetailsCard } from './workflow-description-card';
+import { WorkflowResource } from 'models/workflow';
+import { createTree } from 'models/tree';
 
 export enum WorkflowPanelColumnNames {
     NAME = "Name",
@@ -30,94 +32,111 @@ export interface WorkflowPanelFilter extends DataTableFilterItem {
     type: ResourceStatus;
 }
 
-interface WorkflowPanelDataProps {
-    handleRowDoubleClick: any;
-    handleRowClick: any;
+export interface WorkflowPanelDataProps {
+    workflow?: WorkflowResource;
 }
 
+export interface WorfklowPanelActionProps {
+    handleRowDoubleClick: (workflowUuid: string) => void;
+    handleRowClick: (workflowUuid: string) => void;
+}
+
+export type WorkflowPanelProps = WorkflowPanelDataProps & WorfklowPanelActionProps;
+
 export enum ResourceStatus {
     PUBLIC = "Public",
     PRIVATE = "Private",
     SHARED = "Shared"
 }
 
-const resourceStatus = (type: string) => {
-    switch (type) {
-        case ResourceStatus.PUBLIC:
-            return "Public";
-        case ResourceStatus.PRIVATE:
-            return "Private";
-        case ResourceStatus.SHARED:
-            return "Shared";
-        default:
-            return "Unknown";
-    }
-};
+// TODO: restore filters
+// const resourceStatus = (type: string) => {
+//     switch (type) {
+//         case ResourceStatus.PUBLIC:
+//             return "Public";
+//         case ResourceStatus.PRIVATE:
+//             return "Private";
+//         case ResourceStatus.SHARED:
+//             return "Shared";
+//         default:
+//             return "Unknown";
+//     }
+// };
 
-export const workflowPanelColumns: DataColumns<string, WorkflowPanelFilter> = [
+export const workflowPanelColumns: DataColumns<string, WorkflowResource> = [
     {
         name: WorkflowPanelColumnNames.NAME,
         selected: true,
         configurable: true,
-        sortDirection: SortDirection.ASC,
-        filters: [],
-        render: (uuid: string) => <RosurceWorkflowName uuid={uuid} />
+        sort: {direction: SortDirection.ASC, field: "name"},
+        filters: createTree(),
+        render: (uuid: string) => <ResourceWorkflowName uuid={uuid} />
     },
     {
         name: WorkflowPanelColumnNames.AUTHORISATION,
         selected: true,
         configurable: true,
-        filters: [
-            {
-                name: resourceStatus(ResourceStatus.PUBLIC),
-                selected: true,
-                type: ResourceStatus.PUBLIC
-            },
-            {
-                name: resourceStatus(ResourceStatus.PRIVATE),
-                selected: true,
-                type: ResourceStatus.PRIVATE
-            },
-            {
-                name: resourceStatus(ResourceStatus.SHARED),
-                selected: true,
-                type: ResourceStatus.SHARED
-            }
-        ],
+        filters: createTree(),
+        // TODO: restore filters
+        // filters: [
+        //     {
+        //         name: resourceStatus(ResourceStatus.PUBLIC),
+        //         selected: true,
+        //         type: ResourceStatus.PUBLIC
+        //     },
+        //     {
+        //         name: resourceStatus(ResourceStatus.PRIVATE),
+        //         selected: true,
+        //         type: ResourceStatus.PRIVATE
+        //     },
+        //     {
+        //         name: resourceStatus(ResourceStatus.SHARED),
+        //         selected: true,
+        //         type: ResourceStatus.SHARED
+        //     }
+        // ],
         render: (uuid: string) => <ResourceWorkflowStatus uuid={uuid} />,
     },
     {
         name: WorkflowPanelColumnNames.LAST_MODIFIED,
         selected: true,
         configurable: true,
-        sortDirection: SortDirection.NONE,
-        filters: [],
+        sort: {direction: SortDirection.NONE, field: "modifiedAt"},
+        filters: createTree(),
         render: (uuid: string) => <ResourceLastModifiedDate uuid={uuid} />
     },
     {
         name: '',
         selected: true,
         configurable: false,
-        filters: [],
+        filters: createTree(),
         render: (uuid: string) => <ResourceShare uuid={uuid} />
+    },
+    {
+        name: '',
+        selected: true,
+        configurable: false,
+        filters: createTree(),
+        render: (uuid: string) => <ResourceRunProcess uuid={uuid} />
     }
 ];
 
-export const WorkflowPanelView = ({...props}) => {
-    return <Grid container spacing={16}>
+export const WorkflowPanelView = (props: WorkflowPanelProps) => {
+    return <Grid container spacing={16} style={{ minHeight: '500px' }}>
         <Grid item xs={6}>
             <DataExplorer
                 id={WORKFLOW_PANEL_ID}
                 onRowClick={props.handleRowClick}
                 onRowDoubleClick={props.handleRowDoubleClick}
                 contextMenuColumn={false}
-                onContextMenu={e=>e}
-                dataTableDefaultView={<DataTableDefaultView icon={WorkflowIcon} />} />
+                onContextMenu={e => e}
+                defaultViewIcon={WorkflowIcon}
+                defaultViewMessages={['Workflow list is empty.']} />
         </Grid>
         <Grid item xs={6}>
-            <Paper>
-                <WorkflowDetailsCard />
+            <Paper style={{ height: '100%' }}>
+                <WorkflowDetailsCard workflow={props.workflow} />
             </Paper>
         </Grid>
     </Grid>;
-};
\ No newline at end of file
+};
