X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/58db72fee358d5987139a1b8526c0ca873e07dbf..7db41995e4c8d77094f8dad71902de30b1650b37:/src/views/process-panel/process-details-attributes.tsx diff --git a/src/views/process-panel/process-details-attributes.tsx b/src/views/process-panel/process-details-attributes.tsx index 4f26a71f78..6f3277cbf6 100644 --- a/src/views/process-panel/process-details-attributes.tsx +++ b/src/views/process-panel/process-details-attributes.tsx @@ -3,63 +3,135 @@ // SPDX-License-Identifier: AGPL-3.0 import React from "react"; -import { Grid } from "@material-ui/core"; +import { Grid, StyleRulesCallback, withStyles } from "@material-ui/core"; +import { Dispatch } from 'redux'; import { formatDate } from "common/formatters"; import { resourceLabel } from "common/labels"; import { DetailsAttribute } from "components/details-attribute/details-attribute"; -import { ProcessResource } from "models/process"; import { ResourceKind } from "models/resource"; -import { ResourceOwnerWithName } from "views-components/data-explorer/renderers"; +import { CollectionName, ContainerRunTime, ResourceWithName } from "views-components/data-explorer/renderers"; +import { getProcess, getProcessStatus } from "store/processes/process"; +import { RootState } from "store/store"; +import { connect } from "react-redux"; +import { ProcessResource } from "models/process"; +import { ContainerResource } from "models/container"; +import { navigateToOutput, openWorkflow } from "store/process-panel/process-panel-actions"; +import { ArvadosTheme } from "common/custom-theme"; +import { ProcessRuntimeStatus } from "views-components/process-runtime-status/process-runtime-status"; +import { getPropertyChip } from "views-components/resource-properties-form/property-chip"; + +type CssRules = 'link' | 'propertyTag'; -type CssRules = 'label' | 'value'; +const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ + link: { + fontSize: '0.875rem', + color: theme.palette.primary.main, + '&:hover': { + cursor: 'pointer' + } + }, + propertyTag: { + marginRight: theme.spacing.unit / 2, + marginBottom: theme.spacing.unit / 2 + }, +}); -export const ProcessDetailsAttributes = (props: { item: ProcessResource, twoCol?: boolean, classes?: Record }) => { - const item = props.item; - const classes = props.classes || { label: '', value: '', button: '' }; - const mdSize = props.twoCol ? 6 : 12; - return - - - - - } /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; +const mapStateToProps = (state: RootState, props: { request: ProcessResource }) => { + return { + container: getProcess(props.request.uuid)(state.resources)?.container, + }; }; + +interface ProcessDetailsAttributesActionProps { + navigateToOutput: (uuid: string) => void; + openWorkflow: (uuid: string) => void; +} + +const mapDispatchToProps = (dispatch: Dispatch): ProcessDetailsAttributesActionProps => ({ + navigateToOutput: (uuid) => dispatch(navigateToOutput(uuid)), + openWorkflow: (uuid) => dispatch(openWorkflow(uuid)), +}); + +export const ProcessDetailsAttributes = withStyles(styles, { withTheme: true })( + connect(mapStateToProps, mapDispatchToProps)( + (props: { request: ProcessResource, container?: ContainerResource, twoCol?: boolean, hideProcessPanelRedundantFields?: boolean, classes: Record } & ProcessDetailsAttributesActionProps) => { + const containerRequest = props.request; + const container = props.container; + const classes = props.classes; + const mdSize = props.twoCol ? 6 : 12; + return + + + + {!props.hideProcessPanelRedundantFields && + + } + + + + + + + + } /> + + + + + {!props.hideProcessPanelRedundantFields && + + } + + + + + + + + + + + + + + + + + + + + {containerRequest.outputUuid && props.navigateToOutput(containerRequest.outputUuid!)}> + + } + + {containerRequest.properties.template_uuid && + + props.openWorkflow(containerRequest.properties.template_uuid)}> + + + } + + + + {/* + NOTE: The property list should be kept at the bottom, because it spans + the entire available width, without regards of the twoCol prop. + */} + + + {Object.keys(containerRequest.properties).length > 0 + ? Object.keys(containerRequest.properties).map(k => + Array.isArray(containerRequest.properties[k]) + ? containerRequest.properties[k].map((v: string) => + getPropertyChip(k, v, undefined, classes.propertyTag)) + : getPropertyChip(k, containerRequest.properties[k], undefined, classes.propertyTag)) + :
No properties
} +
+
; + } + ) +);