Skip to content

feat(filter): support field-qualified search terms#3044

Open
petersutter wants to merge 2 commits into
masterfrom
feat/field-search
Open

feat(filter): support field-qualified search terms#3044
petersutter wants to merge 2 commits into
masterfrom
feat/field-search

Conversation

@petersutter

@petersutter petersutter commented Jun 26, 2026

Copy link
Copy Markdown
Member

How to categorize this PR?
/area usability
/kind enhancement

What this PR does / why we need it:
Extends the shoot and seed list filters to support field-qualified search terms, e.g. seed:aws-ha or -region:eu.

Also fixes the search hint tooltip, which was sticking open while the field had focus — now shows on hover only (500 ms delay).

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:

Release note:

Support field-qualified search terms in shoot and seed list filters (e.g. `seed:aws-ha`, `-region:eu`).

Summary by CodeRabbit

  • New Features

    • Search now supports field-specific terms like field:value, quoted exact matches, negation, and more precise handling of empty values.
    • Table filtering behavior has been expanded to better match search terms across multiple visible fields.
  • Bug Fixes

    • Improved search consistency for whitespace, quotes, and special characters in queries.
    • Search results now handle missing or empty field values more reliably.
    • Tooltip behavior on the table search input is now less intrusive.

Tooltip was visible as long as the field had focus, feeling
sticky while typing. Now shows on hover only (500 ms delay).
Search queries like `seed:aws-ha` or `-region:eu` now match
against specific fields instead of all values.
@gardener-prow gardener-prow Bot added area/usability Usability related kind/enhancement Enhancement, improvement, extension labels Jun 26, 2026
@gardener-prow

gardener-prow Bot commented Jun 26, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign klocke-io for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

@gardener-prow gardener-prow Bot added the cla: yes Indicates the PR's author has signed the cla-assistant.io CLA. label Jun 26, 2026
@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Search parsing now supports field-qualified terms, exact matches, exclusions, and allowlisted fields. Table filtering now uses curried predicates, and shoot/seed search callers build keyed field maps before matching. The table search tooltip also disables focus-triggered opening and adds a 500ms delay.

Changes

Table search behavior

Layer / File(s) Summary
Tokenizer and parser core
frontend/src/composables/useTableFilter/helper.js, frontend/__tests__/composables/useTableFilter/helper.spec.js
tokenizeSearch, SearchQuery.matches, and parseSearch now handle quotes, escaped quotes, field qualifiers, and allowed field names, with expanded tests covering tokenization, matching, and parsing cases.
Curried filter predicate
frontend/src/composables/useTableFilter/index.js, frontend/src/views/GShootList.vue, frontend/__tests__/composables/useTableFilter/index.spec.js
useTableFilter now gets an item predicate from filterFn(query), and the shoot list/tests were updated to use the curried contract.
Qualified field search consumers
frontend/src/store/shoot/helper.js, frontend/src/views/GSeedList.vue
provider and region raw values are exposed, and shoot/seed search builds keyed field maps, parses qualified fields, and matches through searchQuery.matches(fields).

Search tooltip

Layer / File(s) Summary
Tooltip timing
frontend/src/components/GTableSearch.vue
v-tooltip now disables focus-triggered opening and uses a 500ms open delay while keeping top placement.

Sequence Diagram(s)

sequenceDiagram
  participant GShootList
  participant useTableFilter
  participant filterFn
  GShootList->>useTableFilter: filteredItems computed
  useTableFilter->>filterFn: filterFn(query)
  filterFn-->>useTableFilter: item predicate
  useTableFilter-->>GShootList: items.filter(predicate)
Loading
sequenceDiagram
  participant GSeedList
  participant parseSearch
  participant SearchQuery
  GSeedList->>parseSearch: parseSearch(query, QUALIFIED_SEARCH_FIELDS)
  parseSearch-->>GSeedList: SearchQuery
  GSeedList->>SearchQuery: matches(fields)
  SearchQuery-->>GSeedList: boolean
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Suggested labels

