Closed nanjarapalli closed 9 months ago
Thanks for the detailed report @nanjarapalli.
Too many API requests to search a single device
That's a valid concern. Unfortunately Astarte does not support a search functionality natively, as it allows to get a paginated list of devices: https://docs.astarte-platform.org/latest/api/index.html#/device/getDevicesList
On the Dashboard we have to fetch all device pages before we can effectively search for a device; so we're trying to have an acceptable balance between asking lots of devices for a single page of data (fewer but slower API calls to Astarte) and asking smaller chunks of data at once (more but faster API calls).
Until Astarte provides a dedicated API, with 60k+ there's only so much that we can do client-side to improve UX and the responsiveness of the search functionality. We are aware of the concern and you are welcome to open a dedicated issue on the Astarte's repository if you wish to track developments on the matter.
Too much network usage to search a single device
This is a consequence of the previous point.
Duplicates are displayed
You are correct. And we actually merged a PR to fix that behavior: https://github.com/astarte-platform/astarte-dashboard/pull/344 Feel free to contact us in private if you'd like to have assistance to roll-out an updated snapshot of the Dashboard on your Astarte deployment.
Due to the missing status of the search, the user may try to use filter options a second time and this makes it even worse that requests are doubled (See inspect in the video)
Duplicate results should be fixed by the aforementioned PR: the Dashboard gets triggered the first time you attempt a search and it fetches the list of all devices so that it can be filtered client-side. Changing the search filters does not trigger more API calls, it now only updates how the fetched list of devices is filtered client-side.
Still, not all search results are visible until the Dashboard has a chance to fetch all the paginated list of devices. However the PR also adds visual signifiers, e.g. a spinner, to make the user aware that a search query is still loading. This way you know whether the Dashboard has finished fetching and filtering the list of all devices and the search query has completed.
Shows no device matches even though the device exists
As per my understanding, this behavior is related to the previous point and the same answer applies.
Gigabytes of memory usage by the browser
The mentioned PR should avoid all unneeded network requests, thus limiting the amount of exchanged data. Besides that, an Astarte API dedicated to a search functionality is what would really solve the behavior, requiring only a single API call to perform a search query.
To recap, the memory usage and the UX of the search functionality are dependent upon what Astarte has to offer, and that kind of issue should be solved there. Besides that, do you think some points are still not being addressed? Or, regardless to Astarte, do you see further improvements that we can add to the Dashboard?
As pointed out, the main issues for the UX of the search functionality are dependent upon what Astarte APIs have to offer. As such, optimal solutions will have to wait for the future versions of Astarte. The other inconsistencies are already fixed, so I'm closing this issue since astarte-platform/astarte#747 will track further developments on the matter.
Setup
Observation/Issues
https://user-images.githubusercontent.com/16062109/204317073-70763bf4-a6de-40a3-aa19-ac31323dc4bc.mp4