← 输入框|github.com|刷新
Skip to content

[web-console] Search pipelines by tag and filter by picked tags - #7854

Merged
Karakatiza666 merged 3 commits into
mainfrom
web-console-filter-by-tags
Nov 8, 2026
Merged

Karakatiza666 merged 3 commits into
mainfrom
web-console-filter-by-tags

Conversation

@Karakatiza666

@Karakatiza666 Karakatiza666 commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

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

  • Unit tests added/updated
  • Integration tests added/updated
  • Documentation updated
  • Changelog updated

Breaking Changes?

Mark if you think the answer is yes for any of these components:

Describe Incompatible Changes

Comment on lines +45 to +47
const isPickableTag = ({ inputValue }: { inputValue: string }) =>
!pickedTagNames.has(tagDisplayName(inputValue)) &&
pipelines.some((pipeline) => pipeline.tags.includes(inputValue))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

@mythical-fred-oss

Copy link
Copy Markdown
Contributor

What I ran

Check Result
svelte-check --threshold error ✅ 0 errors
New search.spec.ts (below), server project ✅ 9/9 pass
List.svelte.spec.ts (client/browser) ⚠️ not run: headless Chromium would not launch in my sandbox

missing (high): unit tests gate (feldera-pr-checks Hard Rule 2). The PR adds new search behaviour, but no test covers search.ts and none covers tags. List.svelte.spec.ts only changes the placeholder and the stubs (tags: []), so nothing tests tag matching, picking a tag, or filtering by picked tags. The "Unit tests" box is unchecked and the manual test plan is empty. Cases with no coverage:

  • a query matches a tag name but not the colour suffix (ef44 must not match prod|ef4444)
  • picked tags compare by name across colours, and a pipeline must carry every picked tag (AND)
  • name matches sort before tag-only matches; in Table.svelte, the column sort still applies inside each group
  • findMatchingTags removes duplicates by name and leaves out tags already picked
  • picking a tag with Enter (see the inline comment) or with a click clears the query; the remove (×) button on a tag drops that filter
  • a blank or whitespace-only query shows no suggestions

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 List.svelte.spec.ts case that picks a suggested tag and checks that the list narrows to the pipelines with that tag.

@Karakatiza666
Karakatiza666 marked this pull request as ready for review November 5, 2026 15:14
if (e.key === 'Enter') {
e.preventDefault()
const typedName = query.trim()
const tag = highlightedTag ?? suggestedTags.find((tag) => tagDisplayName(tag) === typedName)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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:

Suggested change
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'])
})

@mythical-fred-oss

Copy link
Copy Markdown
Contributor

What I ran

Check Result
pre-commit run --files <changed> ✅ passed
vitest --project server search.spec.ts ✅ 15/15
vitest --project client PipelineSearch / List / Table specs, run 3× ✅ 45/45 each run, no flakes seen
Probe: case-insensitive Enter ❌ fails (see inline comment)

Missing tests (medium):

  • Typing a tag name in a different case, then pressing Enter (the inline bug).
  • Table: name matches come first and keep the column sort order within each group (rowsInDisplayOrder).
  • Two pipelines with the same tag name in different colors: the search should suggest it once, and picking it should match both pipelines.

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. */

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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(() => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I still need to learn stuff to understand what's going on here

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.
@Karakatiza666
Karakatiza666 force-pushed the web-console-filter-by-tags branch from 3a9315f to 0cdafb3 Compare November 8, 2026 00:16
@Karakatiza666
Karakatiza666 added this pull request to the merge queue Nov 8, 2026
Merged via the queue into main with commit bfbf9e4 Nov 8, 2026
1 check passed
@Karakatiza666
Karakatiza666 deleted the web-console-filter-by-tags branch November 8, 2026 01:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[WebConsole] Filter by tags

2 participants