jfa-go icon indicating copy to clipboard operation
jfa-go copied to clipboard

Add Paging For Accounts List

Open MuhammadBayiz opened this issue 7 months ago • 10 comments

Hi, i ask to add paging for faster loading of the accounts list i have close to 3 thousand users disabled or active and loading the accounts list is always a Hussle for me it takes quite the time to load, maybe we can add paging to fasten this process? Or another approach for faster loading. Thanks

https://github.com/user-attachments/assets/21c1e04c-abdc-4e37-9c78-d986ba436756

MuhammadBayiz avatar May 14 '25 04:05 MuhammadBayiz

Image

JamsRepos avatar May 15 '25 11:05 JamsRepos

I share a server a cross a community for local content sharing(Public content), although not related to jfa-go.

MuhammadBayiz avatar May 15 '25 11:05 MuhammadBayiz

Holy shit finally, someone with a lot of users. I have a tool to populate Jellyfin with a load of fake users but have never tried with this many. I'll do that and see what changes I can make to improve performance as well as doing some pagination (as seen in the activity log)

hrfee avatar May 15 '25 16:05 hrfee

Holy shit finally, someone with a lot of users. I have a tool to populate Jellyfin with a load of fake users but have never tried with this many. I'll do that and see what changes I can make to improve performance as well as doing some pagination (as seen in the activity log)

That would be great, and I'm ready for any testing.

MuhammadBayiz avatar May 17 '25 05:05 MuhammadBayiz

I just merged infinite scrolling, where items are loaded and added to the DOM as you scroll. It performs well for me with 5000 fake accounts. It also added server-side search, which searches all records at once if you press the "Search/sort all" button. A build should be available soon, let me know any issues you have.

hrfee avatar May 27 '25 14:05 hrfee

I'll test this tonight and will be back with a feedback, thanks for a quick reply.

MuhammadBayiz avatar May 27 '25 14:05 MuhammadBayiz

sorry for this late reply in advance, I've tested it on my windows to connect to my remote jellyfin on a fresh installation and it was very fast it took 17.77ms to load a record from 5764 Total Records I didn't see any bugs or any issues so far, but when I tried to run it on my Linux server for real intensive testing, I coudn't get it to login I always got this error when logging in to the web ui, note previously i was on

docker.io/hrfee/jfa-go:latest 12/26/2023 310338eb7978 using podman, i updated it and used my old configs and tried changing user/password authenticaton method no use.

I was getting this error from chrome console:

           GET https://domain.example/undefined/token/refresh 404 (Not Found)
login @ admin.js:320
(anonymous) @ admin.js:320
(anonymous) @ admin.js:320

is it has something todo with my setup?

here's a summary log of jfa-go from chatgpt(log was too long):

### jfa-go Service Shutdown Log

**Systemd Events**
- `jfa-go.service`: Consumed 10.639s CPU time.
- `jfa-go.service`: Succeeded.
- Service stopped: "An account management system for Jellyfin."

**Database Levels**
- `Level 0`: 5 tables, 88 MiB / 0 B, Score: 1.00 → 4.82
- `Level 1–5`: 0 tables, 0 B / 10 MiB, Score: 0.00 → 0.00
- `Level 6`: 2 tables, 2.1 MiB / 10 MiB, Score: 0.00 → 0.00

**BadgerDB Logs**
- All 6 tables opened in 1ms
- Deleted empty vlog: `373766.vlog`
- Set `nextTxnTs = 56093`
- Lifetime L0 stalled: 0s

**jfa-go Events**
- Server shut down
- Failure serving: `http: Server closed`
- Shutdown signal received
- Backup, User, PWR, and Housekeeping daemons started
- PWR daemon failed: Path "/jf" not found
- Authenticated with Jellyfin: `https://plus.shafilm.vip`
- Router initialized, routes loaded
- DB connected: `/home/kurdflim/.config/jfa-go/db`
- Config loaded: `/home/kurdflim/.config/jfa-go/config.ini`
- Version: `git (c02cfff)`
- Socket: `/tmp/jfa-go.sock`

