11<script setup lang="ts">
22import { BAlert , BTab } from " bootstrap-vue" ;
3- import { computed } from " vue" ;
3+ import { computed , ref , watch } from " vue" ;
44
55import type { InvocationInput , WorkflowInvocationElementView } from " @/api/invocations" ;
6+ import { useWorkflowInstance } from " @/composables/useWorkflowInstance" ;
7+ import type { Step } from " @/stores/workflowStepStore" ;
8+ import { useWorkflowStore } from " @/stores/workflowStore" ;
69
710import Heading from " ../Common/Heading.vue" ;
811import LoadingSpan from " ../LoadingSpan.vue" ;
@@ -18,6 +21,37 @@ const props = defineProps<{
1821 terminal? : boolean ;
1922}>();
2023
24+ // Fetching full workflow to get the workflow output labels (for when invocation is not terminal)
25+ const workflowOutputLabels = ref <string []>([]);
26+ const workflow = computed (() => {
27+ if (! props .terminal ) {
28+ const { workflow } = useWorkflowInstance (props .invocation .workflow_id );
29+ return workflow .value ;
30+ }
31+ return undefined ;
32+ });
33+ const workflowStore = useWorkflowStore ();
34+ watch (
35+ workflow ,
36+ async (newWorkflow ) => {
37+ if (newWorkflow ) {
38+ try {
39+ const wf = await workflowStore .getFullWorkflowCached (newWorkflow .id , newWorkflow .version );
40+ if (wf ) {
41+ const fullWorkflowSteps = (wf .steps ? Object .values (wf .steps ) : []) as Step [];
42+ workflowOutputLabels .value = fullWorkflowSteps
43+ .flatMap ((step ) => step .workflow_outputs || [])
44+ .map ((output ) => output .label )
45+ .filter ((label ) => label !== null && label !== undefined );
46+ }
47+ } catch (error ) {
48+ console .error (" Error fetching full workflow:" , error );
49+ }
50+ }
51+ },
52+ { immediate: true }
53+ );
54+
2155const inputData = computed (() => Object .entries (props .invocation .inputs ));
2256
2357const outputs = computed (() => {
@@ -71,6 +105,17 @@ function dataInputStepLabel(key: string, input: InvocationInput) {
71105 <GenericHistoryItem :item-id =" output.id" :item-src =" output.src" />
72106 </div >
73107 </div >
108+ <div v-else-if =" workflowOutputLabels.length" >
109+ <div v-for =" (label, index) in workflowOutputLabels" :key =" index" >
110+ <Heading size =" text" bold separator >{{ label }}</Heading >
111+ <BAlert v-if =" !props.terminal" class =" m-1 py-2" show variant =" info" >
112+ <LoadingSpan message =" Output not created yet" />
113+ </BAlert >
114+ <BAlert v-else class =" m-1 py-2" show variant =" danger" >
115+ <LoadingSpan message =" Output not available" />
116+ </BAlert >
117+ </div >
118+ </div >
74119 <BAlert v-else show variant =" info" >
75120 <p >
76121 <LoadingSpan v-if =" !props.terminal" :message =" OUTPUTS_NOT_AVAILABLE_YET_MSG" />
0 commit comments