ynput / ayon-core

Apache License 2.0
18 stars 30 forks source link

Add support to filter out folders and tasks by assignment #622

Open fabiaserra opened 4 weeks ago

fabiaserra commented 4 weeks ago

Changelog Description

This adds a toggle in the Launcher, Workfile Manager and a few other widgets that show a folder hierarchy to filter out the folders and tasks shown by whether the user has it assigned or not:

Launcher

With filter image

Without filter image

Creator

image

Workfile manager

image

Scene Inventory

image image

Additional info

The next step would be to also filter out the tasks by whether they are assigned or not Done here https://github.com/ynput/ayon-core/pull/622/commits/61870650d8911c09393663047a96183a6ec638b5

Testing notes:

  1. Open the launcher, workfile manager, creator, scene manager...
  2. Check that a "Show my assignments only" toggle shows up and that when checked, only the folders and tasks that you have assigned show up
fabiaserra commented 3 weeks ago

I'm realizing this needs more work as the FoldersWidget is reused in other tools (i.e. workfile, loader...) EDIT: Done

MustafaJafar commented 3 weeks ago

This PR made me realize that I never assign myself any tasks. I also have one user AYON Admin 😄. anyways, I started assigning myself some tasks and I had to restart the launcher to see the updates. I tried again and said to myself why don't I get back to project and re-select the same project to update the tasks list. and then I faced this error (endless loop). Animation_72

