IFC-2346 Display parent prefixes in search anywhere#8632
Draft
IFC-2346 Display parent prefixes in search anywhere#8632
Conversation
Contributor
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
This is the frontend companion to #8611, which added the
parent_prefixesfield to theInfrahubSearchAnywhereGraphQL query. That PR delivered the backend query and resolver changes; this PR consumes the new field in the frontend search dialog.No backend changes in this PR. The backend work is fully contained in #8611.
What changed
parent_prefixes(i.e., the search query is a valid IP address or CIDR prefix), a dedicated "Parent Prefixes" group appears above the "Objects" group in the search dialog. When the query is not an IP/CIDR, no section appears. When it is but no containing prefixes exist, an empty state message is shown.NodesOptionscomponent, parent prefix results render with the exact same format as regular search results (same fields, layout, namespace badge, click-to-navigate behavior).NodesOptionswas exported fromsearch-nodes.tsxfor reuse.parent_prefixes { node { id kind } }added to theSEARCHquery insearch.ts.parentPrefixes: Array<ObjectResult> | nulladded toSearchAnywhereResultinsearch-anywhere.ts. Maps fromparent_prefixesin the API response.What stayed the same: all existing search behavior is unchanged. The query hook, debounce, case-sensitivity toggle, "Go to" actions, "Objects" results, and "Documentation" results are untouched.
How to review
Key file:
search-parent-prefixes.tsx, follows the same pattern asSearchNodes. The main decision is renderingnullwhenparentPrefixesisnull(non-IP query) vs. showing an empty state when it's an empty array (valid IP, no containing prefixes).NodesOptionsexport insearch-nodes.tsx, changed fromconsttoexport const. No logic change.How to test
Manual: open the search dialog (Cmd+K or click the search trigger), type
10.0.0.2, and verify the "Parent Prefixes" section appears above "Objects" with10.0.0.0/16and10.0.0.0/8. Then typeatl1and verify no "Parent Prefixes" section appears.Impact & rollout
parent_prefixes(older backend version), the field isnulland the component renders nothing.parent_prefixesfield is fetched in the same GraphQL query that already runs for search.SearchParentPrefixesshares the same React Query cache key asSearchNodes(deduplicated request).null.Checklist