Skip to content

frontend: Advanced Search: Add saved searches#5665

Merged
illume merged 5 commits into
kubernetes-sigs:mainfrom
Utkarshpandey0001:feat/saved-advanced-searches
May 22, 2026
Merged

frontend: Advanced Search: Add saved searches#5665
illume merged 5 commits into
kubernetes-sigs:mainfrom
Utkarshpandey0001:feat/saved-advanced-searches

Conversation

@Utkarshpandey0001
Copy link
Copy Markdown
Contributor

Summary

This PR adds saved Advanced Search queries by storing reusable searches in browser local storage and exposing save, restore, rename, and delete actions in the Advanced Search toolbar.

Related Issue

Fixes #5430

Changes

  • Added a Saved Searches control to the Advanced Search toolbar.
  • Added local-storage helpers for saved Advanced Search query persistence.
  • Added support for saving query text, selected resource scope, and namespace scope.
  • Added restore behavior that filters saved resource IDs against resources available in the current cluster.
  • Added tests for saved-search storage edge cases and popover interaction.
  • Updated the Advanced Search story snapshot.

Steps to Test

  1. Navigate to Cluster > Advanced Search (Beta).
  2. Select or type a query, for example status.phase !== "Running".
  3. Click Saved Searches, enter a name, and click Save.
  4. Clear or change the current query/resource selection.
  5. Open Saved Searches and restore the saved query.
  6. Verify the query, selected resources, and namespace scope are restored.
  7. Rename and delete the saved search, then refresh to confirm persistence behavior.

Screenshots

Before

screen_before2.mp4

After

savedquery2.mov

Notes for the Reviewer

  • Saved searches are browser-local only for this first version.
  • No backend or profile storage changes are included.

@k8s-ci-robot k8s-ci-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels May 15, 2026
@Utkarshpandey0001 Utkarshpandey0001 force-pushed the feat/saved-advanced-searches branch from d002418 to b22e76e Compare May 15, 2026 08:02
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 15, 2026
@illume illume requested a review from Copilot May 15, 2026 12:44
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a “Saved Searches” feature to Advanced Search by persisting reusable queries (query text, selected resource scope, and namespace scope) in browser localStorage and exposing save/restore/rename/delete actions in the toolbar UI.

Changes:

  • Introduces a SavedSearches popover control in the Advanced Search toolbar for managing saved queries.
  • Adds localStorage read/write/normalize helpers for saved Advanced Search entries, including validation and max-cap behavior.
  • Adds unit/UI tests and updates the Advanced Search storyshot snapshot.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
frontend/src/components/advancedSearch/SavedSearches.tsx New UI control for saving/restoring/renaming/deleting searches and syncing namespace scope to Redux + URL.
frontend/src/components/advancedSearch/SavedSearches.test.tsx Basic UI test to ensure the popover opens and empty-state text renders.
frontend/src/components/advancedSearch/savedSearches.test.ts Unit tests covering localStorage parsing/normalization and add/rename/delete helpers.
frontend/src/components/advancedSearch/savedAdvancedSearches.ts New persistence/normalization utilities for saved searches (localStorage key, validation, max limit).
frontend/src/components/advancedSearch/AdvancedSearch.tsx Wires the Saved Searches control into the toolbar and implements restore logic that filters saved resource IDs to currently available resources.
frontend/src/components/advancedSearch/snapshots/AdvancedSearch.Default.stories.storyshot Snapshot update reflecting the new toolbar control.
Comments suppressed due to low confidence (1)

frontend/src/components/advancedSearch/SavedSearches.tsx:166

  • When writeSavedAdvancedSearches() throws (quota/private mode), the callers still clear the input (setSaveName('')) or exit rename mode (setEditId(null)), so the user loses their typed name even though nothing was persisted. Consider having updateSearches return a success flag (or throw) so the UI only clears/closes on success, and otherwise keeps the current input/editing state.
                onKeyDown={e => {
                  if (e.key === 'Enter' && saveName.trim() && queryCanBeSaved) {
                    updateSearches(current =>
                      addSavedAdvancedSearch(current, {
                        name: saveName,
                        query: rawQuery,
                        resources: resourcesValue,
                        namespaces: [...selectedNamespaces],
                      })
                    );
                    setSaveName('');
                  }

Comment thread frontend/src/components/advancedSearch/savedSearches.test.ts Outdated
Comment thread frontend/src/components/advancedSearch/SavedSearches.tsx Outdated
Copy link
Copy Markdown
Contributor

@illume illume left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution.

There are some open Copilot review comments — could you take a look at them? Please mark each one as resolved once you've addressed it.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 19 out of 19 changed files in this pull request and generated 2 comments.

Comment thread frontend/src/components/advancedSearch/savedAdvancedSearches.ts
Comment thread frontend/src/components/advancedSearch/SavedSearches.tsx Outdated
Copy link
Copy Markdown
Contributor

@illume illume left a comment

Choose a reason for hiding this comment

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

Thanks for this PR.

The open review comments from Copilot still need attention — can you have a look? Once addressed, please mark them as resolved.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 19 out of 19 changed files in this pull request and generated 2 comments.

Comment thread frontend/src/components/advancedSearch/AdvancedSearch.tsx
Comment thread frontend/src/components/advancedSearch/savedSearches.test.ts Outdated
@k8s-ci-robot k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels May 17, 2026
@illume illume requested a review from Copilot May 18, 2026 07:10
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 21 out of 21 changed files in this pull request and generated no new comments.

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 20, 2026
@Utkarshpandey0001 Utkarshpandey0001 force-pushed the feat/saved-advanced-searches branch from e7a747a to cf5111c Compare May 21, 2026 10:03
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 21, 2026
@Utkarshpandey0001
Copy link
Copy Markdown
Contributor Author

@illume i have rebased branch to resolve conflicts. Could you pls look into it and suggest if any changes requires

Copy link
Copy Markdown
Contributor

@illume illume left a comment

Choose a reason for hiding this comment

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

Thanks! 🎉

@k8s-ci-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: illume, Utkarshpandey0001

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 22, 2026
@illume illume merged commit 3628565 into kubernetes-sigs:main May 22, 2026
11 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feature: Saved and Reuse Advanced Search Queries

4 participants