From 3de5686170f554917ff63f358ad99b3e6f243128 Mon Sep 17 00:00:00 2001 From: Ahmed Awan Date: Mon, 29 Jul 2024 13:57:55 -0500 Subject: [PATCH] [24.1] Fix invocation view steps scroll bug Fixes https://github.com/galaxyproject/galaxy/issues/18443 --- .../Invocation/Graph/InvocationGraph.vue | 1 - .../Graph/WorkflowInvocationSteps.vue | 69 ++++++++----------- 2 files changed, 27 insertions(+), 43 deletions(-) diff --git a/client/src/components/Workflow/Invocation/Graph/InvocationGraph.vue b/client/src/components/Workflow/Invocation/Graph/InvocationGraph.vue index 987782991e20..dd405108e0e8 100644 --- a/client/src/components/Workflow/Invocation/Graph/InvocationGraph.vue +++ b/client/src/components/Workflow/Invocation/Graph/InvocationGraph.vue @@ -341,7 +341,6 @@ function toggleActiveStep(stepId: number) { .graph-steps-aside { overflow-y: scroll; - scroll-behavior: smooth; &.steps-fixed-height { max-height: 60vh; } 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) {