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

feat: [M3-8229] - Volume & Images search and filtering #10570

Merged
merged 15 commits into from
Jun 17, 2024

Conversation

abailly-akamai
Copy link
Contributor

@abailly-akamai abailly-akamai commented Jun 12, 2024

Description 📝

This PR implements search/filtering for both the /volumes & /images landing pages.

The context surrounding this feature is due to the fact that we don't have landing pages for both those entities. When searching through the main search bar, while the entities return in the search suggestions, clicking on them will bring the user to the landing page without any filtering (user would have to do a text search on the page to locate the record). For large accounts, the problem is even worse since the record can be paginated and not visible on the page.

In order to improve this experience, the PR adds search capability on the landing pages, with a query param lookup to auto-populate the field when a main search bar search points to a record.

For coverage, the PR implements two new e2e tests as they are more reliable than units for this particular behavior (API filtering) and mocking wouldn't add too much value.

Changes 🔄

For both images and volumes:

  • Add search query params to search results
  • Add search bars to landing pages
  • implement filtering and loading behaviors
  • write e2e suites

Target release date 🗓️

6/24/2024

Preview 📷

Volumes Images
Screen.Recording.2024-06-13.at.12.12.12.mov
Screen.Recording.2024-06-13.at.12.15.04.mov

How to test 🧪

⚠️ These steps apply to both the /volumes & /images landing pages.

Reproduction steps

  • In production, search for a volume or image in the main search and notice the poor experience

Verification steps

  • As seen in the videos, have a few entities created and test search/filtering
    • landing page search
    • main search bar searching/linking

ℹ️: images feature quite a constricting rate limiting. While debounced, over searching may get you a 400. This is a known issue which hopefully can be addressed soon (will have an ARB ticket for this).

As an Author I have considered 🤔

Check all that apply

  • 👀 Doing a self review
  • ❔ Our contribution guidelines
  • 🤏 Splitting feature into small PRs
  • ➕ Adding a changeset
  • 🧪 Providing/Improving test coverage
  • 🔐 Removing all sensitive information from the code and PR description
  • 🚩 Using a feature flag to protect the release
  • 👣 Providing comprehensive reproduction steps
  • 📑 Providing or updating our documentation
  • 🕛 Scheduling a pair reviewing session
  • 📱 Providing mobile support
  • ♿ Providing accessibility support

@abailly-akamai abailly-akamai self-assigned this Jun 12, 2024
@abailly-akamai abailly-akamai changed the title feat: [M3-8229] - Volume search filtering feat: [M3-8229] - Volume & Images search filtering Jun 13, 2024
@abailly-akamai abailly-akamai changed the title feat: [M3-8229] - Volume & Images search filtering feat: [M3-8229] - Volume & Images search and filtering Jun 13, 2024
}

setQuery(selectedImageFromParams.label);
}, [imageIdFromParam, manualImages, automaticImages]);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This may feel verbose but i like our trend of being super explicit in useEffects (and in logic blocks in general) to make things clear and readable, including early returns when possible.

placeholder="Search Images"
sx={{ mb: 2 }}
value={query}
/>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why did I not use the DebouncedSearchTextField? I am glad you asked. Cause that component is essentially crap and needs a complete refactor. There's even a customValue on that component to bypass the debouncing which does not make sense at all. All we need is to debounce on the onChange which is done here directly.

We already have a ticket to refactor the DebouncedSearchTextField component but I am wondering if we need a component at all for this. TBD

@@ -83,10 +85,9 @@ export const imageToSearchableItem = (image: Image): SearchableItem => ({
data: {
created: image.created,
description: image.description || '',
/* TODO: Update this with the Images icon! */
Copy link
Contributor Author

Choose a reason for hiding this comment

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

5 years later, yay! 🎉 (we were still showing the volume icon for images)

@abailly-akamai abailly-akamai marked this pull request as ready for review June 13, 2024 16:33
@abailly-akamai abailly-akamai requested review from a team as code owners June 13, 2024 16:33
@abailly-akamai abailly-akamai requested review from cliu-akamai, dwiley-akamai, carrillo-erik and gitkcosby and removed request for a team June 13, 2024 16:33
Copy link

@gitkcosby gitkcosby left a comment

Choose a reason for hiding this comment

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

Looks good to me. And, a great improvement.

Copy link

github-actions bot commented Jun 13, 2024

Coverage Report:
Base Coverage: 82.85%
Current Coverage: 82.85%

Copy link
Member

@bnussman-akamai bnussman-akamai left a comment

Choose a reason for hiding this comment

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

If you start searching from page 2 for example, results won't show because they are one page 1. Maybe we need to reset to page 1 on search?

Screen.Recording.2024-06-13.at.5.33.23.PM.mov

Comment on lines 233 to 235
{isFetching ? (
<TableRowLoading columns={6} />
) : (
Copy link
Member

Choose a reason for hiding this comment

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

I'd be in favor of removing this loading state. I think the spinner on the Search field is good enough, this one just causes the page to shift more

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Am going to keep it for now and see about more feedback. On the fence, it's nice for large accounts where the pagination shows

Copy link
Member

Choose a reason for hiding this comment

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

Still feel like we could do without this. It also causes shifting when the order is changed, which we don't do elsewhere in the app:

Screen.Recording.2024-06-14.at.10.26.41.AM.mov

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 i took it out but the search spinner isn't enough IMO - that's a bigger problem with a missing pattern in the app for this case - some tables have a circular loader for this case but that's annoying as well. i'll live with this

packages/manager/src/features/Volumes/VolumesLanding.tsx Outdated Show resolved Hide resolved
packages/manager/src/features/Images/ImagesLanding.tsx Outdated Show resolved Hide resolved
@carrillo-erik
Copy link
Contributor

carrillo-erik commented Jun 14, 2024

The failing landing-page-empty-state.spec.ts test is valid. I was able to confirm that Volumes landing page not rendered when a user does NOT have any volumes on their account. It appears the same is happening with Images landing page, although the test results do not reflect it.

See images below.

Expected Received
Screenshot 2024-06-14 at 4 53 30 AM Screenshot 2024-06-14 at 4 51 32 AM
Screenshot 2024-06-14 at 5 01 55 AM Screenshot 2024-06-14 at 5 01 24 AM

Copy link
Contributor

@carrillo-erik carrillo-erik left a comment

Choose a reason for hiding this comment

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

Great! ✅

Copy link
Member

@bnussman-akamai bnussman-akamai left a comment

Choose a reason for hiding this comment

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

Looks good! 🔍

@abailly-akamai
Copy link
Contributor Author

Thanks for the continued reviews and pushing for cleanest solution @bnussman-akamai 🥇

@bnussman-akamai
Copy link
Member

No problem! Thanks for jumping on this so quickly! 🛻💨

@abailly-akamai abailly-akamai merged commit 4ac62db into linode:develop Jun 17, 2024
32 of 33 checks passed
nikhagra-akamai pushed a commit to nikhagra-akamai/manager that referenced this pull request Jun 19, 2024
* Initial commit: search implementation

* Cleaner logic

* improve code and expand to images

* e2e coverage

* cleanup

* type fixes post rebase

* feedback @bnussman-akamai

* Added changeset: Volume & Images landing pages search and filtering

* feedback @bnussman-akamai

* more changes from feedback

* cleanup

* fix empty state

* moar cleanup

* moar cleanup

* code readability
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.

4 participants