frontend: Advanced Search: Add saved searches#5665
Conversation
d002418 to
b22e76e
Compare
There was a problem hiding this comment.
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
SavedSearchespopover 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 havingupdateSearchesreturn 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('');
}
illume
left a comment
There was a problem hiding this comment.
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.
e3436c3 to
139fef4
Compare
illume
left a comment
There was a problem hiding this comment.
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.
Store reusable Advanced Search queries in local storage so operators can restore frequent resource searches without rebuilding them.
e7a747a to
cf5111c
Compare
|
@illume i have rebased branch to resolve conflicts. Could you pls look into it and suggest if any changes requires |
|
[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 DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
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
Steps to Test
status.phase !== "Running".Screenshots
Before
screen_before2.mp4
After
savedquery2.mov
Notes for the Reviewer