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

Activity Page does not support Filtering and Pagination together correctly #6221

Open
PeachesMLG opened this issue Oct 18, 2024 · 11 comments
Open
Labels
enhancement Improve existing functionality or small fixes

Comments

@PeachesMLG
Copy link

Describe The Bug
The Activity Page does not support Filtering and Pagination together due to doing pagination on server side, and filtering on the client side.
This means If you set a filter for a user, it only filters the results on the current page you are on.
e.g. Page1 may return 0 results, Page 2 may return 2 results, page 3 5 ect.

Steps To Reproduce
This is demenstrated best on an account that doesnt use jellyfin often

  1. Go to the activity page
  2. Create a filter (e.g. filter by a user)
  3. Navigate through the pages and see the problem

Screenshots
Page 1
image
Page 2
Untitled design

System (please complete the following information):

  • Platform: Browser
  • Browser: Firefox
  • Jellyfin Version: 10.9.11
@PeachesMLG PeachesMLG added the bug Something isn't working label Oct 18, 2024
@A7Lavinraj
Copy link

That means filtering should be done first before pagination, right?

@thornbill thornbill added enhancement Improve existing functionality or small fixes and removed bug Something isn't working labels Oct 23, 2024
@thornbill
Copy link
Member

It's definitely not ideal, but this is currently working as intended. Pagination happens on the backend because the query can be slow (I have 126,000+ entries on my main server) and filtering happens on the frontend because the api does not support filtering. We might be able to add some logic to fetch additional rows if filtering results in less than the page size but that doesn't appear to be something that is supported "out of the box" with the table library.

@PeachesMLG
Copy link
Author

PeachesMLG commented Oct 23, 2024

It's definitely not ideal, but this is currently working as intended. Pagination happens on the backend because the query can be slow (I have 126,000+ entries on my main server) and filtering happens on the frontend because the api does not support filtering. We might be able to add some logic to fetch additional rows if filtering results in less than the page size but that doesn't appear to be something that is supported "out of the box" with the table library.

When you say the API doesnt support it, do you mean the Jellyfin server API doesnt have a filter option on the query?
or the Material React Table Library doesnt support server side filtering?

@thornbill
Copy link
Member

The user activity API in the Jellyfin server does not support filtering.

@A7Lavinraj
Copy link

A7Lavinraj commented Oct 24, 2024

So what we have to build anyways(filtering?), like give some hints to do it

@PeachesMLG
Copy link
Author

The user activity API in the Jellyfin server does not support filtering.

So from what I can see it has Date and UserId filtering
https://github.com/jellyfin/jellyfin/blob/master/Jellyfin.Api/Controllers/ActivityLogController.cs#L49
I guess it potentially needs a Level and Type filter aswell? Is there anything else the backend would need in order for this to work that im missing?

@Dan-613
Copy link

Dan-613 commented Nov 5, 2024

Just thinking about working on this and adding filtering server-side, however it might be slow to return results if the Activity Logs are big since the Type is stored as a string unless we add an index on the type.

Is it worth it to add Type and Level filtering server-side if an index is required?

@thornbill
Copy link
Member

So from what I can see it has Date and UserId filtering

https://github.com/jellyfin/jellyfin/blob/master/Jellyfin.Api/Controllers/ActivityLogController.cs#L49

I guess it potentially needs a Level and Type filter aswell? Is there anything else the backend would need in order for this to work that im missing?

This is not correct. You can only currently filter on system vs user events and get the activity since a specific date.

@Dan-613
Copy link

Dan-613 commented Nov 5, 2024

This is not correct. You can only currently filter on system vs user events and get the activity since a specific date.

The suggestion is to add Type and Level filtering on the server-side.

@viown
Copy link
Member

viown commented Nov 5, 2024

Just thinking about working on this and adding filtering server-side, however it might be slow to return results if the Activity Logs are big since the Type is stored as a string unless we add an index on the type.

It might be a bit too complex to implement the required functionality to make it work on web as we'd need support for both sorting and filtering (for all columns) by query.

@Dan-613
Copy link

Dan-613 commented Nov 6, 2024

It might be a bit too complex to implement the required functionality to make it work on web as we'd need support for both sorting and filtering (for all columns) by query.

I don't mind giving it a try. Material React Table being used seems to support server-side querying and filtering.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improve existing functionality or small fixes
Projects
None yet
Development

No branches or pull requests

5 participants