Skip to content

Commit dc6a6be

Browse files
Merge pull request #21115 from ahmedhamidawan/fix_invocation_routable_tabs
[25.1] Fix invalid invocation tab handling and unify disabled tab components
2 parents 7f6927b + 2474d05 commit dc6a6be

File tree

2 files changed

+40
-13
lines changed

2 files changed

+40
-13
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<script setup lang="ts">
2+
import { BAlert } from "bootstrap-vue";
3+
4+
import GLink from "../BaseComponents/GLink.vue";
5+
6+
const props = defineProps<{
7+
invocationId: string;
8+
tooltip: string;
9+
}>();
10+
</script>
11+
12+
<template>
13+
<BAlert variant="info" show>
14+
<span v-localize>{{ props.tooltip }}</span>
15+
View the invocation
16+
<GLink :to="`/workflows/invocations/${props.invocationId}`">Overview</GLink>
17+
instead.
18+
</BAlert>
19+
</template>

client/src/components/WorkflowInvocationState/WorkflowInvocationState.vue

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import WorkflowInvocationSteps from "../Workflow/Invocation/Graph/WorkflowInvoca
2424
import InvocationReport from "../Workflow/InvocationReport.vue";
2525
import WorkflowAnnotation from "../Workflow/WorkflowAnnotation.vue";
2626
import WorkflowNavigationTitle from "../Workflow/WorkflowNavigationTitle.vue";
27+
import TabsDisabledAlert from "./TabsDisabledAlert.vue";
2728
import WorkflowInvocationExportOptions from "./WorkflowInvocationExportOptions.vue";
2829
import WorkflowInvocationFeedback from "./WorkflowInvocationFeedback.vue";
2930
import WorkflowInvocationInputOutputTabs from "./WorkflowInvocationInputOutputTabs.vue";
@@ -76,14 +77,19 @@ const tabsDisabled = computed(
7677
const disabledTabTooltip = computed(() => {
7778
const state = invocationState.value;
7879
if (state != "scheduled") {
79-
return `This workflow is not currently scheduled. The current state is ${state}. Once the workflow is fully scheduled and jobs have complete any disabled tabs will become available.`;
80+
return `This workflow is not currently scheduled. The current state is ${state}. Disabled tabs are available if the workflow is fully scheduled and all jobs have completed.`;
8081
} else if (stateCounts.value && stateCounts.value.runningCount != 0) {
8182
return `The workflow invocation still contains ${stateCounts.value.runningCount} running job(s). Once these jobs have completed any disabled tabs will become available.`;
8283
} else {
8384
return "Steps for this workflow are still running. Any disabled tabs will be available once complete.";
8485
}
8586
});
8687
88+
/** We are on the default "Overview" tab if the tab prop is not set or is not one of the expected tab values */
89+
const onOverviewTab = computed(() => {
90+
return !props.tab || !["steps", "inputs", "outputs", "report", "export", "metrics", "debug"].includes(props.tab);
91+
});
92+
8793
const invocation = computed(() => {
8894
const storedInvocation = invocationStore.getInvocationById(props.invocationId);
8995
if (invocationLoaded.value && isWorkflowInvocationElementView(storedInvocation)) {
@@ -339,7 +345,7 @@ async function onCancel() {
339345
</WorkflowAnnotation>
340346

341347
<BNav v-if="props.isFullPage" pills class="mb-2 p-2 bg-light border-bottom">
342-
<BNavItem title="Overview" :active="!props.tab" :to="`/workflows/invocations/${props.invocationId}`">
348+
<BNavItem title="Overview" :active="onOverviewTab" :to="`/workflows/invocations/${props.invocationId}`">
343349
Overview
344350
</BNavItem>
345351
<BNavItem
@@ -361,17 +367,17 @@ async function onCancel() {
361367
Outputs
362368
</BNavItem>
363369
<BNavItem
364-
title="Report"
370+
:title="!tabsDisabled ? 'Report' : disabledTabTooltip"
365371
class="invocation-report-tab"
366-
:active="props.tab === 'report'"
372+
:active="!tabsDisabled && props.tab === 'report'"
367373
:to="`/workflows/invocations/${props.invocationId}/report`"
368374
:disabled="tabsDisabled">
369375
Report
370376
</BNavItem>
371377
<BNavItem
372-
title="Export"
378+
:title="!tabsDisabled ? 'Export' : disabledTabTooltip"
373379
class="invocation-export-tab"
374-
:active="props.tab === 'export'"
380+
:active="!tabsDisabled && props.tab === 'export'"
375381
:to="`/workflows/invocations/${props.invocationId}/export`"
376382
:disabled="tabsDisabled">
377383
Export
@@ -423,7 +429,7 @@ async function onCancel() {
423429
</BNav>
424430

425431
<div class="mt-1 d-flex flex-column overflow-auto">
426-
<div v-if="!props.tab">
432+
<div v-if="onOverviewTab">
427433
<WorkflowInvocationOverview
428434
class="invocation-overview"
429435
:invocation="invocation"
@@ -451,15 +457,17 @@ async function onCancel() {
451457
<BAlert v-if="isSubworkflow" variant="info" show>
452458
<span v-localize>Report is not available for subworkflow.</span>
453459
</BAlert>
454-
<BAlert v-else-if="!invocationStateSuccess" variant="info" show>
455-
<span v-localize>{{ disabledTabTooltip }}</span>
456-
</BAlert>
460+
<TabsDisabledAlert
461+
v-else-if="tabsDisabled"
462+
:invocation-id="props.invocationId"
463+
:tooltip="disabledTabTooltip" />
457464
<InvocationReport v-else :invocation-id="invocation.id" />
458465
</div>
459466
<div v-if="props.tab === 'export'">
460-
<BAlert v-if="!invocationAndJobTerminal" variant="info" show>
461-
<span v-localize>{{ disabledTabTooltip }}</span>
462-
</BAlert>
467+
<TabsDisabledAlert
468+
v-if="tabsDisabled"
469+
:invocation-id="props.invocationId"
470+
:tooltip="disabledTabTooltip" />
463471
<div v-else>
464472
<WorkflowInvocationExportOptions :invocation-id="invocation.id" />
465473
</div>

0 commit comments

Comments
 (0)