1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import * as React from 'react';
6 import { DataExplorer } from "~/views-components/data-explorer/data-explorer";
7 import { WorkflowIcon } from '~/components/icon/icon';
8 import { DataTableDefaultView } from '~/components/data-table-default-view/data-table-default-view';
9 import { WORKFLOW_PANEL_ID } from '~/store/workflow-panel/workflow-panel-actions';
11 ResourceLastModifiedDate,
13 ResourceWorkflowStatus,
15 } from "~/views-components/data-explorer/renderers";
16 import { SortDirection } from '~/components/data-table/data-column';
17 import { DataColumns } from '~/components/data-table/data-table';
18 import { DataTableFilterItem } from '~/components/data-table-filters/data-table-filters';
19 import { Grid, Paper } from '@material-ui/core';
20 import { WorkflowDetailsCard } from './workflow-description-card';
22 export enum WorkflowPanelColumnNames {
24 AUTHORISATION = "Authorisation",
25 LAST_MODIFIED = "Last modified",
29 export interface WorkflowPanelFilter extends DataTableFilterItem {
33 interface WorkflowPanelDataProps {
34 handleRowDoubleClick: any;
38 export enum ResourceStatus {
44 const resourceStatus = (type: string) => {
46 case ResourceStatus.PUBLIC:
48 case ResourceStatus.PRIVATE:
50 case ResourceStatus.SHARED:
57 export const workflowPanelColumns: DataColumns<string, WorkflowPanelFilter> = [
59 name: WorkflowPanelColumnNames.NAME,
62 sortDirection: SortDirection.ASC,
64 render: (uuid: string) => <RosurceWorkflowName uuid={uuid} />
67 name: WorkflowPanelColumnNames.AUTHORISATION,
72 name: resourceStatus(ResourceStatus.PUBLIC),
74 type: ResourceStatus.PUBLIC
77 name: resourceStatus(ResourceStatus.PRIVATE),
79 type: ResourceStatus.PRIVATE
82 name: resourceStatus(ResourceStatus.SHARED),
84 type: ResourceStatus.SHARED
87 render: (uuid: string) => <ResourceWorkflowStatus uuid={uuid} />,
90 name: WorkflowPanelColumnNames.LAST_MODIFIED,
93 sortDirection: SortDirection.NONE,
95 render: (uuid: string) => <ResourceLastModifiedDate uuid={uuid} />
102 render: (uuid: string) => <ResourceShare uuid={uuid} />
106 export const WorkflowPanelView = ({...props}) => {
107 return <Grid container spacing={16}>
110 id={WORKFLOW_PANEL_ID}
111 onRowClick={props.handleRowClick}
112 onRowDoubleClick={props.handleRowDoubleClick}
113 contextMenuColumn={false}
114 dataTableDefaultView={<DataTableDefaultView icon={WorkflowIcon} />} />
118 <WorkflowDetailsCard />