X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/d9ee24d0f78a21603e2276d0d3142d4db40a831b..7ea638f63582f5c9b6ab696c3dcb1855778d2432:/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 47ec76c8..c118017d 100644
--- a/src/views-components/data-explorer/renderers.tsx
+++ b/src/views-components/data-explorer/renderers.tsx
@@ -7,13 +7,13 @@ import { Grid, Typography, withStyles, Tooltip, IconButton, Checkbox } from '@ma
import { FavoriteStar, PublicFavoriteStar } from '../favorite-star/favorite-star';
import { ResourceKind, TrashableResource } from '~/models/resource';
import { ProjectIcon, CollectionIcon, ProcessIcon, DefaultIcon, WorkflowIcon, ShareIcon } from '~/components/icon/icon';
-import { formatDate, formatFileSize } from '~/common/formatters';
+import { formatDate, formatFileSize, formatTime } from '~/common/formatters';
import { resourceLabel } from '~/common/labels';
import { connect, DispatchProp } from 'react-redux';
import { RootState } from '~/store/store';
import { getResource } from '~/store/resources/resources';
import { GroupContentsResource } from '~/services/groups-service/groups-service';
-import { getProcess, Process, getProcessStatus, getProcessStatusColor } from '~/store/processes/process';
+import { getProcess, Process, getProcessStatus, getProcessStatusColor, getProcessRuntime } from '~/store/processes/process';
import { ArvadosTheme } from '~/common/custom-theme';
import { compose, Dispatch } from 'redux';
import { WorkflowResource } from '~/models/workflow';
@@ -35,9 +35,9 @@ const renderName = (dispatch: Dispatch, item: { name: string; uuid: string, kind
dispatch(navigateTo(item.uuid))}>
- { item.kind === ResourceKind.PROJECT || item.kind === ResourceKind.COLLECTION
+ {item.kind === ResourceKind.PROJECT || item.kind === ResourceKind.COLLECTION
?
- : null }
+ : null}
{item.name}
@@ -383,6 +383,12 @@ export const ResourceLastModifiedDate = connect(
return { date: resource ? resource.modifiedAt : '' };
})((props: { date: string }) => renderDate(props.date));
+export const ResourceCreatedAtDate = connect(
+ (state: RootState, props: { uuid: string }) => {
+ const resource = getResource(props.uuid)(state.resources);
+ return { date: resource ? resource.createdAt : '' };
+ })((props: { date: string }) => renderDate(props.date));
+
export const ResourceTrashDate = connect(
(state: RootState, props: { uuid: string }) => {
const resource = getResource(props.uuid)(state.resources);
@@ -449,3 +455,47 @@ export const ProcessStatus = compose(
{status}
;
});
+
+export const renderRunTime = (time: number) =>
+
+ {formatTime(time, true)}
+ ;
+
+interface ContainerRunTimeProps {
+ process: Process;
+}
+
+interface ContainerRunTimeState {
+ runtime: number;
+}
+
+export const ContainerRunTime = connect((state: RootState, props: { uuid: string }) => {
+ return { process: getProcess(props.uuid)(state.resources) };
+})(class extends React.Component {
+ private timer: any;
+
+ constructor(props: ContainerRunTimeProps) {
+ super(props);
+ this.state = { runtime: this.getRuntime() };
+ }
+
+ getRuntime() {
+ return this.props.process ? getProcessRuntime(this.props.process) : 0;
+ }
+
+ updateRuntime() {
+ this.setState({ runtime: this.getRuntime() });
+ }
+
+ componentDidMount() {
+ this.timer = setInterval(this.updateRuntime.bind(this), 5000);
+ }
+
+ componentWillUnmount() {
+ clearInterval(this.timer);
+ }
+
+ render() {
+ return renderRunTime(this.state.runtime);
+ }
+});