Skip to content
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

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

Open
wants to merge 16 commits into
base: develop
Choose a base branch
from

Conversation

fabiaserra
Copy link
Contributor

@fabiaserra fabiaserra commented Jun 10, 2024

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 6187065

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

@ynbot ynbot added type: feature Adding something new and exciting to the product size/S labels Jun 10, 2024
@fabiaserra fabiaserra changed the title Add a checkbox in Launcher to filter out folders by assignment only Add support in Launcher to filter out folders and tasks by assignment only Jun 10, 2024
@fabiaserra fabiaserra changed the title Add support in Launcher to filter out folders and tasks by assignment only Add support in Launcher to filter out folders and tasks by assignment Jun 10, 2024
@@ -49,12 +49,16 @@ def __init__(self, controller, parent):
folders_filter_text = PlaceholderLineEdit(folders_wrapper)
folders_filter_text.setPlaceholderText("Filter folders...")

show_only_assignments = QtWidgets.QCheckBox("Show only assignments")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I personally think this wording is a bit weird. It's not showing assignments, it's still showing folder and tasks - but just filters to those assigned to you.

This would already be clearer "Show only assigned folders"
Even more explicit if it refers to assignments to "You" maybe - although that may be just me overthinking this and could be easily added in a tooltip.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wrote it like this knowing that I was going to use the same filter to filter out tasks, does that now change your thinking about the wording too?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or I could change it to Show only my assignments

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if anyone else's mind trips over this so I'll leave to anyone else to confirm from a UX perspective what they like instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I do prefer Show only my assignments tbh

client/ayon_core/tools/utils/folders_widget.py Outdated Show resolved Hide resolved
@fabiaserra
Copy link
Contributor Author

fabiaserra commented Jun 11, 2024

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

@fabiaserra fabiaserra changed the title Add support in Launcher to filter out folders and tasks by assignment Add support to filter out folders and tasks by assignment Jun 11, 2024
@fabiaserra fabiaserra requested a review from BigRoy June 11, 2024 17:04
Comment on lines 287 to 290
If a child folder is assigned (i.e. /season/seq/sh010) this
function will also return all the parent entities on the
hierarchy (i.e. ["/season", "/season/seq"]) as those are
implicitly assigned to the user as well.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand reasoning as to why we might want to include parents for filtering for filtering logic where we still want to access the child. But the wording here is a bit weird since I don't understand why "implicitly" it means the parent folder is also assigned to the user - that seems odd and not the case in the frontend?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what do you suggest?

Copy link
Collaborator

@BigRoy BigRoy Jun 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest just explaining it as:

        If a child folder is assigned (i.e. /season/seq/sh010) this
        function will also return all the parent entities on the
        hierarchy (i.e. ["/season", "/season/seq"]) because it
        contains children folders assigned to the user.

But maybe I'm misinterpreting why it's returning the parent entities?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand both the same way but I will change it to your phrasing

Comment on lines +52 to +56
show_only_my_assignments = QtWidgets.QCheckBox(
"Show only my assignments"
)
show_only_my_assignments.setChecked(True)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Admittedly now it starts feeling weird there's so much duplicated code for this hierarchy widget that also allows filtering across the codebase - but hey, we likely have good reasons for it :P

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah... I felt a bit like playing whac-a-mole trying to add it on all the places

@MustafaJafar
Copy link
Contributor

MustafaJafar commented Jun 13, 2024

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
Copy link
Contributor

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
Copy link
Contributor Author

fabiaserra commented Jun 13, 2024

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 6e0de41

@fabiaserra
Copy link
Contributor Author

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
Copy link
Contributor

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
Copy link
Contributor Author

fabiaserra commented Jun 13, 2024

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
Copy link
Contributor Author

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 6dde360

Copy link
Contributor

@MustafaJafar MustafaJafar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error is no longer occurs however a new bug shows up.
When closing the launcher after selecting a project and re-opening the launcher, the list becomes empty.

Animation_78

@MustafaJafar MustafaJafar added the community Issues and PRs coming from the community members label Jul 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community Issues and PRs coming from the community members size/S type: feature Adding something new and exciting to the product
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants