diff --git a/client/src/components/Workflow/Invocation/Graph/InvocationGraph.vue b/client/src/components/Workflow/Invocation/Graph/InvocationGraph.vue index 987782991e20..f59331bcfeef 100644 --- a/client/src/components/Workflow/Invocation/Graph/InvocationGraph.vue +++ b/client/src/components/Workflow/Invocation/Graph/InvocationGraph.vue @@ -226,6 +226,7 @@ function toggleActiveStep(stepId: number) {
diff --git a/client/src/components/Workflow/Invocation/Graph/WorkflowInvocationSteps.vue b/client/src/components/Workflow/Invocation/Graph/WorkflowInvocationSteps.vue index febb69008e06..458d87aab8ad 100644 --- a/client/src/components/Workflow/Invocation/Graph/WorkflowInvocationSteps.vue +++ b/client/src/components/Workflow/Invocation/Graph/WorkflowInvocationSteps.vue @@ -2,7 +2,7 @@ import { library } from "@fortawesome/fontawesome-svg-core"; import { faChevronDown, faChevronUp, faSignInAlt } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/vue-fontawesome"; -import { computed, ref, watch } from "vue"; +import { computed, nextTick, ref, watch } from "vue"; import type { WorkflowInvocationElementView } from "@/api/invocations"; import { isWorkflowInput } from "@/components/Workflow/constants"; @@ -43,28 +43,28 @@ const props = withDefaults(defineProps(), { }); const stepsDiv = ref(); -const expandInvocationInputs = ref(false); const workflowInputSteps = Object.values(props.workflow.steps).filter((step) => isWorkflowInput(step.type)); -const hasSingularInput = computed(() => workflowInputSteps.length === 1); -const workflowRemainingSteps = hasSingularInput.value - ? Object.values(props.workflow.steps) - : Object.values(props.workflow.steps).filter((step) => !isWorkflowInput(step.type)); +const oneOrNoInput = computed(() => workflowInputSteps.length <= 1); +const expandInvocationInputs = ref(oneOrNoInput.value); watch( () => [props.activeNodeId, stepsDiv.value], async ([nodeId, card]) => { - // if the active node id is an input step, expand the inputs section, else, collapse it - const isAnInput = workflowInputSteps.findIndex((step) => step.id === props.activeNodeId) !== -1; - expandInvocationInputs.value = isAnInput; + // if the active node id is an input step, expand the inputs section if not already expanded + if (!expandInvocationInputs.value) { + const isAnInput = workflowInputSteps.findIndex((step) => step.id === props.activeNodeId) !== -1; + expandInvocationInputs.value = isAnInput; + } + + await nextTick(); // on full page view, scroll to the active step card in the steps section if (props.isFullPage) { if (nodeId !== undefined && card) { // scroll to the active step card const stepCard = stepsDiv.value?.querySelector(`[data-index="${props.activeNodeId}"]`); - const portletHeaderDiv = stepCard?.querySelector(".portlet-header"); - stepsDiv.value?.scrollTo({ top: portletHeaderDiv?.getBoundingClientRect().top }); + stepCard?.scrollIntoView({ block: "nearest", inline: "start" }); } } // clear any job being shown @@ -81,7 +81,7 @@ function showJob(jobId: string | undefined) {