From: Pawel Kromplewski Date: Tue, 18 Dec 2018 13:25:31 +0000 (+0100) Subject: Merge branch '14434-display-workflow-name' X-Git-Tag: 1.4.0~71^2~14 X-Git-Url: https://git.arvados.org/arvados-workbench2.git/commitdiff_plain/61cd8fe9d4fe4dfeab443f31bbbc5effa5176765?hp=77c99a3667bbbf09734bede8f154ef86a60d823b Merge branch '14434-display-workflow-name' refs #14434 Arvados-DCO-1.1-Signed-off-by: Pawel Kromplewski --- diff --git a/src/common/formatters.ts b/src/common/formatters.ts index ae50ee8a..60e6cd59 100644 --- a/src/common/formatters.ts +++ b/src/common/formatters.ts @@ -4,7 +4,7 @@ import { PropertyValue } from "~/models/search-bar"; -export const formatDate = (isoDate?: string) => { +export const formatDate = (isoDate?: string | null) => { if (isoDate) { const date = new Date(isoDate); const text = date.toLocaleString(); diff --git a/src/components/details-attribute/details-attribute.tsx b/src/components/details-attribute/details-attribute.tsx index 78b4341d..d255d14b 100644 --- a/src/components/details-attribute/details-attribute.tsx +++ b/src/components/details-attribute/details-attribute.tsx @@ -48,17 +48,22 @@ interface DetailsAttributeDataProps { lowercaseValue?: boolean; link?: string; children?: React.ReactNode; + onValueClick?: () => void; } type DetailsAttributeProps = DetailsAttributeDataProps & WithStyles; export const DetailsAttribute = withStyles(styles)( - ({ label, link, value, children, classes, classLabel, classValue, lowercaseValue }: DetailsAttributeProps) => + ({ label, link, value, children, classes, classLabel, classValue, lowercaseValue, onValueClick }: DetailsAttributeProps) => {label} { link ? {value} - : + : {value} {children} } diff --git a/src/store/process-panel/process-panel-actions.ts b/src/store/process-panel/process-panel-actions.ts index 2aa914af..42a718bd 100644 --- a/src/store/process-panel/process-panel-actions.ts +++ b/src/store/process-panel/process-panel-actions.ts @@ -8,9 +8,10 @@ import { Dispatch } from 'redux'; import { ProcessStatus } from '~/store/processes/process'; import { RootState } from '~/store/store'; import { ServiceRepository } from "~/services/services"; -import { navigateToCollection } from '~/store/navigation/navigation-action'; +import { navigateToCollection, navigateToWorkflows } from '~/store/navigation/navigation-action'; import { snackbarActions } from '~/store/snackbar/snackbar-actions'; import { SnackbarKind } from '../snackbar/snackbar-actions'; +import { showWorkflowDetails } from '~/store/workflow-panel/workflow-panel-actions'; export const procesPanelActions = unionize({ SET_PROCESS_PANEL_FILTERS: ofType(), @@ -37,6 +38,12 @@ export const navigateToOutput = (uuid: string) => } }; +export const openWorkflow = (uuid: string) => + (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => { + dispatch(navigateToWorkflows); + dispatch(showWorkflowDetails(uuid)); + }; + export const initProcessPanelFilters = procesPanelActions.SET_PROCESS_PANEL_FILTERS([ ProcessStatus.QUEUED, ProcessStatus.COMPLETED, diff --git a/src/views/process-panel/process-information-card.tsx b/src/views/process-panel/process-information-card.tsx index 7f3e025f..52f13987 100644 --- a/src/views/process-panel/process-information-card.tsx +++ b/src/views/process-panel/process-information-card.tsx @@ -13,7 +13,7 @@ import { DetailsAttribute } from '~/components/details-attribute/details-attribu import { Process } from '~/store/processes/process'; import { getProcessStatus, getProcessStatusColor } from '~/store/processes/process'; import { formatDate } from '~/common/formatters'; - +import { openWorkflow } from "~/store/process-panel/process-panel-actions"; type CssRules = 'card' | 'iconHeader' | 'label' | 'value' | 'chip' | 'link' | 'content' | 'title' | 'avatar'; @@ -70,29 +70,33 @@ export interface ProcessInformationCardDataProps { onContextMenu: (event: React.MouseEvent) => void; openProcessInputDialog: (uuid: string) => void; navigateToOutput: (uuid: string) => void; + navigateToWorkflow: (uuid: string) => void; } type ProcessInformationCardProps = ProcessInformationCardDataProps & WithStyles; export const ProcessInformationCard = withStyles(styles, { withTheme: true })( - ({ classes, process, onContextMenu, theme, openProcessInputDialog, navigateToOutput }: ProcessInformationCardProps) => - + ({ classes, process, onContextMenu, theme, openProcessInputDialog, navigateToOutput, navigateToWorkflow }: ProcessInformationCardProps) => { + const { container } = process; + const startedAt = container ? formatDate(container.startedAt) : 'N/A'; + const finishedAt = container ? formatDate(container.finishedAt) : 'N/A'; + return } + avatar={} action={
+ className={classes.chip} + style={{backgroundColor: getProcessStatusColor(getProcessStatus(process), theme as ArvadosTheme)}}/> onContextMenu(event)}> - +
@@ -109,28 +113,34 @@ export const ProcessInformationCard = withStyles(styles, { withTheme: true })( {getDescription(process)} - } /> + }/> + label='From' + value={process.container ? formatDate(startedAt) : 'N/A'}/> - + label='To' + value={process.container ? formatDate(finishedAt) : 'N/A'}/> + {process.containerRequest.properties.templateUuid && + navigateToWorkflow(process.containerRequest.properties.templateUuid)} + />} navigateToOutput(process.containerRequest.outputUuid!)}> - + openProcessInputDialog(process.containerRequest.uuid)}> - + -
+
; + } ); const getDescription = (process: Process) => diff --git a/src/views/process-panel/process-panel-root.tsx b/src/views/process-panel/process-panel-root.tsx index 73f71e5e..5fb6390c 100644 --- a/src/views/process-panel/process-panel-root.tsx +++ b/src/views/process-panel/process-panel-root.tsx @@ -24,6 +24,7 @@ export interface ProcessPanelRootActionProps { onToggle: (status: string) => void; openProcessInputDialog: (uuid: string) => void; navigateToOutput: (uuid: string) => void; + navigateToWorkflow: (uuid: string) => void; } export type ProcessPanelRootProps = ProcessPanelRootDataProps & ProcessPanelRootActionProps; @@ -36,7 +37,9 @@ export const ProcessPanelRoot = ({ process, ...props }: ProcessPanelRootProps) = process={process} onContextMenu={event => props.onContextMenu(event, process)} openProcessInputDialog={props.openProcessInputDialog} - navigateToOutput={props.navigateToOutput} /> + navigateToOutput={props.navigateToOutput} + navigateToWorkflow={props.navigateToWorkflow} + /> { @@ -35,7 +35,8 @@ const mapDispatchToProps = (dispatch: Dispatch): ProcessPanelRootActionProps => dispatch(toggleProcessPanelFilter(status)); }, openProcessInputDialog: (uuid) => dispatch(openProcessInputDialog(uuid)), - navigateToOutput: (uuid) => dispatch(navigateToOutput(uuid)) + navigateToOutput: (uuid) => dispatch(navigateToOutput(uuid)), + navigateToWorkflow: (uuid) => dispatch(openWorkflow(uuid)) }); export const ProcessPanel = connect(mapStateToProps, mapDispatchToProps)(ProcessPanelRoot);