11<script setup lang="ts">
22import { library } from " @fortawesome/fontawesome-svg-core" ;
33import {
4+ faArrowCircleLeft ,
5+ faArrowCircleRight ,
46 faArrowDown ,
57 faChevronDown ,
68 faChevronUp ,
@@ -10,7 +12,7 @@ import {
1012} from " @fortawesome/free-solid-svg-icons" ;
1113import { FontAwesomeIcon } from " @fortawesome/vue-fontawesome" ;
1214import { until } from " @vueuse/core" ;
13- import { BAlert , BButton , BCard , BCardBody , BCardHeader } from " bootstrap-vue" ;
15+ import { BAlert , BCard , BCardBody , BCardHeader } from " bootstrap-vue" ;
1416import { storeToRefs } from " pinia" ;
1517import { computed , nextTick , onMounted , onUnmounted , ref , watch } from " vue" ;
1618
@@ -20,6 +22,8 @@ import { useDatatypesMapper } from "@/composables/datatypesMapper";
2022import { useInvocationGraph } from " @/composables/useInvocationGraph" ;
2123import { useWorkflowStateStore } from " @/stores/workflowEditorStateStore" ;
2224
25+ import GButton from " @/components/BaseComponents/GButton.vue" ;
26+ import GButtonGroup from " @/components/BaseComponents/GButtonGroup.vue" ;
2327import LoadingSpan from " @/components/LoadingSpan.vue" ;
2428import WorkflowGraph from " @/components/Workflow/Editor/WorkflowGraph.vue" ;
2529import WorkflowInvocationStep from " @/components/WorkflowInvocationState/WorkflowInvocationStep.vue" ;
@@ -145,6 +149,19 @@ async function loadGraph() {
145149 }
146150}
147151
152+ /** Moves to the next or previous step in the workflow (if possible) */
153+ function navigateStep(direction : " previous" | " next" ) {
154+ const totalSteps = Object .keys (props .workflow .steps ).length ;
155+
156+ if (activeNodeId .value !== null && totalSteps > 1 ) {
157+ if (direction === " next" && activeNodeId .value < totalSteps - 1 ) {
158+ activeNodeId .value += 1 ;
159+ } else if (direction === " previous" && activeNodeId .value > 0 ) {
160+ activeNodeId .value -= 1 ;
161+ }
162+ }
163+ }
164+
148165/** Poll and load the invocation graph until the invocation is terminal */
149166async function pollInvocationGraph() {
150167 await loadGraph ();
@@ -205,7 +222,7 @@ function stepClicked(nodeId: number | null) {
205222 </BCard >
206223 </div >
207224 </div >
208- <BCard v-if =" activeNodeId !== null && activeStep" ref =" stepCard" class =" mt-2" no-body >
225+ <BCard v-if =" activeNodeId !== null && activeStep" ref =" stepCard" class =" invocation-step-card mt-2" no-body >
209226 <BCardHeader
210227 class =" d-flex justify-content-between align-items-center px-3 py-1"
211228 :class =" activeNodeId !== null ? steps[activeNodeId]?.headerClass : ''" >
@@ -215,12 +232,32 @@ function stepClicked(nodeId: number | null) {
215232 :graph-step =" steps[activeNodeId]"
216233 :invocation-step =" props.invocation.steps[activeNodeId]" />
217234 <div class =" d-flex flex-gapx-1" >
218- <BButton title =" Scroll to Step" size =" sm " variant = " link " @click =" scrollStepToView()" >
235+ <GButton title =" Scroll to Step" size =" small " transparent @click =" scrollStepToView()" >
219236 <FontAwesomeIcon :icon =" faArrowDown" />
220- </BButton >
221- <BButton title =" Hide Step" size =" sm" variant =" link" @click =" activeNodeId = null" >
237+ </GButton >
238+ <GButtonGroup >
239+ <GButton
240+ title =" Previous Step"
241+ :disabled =" activeNodeId === 0"
242+ disabled-title =" No Previous Step"
243+ transparent
244+ @click =" navigateStep('previous')" >
245+ <FontAwesomeIcon :icon =" faArrowCircleLeft" />
246+ Prev
247+ </GButton >
248+ <GButton
249+ title =" Next Step"
250+ :disabled =" activeNodeId === Object.keys(props.workflow.steps).length - 1"
251+ disabled-title =" No More Steps"
252+ transparent
253+ @click =" navigateStep('next')" >
254+ <FontAwesomeIcon :icon =" faArrowCircleRight" />
255+ Next
256+ </GButton >
257+ </GButtonGroup >
258+ <GButton title =" Hide Step" size =" small" transparent @click =" activeNodeId = null" >
222259 <FontAwesomeIcon :icon =" faTimes" />
223- </BButton >
260+ </GButton >
224261 </div >
225262 </BCardHeader >
226263 <BCardBody body-class =" p-2" >
@@ -272,4 +309,8 @@ function stepClicked(nodeId: number | null) {
272309 z-index : 100 ;
273310 }
274311}
312+
313+ .invocation-step-card {
314+ min-height : 500px ;
315+ }
275316 </style >
0 commit comments