Repository navigation
[web-console] Search pipelines by tag and filter by picked tags - #7854
Conversation
| const isPickableTag = ({ inputValue }: { inputValue: string }) => | ||
| !pickedTagNames.has(tagDisplayName(inputValue)) && | ||
| pipelines.some((pipeline) => pipeline.tags.includes(inputValue)) |
There was a problem hiding this comment.
bug (medium): This compares the raw stored tag, not its display name. Tags created in the UI always get a color suffix (Tags.svelte defaults newTagColor to the palette), e.g. prod|ef4444. If a user types prod and presses Enter, the tag is never picked, even though prod is the only text the user sees. If the stored tag is bare and the user types Prod, it also fails, because this check is case-sensitive while the suggestions are not. Look up the tag by tagDisplayName, then add the stored tag (from onValueChange, or by intercepting Enter and calling pickTag(match)). That way the chip also keeps its colour. No test covers Enter-to-pick.
|
What I ran
missing (high): unit tests gate (feldera-pr-checks Hard Rule 2). The PR adds new search behaviour, but no test covers
Here is a suggested starting point, which passes locally: +++ b/js-packages/web-console/src/lib/functions/pipelines/search.spec.ts
+import { describe, expect, it } from 'vitest'
+import { findMatchingTags, matchesPipelineSearch, nameMatchesFirst } from './search.ts'
+const p = (name: string, tags: string[] = []) => ({ name, tags })
+describe('matchesPipelineSearch', () => {
+ it('matches by name or tag name, not color suffix', () => {
+ expect(matchesPipelineSearch(p('orders', ['prod|ef4444']), 'pro', [])).toBe(true)
+ expect(matchesPipelineSearch(p('a', ['prod|ef4444']), 'ef44', [])).toBe(false)
+ })
+ it('requires every picked tag, compared by name', () => {
+ const pipe = p('a', ['prod|ef4444', 'eu'])
+ expect(matchesPipelineSearch(pipe, '', ['prod|22c55e', 'eu'])).toBe(true)
+ expect(matchesPipelineSearch(pipe, '', ['prod', 'us'])).toBe(false)
+ })
+})
+it('nameMatchesFirst keeps order inside groups', () => {
+ const rows = [p('b', ['pay']), p('payments'), p('c', ['pay']), p('pay2')]
+ expect(nameMatchesFirst(rows, 'pay').map((r) => r.name)).toEqual(['payments', 'pay2', 'b', 'c'])
+})
+it('findMatchingTags dedupes by name and sorts', () => {
+ const pipes = [p('a', ['prod|ef4444', 'preview']), p('b', ['prod|22c55e'])]
+ expect(findMatchingTags(pipes, 'pr')).toEqual(['preview', 'prod|ef4444'])
+})Please also add a |
| if (e.key === 'Enter') { | ||
| e.preventDefault() | ||
| const typedName = query.trim() | ||
| const tag = highlightedTag ?? suggestedTags.find((tag) => tagDisplayName(tag) === typedName) |
There was a problem hiding this comment.
bug (medium): The suggestions come from matchesSubstring, which ignores case, but this exact-name check is case-sensitive. So typing PROD shows the prod suggestion, and Enter then does nothing. I confirmed this with a test (fill('PROD') → {Enter} → tagFilters stays []). Compare the names case-insensitively, the same way the suggestions do:
| const tag = highlightedTag ?? suggestedTags.find((tag) => tagDisplayName(tag) === typedName) | |
| const tag = | |
| highlightedTag ?? | |
| suggestedTags.find((tag) => tagDisplayName(tag).toLowerCase() === typedName.toLowerCase()) |
Please also add a spec case for this:
it('picks a suggested tag on Enter when the typed name differs in case', async () => {
const bound = await renderSearch('right')
await input().fill('PROD')
await expect.poll(suggestedNames).toEqual(['prod'])
await userEvent.keyboard('{Enter}')
await expect.poll(() => bound.tagFilters).toEqual(['prod|22c55e'])
})|
What I ran
Missing tests (medium):
Gates: Unit and component tests are present. The PR changes UI only, so the docs gate does not block it. It has no dependency, API or unsafe changes. Commit messages are fine. Fix the Enter case bug, then LGTM. |
| onclick?: (e: MouseEvent) => void | ||
| /** Shows a highlight on the chip, for selection with the keyboard. */ | ||
| isHighlighted?: boolean | ||
| /** Add `min-w-0 max-w-full` to let the chip shrink and cut its text with an ellipsis. */ |
There was a problem hiding this comment.
I am not sure this comment belongs here, but I don't know if there's a better place.
This is a type...
| } | ||
|
|
||
| // Follow the input while the popup is open, because the page can scroll or resize. | ||
| $effect(() => { |
There was a problem hiding this comment.
I still need to learn stuff to understand what's going on here
There was a problem hiding this comment.
This and the next few pages should be very helpful when you get to it
https://svelte.dev/tutorial/svelte/state
The pipeline search on the home page and in the pipeline list panel now matches pipeline names and tag names; name matches come first. Matching tags show while the search input has focus: in a wrapping popup above the input on the home page, in a popup row to the right of the input in the pipeline list panel, and inline under the input in the overlay drawer. A picked tag becomes a chip in the input (Skeleton TagsInput), and the list shows only pipelines that carry every picked tag. Closes #7460
…d tests - Enter picks the highlighted tag, or the suggested tag whose name is the typed text. Other text stays in the input as the query. - Tab and Shift+Tab move a highlight through the suggested tags. - A comma stays in the query. TagsInput used it as a delimiter and cleared the input. - Render the inline tag list and the popup as one element. - Add unit tests for the search functions and component tests for PipelineSearch, the pipeline list and the pipelines table.
…ag query - The pipelines table keeps a non-default column sort inside the name matches and inside the tag matches. - PipelineSearch shows no tag suggestions for a query of only spaces.
3a9315f to
0cdafb3
Compare
The pipeline search on the home page and in the pipeline list panel now matches pipeline names and tag names; name matches come first. Matching tags show while the search input has focus. A picked tag becomes a chip in the input (Skeleton TagsInput), and the list shows only pipelines that carry every picked tag.
Closes #7460
Screencast.From.2026-11-04.21-03-55.webm
Linked Issue
Describe Manual Test Plan
Checklist
Breaking Changes?
Mark if you think the answer is yes for any of these components:
Describe Incompatible Changes