-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Feature(UI): Canvas Workflow Integration - Run Workflow on Raster Layer #8665
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Feature(UI): Canvas Workflow Integration - Run Workflow on Raster Layer #8665
Conversation
This commit implements a new feature that allows users to run workflows directly from the unified canvas. Users can now: - Access a "Run Workflow" option from the canvas layer context menu - Select a workflow with image parameters from a modal dialog - Customize workflow parameters (non-image fields) - Execute the workflow with the current canvas layer as input - Have the result automatically added back to the canvas Key changes: - Added canvasWorkflowIntegrationSlice for state management - Created CanvasWorkflowIntegrationModal and related UI components - Added context menu item to raster layers - Integrated workflow execution with canvas image extraction - Added modal to global modal isolator This integration enhances the canvas by allowing users to leverage custom workflows for advanced image processing directly within the canvas workspace. Implements feature request for deeper workflow-canvas integration.
…-011CV36r1eKmax4DQhPyfiHf
- Extract WorkflowFieldRenderer component for individual field rendering - Add WorkflowFormPreview component to handle workflow parameter display - Remove workflow compatibility filtering - allow all workflows - Simplify workflow selector to use flattened workflow list - Add comprehensive field type support (String, Integer, Float, Boolean, Enum, Scheduler, Board, Model, Image, Color) - Implement image field selection UI with radio
- Add useFilteredWorkflows hook to filter workflows with ImageField inputs - Add workflowHasImageField utility to check for ImageField in Form Builder - Only show workflows that have Form Builder with at least one ImageField - Add loading state while filtering workflows - Improve error messages to clarify Form Builder requirement - Update modal description to mention Form Builder and parameter adjustment - Add fallback error message for workflows without Form Builder
…on state - Add _version field (v1) to canvasWorkflowIntegrationState for future migrations - Add persistConfig with migration function to handle version upgrades - Add persistDenylist to exclude transient state (isOpen, isProcessing, sourceEntityIdentifier) - Use es-toolkit isPlainObject and tsafe assert for type-safe migration - Persist selectedWorkflowId and fieldValues across sessions
|
This feature looks like an awesome addition to Invoke! Just from watching the video my only feedback would be to do away with that image checkbox and upload section, I think we can safely assume they're running that workflow on the image layer and don't need that extra semi-confusing step. Unless I'm missing something ofc. |
|
Some workflows can have more then one Image input so you need that selection Option. Maybe not if there is only one but this can be done later. |
The way I actually wanted is to have a Save Image node at the end and no other node that can save images. (Many Nodes that have a Output image can save images but are not the Save Image Node) The special node way would mean you have workflows that work only for the canvas. (or have a not needed node in the workflow tab.) There are 2 others ways: For the staging area to support multiple returns, getOutputImageName would need to become getOutputImageNames (return all canvas output images), and each would appear as a separate staging area item. |
…rm UX - Clear processing state when workflow execution fails at enqueue time or during invocation, so the modal doesn't get stuck - Optimistically update listAllQueueItems cache on queue item status changes so the staging area immediately exits on failure - Clear processing state on invocation_error for canvas workflow origin - Auto-select the only unfilled ImageField in workflow form - Fix image field overflow and thumbnail sizing in workflow form
I don't necessarily see that as a bad thing. If I have lots of workflows saved, it is helpful for the canvas interactions to only show the compatible subset that I have made to work as raster layer filters. It could also allow sending back multiple results or intermediates per workflow without that functionality being tied to (or intercepting) the save to gallery. If I do have a workflow that already takes an image and outputs another, then adding one node after my normal save image makes it "canvas-capable". If in the future we expand the feature to also take bbox inputs (composite raster area, inpaint mask, regional collection), then that will also require a specialty node as well. I think it's a good idea to build around explicit workflow definitions intended for canvas in that case. |
Add a dedicated `canvas_output` backend invocation node that explicitly marks which images go to the canvas staging area, replacing the fragile board-based heuristic. Each `canvas_output` node produces a separate navigable entry in the staging area, allowing workflows with multiple outputs to be individually previewed and accepted. Key changes: - New `CanvasOutputInvocation` backend node (canvas.py) - Entry-based staging area model where each output image is a separate navigable entry with flat next/prev cycling across all items - Frontend execute hook uses `canvas_output` type detection instead of board field heuristic, with proper board field value translation - Workflow filtering requires both Form Builder and canvas_output node - Updated QueueItemPreviewMini and StagingAreaItemsList for entries - Tests for entry-based navigation, multi-output, and race conditions


Summary
This PR adds a Canvas Workflow Integration feature that allows users to execute workflows directly on canvas layers, with a dedicated
canvas_outputbackend node and an entry-based staging area that supports multiple output images.Canvas Workflow Integration
Adds a new modal dialog accessible from raster layer context menus that enables users to:
Canvas OutputnodeCanvas Output Node
Adds a new
CanvasOutputInvocationbackend node (canvas_output) that explicitly marks which images should be routed to the canvas staging area. This replaces a fragile heuristic that detected output nodes by scanning forboardinput fields.Breaking change: Workflows need a
Canvas Outputnode to work with canvas workflow integration.Entry-Based Staging Area
Rearchitects the staging area so each
canvas_outputnode in a workflow produces its own navigable entry. A workflow with 2Canvas Outputnodes will show 2 separate thumbnails in the staging area strip, each individually selectable and acceptable.Bug Fixes
'auto'/'none'strings which the backend rejects — these are now filtered during graph construction.QA Instructions
Canvas OutputnodeCanvas Outputnodes → verify 2 separate entries appear in staging area strip, each with its own thumbnail, individually navigable with arrow keyssave_imagenode alongsidecanvas_output→ verify it queues without "BoardField" validation errorcanvas_outputnode do NOT appear in the canvas workflow selectorVideo Demo
Demo
Merge Plan
No special merge considerations. Standard merge to main is fine.
Checklist
What's Newcopy (if doing a release after this PR)