mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 12:54:40 +01:00
only one method to get actions
This commit is contained in:
parent
53848ad366
commit
29b3794dd8
3 changed files with 42 additions and 75 deletions
|
|
@ -970,33 +970,23 @@ class FrontendLoaderController(_BaseLoaderController):
|
|||
|
||||
# Load action items
|
||||
@abstractmethod
|
||||
def get_versions_action_items(self, project_name, version_ids):
|
||||
def get_action_items(
|
||||
self,
|
||||
project_name: str,
|
||||
entity_ids: set[str],
|
||||
entity_type: str,
|
||||
) -> list[ActionItem]:
|
||||
"""Action items for versions selection.
|
||||
|
||||
Args:
|
||||
project_name (str): Project name.
|
||||
version_ids (Iterable[str]): Version ids.
|
||||
entity_ids (set[str]): Entity ids.
|
||||
entity_type (str): Entity type.
|
||||
|
||||
Returns:
|
||||
list[ActionItem]: List of action items.
|
||||
|
||||
"""
|
||||
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def get_representations_action_items(
|
||||
self, project_name, representation_ids
|
||||
):
|
||||
"""Action items for representations selection.
|
||||
|
||||
Args:
|
||||
project_name (str): Project name.
|
||||
representation_ids (Iterable[str]): Representation ids.
|
||||
|
||||
Returns:
|
||||
list[ActionItem]: List of action items.
|
||||
"""
|
||||
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
|
|
|
|||
|
|
@ -21,7 +21,8 @@ from ayon_core.tools.common_models import (
|
|||
from .abstract import (
|
||||
BackendLoaderController,
|
||||
FrontendLoaderController,
|
||||
ProductTypesFilter
|
||||
ProductTypesFilter,
|
||||
ActionItem,
|
||||
)
|
||||
from .models import (
|
||||
SelectionModel,
|
||||
|
|
@ -287,21 +288,20 @@ class LoaderController(BackendLoaderController, FrontendLoaderController):
|
|||
project_name, product_ids, group_name
|
||||
)
|
||||
|
||||
def get_versions_action_items(self, project_name, version_ids):
|
||||
return self._loader_actions_model.get_versions_action_items(
|
||||
project_name, version_ids)
|
||||
|
||||
def get_representations_action_items(
|
||||
self, project_name, representation_ids):
|
||||
action_items = (
|
||||
self._loader_actions_model.get_representations_action_items(
|
||||
project_name, representation_ids)
|
||||
def get_action_items(
|
||||
self,
|
||||
project_name: str,
|
||||
entity_ids: set[str],
|
||||
entity_type: str,
|
||||
) -> list[ActionItem]:
|
||||
action_items = self._loader_actions_model.get_action_items(
|
||||
project_name, entity_ids, entity_type
|
||||
)
|
||||
|
||||
action_items.extend(self._sitesync_model.get_sitesync_action_items(
|
||||
project_name, representation_ids)
|
||||
)
|
||||
|
||||
if entity_type == "representation":
|
||||
site_sync_items = self._sitesync_model.get_sitesync_action_items(
|
||||
project_name, entity_ids
|
||||
)
|
||||
action_items.extend(site_sync_items)
|
||||
return action_items
|
||||
|
||||
def trigger_action_item(
|
||||
|
|
|
|||
|
|
@ -61,56 +61,33 @@ class LoaderActionsModel:
|
|||
self._product_loaders.reset()
|
||||
self._repre_loaders.reset()
|
||||
|
||||
def get_versions_action_items(self, project_name, version_ids):
|
||||
"""Get action items for given version ids.
|
||||
|
||||
Args:
|
||||
project_name (str): Project name.
|
||||
version_ids (Iterable[str]): Version ids.
|
||||
def get_action_items(
|
||||
self,
|
||||
project_name: str,
|
||||
entity_ids: set[str],
|
||||
entity_type: str,
|
||||
) -> list[ActionItem]:
|
||||
version_context_by_id = {}
|
||||
repre_context_by_id = {}
|
||||
if entity_type == "representation":
|
||||
(
|
||||
version_context_by_id,
|
||||
repre_context_by_id
|
||||
) = self._contexts_for_representations(project_name, entity_ids)
|
||||
|
||||
Returns:
|
||||
list[ActionItem]: List of action items.
|
||||
"""
|
||||
if entity_type == "version":
|
||||
(
|
||||
version_context_by_id,
|
||||
repre_context_by_id
|
||||
) = self._contexts_for_versions(project_name, entity_ids)
|
||||
|
||||
(
|
||||
version_context_by_id,
|
||||
repre_context_by_id
|
||||
) = self._contexts_for_versions(
|
||||
project_name,
|
||||
version_ids
|
||||
)
|
||||
return self._get_action_items_for_contexts(
|
||||
project_name,
|
||||
version_context_by_id,
|
||||
repre_context_by_id
|
||||
)
|
||||
|
||||
def get_representations_action_items(
|
||||
self, project_name, representation_ids
|
||||
):
|
||||
"""Get action items for given representation ids.
|
||||
|
||||
Args:
|
||||
project_name (str): Project name.
|
||||
representation_ids (Iterable[str]): Representation ids.
|
||||
|
||||
Returns:
|
||||
list[ActionItem]: List of action items.
|
||||
"""
|
||||
|
||||
(
|
||||
product_context_by_id,
|
||||
repre_context_by_id
|
||||
) = self._contexts_for_representations(
|
||||
project_name,
|
||||
representation_ids
|
||||
)
|
||||
return self._get_action_items_for_contexts(
|
||||
project_name,
|
||||
product_context_by_id,
|
||||
repre_context_by_id
|
||||
)
|
||||
|
||||
def trigger_action_item(
|
||||
self,
|
||||
identifier: str,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue