-
Notifications
You must be signed in to change notification settings - Fork 16
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
WebActions backend #183
WebActions backend #183
Conversation
Assuming these are all defined by the addon. Can the addon also define the icon? Where is the icon file stored? |
Yes, they are provided by the addon. Icon is tricky TBH. My idea is to allow addon to "register" icons (basically store icons in redis when the server starts) and then it could just use icon name in the manifest and frontend would be able to retrieve it similarly we do it with thumbnails. (something like |
Is the only way to create actions through an addon? I can imagine that someone may want to just upload actions. Further to that, we may want to write build in tools that make creating actions easier. |
I can imagine an addon that would allow creating custom actions from its settings or toml files for example. Action definitions are easily serializable. Not a part of MVP tho. |
Method EDITED: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works
Description of changes
TODO
take_action
Later:
New endpoints
list_available_actions_for_context
[POST] /api/actions/list
Returns a list of available actions for a given context. Context is provided as a JSON object in the request body:
Note
entitySubtypes
is not strictly required, but since the frontendalways has the information about the selected entities, it may be
included and save the backend from having to fetch it from the DB.
Additional query parameter
mode
can be passed to the endpoint. It defaults tosimple
, that only returns the list of "simple" actions. (actions that don't require any computation to return the result - the list is just determined by entityType and entitySubtypes).If
mode
is set todynamic
, the endpoint will return the list of dynamic actions. This list is computed by the addon and may take a while to resolve. So whilesimple
mode is called every time the selection changes,dynamic
mode should be called only when the user explicitly requests it and display the actions in a dialog box.all
mode is also supported to return both simple and dynamic actions.The response model is still WIP, but it is documented. It contains metadata about the actions, such a and identifier, label and icon.
execute_action
[POST] /api/actions/execute
Executes an action on a given context. In the request body, the endpoint expect the same context object as in the
list
endpoint.The following query parameters are required:
addonName
addonVersion
variant
identifier
You can get all the parameters for each of the actions from the
list
response.When the action is executed, there are two possible outcomes:
Server action
In the case of "server" action, the logic is executed directly on the server and the response only contains:
Message is then displayed to the user.
Launcher actions
In the case of "launcher" actions, the response also contains a URI:
URI contains
server_url
andtoken
query parameters. Theserver_url
is the base URL of the Ayon server and thetoken
is a hash of the created event.The event is created by the server and contains information on the action and the context. Event is created in 'pending' state and is then processed by the Ayon Launcher.
take_action
Launcher calls
[GET] /api/actions/take/{token}
endpoint to receive the event information. When this endpoint is called, the event is also marked asin_progress
which prevents calling the endpoint again (as it only returnsevents in
pending
state).The launcher is then fully responsible for executing the action and the lifecycle of the event.
When the
/take
endpoint is not called within a certain time frame, the event is removed from the database.