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 { 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 // TODO: restore filters
54 // const resourceStatus = (type: string) => {
56 // case ResourceStatus.PUBLIC:
58 // case ResourceStatus.PRIVATE:
60 // case ResourceStatus.SHARED:
67 export const workflowPanelColumns: DataColumns<string> = [
69 name: WorkflowPanelColumnNames.NAME,
72 sortDirection: SortDirection.ASC,
73 filters: createTree(),
74 render: (uuid: string) => <ResourceWorkflowName uuid={uuid} />
77 name: WorkflowPanelColumnNames.AUTHORISATION,
80 filters: createTree(),
81 // TODO: restore filters
84 // name: resourceStatus(ResourceStatus.PUBLIC),
86 // type: ResourceStatus.PUBLIC
89 // name: resourceStatus(ResourceStatus.PRIVATE),
91 // type: ResourceStatus.PRIVATE
94 // name: resourceStatus(ResourceStatus.SHARED),
96 // type: ResourceStatus.SHARED
99 render: (uuid: string) => <ResourceWorkflowStatus uuid={uuid} />,
102 name: WorkflowPanelColumnNames.LAST_MODIFIED,
105 sortDirection: SortDirection.NONE,
106 filters: createTree(),
107 render: (uuid: string) => <ResourceLastModifiedDate uuid={uuid} />
113 filters: createTree(),
114 render: (uuid: string) => <ResourceShare uuid={uuid} />
120 filters: createTree(),
121 render: (uuid: string) => <ResourceRunProcess uuid={uuid} />
125 export const WorkflowPanelView = (props: WorkflowPanelProps) => {
126 return <Grid container spacing={16} style={{ minHeight: '500px' }}>
129 id={WORKFLOW_PANEL_ID}
130 onRowClick={props.handleRowClick}
131 onRowDoubleClick={props.handleRowDoubleClick}
132 contextMenuColumn={false}
133 onContextMenu={e => e}
134 dataTableDefaultView={<DataTableDefaultView icon={WorkflowIcon} />} />
137 <Paper style={{ height: '100%' }}>
138 <WorkflowDetailsCard workflow={props.workflow} />