X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/5627bf1a83323d2b0364cb069564998eb8c6ca7a..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 abf1839286..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 } 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 { 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}
@@ -35,7 +36,7 @@ export const renderName = (item: { name: string; uuid: string, kind: string }) =
export const ResourceName = connect(
(state: RootState, props: { uuid: string }) => {
- const resource = getResource(props.uuid)(state.resources) as GroupContentsResource | undefined;
+ const resource = getResource(props.uuid)(state.resources);
return resource || { name: '', uuid: '', kind: '' };
})(renderName);
@@ -47,29 +48,43 @@ 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)};
+export const renderDate = (date?: string) => {
+ return {formatDate(date)};
};
export const ResourceLastModifiedDate = connect(
(state: RootState, props: { uuid: string }) => {
- const resource = getResource(props.uuid)(state.resources) as GroupContentsResource | undefined;
+ const resource = getResource(props.uuid)(state.resources);
return { date: resource ? resource.modifiedAt : '' };
})((props: { date: string }) => renderDate(props.date));
+export const ResourceTrashDate = connect(
+ (state: RootState, props: { uuid: string }) => {
+ 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);
+ return { date: resource ? resource.deleteAt : '' };
+ })((props: { date: string }) => renderDate(props.date));
+
export const renderFileSize = (fileSize?: number) =>
-
+
{formatFileSize(fileSize)}
;
export const ResourceFileSize = connect(
(state: RootState, props: { uuid: string }) => {
- const resource = getResource(props.uuid)(state.resources) as GroupContentsResource | undefined;
+ const resource = getResource(props.uuid)(state.resources);
return {};
})((props: { fileSize?: number }) => renderFileSize(props.fileSize));
@@ -80,7 +95,7 @@ export const renderOwner = (owner: string) =>
export const ResourceOwner = connect(
(state: RootState, props: { uuid: string }) => {
- const resource = getResource(props.uuid)(state.resources) as GroupContentsResource | undefined;
+ const resource = getResource(props.uuid)(state.resources);
return { owner: resource ? resource.ownerUuid : '' };
})((props: { owner: string }) => renderOwner(props.owner));
@@ -91,17 +106,21 @@ export const renderType = (type: string) =>
export const ResourceType = connect(
(state: RootState, props: { uuid: string }) => {
- const resource = getResource(props.uuid)(state.resources) as GroupContentsResource | undefined;
+ const resource = getResource(props.uuid)(state.resources);
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) as ProcessResource | undefined;
- 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}
+ ;
+ });