[arvados-workbench2] created: 2.6.3-51-g8dbd060c
git repository hosting
git at public.arvados.org
Tue Aug 8 21:20:15 UTC 2023
at 8dbd060cdc504973ca88a8bf806dc7eb3f8df31b (commit)
commit 8dbd060cdc504973ca88a8bf806dc7eb3f8df31b
Author: Peter Amstutz <peter.amstutz at curii.com>
Date: Tue Aug 8 17:18:41 2023 -0400
20513: Add "Workflow code" link to details
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz at curii.com>
diff --git a/src/views/process-panel/process-details-attributes.tsx b/src/views/process-panel/process-details-attributes.tsx
index 7bdf8897..4979e391 100644
--- a/src/views/process-panel/process-details-attributes.tsx
+++ b/src/views/process-panel/process-details-attributes.tsx
@@ -13,7 +13,7 @@ import { CollectionName, ContainerRunTime, ResourceWithName } from "views-compon
import { getProcess, getProcessStatus } from "store/processes/process";
import { RootState } from "store/store";
import { connect } from "react-redux";
-import { ProcessResource } from "models/process";
+import { ProcessResource, MOUNT_PATH_CWL_WORKFLOW } from "models/process";
import { ContainerResource } from "models/container";
import { navigateToOutput, openWorkflow } from "store/process-panel/process-panel-actions";
import { ArvadosTheme } from "common/custom-theme";
@@ -21,6 +21,8 @@ import { ProcessRuntimeStatus } from "views-components/process-runtime-status/pr
import { getPropertyChip } from "views-components/resource-properties-form/property-chip";
import { ContainerRequestResource } from "models/container-request";
import { filterResources } from "store/resources/resources";
+import { JSONMount } from 'models/mount-types';
+import { getCollectionUrl } from 'models/collection';
type CssRules = 'link' | 'propertyTag';
@@ -40,8 +42,31 @@ const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
const mapStateToProps = (state: RootState, props: { request: ProcessResource }) => {
const process = getProcess(props.request.uuid)(state.resources);
+
+ let workflowCollection = "";
+ let workflowPath = "";
+ if (process?.containerRequest?.mounts && process.containerRequest.mounts[MOUNT_PATH_CWL_WORKFLOW]) {
+ const wf = process.containerRequest.mounts[MOUNT_PATH_CWL_WORKFLOW] as JSONMount;
+
+ if (wf.content["$graph"] &&
+ wf.content["$graph"].length > 0 &&
+ wf.content["$graph"][0] &&
+ wf.content["$graph"][0]["steps"] &&
+ wf.content["$graph"][0]["steps"][0]) {
+
+ const REGEX = /keep:([0-9a-f]{32}\+\d+)\/(.*)/;
+ const pdh = wf.content["$graph"][0]["steps"][0].run.match(REGEX);
+ if (pdh) {
+ workflowCollection = pdh[1];
+ workflowPath = pdh[2];
+ }
+ }
+ }
+
return {
container: process?.container,
+ workflowCollection,
+ workflowPath,
subprocesses: filterResources((resource: ContainerRequestResource) =>
resource.kind === ResourceKind.CONTAINER_REQUEST &&
resource.requestingContainerUuid === process?.containerRequest.containerUuid
@@ -61,14 +86,20 @@ const mapDispatchToProps = (dispatch: Dispatch): ProcessDetailsAttributesActionP
export const ProcessDetailsAttributes = withStyles(styles, { withTheme: true })(
connect(mapStateToProps, mapDispatchToProps)(
- (props: { request: ProcessResource, container?: ContainerResource, subprocesses: ContainerRequestResource[], twoCol?: boolean, hideProcessPanelRedundantFields?: boolean, classes: Record<CssRules, string> } & ProcessDetailsAttributesActionProps) => {
+ (props: {
+ request: ProcessResource, container?: ContainerResource, subprocesses: ContainerRequestResource[],
+ workflowCollection, workflowPath,
+ twoCol?: boolean, hideProcessPanelRedundantFields?: boolean, classes: Record<CssRules, string>
+ } & ProcessDetailsAttributesActionProps) => {
const containerRequest = props.request;
const container = props.container;
const subprocesses = props.subprocesses;
const classes = props.classes;
const mdSize = props.twoCol ? 6 : 12;
+ const workflowCollection = props.workflowCollection;
+ const workflowPath = props.workflowPath;
const filteredPropertyKeys = Object.keys(containerRequest.properties)
- .filter(k => (typeof containerRequest.properties[k] !== 'object'));
+ .filter(k => (typeof containerRequest.properties[k] !== 'object'));
return <Grid container>
<Grid item xs={12}>
<ProcessRuntimeStatus runtimeStatus={container?.runtimeStatus} containerCount={containerRequest.containerCount} />
@@ -128,8 +159,13 @@ export const ProcessDetailsAttributes = withStyles(styles, { withTheme: true })(
</span>}
</Grid>
{container && container.cost > 0 && <Grid item xs={12} md={mdSize}>
- <DetailsAttribute label='Cost ' value={formatContainerCost(container.cost)} />
+ <DetailsAttribute label='Cost ' value={formatContainerCost(container.cost)} />
</Grid>}
+
+ {container && workflowCollection && <Grid item xs={12} md={mdSize}>
+ <DetailsAttribute label='Workflow code' link={getCollectionUrl(workflowCollection)} value={workflowPath} />
+ </Grid>}
+
{containerRequest && containerRequest.cumulativeCost > 0 && subprocesses.length > 0 && <Grid item xs={12} md={mdSize}>
<DetailsAttribute label='Container & subprocess cost' value={formatContainerCost(containerRequest.cumulativeCost)} />
</Grid>}
@@ -144,9 +180,9 @@ export const ProcessDetailsAttributes = withStyles(styles, { withTheme: true })(
<DetailsAttribute label='Priority' value={containerRequest.priority} />
</Grid>
{/*
- NOTE: The property list should be kept at the bottom, because it spans
- the entire available width, without regards of the twoCol prop.
- */}
+ NOTE: The property list should be kept at the bottom, because it spans
+ the entire available width, without regards of the twoCol prop.
+ */}
<Grid item xs={12} md={12}>
<DetailsAttribute label='Properties' />
{filteredPropertyKeys.length > 0
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list