nextstrain / nextstrain.org

The Nextstrain website
https://nextstrain.org
GNU Affero General Public License v3.0
87 stars 49 forks source link

Add last-modified dates to resource listing UI on groups pages #925

Open jameshadfield opened 1 week ago

jameshadfield commented 1 week ago

Context

The new resource-listing UI provides a way to surface last modified dates, as seen on the /staging page.

The /groups page now uses the resource-listing UI. This will soon also be the case for /groups/<groupName> pages. This work required modifications to the UI so that it would work in the absence of last-modified dates, because the charon/getAvailable API returns a list of resources (narratives & datasets) which don't include any information about the date the file was uploaded/modified.

Were the last-modified information available it would improve the UI on these pages by allowing for chronological sorting and identifying which resources had been recently updated.

Details

For individual groups pages and the summary /groups page the server obtains the data via a list objects call to S3 which returns data including the LastModified timestamp¹.

Our API ultimately returns data which looks like:

{
    "datasets": [
        {
            "request": "groups/blab/229e/E",
            "secondTreeOptions": [],
            "buildUrl":null
        },

We could extend this response to include an additional property² (e.g. lastModified: YYYY-MM-DD).

This data would then be easily parsed by the callback supplied to the list-resources UI and thus shown in the UI.


¹ This isn't the same as when the dataset was updated (as recorded in the dataset JSON's meta.updated field) however last-modified timestamps is also what the /staging and /pathogens pages use.

² An additional property shouldn't affect consumers of the API but this is something to keep in mind (primarily Auspice, but perhaps others - the CLI?).