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,
16 } from "~/views-components/data-explorer/renderers";
17 import { SortDirection } from '~/components/data-table/data-column';
18 import { DataColumns } from '~/components/data-table/data-table';
19 import { DataTableFilterItem } from '~/components/data-table-filters/data-table-filters';
20 import { Grid, Paper } from '@material-ui/core';
21 import { WorkflowDetailsCard } from './workflow-description-card';
22 import { WorkflowResource } from '~/models/workflow';
23 import { createTree } from '~/models/tree';
25 export enum WorkflowPanelColumnNames {
27 AUTHORISATION = "Authorisation",
28 LAST_MODIFIED = "Last modified",
32 export interface WorkflowPanelFilter extends DataTableFilterItem {
36 export interface WorkflowPanelDataProps {
37 workflow?: WorkflowResource;
40 export interface WorfklowPanelActionProps {
41 handleRowDoubleClick: (workflowUuid: string) => void;
42 handleRowClick: (workflowUuid: string) => void;
45 export type WorkflowPanelProps = WorkflowPanelDataProps & WorfklowPanelActionProps;
47 export enum ResourceStatus {
53 const resourceStatus = (type: string) => {
55 case ResourceStatus.PUBLIC:
57 case ResourceStatus.PRIVATE:
59 case ResourceStatus.SHARED:
66 export const workflowPanelColumns: DataColumns<string> = [
68 name: WorkflowPanelColumnNames.NAME,
71 sortDirection: SortDirection.ASC,
72 filters: createTree(),
73 render: (uuid: string) => <RosurceWorkflowName uuid={uuid} />
76 name: WorkflowPanelColumnNames.AUTHORISATION,
79 filters: createTree(),
80 // TODO: restore filters
83 // name: resourceStatus(ResourceStatus.PUBLIC),
85 // type: ResourceStatus.PUBLIC
88 // name: resourceStatus(ResourceStatus.PRIVATE),
90 // type: ResourceStatus.PRIVATE
93 // name: resourceStatus(ResourceStatus.SHARED),
95 // type: ResourceStatus.SHARED
98 render: (uuid: string) => <ResourceWorkflowStatus uuid={uuid} />,
101 name: WorkflowPanelColumnNames.LAST_MODIFIED,
104 sortDirection: SortDirection.NONE,
105 filters: createTree(),
106 render: (uuid: string) => <ResourceLastModifiedDate uuid={uuid} />
112 filters: createTree(),
113 render: (uuid: string) => <ResourceShare uuid={uuid} />
119 filters: createTree(),
120 render: (uuid: string) => <ResourceRunProcess uuid={uuid} />
124 export const WorkflowPanelView = (props: WorkflowPanelProps) => {
125 return <Grid container spacing={16} style={{ minHeight: '500px' }}>
128 id={WORKFLOW_PANEL_ID}
129 onRowClick={props.handleRowClick}
130 onRowDoubleClick={props.handleRowDoubleClick}
131 contextMenuColumn={false}
132 onContextMenu={e => e}
133 dataTableDefaultView={<DataTableDefaultView icon={WorkflowIcon} />} />
136 <Paper style={{ height: '100%' }}>
137 <WorkflowDetailsCard workflow={props.workflow} />