Open in RV web action as dynamic action - #89
Conversation
This requires the server and frontend to actually start serving the dynamic actions, which it doesn't currently. So would require a new server release first.
|
|
||
| if not getattr(self, "review_controller", None): | ||
| return |
There was a problem hiding this comment.
This change was actually irrelevant to this PR - will make a separate PR as well.
|
|
||
| logger.info(f"Checking if can be opened in context: {context}") |
There was a problem hiding this comment.
Just there for now to debug when this would be called - so that when server gets support for dynamic action we can start checking whether this doesn't call an awful an amount of times and becomes slow or not. :)
But since server doesn't support the get dynamic actions yet... it will never trigger it.
There was a problem hiding this comment.
Pull request overview
This PR converts the “Open in RV” server action from a static/simple action into a context-dependent dynamic action so it only appears when valid for the current selection, and adds a small client-side guard to avoid panel-opening errors when the review controller is not available.
Changes:
- Switch server action manifest from
SimpleActionManifesttoDynamicActionManifestand expose it viaget_dynamic_actionsgated bycan_open_in_rv(context). - Add logging inside
can_open_in_rv(currently at INFO). - Prevent
_open_visible_panelsfrom running whenreview_controlleris missing.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
server/action.py |
Converts action manifest to dynamic and adds logging during can_open_in_rv evaluation. |
server/__init__.py |
Switches addon hook from get_simple_actions to get_dynamic_actions and gates action visibility via can_open_in_rv. |
client/ayon_openrv/startup/pkgs_source/ayon_menus/ayon_menus.py |
Adds a guard to avoid calling panel logic when review_controller is not set. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| async def can_open_in_rv(context: "ActionContext") -> bool: | ||
| """Return True if the action can run for the given context.""" | ||
|
|
||
| logger.info(f"Checking if can be opened in context: {context}") |
| async def get_dynamic_actions( | ||
| self, | ||
| project_name: Optional[str] = None, | ||
| context, | ||
| variant: str = "production", | ||
| ) -> list[SimpleActionManifest]: | ||
| return [get_open_in_rv_simple_action()] | ||
| ) -> list["DynamicActionManifest"]: | ||
| """Return dynamic actions for the given context. | ||
|
|
||
| The Open in RV action should only be shown when it is valid for the | ||
| selected version (i.e. when can_open_in_rv(context) is True). | ||
| """ | ||
| actions = [] | ||
| if await can_open_in_rv(context): | ||
| actions.append(get_open_in_rv_action()) | ||
| return actions |
Changelog Description
Open in RV web action as dynamic action.
Additional review information
This requires the server and frontend to actually start serving the dynamic actions, which it doesn't currently. So would require a new server release first.
Fix #88
Testing notes: