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

fix #5957 feat(nimbus-ui): sortable directory columns #6084

Merged
merged 1 commit into from Aug 3, 2021

Conversation

lmorchard
Copy link
Contributor

@lmorchard lmorchard commented Jul 28, 2021

Because:

  • We want to make the directory view table sortable by each column

  • Currently applied sorting should be reflected in the url query
    parameter.

This commit:

  • Adds support for directory tab selection via query parameter

  • Adds experiment sorting to DirectoryTable based on location query
    parameters

  • Adds SortableColumnTitle component to DirectoryTable to cycle through
    column sorting modes and update location query parameters

  • Updates column definitions in DirectoryTable components to support
    sorting criteria

  • Adds sorting utilities to lib/experiment.ts

  • Tweaks mock data to add more sortable variety

  • Updates tests and stories with router context

  • Adds useSearchParamsState hook to read and update location query
    parameters

@jaredlockhart
Copy link
Collaborator

HOLY COW @lmorchard IT'S SO COOL 👏 👏 👏 👏 🎉 🎉 🎉 🎉 🎉 🎉

@lmorchard lmorchard force-pushed the 5957-directory-table-sort branch 2 times, most recently from 6395844 to 5d25299 Compare July 29, 2021 23:22
@lmorchard lmorchard changed the title issue #5957: Make directory view columns sortable fix #5957 feat(nimbus-ui): sortable directory columns Jul 29, 2021
@lmorchard
Copy link
Contributor Author

lmorchard commented Jul 29, 2021

Hmm, almost passing CI. I see an integration_nimbus failure, but not sure if it's intermittent (seems not entirely related to changes)

Failed on a re-run, will keep banging on it tomorrow. Maybe the new query params on the home page are tripping up nimbus/test_e2e_create_experiment.py::test_create_new_experiment_remote_settings_reject somehow

@pdehaan
Copy link
Contributor

pdehaan commented Jul 29, 2021

This is super cool! 👍
Not sure if we can randomize the experiment owner/feature/startdate a bit more in Storybook.

Also noticed the minor edge case of adding that sorting triangle can cause some columns to shift.

Comment on lines 195 to +201
# Load home page and wait for experiment to show in the Drafts tab
selenium.get(base_url)
drafts_tab_url = f"{base_url}?tab=drafts"
selenium.get(drafts_tab_url)
experiment_found = False
for attempt in range(45):
try:
home = HomePage(selenium, base_url).wait_for_page_to_load()
home.tabs[-1].click()
home = HomePage(selenium, drafts_tab_url)
Copy link
Contributor Author

@lmorchard lmorchard Jul 30, 2021

Choose a reason for hiding this comment

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

This gets the failing integration test to pass, but it's kind of a weird fix.

The thing that it was tripping on was HomePage(selenium, base_url).wait_for_page_to_load(). That just looks for the presence of .directory-table in the DOM.

As far as I can tell, that element is in the DOM when it fails. And this same method is used in other tests and works. But, for some reason, it consistently fails in this test. Can't figure out why.

Copy link
Contributor

Choose a reason for hiding this comment

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

/Paging Dr @jrbenny35

Because:

* We want to make the directory view table sortable by each column

* Currently applied sorting should be reflected in the url query
  parameter.

This commit:

* Adds support for directory tab selection via query parameter

* Adds experiment sorting to DirectoryTable based on location query
  parameters

* Adds SortableColumnTitle component to DirectoryTable to cycle through
  column sorting modes and update location query parameters

* Updates column definitions in DirectoryTable components to support
  sorting criteria

* Adds sorting utilities to lib/experiment.ts

* Tweaks mock data to add more sortable variety

* Updates tests and stories with router context

* Adds useSearchParamsState hook to read and update location query
  parameters
@lmorchard lmorchard marked this pull request as ready for review July 30, 2021 22:46
Copy link
Contributor

@jodyheavener jodyheavener left a comment

Choose a reason for hiding this comment

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

Trying to find things but coming up pretty well empty, this just works really well

<p className="p-3">
Location:{" "}
<code data-testid="location">
{location.pathname}
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like this is always rendering /slug/edit

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, that's just the canned value from mocks. Threw it in there just to make sure the path didn't get altered by the query parameter manipulation

Copy link
Collaborator

@jaredlockhart jaredlockhart left a comment

Choose a reason for hiding this comment

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

Looks and works great @lmorchard ! 🎉 🎉 🎉 🎉

@lmorchard
Copy link
Contributor Author

Gotta take the r+'s and merge to clear the way for issue #5958

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.

None yet

4 participants