X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/46f597da5c34d80250cc7efd87d2ce087528ed5f..9ea087b587f8139416cea16fbe4caad0d6df90c4:/src/views-components/data-explorer/renderers.tsx diff --git a/src/views-components/data-explorer/renderers.tsx b/src/views-components/data-explorer/renderers.tsx index 9bcbcf611c..b9475f5010 100644 --- a/src/views-components/data-explorer/renderers.tsx +++ b/src/views-components/data-explorer/renderers.tsx @@ -3,18 +3,19 @@ // SPDX-License-Identifier: AGPL-3.0 import * as React from 'react'; -import { Grid, Typography } from '@material-ui/core'; +import { Grid, Typography, withStyles } from '@material-ui/core'; import { FavoriteStar } from '../favorite-star/favorite-star'; -import { ResourceKind, TrashResource } from '~/models/resource'; -import { ProjectIcon, CollectionIcon, ProcessIcon, DefaultIcon } from '~/components/icon/icon'; +import { ResourceKind, TrashableResource } from '~/models/resource'; +import { ProjectIcon, CollectionIcon, ProcessIcon, DefaultIcon, WorkflowIcon } from '~/components/icon/icon'; import { formatDate, formatFileSize } from '~/common/formatters'; import { resourceLabel } from '~/common/labels'; import { connect } from 'react-redux'; import { RootState } from '~/store/store'; import { getResource } from '~/store/resources/resources'; import { GroupContentsResource } from '~/services/groups-service/groups-service'; -import { ProcessResource } from '~/models/process'; - +import { getProcess, Process, getProcessStatus, getProcessStatusColor } from '~/store/processes/process'; +import { ArvadosTheme } from '~/common/custom-theme'; +import { compose } from 'redux'; export const renderName = (item: { name: string; uuid: string, kind: string }) => @@ -22,7 +23,7 @@ export const renderName = (item: { name: string; uuid: string, kind: string }) = {renderIcon(item)} - + {item.name} @@ -47,13 +48,15 @@ export const renderIcon = (item: { kind: string }) => { return ; case ResourceKind.PROCESS: return ; + case ResourceKind.WORKFLOW: + return ; default: return ; } }; export const renderDate = (date?: string) => { - return {formatDate(date)}; + return {formatDate(date)}; }; export const ResourceLastModifiedDate = connect( @@ -64,18 +67,18 @@ export const ResourceLastModifiedDate = connect( export const ResourceTrashDate = connect( (state: RootState, props: { uuid: string }) => { - const resource = getResource(props.uuid)(state.resources); + const resource = getResource(props.uuid)(state.resources); return { date: resource ? resource.trashAt : '' }; })((props: { date: string }) => renderDate(props.date)); export const ResourceDeleteDate = connect( (state: RootState, props: { uuid: string }) => { - const resource = getResource(props.uuid)(state.resources); + const resource = getResource(props.uuid)(state.resources); return { date: resource ? resource.deleteAt : '' }; })((props: { date: string }) => renderDate(props.date)); export const renderFileSize = (fileSize?: number) => - + {formatFileSize(fileSize)} ; @@ -107,13 +110,17 @@ export const ResourceType = connect( return { type: resource ? resource.kind : '' }; })((props: { type: string }) => renderType(props.type)); -export const renderStatus = (item: { status?: string }) => - - {item.status || "-"} - ; - -export const ProcessStatus = connect( - (state: RootState, props: { uuid: string }) => { - const resource = getResource(props.uuid)(state.resources); - return { status: resource ? resource.state : '-' }; - })((props: { status: string }) => renderType(props.status)); +export const ProcessStatus = compose( + connect((state: RootState, props: { uuid: string }) => { + return { process: getProcess(props.uuid)(state.resources) }; + }), + withStyles({}, { withTheme: true })) + ((props: { process?: Process, theme: ArvadosTheme }) => { + const status = props.process ? getProcessStatus(props.process) : "-"; + return + {status} + ; + });