Traceback (most recent call last):
  File "E:\Ynput\ayon-launcher\.venv\lib\site-packages\ayon_api\server_api.py", line 199, in raise_for_status
    self._response.raise_for_status()
  File "E:\Ynput\ayon-launcher\.venv\lib\site-packages\requests\models.py", line 1021, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: http://192.168.1.4:5000/api/projects/None/hierarchy

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "E:\Ynput\ayon-core\client\ayon_core\lib\events.py", line 333, in process_event
    callback(event)
  File "E:\Ynput\ayon-core\client\ayon_core\tools\utils\folders_widget.py", line 577, in _on_folders_refresh_finished
    self.set_project_name(event["project_name"])
  File "E:\Ynput\ayon-core\client\ayon_core\tools\utils\folders_widget.py", line 456, in set_project_name
    self._refresh_folder_assignments(project_name)
  File "E:\Ynput\ayon-core\client\ayon_core\tools\utils\folders_widget.py", line 572, in _refresh_folder_assignments
    assigned_folder_paths = self._controller.get_assigned_folder_paths(project_name)
  File "E:\Ynput\ayon-core\client\ayon_core\tools\launcher\control.py", line 68, in get_assigned_folder_paths
    return self._hierarchy_model.get_assigned_folder_paths(
  File "E:\Ynput\ayon-core\client\ayon_core\tools\common_models\hierarchy.py", line 310, in get_assigned_folder_paths
    folder_items = self.get_folder_items(project_name, sender)
  File "E:\Ynput\ayon-core\client\ayon_core\tools\common_models\hierarchy.py", line 279, in get_folder_items
    self._refresh_folders_cache(project_name, sender)
  File "E:\Ynput\ayon-core\client\ayon_core\tools\common_models\hierarchy.py", line 573, in _refresh_folders_cache
    folder_items = self._query_folders(project_name)
  File "E:\Ynput\ayon-core\client\ayon_core\tools\common_models\hierarchy.py", line 577, in _query_folders
    hierarchy = ayon_api.get_folders_hierarchy(project_name)
  File "E:\Ynput\ayon-launcher\.venv\lib\site-packages\ayon_api\_api.py", line 785, in get_folders_hierarchy
    return con.get_folders_hierarchy(*args, **kwargs)
  File "E:\Ynput\ayon-launcher\.venv\lib\site-packages\ayon_api\server_api.py", line 3553, in get_folders_hierarchy
    response.raise_for_status()
  File "E:\Ynput\ayon-launcher\.venv\lib\site-packages\ayon_api\server_api.py", line 203, in raise_for_status
    raise HTTPRequestError(message, exc.response)
ayon_api.exceptions.HTTPRequestError: 404 Client Error: Not Found for url: http://192.168.1.4:5000/api/projects/None/hierarchy
WARNING:EventCallback:Failed to execute event callback < EventCallback - _on_folders_refresh_finished > E:\Ynput\ayon-core\client\ayon_core\tools\utils\folders_widget.py
Traceback (most recent call last):
  File "E:\Ynput\ayon-launcher\.venv\lib\site-packages\ayon_api\server_api.py", line 199, in raise_for_status
    self._response.raise_for_status()
  File "E:\Ynput\ayon-launcher\.venv\lib\site-packages\requests\models.py", line 1021, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: http://192.168.1.4:5000/api/projects/None/hierarchy
MustafaJafar commented 3 weeks ago

Looks good. Is there any reason it's enabled by default in the launcher and disabled in the rest ? Is there a way to specify whether or not to enable that check box by default ? image

fabiaserra commented 3 weeks ago

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "E:\Ynput\ayon-core\client\ayon_core\lib\events.py", line 333, in process_event callback(event) File "E:\Ynput\ayon-core\client\ayon_core\tools\utils\folders_widget.py", line 577, in _on_folders_refresh_finished self.set_project_name(event["project_name"]) File "E:\Ynput\ayon-core\client\ayon_core\tools\utils\folders_widget.py", line 456, in set_project_name self._refresh_folder_assignments(project_name) File "E:\Ynput\ayon-core\client\ayon_core\tools\utils\folders_widget.py", line 572, in _refresh_folder_assignments assigned_folder_paths = self._controller.get_assigned_folder_paths(project_name) File "E:\Ynput\ayon-core\client\ayon_core\tools\launcher\control.py", line 68, in get_assigned_folder_paths return self._hierarchy_model.get_assigned_folder_paths( File "E:\Ynput\ayon-core\client\ayon_core\tools\common_models\hierarchy.py", line 310, in get_assigned_folder_paths folder_items = self.get_folder_items(project_name, sender) File "E:\Ynput\ayon-core\client\ayon_core\tools\common_models\hierarchy.py", line 279, in get_folder_items self._refresh_folders_cache(project_name, sender) File "E:\Ynput\ayon-core\client\ayon_core\tools\common_models\hierarchy.py", line 573, in _refresh_folders_cache folder_items = self._query_folders(project_name) File "E:\Ynput\ayon-core\client\ayon_core\tools\common_models\hierarchy.py", line 577, in _query_folders hierarchy = ayon_api.get_folders_hierarchy(project_name) File "E:\Ynput\ayon-launcher.venv\lib\site-packages\ayon_api_api.py", line 785, in get_folders_hierarchy return con.get_folders_hierarchy(*args, **kwargs) File "E:\Ynput\ayon-launcher.venv\lib\site-packages\ayon_api\server_api.py", line 3553, in get_folders_hierarchy response.raise_for_status() File "E:\Ynput\ayon-launcher.venv\lib\site-packages\ayon_api\server_api.py", line 203, in raise_for_status raise HTTPRequestError(message, exc.response) ayon_api.exceptions.HTTPRequestError: 404 Client Error: Not Found for url: http://192.168.1.4:5000/api/projects/None/hierarchy WARNING:EventCallback:Failed to execute event callback < EventCallback - _on_folders_refresh_finished > E:\Ynput\ayon-core\client\ayon_core\tools\utils\folders_widget.py Traceback (most recent call last): File "E:\Ynput\ayon-launcher.venv\lib\site-packages\ayon_api\server_api.py", line 199, in raise_for_status self._response.raise_for_status() File "E:\Ynput\ayon-launcher.venv\lib\site-packages\requests\models.py", line 1021, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 404 Client Error: Not Found for url: http://192.168.1.4:5000/api/projects/None/hierarchy

Oh yeah, I have fixed that on my fork, let me push it here as well

EDIT: done here https://github.com/ynput/ayon-core/pull/622/commits/6e0de41d769448f96681ac976809888f88699c94

fabiaserra commented 3 weeks ago

Looks good. Is there any reason it's enabled by default in the launcher and disabled in the rest ?

No reason really, we should probably just expose it as addon settings to let each studio choose their defaults

MustafaJafar commented 3 weeks ago

Oh yeah, I have fixed that on my fork, let me push it here as well

EDIT: done here 6e0de41

The error vanished. Thanks. I wonder why the update doesn't work.. I had to return and reselect my project to make it work. Animation_73

fabiaserra commented 3 weeks ago

Oh yeah, I have fixed that on my fork, let me push it here as well EDIT: done here 6e0de41

The error vanished. Thanks. I wonder why the update doesn't work.. I had to return and reselect my project to make it work.

Good catch, but the reason is because I'm only calling the function _refresh_folder_assignments on the set_project_name function, which only happens on first load. I can add it on the refresh function too and that should do it

fabiaserra commented 3 weeks ago

Good catch, but the reason is because I'm only calling the function _refresh_folder_assignments on the set_project_name function, which only happens on first load. I can add it on the refresh function too and that should do it

Fixed here https://github.com/ynput/ayon-core/pull/622/commits/6dde360d71afbba05da72276b81cc2f9e3a781cb