**Requests and Responses**
- `/undefined/token/login` → 404 (multiple times)
- `/undefined/token/refresh` → 404
- `/geoserver` → 404
- `/lang/admin` → 200
- `/lang/user` → 200
- `/lang/form` → 200
- `/invite/zBLHEK2bi9wUFKBbq4VbTA` → 200
- `/my/token/login` → 401 / 200
- `/my/token/refresh` → 400
- `/my/logout` → 500
- `/my/details`, `/my/account` → 200
- Various static assets (fonts, CSS, JS) → 200

**User Authentication Flow**
- Token requested (login, refresh)
- Failed authorization: invalid user/pass
- User "bndyanmala" expired and disabled

**Summary**
- Clean shutdown after handling token errors and expired user accounts.
- Database clean and compact.
- Routes and daemons initialized correctly, except PWR daemon path error.

MuhammadBayiz avatar May 29 '25 21:05 MuhammadBayiz

I've tried to recreate the config.ini fresh with my old db but no luck with logging in to webui. I even added a subpath for admin page but still same error

MuhammadBayiz avatar May 29 '25 21:05 MuhammadBayiz

Even on a fresh config/db i get this

[GIN] GET(/) => 200
[GIN] GET(/lang/admin) => 200
[GIN] GET(/undefined/token/refresh) => 404
[GIN] GET(/undefined/token/login) => 404
[GIN] GET(/misc/.env) => 404
[GIN] GET(/undefined/token/login) => 404
[GIN] GET(/modules/api/.env) => 404
[GIN] GET(/modules/auth/.env) => 404
[GIN] GET(/modules/db/.env) => 404
[GIN] GET(/modules/.env) => 404                                                  [GIN] GET(/modules/utils/.env) => 404
[GIN] GET(/partners/.env) => 404                                                 [GIN] GET(/) => 200
[GIN] GET(/platform/.env) => 404

MuhammadBayiz avatar May 31 '25 11:05 MuhammadBayiz

I got it to work and I've been testing and tinkering with it and here's my thoughts on it:

  • in slow connection, if you don't wait until the first batch (40) accounts load it wont search at all you would have to refresh the page and that takes 1-2 Sec to load first and then do the search its fine for slow connection but would be better if it would've still searched after the it loaded the first batch.
  • Mass Editing is a little buggy, for example i wanted to update settings for around ~800 users when filtering them i coundt select all of them because not all of them were loaded so i had to catch the load all button before it jumped again to the end of the page in order for the accounts to load and sometimes on mobile even after pressing load all and all the accounts where loaded as it showed in the number reading of records up the page when selecting "Select All" it would only select about ~80 i had to go all the way to the end in order for them load properly and then re selecting all.
  • the changes to accounts doesnt happen in real time, multiple examples (mostly on mobile), deleting expiry most time dont happen in th ui i have to refresh the page multiple times in order it to apply or show if it was removed also for extending too i have to refresh couple of times and wait.

an example of the select all button, it loaded 120 but only selected 117:

Image

MuhammadBayiz avatar Jun 07 '25 20:06 MuhammadBayiz

Thanks for all these observations, sorry I didn't have time to work on them for a while but I'll try and do what I can over the next few weeks.

hrfee avatar Jul 14 '25 14:07 hrfee

1st Bullet: I can't reproduce this. I load the admin page normally, enable throttling to GPRS speeds, open the account tab, immediately paste in a search before anything loads. Pages continue to load all the way until my search is found (it's roughly no. 180 in the list).

2nd Bullet: With bdd1460, pressing the "Select All" checkbox once will select everything loaded in the browser and show an indeterminate symbol if there is more unloaded. If you click again, all records will be loaded an selected. I also put a copy of the load all button in the top "Actions" bar so it's easier to access. I hope this makes select everything easier.

I'll get to the other things soon.

hrfee avatar Jul 18 '25 17:07 hrfee

The user cache is invalidated when changes are made now, so reloading after making a change should bring along new values. It's quite a lazy solution but seems to be fast enough (~1s delay with 5000 users) for now. I'm gonna mark this done, feel free to let me know if there's anything else.

hrfee avatar Nov 27 '25 18:11 hrfee