fablabbcn / smartcitizen-web

The Smart Citizen Kit platform
https://smartcitizen.me
GNU Affero General Public License v3.0
13 stars 7 forks source link

Add pagination, search and other improvements to user kits page #443

Closed oscgonfer closed 3 months ago

oscgonfer commented 11 months ago

This is an issue to add a search bar and a pagination to the kits page for large amounts of kits. This could allow us to avoid slow page loads in the view with large amount of kits. Now, a quick and dirty profiling gives 1.2s of request time to the /me endpoint, but much more for a larger request:

imagen

oscgonfer commented 8 months ago

We will move to the users endpoint for the requests on the users kit page. See referenced issue by @timcowlishaw

@pral2a would you happen to know why we are asking for devices in this page?

pral2a commented 8 months ago

I'm not sure if I'm getting the question fully. To fill the user profile with the devices owned by the user, we use /me to obtain the devices list and then /devices/{id} to load all the devices a user owns. Originally, we expected a max of 10 devices per user. However, right now, some users own a lot of devices, and the view crashes, causing issues and becoming useless for those users. I suggest to use pagination to reduce the number of requests to /devices/{id} .

oscgonfer commented 8 months ago

I'm not sure if I'm getting the question fully. To fill the user profile with the devices owned by the user, we use /me to obtain the devices list and then /devices/{id} to load all the devices a user owns.

Yes, so we think is that we can query directly the /users/{id} endpoint to get all the information needed for the devices, as that endpoint provides already the information needed to populate the device-card. If we need something else, we can always change that api endpoint, but as I see it I think all is there.

pral2a commented 8 months ago

Great! Please, ensure first how the end-point deals with private devices

oscgonfer commented 4 months ago

Adding to this, we can improve the view by adding something like list.js.