1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import React from 'react';
6 import { DataExplorer } from "views-components/data-explorer/data-explorer";
7 import { WorkflowIcon } from 'components/icon/icon';
8 import { WORKFLOW_PANEL_ID } from 'store/workflow-panel/workflow-panel-actions';
10 ResourceLastModifiedDate,
12 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';
21 import { WorkflowResource } from 'models/workflow';
22 import { createTree } from 'models/tree';
24 export enum WorkflowPanelColumnNames {
26 AUTHORISATION = "Authorisation",
27 LAST_MODIFIED = "Last modified",
31 export interface WorkflowPanelFilter extends DataTableFilterItem {
35 export interface WorkflowPanelDataProps {
36 workflow?: WorkflowResource;
39 export interface WorfklowPanelActionProps {
40 handleRowDoubleClick: (workflowUuid: string) => void;
41 handleRowClick: (workflowUuid: string) => void;
44 export type WorkflowPanelProps = WorkflowPanelDataProps & WorfklowPanelActionProps;
46 export enum ResourceStatus {
52 // TODO: restore filters
53 // const resourceStatus = (type: string) => {
55 // case ResourceStatus.PUBLIC:
57 // case ResourceStatus.PRIVATE:
59 // case ResourceStatus.SHARED:
66 export const workflowPanelColumns: DataColumns<string, WorkflowResource> = [
68 name: WorkflowPanelColumnNames.NAME,
71 sort: {direction: SortDirection.ASC, field: "name"},
72 filters: createTree(),
73 render: (uuid: string) => <ResourceWorkflowName 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 sort: {direction: SortDirection.NONE, field: "modifiedAt"},
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 defaultViewIcon={WorkflowIcon}
134 defaultViewMessages={['Workflow list is empty.']} />
137 <Paper style={{ height: '100%' }}>
138 <WorkflowDetailsCard workflow={props.workflow} />