approved, lgtm

Suggested reviewers

  • holgerkoser
  • klocke-io
  • grolu

Poem

A bunny found tokens in moonlit rows,
With field:value leaps and a twitch of nose.
Quotes stayed snug, and the filters ran spry,
While carrots of code made the search hop by.
I nibble, I cheer, with a thump and a grin 🐰

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title concisely and accurately summarizes the main change: adding field-qualified search term support.
Description check ✅ Passed The description matches the template and covers categorization, purpose, issue reference placeholder, and release note, with only minor gaps in specifics.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/field-search

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@gardener-prow gardener-prow Bot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Jun 26, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
frontend/src/composables/useTableFilter/index.js (1)

38-39: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Validate the curried filter result before filtering.

Now that filterFn is a factory, a stale caller can return a non-function and make Array.prototype.filter throw an unclear runtime error.

Proposed guard
     const predicate = filterFn(query)
+    if (typeof predicate !== 'function') {
+      throw new Error('useTableFilter: filterFn(query) must return a predicate function')
+    }
     return items.value.filter(predicate)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@frontend/src/composables/useTableFilter/index.js` around lines 38 - 39, The
filter pipeline in useTableFilter is assuming filterFn(query) always returns a
valid predicate, which can cause Array.prototype.filter to fail with a vague
runtime error. Update the logic in the composable that builds the predicate to
validate the curried result before calling items.value.filter, and handle the
non-function case gracefully (for example by returning an empty result or a safe
fallback) so stale callers do not break the table filtering flow.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@frontend/src/components/GTableSearch.vue`:
- Around line 8-12: The search syntax help tooltip in GTableSearch.vue is
becoming hover-only because open-on-focus is disabled on the v-tooltip
activator. Update the tooltip/activator wiring so keyboard and touch users can
still reveal the same help content, using the GTableSearch component’s search
input as the trigger and preserving an accessible non-hover interaction path.

In `@frontend/src/store/shoot/helper.js`:
- Around line 323-335: The search field map in helper.js is dropping the
existing workerless keyword handling, so searches for workerless no longer match
the intended shoots. Update the fields object built in the relevant
search/filter helper to include a derived workerless value alongside the
existing getRawVal entries, and make sure it is populated from the shoot/item
state used by the previous search path. Keep the change localized to the helper
logic that assembles searchable fields so existing keyword behavior is
preserved.

---

Nitpick comments:
In `@frontend/src/composables/useTableFilter/index.js`:
- Around line 38-39: The filter pipeline in useTableFilter is assuming
filterFn(query) always returns a valid predicate, which can cause
Array.prototype.filter to fail with a vague runtime error. Update the logic in
the composable that builds the predicate to validate the curried result before
calling items.value.filter, and handle the non-function case gracefully (for
example by returning an empty result or a safe fallback) so stale callers do not
break the table filtering flow.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5d0a1a81-6ce4-4d20-8df7-78fe702d08ac

📥 Commits

Reviewing files that changed from the base of the PR and between 011ce52 and c59055b.

📒 Files selected for processing (8)
  • frontend/__tests__/composables/useTableFilter/helper.spec.js
  • frontend/__tests__/composables/useTableFilter/index.spec.js
  • frontend/src/components/GTableSearch.vue
  • frontend/src/composables/useTableFilter/helper.js
  • frontend/src/composables/useTableFilter/index.js
  • frontend/src/store/shoot/helper.js
  • frontend/src/views/GSeedList.vue
  • frontend/src/views/GShootList.vue

Comment thread frontend/src/components/GTableSearch.vue
Comment thread frontend/src/store/shoot/helper.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/usability Usability related cla: yes Indicates the PR's author has signed the cla-assistant.io CLA. kind/enhancement Enhancement, improvement, extension size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant