Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace Datasets DatasetSelect component on groups page with ListResources [#870] #904

Merged
merged 4 commits into from
Jun 14, 2024

Conversation

genehack
Copy link
Contributor

@genehack genehack commented Jun 6, 2024

Description of proposed changes

Replaces the current "datasets" DatasetSelect component with a ListResources component that hits the same backend charon API. Also refactors in useDataFetch to change the hard-coded parser into a passed-in (mandatory) callback function, and updates two existing uses to the new pattern. Finally, adds in conditional display logic to the ListResources component to hide or otherwise not set UI elements that don't make sense with the groups dataset (e.g., last modified dates, since we don't have those).

Preview

Related issue(s)

#870

Checklist

@genehack genehack requested review from jameshadfield, victorlin and a team and removed request for jameshadfield June 6, 2024 22:27
@nextstrain-bot nextstrain-bot temporarily deployed to nextstrain-s-group-reso-yqiu5v June 6, 2024 22:27 Inactive
static-site/src/components/ListResources/useDataFetch.ts Outdated Show resolved Hide resolved
static-site/src/components/ListResources/index.tsx Outdated Show resolved Hide resolved
static-site/src/components/ListResources/index.tsx Outdated Show resolved Hide resolved
static-site/src/pages/groups.jsx Outdated Show resolved Hide resolved
static-site/src/pages/groups.jsx Outdated Show resolved Hide resolved
@nextstrain-bot nextstrain-bot temporarily deployed to nextstrain-s-group-reso-4fitvj June 7, 2024 20:10 Inactive
@nextstrain-bot nextstrain-bot temporarily deployed to nextstrain-s-group-reso-7bcwgz June 7, 2024 22:51 Inactive
@nextstrain-bot nextstrain-bot temporarily deployed to nextstrain-s-group-reso-3jjhe6 June 7, 2024 23:31 Inactive
@nextstrain-bot nextstrain-bot temporarily deployed to nextstrain-s-group-reso-36vhnk June 10, 2024 17:36 Inactive
@nextstrain-bot nextstrain-bot temporarily deployed to nextstrain-s-group-reso-4pxf0r June 10, 2024 17:44 Inactive
@genehack
Copy link
Contributor Author

Note: CI / build will be broken until TS lint changes PR lands.

@victorlin
Copy link
Member

Note: CI / build will be broken until TS lint changes PR lands.

This blockage doesn't seem necessary/productive. Attempting removal with #909

@genehack
Copy link
Contributor Author

Note: CI / build will be broken until TS lint changes PR lands.

This blockage doesn't seem necessary/productive. Attempting removal with #909

it's not necessary, in that i could add lines to disable the couple lint failures -- but then those would need to be removed once #906 lands, and that feels like unproductive churn to me.

(i don't have a strong opinion about the direction #909 moves things in; i think linting being mildly annoying when broken is maybe a good thing…)

@victorlin
Copy link
Member

@genehack continuing the tangential discussion in #909 (comment)

@nextstrain-bot nextstrain-bot temporarily deployed to nextstrain-s-group-reso-0ftewi June 10, 2024 20:27 Inactive
@nextstrain-bot nextstrain-bot temporarily deployed to nextstrain-s-group-reso-vcqpx2 June 10, 2024 20:36 Inactive
@genehack
Copy link
Contributor Author

@genehack continuing the tangential discussion in #909 (comment)

👍

I merged #906 so that should get this unblocked soon (he says, as he discovers another linting problem...) — I will link a preview link once it builds.

@nextstrain-bot nextstrain-bot temporarily deployed to nextstrain-s-group-reso-fafosr June 10, 2024 20:41 Inactive
@genehack genehack temporarily deployed to nextstrain-s-group-reso-fafosr June 12, 2024 00:47 Inactive
@genehack genehack had a problem deploying to nextstrain-s-group-reso-fafosr June 12, 2024 18:38 Failure
@genehack genehack temporarily deployed to nextstrain-s-group-reso-fafosr June 12, 2024 18:40 Inactive
@genehack
Copy link
Contributor Author

genehack commented Jun 12, 2024

Okay, updated: callbacks now handle the fetch(); general other cleanups and fixups.

Previews

Copy link
Member

@jameshadfield jameshadfield left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The overloading of the word "group" must have made this a confusing first experience!

The error handling seems a little convoluted to me and it seems like it could be simplified in this PR, but that's the only thing that stands out to me. Functionally it's working really well.

static-site/src/components/ListResources/useDataFetch.ts Outdated Show resolved Hide resolved
static-site/src/pages/groups.jsx Outdated Show resolved Hide resolved
static-site/src/components/ListResources/index.tsx Outdated Show resolved Hide resolved
@genehack genehack temporarily deployed to nextstrain-s-group-reso-fafosr June 13, 2024 17:40 Inactive
@genehack genehack had a problem deploying to nextstrain-s-group-reso-fafosr June 13, 2024 18:29 Failure
@tsibley
Copy link
Member

tsibley commented Jun 13, 2024

note that only blab group data is being returned by the charon/getAvailable call in the staging/preview environment, and I'm not sure why that isn't reflected in the group tiles in the preview…

Maybe this was addressed in a meeting off-thread you had, but since I didn't see mention of it I wanted to clarify this for you.

Heroku review apps run in production mode with production config, but we've intentionally configured them (on the Heroku side) to use the nextstrain.org-testing AWS IAM user, which has a much more restrictive policy attached to it than the actual production IAM user (nextstrain.org)'s attached policy.

@genehack
Copy link
Contributor Author

note that only blab group data is being returned by the charon/getAvailable call in the staging/preview environment, and I'm not sure why that isn't reflected in the group tiles in the preview…

Maybe this was addressed in a meeting off-thread you had, but since I didn't see mention of it I wanted to clarify this for you.

Heroku review apps run in production mode with production config, but we've intentionally configured them (on the Heroku side) to use the nextstrain.org-testing AWS IAM user, which has a much more restrictive policy attached to it than the actual production IAM user (nextstrain.org)'s attached policy.

nope, nobody else has shared this; thanks, this makes sense.

Convert the two existing uses into the callback form.

This does not add any new functionality, it only re-arranges
implementation of existing functionality.
…urces [#870]

* make the Resource.lastUpdated property optional
* conditionalize display of "List known update" in IndividualResource
  TooltipWrapper
* conditionalize display of "Most recent snapshot" in ResourceGroup
* conditionalize use of Showcase in ListResources based on length of
  showcaseCards prop
* conditionalize use of SortOptions in ListResources based on initial
  group lacking a lastUpdated field
* extend groups page with ListResources callback to hit
  charon/getAvailableResources endpoint
out of scope for the main thrust of the branch, but quiets the
typechecker.
@genehack genehack temporarily deployed to nextstrain-s-group-reso-fafosr June 13, 2024 19:14 Inactive
@trvrb
Copy link
Member

trvrb commented Jun 13, 2024

Makes sense that this is just showing blab on the preview app, but the wider blab dataset list is a bit funny in terms of collapsing. The amount of content shown should be relative to the how many lines there are. Currently the blab dataset list is definitely too long even in collapsed view.

Ie collapsed height should be consistent across cards regardless of whether specific cards use one column, two columns or three columns.

@genehack
Copy link
Contributor Author

Makes sense that this is just showing blab on the preview app, but the wider blab dataset list is a bit funny in terms of collapsing. The amount of content shown should be relative to the how many lines there are. Currently the blab dataset list is definitely too long even in collapsed view.

I will look at what's going on here. Interestingly, if I point my local dev instance at the production data endpoint (i.e., if I fetch the data fram https://nextstrain.org/charon/getAvailable?prefix=/groups/), this does not happen:

Screenshot 2024-06-14 at 10 10 06

I wonder if the oddness in the display is because of the smaller data set size available in the preview environment?

@genehack
Copy link
Contributor Author

I wonder if the oddness in the display is because of the smaller data set size available in the preview environment?

Experimenting further, if I take the production data but filter it down to just 2 cards worth of data, the cards I get are large. Expanding that to 3 cards, the layout is as expected.

Two groups:

Screenshot 2024-06-14 at 10 23 55

Three groups:

Screenshot 2024-06-14 at 10 24 09

@genehack
Copy link
Contributor Author

I wonder if the oddness in the display is because of the smaller data set size available in the preview environment?

Experimenting further, if I take the production data but filter it down to just 2 cards worth of data, the cards I get are large. Expanding that to 3 cards, the layout is as expected.

Digging ever further, this seems to be intentional behavior. @jameshadfield could you speak to this?

I'm going to say I don't think this should be something that blocks this PR; if we do want to change this behavior, it can be a distinct thing.

@genehack genehack merged commit 65c8eb0 into master Jun 14, 2024
7 checks passed
@genehack genehack deleted the group-resource-list-870 branch June 14, 2024 17:37
@jameshadfield
Copy link
Member

Digging ever further, this seems to be intentional behavior. @jameshadfield could you speak to this?

The intention is that if few cards are in view (commonly achieved via filtering) then we should show more entries per card. The exact thresholds are (as always) open to change. We could (probably should) also remove the expand/contract toggle if there is only 1 card.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants