Skip to content

Commit

Permalink
always toggle a non-input step in graph view
Browse files Browse the repository at this point in the history
If there isn't an errored step, still toggle/expand the last step in the workflow invocation.
  • Loading branch information
ahmedhamidawan committed Apr 25, 2024
1 parent c350810 commit 255ae1b
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,16 @@ watch(
{ immediate: true }
);
// on loading the steps, if any of the steps (an obj) has state === "error", toggleActiveNode
// on loading steps, toggle the first one with state === "error" or last one if none are errored
watch(
() => initialLoading.value,
(newVal) => {
if (!newVal && steps.value) {
const errorStep = Object.values(steps.value).find((step) => step.state === "error");
if (errorStep) {
stateStore.activeNodeId = errorStep.id;
} else {
stateStore.activeNodeId = Object.values(steps.value)?.slice(-1)[0]?.id || null;
}
}
},
Expand Down Expand Up @@ -191,7 +193,7 @@ function scrollJobToView() {
jobCardHeader?.scrollIntoView({ behavior: "smooth", block: "start" });
}
function toggleActiveNode(stepId: number) {
function toggleActiveStep(stepId: number) {
if (stateStore.activeNodeId === stepId) {
stateStore.activeNodeId = null;
} else {
Expand Down Expand Up @@ -242,7 +244,7 @@ function getStepKey(step: Step) {
<span v-localize>Hide Graph</span>
</BButton>
</div>
<BButton v-else size="sm" class="p-0" @click="hideGraph = false">
<BButton v-else size="sm" class="p-0" style="width: min-content" @click="hideGraph = false">
<FontAwesomeIcon :icon="faSitemap" />
<div v-localize>Show Graph</div>
</BButton>
Expand All @@ -255,7 +257,7 @@ function getStepKey(step: Step) {
:hide-graph="hideGraph"
:showing-job-id="showingJobId || ''"
@update:showing-job-id="(jobId) => (showingJobId = jobId)"
@focus-on-step="toggleActiveNode" />
@focus-on-step="toggleActiveStep" />
</div>
</ExpandedItems>
<BCard v-if="showingJobId" ref="jobCard" class="mt-1" no-body :data-index="showingJobId">
Expand Down

0 comments on commit 255ae1b

Please sign in to comment.