feat(ui): Deeplinks for StudioInitAction #7277
Open
+129
−18
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This feature provides a way to link into specific elements of the UI. Utilizing InvokeAIUI component's StudioInitAction to be called trough a hashbang.
this way e.g.
loadWorkflow #!loadWorkflow&workflowId={WORKFOLW_ID}
will load the workflow WORKFOLW_ID
selectBoard #!loadWorkflow&selectBoard={BOARD_ID}
e.g.
http://localhost:9090/#!selectBoard&boardId=aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeee01
will select the board with id aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeee01
selectImage#!selectImage&imageName={IMG_NAME}e.g.http://localhost:9090/#!selectImage&imageName=aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeee02.png
will select the image aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeee02.png, also select the corresponding board and images/asset tabNYI: needs some more work to be ready, also should be a seperate PR (in my optionion)
selectStylePreset #!selectStylePreset&stylePresetId={PRESET_ID}
e.g.
http://localhost:9090/#!selectStylePreset&stylePresetId=aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeee03
will select the preset with ID aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeee03
sendToCanvas #!sendToCanvas&imageName={IMG_NAME}
e.g.
http://localhost:9090/#!sendToCanvas&imageName=aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeee04.png
will setup a canvas where the given image (aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeee04.png) is added as a raster layer
useAllParameters #!useAllParameters&imageName={IMG_NAME}
e.g.
http://localhost:9090/#!useAllParameters&imageName=aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeee05.png
will load all parameters of the given image aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeee05.png
goToDestination
canvas #!goToDestination&destination=canvas
Go to the canvas tab, close the image viewer, and disable send-to-gallery mode
generation #!goToDestination&destination=generation
Go to the canvas tab, open the image viewer, and enable send-to-gallery mode
upscaling #!goToDestination&destination=upscaling
Go to the upscaling tab
workflows #!goToDestination&destination=workflows
will navigate to workflows
viewAllWorkflows #!goToDestination&destination=viewAllWorkflows
Go to the workflows tab and open the workflow library modal
viewAllStylePresets #!goToDestination&destination=viewAllStylePresets
Go to the canvas tab and open the style presets menu
Related Issues / Discussions
Discussed with @psychedelicious starting here on Discord
QA Instructions
For now the action will only executed on startup. So a reload is needed. To test, you can edit the hash part of the URL or navigate to them by pasting them into the URL. Right now there is no history change event so if edited manually (or changed on site) you will need to reload the page.
Merge Plan
Please take into consideration: This PR contains some change to the InvokeAIUI.tsx - as minimal as possible but still the parent of all that follows. The type definitions of the StudioInitAction are now zod schemas to validate them.