From feb4bf9cbf5f0e8fa23a6fcbd4dbfe4162f633f6 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 ccc4023e9e66..c6c3d2077a28 100644 --- a/client/src/api/jobs.ts +++ b/client/src/api/jobs.ts @@ -12,6 +12,7 @@ export const fetchJobDestinationParams = fetcher.path("/api/jobs/{job_id}/destin export const jobsFetcher = fetcher.path("/api/jobs").method("get").create(); export type ShowFullJobResponse = components["schemas"]["ShowFullJobResponse"]; +export type JobBaseModel = components["schemas"]["JobBaseModel"]; export type JobDetails = components["schemas"]["ShowFullJobResponse"] | components["schemas"]["EncodedJobDetails"]; export const fetchJobDetails = fetcher.path("/api/jobs/{job_id}").method("get").create(); 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 a7400edabf51..71f1f7b8bc46 100644 --- a/client/src/composables/useInvocationGraph.ts +++ b/client/src/composables/useInvocationGraph.ts @@ -204,10 +204,7 @@ export function useInvocationGraph( } /** Setting the header class for the graph step */ - graphStepFromWfStep.headerClass = { - "node-header-invocation": true, - [`header-${graphStepFromWfStep.state}`]: !!graphStepFromWfStep.state, - }; + graphStepFromWfStep.headerClass = getHeaderClass(graphStepFromWfStep.state as string); // TODO: maybe a different one for inputs? Currently they have no state either. /** Setting the header icon for the graph step */ @@ -279,3 +276,10 @@ export function useInvocationGraph( loadInvocationGraph, }; } + +export function getHeaderClass(state: string) { + return { + "node-header-invocation": true, + [`header-${state}`]: !!state, + }; +}