Smarter fetching of directories
We should consider caching the requests that we make in the file browser to avoid re-fetching the content of the current directory every time we navigate.
To achieve this, we first need to make consistent requests, which isn't the case at the moment. As an example, with the file structure on Bosquet, the following requests all return the same thing (i.e. the content of the root folder):
- GET https://bosquet.silx.org/daiquiri/api/filebrowser/directory?path=
- GET https://bosquet.silx.org/daiquiri/api/filebrowser/directory?path=FetuB-27A_5/..
- GET https://bosquet.silx.org/daiquiri/api/filebrowser/directory?path=data/..
- GET https://bosquet.silx.org/daiquiri/api/filebrowser/directory?path=id29/..
We could resolve /..
path segments on the front-end, but I think it would be more elegant to rethink the API a little, more specifically the response of the /filebrowser/directory
endpoint.
At the moment, the endpoint returns a path
of the form:
-
<currentFolder>/..
for..
entries, and -
./<entryName>
for the root folder's entries.
Instead, it could simply return an absolute path for every entry (or rather a path relative to the root folder - e.g. FetuB-27A_5
, not /home/huder/daiquiri_backend/braggy-data/FetuB-27A_5
).
As a bonus, this refactor of the API would save us from having to call the /filebrowser
endpoint every time to get the absolute path of the current directory; we could make this call once for the root directory (to get /home/huder/daiquiri_backend/braggy-data
) and then just use this path as prefix for all sub-directories.