Show node state colors in workflow invocation graph minimap#22335
Show node state colors in workflow invocation graph minimap#22335ahmedhamidawan wants to merge 10 commits intogalaxyproject:devfrom
Conversation
In the invocation graph view, the minimap previously rendered all steps in a flat primary color regardless of their execution state. Here, we've made the minimap reflect the same state-based colors used in the graph node headers. - The state-to-color mapping is driven by CSS custom properties on the minimap canvas element. - Also added borders to the minimap nodes since some of the state colors are very light and hence, hard to see.
Before this change, they would appear in the default node-header color.
| import type { useWorkflowStateStore } from "@/stores/workflowEditorStateStore"; | ||
| import type { Step } from "@/stores/workflowStepStore"; | ||
|
|
||
| const stateNames = [ |
There was a problem hiding this comment.
Can we re-use states ? We want something shared ideally derived from the API schema. Note these seem to be dataset states too, those don't seem right for coloring steps ?
There was a problem hiding this comment.
I have reused the graphStepStates as set on the client for invocation graph steps in the useInvocationGraph composable.
"hidden" was in the GraphStep state union but is unreachable — it appears in neither JobState, DatasetState, nor InvocationStepState in the API schema, so no code path in updateStep or initializeGraphInput can ever set it. Removing it from graphStepStates also drops the now-dead --state-color-hidden CSS variable. Also adds vitest coverage for all reachable step state cases: no invocation step (queued), no matching job summary (waiting), single- and all-instance job states, and the populated_state fallback mappings (scheduled/ready→queued, resubmitted→new, failed→error, deleting→deleted). Co-Authored-By: Claude <noreply@anthropic.com>
| import { provideScopedWorkflowStores } from "./workflowStores"; | ||
|
|
||
| /** All possible states for an Invocation Graph step, derived from job states, | ||
| * input dataset states, and subworkflow scheduling states. */ |
There was a problem hiding this comment.
How could you include dataset states in the graph ? Also my previous comment applies, don't redefine this here, use API-defined states please (components["schemas"]["JobState"], components["schemas"]["InvocationState"]), .
There was a problem hiding this comment.
I would expect invocation states as well here ?
There was a problem hiding this comment.
How could you include dataset states in the graph ?
The reason dataset states are included is because workflow inputs are also GraphSteps, and we set the state of an input dataset/collection graph step based on its state.
| --view-color: #{fade-out($brand-dark, 0.8)}; | ||
| --view-outline-color: #{$brand-info}; | ||
|
|
||
| // Invocation state colors |
There was a problem hiding this comment.
Is there no type-safe way to do this? If we add a new state the catch all undefined is going to be used without any compile-time warning.
Replace the hand-maintained `graphStepStates` string array and its derived type with a proper schema-derived union: `JobState | DatasetState | InvocationStepState`, covering the three code paths that set a step's state (tool/collection steps, data input steps, subworkflow steps respectively). Drop the `graphStepStates` export entirely — the type is the authority now. In `canvasDraw.ts`, eliminate the dependent `stateNames` array by switching to a lazy `lookupStateColor` helper that reads `--state-color-{state}` CSS variables on first use and caches them, so any state defined in CSS is automatically picked up without a manual list.
Type `iconClasses` as `Record<GraphStepState, ...>` so TypeScript enforces exhaustive coverage of all step states. Fill in icons for all states in the full `JobState | DatasetState | InvocationStepState` union, using `states.ts` conventions as reference. Tighten `getHeaderClass` to accept `GraphStepState | undefined` instead of `string`, removing the cast at the call site. Expand `statePlaceholders` with `upload`, `setting_metadata`, `failed_metadata`, and `stop`.
Replaces the implicit `undefined` on `GraphStep.state` with an explicit `"uninitialized"` sentinel, making `state` a required field. New steps are initialized to `"uninitialized"` with `headerClass` set immediately. `updateStep` now starts fresh each call (`newState = undefined`) and falls back to the previous state via `newState ?? graphStep.state` if nothing could be determined, rather than silently inheriting it as the starting value. Co-Authored-By: Claude <noreply@anthropic.com>
- add paused, skipped, uninitialized to $galaxy-state-bg - generate --state-color-* CSS custom properties via :root @each (str-replace handles setting_metadata → setting-metadata) - remove the 12 hardcoded --state-color-* vars from WorkflowMinimap.vue - drop the lookupStateColor("undefined") catch-all; fall back to nodeColor directly - update canvasDraw tests to reflect the removed undefined fallback Co-Authored-By: Claude <noreply@anthropic.com>
|
@mvdbeek I have added commits now that use schema defined types for Graph Step states (of all sorts; input steps, tool steps, subworkflows etc.) which are computed in the client in The state scss colors defined in |
| return { stepPosition: positions } as unknown as ReturnType<typeof useWorkflowStateStore>; | ||
| } | ||
|
|
||
| const STATE_COLORS = { |
There was a problem hiding this comment.
Seems like a code smell ? Why is that in the test file ?
There was a problem hiding this comment.
The test is just making sure the correct (mocked in the test) color is set on the minimap node. I have replaced those raw color values with mock strings. And I have also annotated the test better.
In the invocation graph view, the minimap previously rendered all steps in a flat primary color regardless of their execution state.
Here, we've made the minimap reflect the same state-based colors used in the graph node headers.
sync_invocation_minimap_with_step_colors.mp4
Fixes #21086 (once the 3rd item there is also complete of course)
How to test the changes?
(Select all options that apply)
License