From ea4fcb4423e68561e2041465248fa3ef79ebe2e8 Mon Sep 17 00:00:00 2001 From: Ahmed Awan Date: Thu, 1 Aug 2024 10:59:47 -0500 Subject: [PATCH] add a tab view for jobs under a step in invocation view --- client/src/api/jobs.ts | 1 + .../WorkflowInvocationState/JobStepTabs.vue | 105 ++++++++++++++++++ .../WorkflowInvocationStep.vue | 34 ++++-- client/src/composables/useInvocationGraph.ts | 12 +- 4 files changed, 140 insertions(+), 12 deletions(-) create mode 100644 client/src/components/WorkflowInvocationState/JobStepTabs.vue diff --git a/client/src/api/jobs.ts b/client/src/api/jobs.ts index 661d412d2849..a4d3499fae51 100644 --- a/client/src/api/jobs.ts +++ b/client/src/api/jobs.ts @@ -2,5 +2,6 @@ import { type components } from "@/api/schema"; export type JobDestinationParams = components["schemas"]["JobDestinationParams"]; export type ShowFullJobResponse = components["schemas"]["ShowFullJobResponse"]; +export type JobBaseModel = components["schemas"]["JobBaseModel"]; export type JobDetails = components["schemas"]["ShowFullJobResponse"] | components["schemas"]["EncodedJobDetails"]; export type JobInputSummary = components["schemas"]["JobInputSummary"]; diff --git a/client/src/components/WorkflowInvocationState/JobStepTabs.vue b/client/src/components/WorkflowInvocationState/JobStepTabs.vue new file mode 100644 index 000000000000..35c1e260282a --- /dev/null +++ b/client/src/components/WorkflowInvocationState/JobStepTabs.vue @@ -0,0 +1,105 @@ + + + diff --git a/client/src/components/WorkflowInvocationState/WorkflowInvocationStep.vue b/client/src/components/WorkflowInvocationState/WorkflowInvocationStep.vue index 449b3dedf26a..e95e19f8957f 100644 --- a/client/src/components/WorkflowInvocationState/WorkflowInvocationStep.vue +++ b/client/src/components/WorkflowInvocationState/WorkflowInvocationStep.vue @@ -51,15 +51,18 @@ class="invocation-step-job-details" :open="inGraphView"> - Jobs (Click on any job to view its details) + {{ jobStepHeading(stepDetails) }} - + + + + This step has no jobs param.workflow_step_id === stepDetails.workflow_step_id ); }, + jobStepHeading(stepDetails) { + if (stepDetails.jobs?.length > 1) { + return "Jobs (Click on any job to view its details)"; + } else if (stepDetails.jobs?.length === 1) { + if (this.inGraphView) { + return "Job"; + } else { + return "Job (Click on the job to view its details)"; + } + } else { + return "No jobs"; + } + }, showJob(id) { this.$emit("show-job", id); }, diff --git a/client/src/composables/useInvocationGraph.ts b/client/src/composables/useInvocationGraph.ts index 7cd61905168d..59e83a8831eb 100644 --- a/client/src/composables/useInvocationGraph.ts +++ b/client/src/composables/useInvocationGraph.ts @@ -277,10 +277,7 @@ export function useInvocationGraph( graphStep.state = newState; /** Setting the header class for the graph step */ - graphStep.headerClass = { - "node-header-invocation": true, - [`header-${graphStep.state}`]: !!graphStep.state, - }; + graphStep.headerClass = getHeaderClass(graphStep.state as string); // TODO: maybe a different one for inputs? Currently they have no state either. /** Setting the header icon for the graph step */ @@ -336,3 +333,10 @@ export function useInvocationGraph( loadInvocationGraph, }; } + +export function getHeaderClass(state: string) { + return { + "node-header-invocation": true, + [`header-${state}`]: !!state, + }; +}