Skip to content

Conversation

@bnussman-akamai
Copy link
Member

@bnussman-akamai bnussman-akamai commented Mar 10, 2025

Description 📝

This PR performs a light refactor of Cloud Manager's main search 🔍

By no means does it make search as good as I want it to be, but this takes a step in the right direction by cleaning up the implementation and introducing "Search v2" for large customers.

Changes 🔄

  • Removes dependency on recompose (to unblock React 19) 🗑️
  • Updates the API search implementation to use @linode/search parser (Search v2) to give large customers better functionality (like and, or, >, <, etc...) ✨
    • Customers with less than 1500 Linodes will still use the existing search implementation
  • Adds StackScripts as a searchable entity ➕
  • Adds REACT_APP_FORCE_SEARCH_TYPE env variable to manually set which search engine Cloud Manager should use
    • client will force Cloud Manager to use the existing client size search implimentation
    • api will force Cloud Manager to use Search v2, which uses server-side API filtering
  • Fixes bug causing search to show incorrect icon for some entities 🔧

Preview 📷

Note

No significant UI changes are expected

How to test 🧪

  • Test Cloud Manager's main search bar and the search landing page (http://localhost:3000/search)
    • Compare functionality to production and ensure there are no regressions as far as how search works
  • Set REACT_APP_FORCE_SEARCH_TYPE=api in your .env file and test the new API search as if you were a large customer
    • Verify basic queries works
    • Verify complex queries work (for example: tag: prod, label: lke or label: prod, etc...)
    • Verify there is some level of basic error handling
Author Checklists

As an Author, to speed up the review process, I considered 🤔

👀 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


  • I have read and considered all applicable items listed above.

As an Author, before moving this PR from Draft to Open, I confirmed ✅

  • All unit tests are passing
  • TypeScript compilation succeeded without errors
  • Code passes all linting rules

@bnussman-akamai bnussman-akamai self-assigned this Mar 10, 2025
@bnussman-akamai bnussman-akamai requested a review from a team as a code owner March 10, 2025 17:43
@bnussman-akamai bnussman-akamai requested review from dwiley-akamai and hana-akamai and removed request for a team March 10, 2025 17:43
@bnussman-akamai bnussman-akamai changed the title Poc/start refatcoring search refactor: Clean up main search implementation Mar 10, 2025
@bnussman-akamai bnussman-akamai changed the title refactor: Clean up main search implementation refactor: [M3-9510] - Clean up main search implementation Mar 10, 2025
export const getDescriptionForCluster = (cluster: KubernetesCluster) => {
const description: string[] = [
`Kubernetes ${cluster.k8s_version}`,
region?.label ?? cluster.region,
Copy link
Member Author

Choose a reason for hiding this comment

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

The one trade-off this PR makes is that our "entityToSearchableItem" functions must be pure and not require extra API data. This is functionality we can add back in the future, but not as easily right now.

@github-actions
Copy link

github-actions bot commented Mar 10, 2025

Coverage Report:
Base Coverage: 79.96%
Current Coverage: 79.82%

Copy link
Contributor

@jaalah-akamai jaalah-akamai left a comment

Choose a reason for hiding this comment

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

✅ Tested operators: is, or, and, >
✅ Was able to filter by tags and labels
✅ Product family icons appear to work again
❓ I was not able to search for stackscripts in top menu search bar

@bnussman-akamai
Copy link
Member Author

bnussman-akamai commented Mar 11, 2025

@jaalah-akamai It should be working but I was missing some cache invalidations. Should work for sure now. 8c336b7

@jaalah-akamai
Copy link
Contributor

✅ confirmed
Screenshot 2025-03-11 at 11 35 53 AM

Copy link
Contributor

@jaalah-akamai jaalah-akamai left a comment

Choose a reason for hiding this comment

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

Nice work - approving

const combinedResults = result.flatMap(
(r) =>
r.data?.pages.flatMap((p) =>
p.data.map(r.getSearchableItem as (i: unknown) => SearchableItem)
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm sure this type assertion is fine here. Adding a type guard would be nice, but it looks to add a bunch more boilerplate for something I think we can be pretty certain about.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I don't like this, but I think it is safe enough for now.

Ultimately, I'd like to refactor or remove the SearchableItem type completely because its type-safety is questionable at best. This PR improves it a tiny bit, but not significantly

@bnussman-akamai bnussman-akamai added the Add'tl Approval Needed Waiting on another approval! label Mar 11, 2025
Copy link
Contributor

@dwiley-akamai dwiley-akamai left a comment

Choose a reason for hiding this comment

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

No functionality regressions observed ✅
Search queries & basic error handling with REACT_APP_FORCE_SEARCH_TYPE=api set ✅

@github-project-automation github-project-automation bot moved this from Review to Approved in Cloud Manager Mar 18, 2025
@bnussman-akamai bnussman-akamai added Approved Multiple approvals and ready to merge! and removed Add'tl Approval Needed Waiting on another approval! labels Mar 18, 2025
@linode-gh-bot
Copy link
Collaborator

Cloud Manager UI test results

🎉 539 passing tests on test run #19 ↗︎

❌ Failing✅ Passing↪️ Skipped🕐 Duration
0 Failing539 Passing3 Skipped121m 52s

@bnussman-akamai bnussman-akamai merged commit dff18f9 into linode:develop Mar 18, 2025
27 checks passed
@github-project-automation github-project-automation bot moved this from Approved to Merged in Cloud Manager Mar 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Approved Multiple approvals and ready to merge! Search Relates to Cloud Manager's search functionality

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

5 participants