[ARVADOS-WORKBENCH2] updated: 1.2.0-226-gd1272ea
Git user
git at public.curoverse.com
Fri Aug 31 07:12:34 EDT 2018
Summary of changes:
src/common/api/common-resource-service.ts | 2 +-
src/common/formatters.ts | 11 +++++
src/index.tsx | 9 ++--
src/store/processes/process.ts | 28 +++++++----
src/store/processes/processes-actions.ts | 9 ++--
src/views/process-panel/process-panel-root.tsx | 8 +++-
src/views/process-panel/process-panel.tsx | 5 +-
.../process-panel/process-subprocesses-card.tsx | 30 +++++++++---
src/views/process-panel/process-subprocesses.tsx | 56 +++-------------------
src/websocket/resource-event-message.ts | 23 +++++++++
src/websocket/websocket-service.ts | 47 ++++++++++++++++++
src/websocket/websocket.ts | 35 ++++++++++++++
12 files changed, 185 insertions(+), 78 deletions(-)
create mode 100644 src/websocket/resource-event-message.ts
create mode 100644 src/websocket/websocket-service.ts
create mode 100644 src/websocket/websocket.ts
via d1272ea9203c4d6b644be3159c80eaf136f4e08c (commit)
via e7af6c00434d5eb34c72ac714cfd450052185762 (commit)
via c7f6c72066b4f334e43a2bd1c9a9dcf0e703d1f4 (commit)
via e602a1284fb49aa9f7e727e828e48638a657cebb (commit)
via 18e651dbee6e598bd79576b178fb4d755cd7a424 (commit)
via de93a71c82562f2fdedfd485c5d0164651300140 (commit)
from 97de0bf90660e72220f350483981e35d53a5998f (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit d1272ea9203c4d6b644be3159c80eaf136f4e08c
Author: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>
Date: Fri Aug 31 13:12:26 2018 +0200
cr changes
Feature #13859
Arvados-DCO-1.1-Signed-off-by: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>
diff --git a/src/common/formatters.ts b/src/common/formatters.ts
index 49e0690..a7680a0 100644
--- a/src/common/formatters.ts
+++ b/src/common/formatters.ts
@@ -19,6 +19,17 @@ export const formatFileSize = (size?: number) => {
return "";
};
+export const msToTime = (time: number) => {
+ const minutes = Math.floor(time / (1000 * 60) % 60).toFixed(0);
+ const hours = Math.floor(time / (1000 * 60 * 60)).toFixed(0);
+
+ return hours + "h " + minutes + "m";
+};
+
+export const getDiffTime = (endTime: string, startTime: string) => {
+ return new Date(endTime).getTime() - new Date(startTime).getTime();
+};
+
export const formatProgress = (loaded: number, total: number) => {
const progress = loaded >= 0 && total > 0 ? loaded * 100 / total : 0;
return `${progress.toFixed(2)}%`;
diff --git a/src/store/processes/process.ts b/src/store/processes/process.ts
index 0f12b3f..98a84fd 100644
--- a/src/store/processes/process.ts
+++ b/src/store/processes/process.ts
@@ -7,6 +7,7 @@ import { ContainerResource } from '../../models/container';
import { ResourcesState, getResource } from '~/store/resources/resources';
import { filterResources } from '../resources/resources';
import { ResourceKind, Resource } from '~/models/resource';
+import { getDiffTime } from '~/common/formatters';
export interface Process {
containerRequest: ContainerRequestResource;
@@ -41,6 +42,11 @@ export const getSubprocesses = (uuid: string) => (resources: ResourcesState) =>
return [];
};
+export const getProcessRuntime = (subprocess: Process) =>
+ subprocess.container
+ ? getDiffTime(subprocess.container.finishedAt || '', subprocess.container.startedAt || '')
+ : 0;
+
export const getProcessStatus = (process: Process) =>
process.container
? process.container.state
diff --git a/src/views/process-panel/process-panel-root.tsx b/src/views/process-panel/process-panel-root.tsx
index 49ce98c..443dbeb 100644
--- a/src/views/process-panel/process-panel-root.tsx
+++ b/src/views/process-panel/process-panel-root.tsx
@@ -10,12 +10,13 @@ import { ProcessIcon } from '~/components/icon/icon';
import { Process } from '~/store/processes/process';
import { SubprocessesCard } from './subprocesses-card';
import { ProcessSubprocesses } from '~/views-components/process-subprocesses/process-subprocesses';
-import { SubprocessesStatus } from '~/views/process-panel/process-subprocesses';
+import { SubprocessesStatus } from '~/views/process-panel/process-subprocesses-card';
type CssRules = 'headerActive' | 'headerCompleted' | 'headerQueued' | 'headerFailed' | 'headerCanceled';
export interface ProcessPanelRootDataProps {
process?: Process;
+ subprocesses: Array<Process>;
}
export interface ProcessPanelRootActionProps {
@@ -63,7 +64,10 @@ export const ProcessPanelRoot = (props: ProcessPanelRootProps) =>
onToggle={() => { return; }}
/>
</Grid>
- <ProcessSubprocesses />
+ <Grid item xs={12}>
+ <ProcessSubprocesses
+ subprocesses={props.subprocesses} />
+ </Grid>
</Grid>
: <Grid container
alignItems='center'
diff --git a/src/views/process-panel/process-panel.tsx b/src/views/process-panel/process-panel.tsx
index 421945f..9f1d0ad 100644
--- a/src/views/process-panel/process-panel.tsx
+++ b/src/views/process-panel/process-panel.tsx
@@ -5,7 +5,7 @@
import * as React from 'react';
import { RootState } from '~/store/store';
import { connect } from 'react-redux';
-import { getProcess } from '~/store/processes/process';
+import { getProcess, getSubprocesses } from '~/store/processes/process';
import { Dispatch } from 'redux';
import { openProcessContextMenu } from '~/store/context-menu/context-menu-actions';
import { matchProcessRoute } from '~/routes/routes';
@@ -16,7 +16,8 @@ const mapStateToProps = ({ router, resources }: RootState): ProcessPanelRootData
const match = matchProcessRoute(pathname);
const uuid = match ? match.params.id : '';
return {
- process: getProcess(uuid)(resources)
+ process: getProcess(uuid)(resources),
+ subprocesses: getSubprocesses(uuid)(resources)
};
};
diff --git a/src/views/process-panel/process-subprocesses-card.tsx b/src/views/process-panel/process-subprocesses-card.tsx
index 17c4424..72104a7 100644
--- a/src/views/process-panel/process-subprocesses-card.tsx
+++ b/src/views/process-panel/process-subprocesses-card.tsx
@@ -12,6 +12,8 @@ import { ArvadosTheme } from '~/common/custom-theme';
import { MoreOptionsIcon } from '~/components/icon/icon';
import { DetailsAttribute } from '~/components/details-attribute/details-attribute';
import { getBackgroundColorStatus } from '~/views/process-panel/process-panel-root';
+import { Process, getProcessStatus, getProcessRuntime } from '~/store/processes/process';
+import { msToTime } from '~/common/formatters';
export type CssRules = 'label' | 'value' | 'title' | 'content' | 'action' | 'options' | 'status' | 'rightSideHeader' | 'titleHeader'
| 'header' | 'headerActive' | 'headerCompleted' | 'headerQueued' | 'headerFailed' | 'headerCanceled';
@@ -73,23 +75,37 @@ const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
},
});
+export enum SubprocessesStatus {
+ ACTIVE = 'Active',
+ COMPLETED = 'Completed',
+ QUEUED = 'Queued',
+ FAILED = 'Failed',
+ CANCELED = 'Canceled'
+}
+
+export interface SubprocessItemProps {
+ title: string;
+ status: string;
+ runtime?: string;
+}
+
export interface ProcessSubprocessesCardDataProps {
onContextMenu: (event: React.MouseEvent<HTMLElement>) => void;
- items: any;
+ subprocess: Process;
}
type ProcessSubprocessesCardProps = ProcessSubprocessesCardDataProps & WithStyles<CssRules>;
export const ProcessSubprocessesCard = withStyles(styles)(
- ({ classes, onContextMenu, items }: ProcessSubprocessesCardProps) => {
+ ({ classes, onContextMenu, subprocess }: ProcessSubprocessesCardProps) => {
return <Card>
<CardHeader
- className={classnames([classes.header, getBackgroundColorStatus(items.status, classes)])}
+ className={classnames([classes.header, getBackgroundColorStatus(getProcessStatus(subprocess), classes)])}
classes={{ content: classes.title, action: classes.action }}
action={
<div className={classes.rightSideHeader}>
<Typography noWrap variant="body2" className={classes.status}>
- {items.status}
+ {getProcessStatus(subprocess)}
</Typography>
<IconButton
className={classes.options}
@@ -100,15 +116,15 @@ export const ProcessSubprocessesCard = withStyles(styles)(
</div>
}
title={
- <Tooltip title={items.title}>
+ <Tooltip title={subprocess.containerRequest.name}>
<Typography noWrap variant="body2" className={classes.titleHeader}>
- {items.title}
+ {subprocess.containerRequest.name}
</Typography>
</Tooltip>
} />
<CardContent className={classes.content}>
<DetailsAttribute classLabel={classes.label} classValue={classes.value}
- label='Runtime' value="0h 2m" />
+ label="Runtime" value={msToTime(getProcessRuntime(subprocess))} />
</CardContent>
</Card>;
});
\ No newline at end of file
diff --git a/src/views/process-panel/process-subprocesses.tsx b/src/views/process-panel/process-subprocesses.tsx
index 4ab444c..cfd517c 100644
--- a/src/views/process-panel/process-subprocesses.tsx
+++ b/src/views/process-panel/process-subprocesses.tsx
@@ -5,63 +5,19 @@
import * as React from 'react';
import { Grid } from '@material-ui/core';
import { ProcessSubprocessesCard } from '~/views/process-panel/process-subprocesses-card';
-
-export enum SubprocessesStatus {
- ACTIVE = 'Active',
- COMPLETED = 'Completed',
- QUEUED = 'Queued',
- FAILED = 'Failed',
- CANCELED = 'Canceled'
-}
+import { Process } from '~/store/processes/process';
export interface ProcessSubprocessesDataProps {
+ subprocesses: Array<Process>;
onContextMenu: (event: React.MouseEvent<HTMLElement>) => void;
}
-interface SubprocessesProps {
- title: string;
- status: string;
- runtime?: string;
-}
-
-export const ProcessSubprocesses = ({ onContextMenu }: ProcessSubprocessesDataProps) => {
+export const ProcessSubprocesses = ({ onContextMenu, subprocesses }: ProcessSubprocessesDataProps) => {
return <Grid container spacing={16}>
- {items.map(it =>
- <Grid item xs={2} key={it.title}>
- <ProcessSubprocessesCard onContextMenu={onContextMenu} items={it} />
+ {subprocesses.map(subprocess =>
+ <Grid item xs={2} key={subprocess.containerRequest.uuid}>
+ <ProcessSubprocessesCard onContextMenu={onContextMenu} subprocess={subprocess}/>
</Grid>
)}
</Grid>;
};
-
-const items: Array<SubprocessesProps> = [
- {
- title: 'cos1',
- status: SubprocessesStatus.ACTIVE
- },
- {
- title: 'cos2',
- status: SubprocessesStatus.FAILED
- },
- {
- title: 'cos3',
- status: SubprocessesStatus.QUEUED
- },
- {
- title: 'cos4',
- status: SubprocessesStatus.CANCELED
- },
- {
- title: 'cos5',
- status: SubprocessesStatus.COMPLETED
- },
- {
- title: 'cos6',
- status: SubprocessesStatus.COMPLETED
- },
- {
- title: 'cos7',
- status: SubprocessesStatus.COMPLETED
- },
-];
-
commit e7af6c00434d5eb34c72ac714cfd450052185762
Merge: 97de0bf c7f6c72
Author: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>
Date: Fri Aug 31 10:56:27 2018 +0200
Merge branch 'master' into 13859-process-view-subprocesses
refs #13859
Arvados-DCO-1.1-Signed-off-by: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list