Skip to content

Add search result highlighting to pipeline rows#1878

Open
Mbeaulne wants to merge 1 commit into02-27-pipeline_filtersfrom
03-02-pipeline_filters_content_highlight
Open

Add search result highlighting to pipeline rows#1878
Mbeaulne wants to merge 1 commit into02-27-pipeline_filtersfrom
03-02-pipeline_filters_content_highlight

Conversation

@Mbeaulne
Copy link
Collaborator

@Mbeaulne Mbeaulne commented Mar 2, 2026

Description

Enhanced the pipeline search functionality with text highlighting and expanded search result display. The pipeline table now highlights matching text in pipeline names, descriptions, and component names. When searching, matched descriptions are displayed below pipeline names, and matched component names are shown as badges with icons. Added a new HighlightText component that uses regex to highlight search terms while escaping special characters for safe pattern matching.

Related Issue and Pull requests

Type of Change

  • Bug fix
  • New feature
  • Improvement
  • Cleanup/Refactor
  • Breaking change
  • Documentation update

Checklist

  • I have tested this does not break current pipelines / runs functionality
  • I have tested the changes on staging

Screenshots (if applicable)

image.png

Test Instructions

  1. Navigate to the pipelines section
  2. Use the search functionality to search for pipeline names, descriptions, or component names
  3. Verify that matching text is highlighted in bold
  4. Confirm that matched descriptions appear below pipeline names
  5. Check that matched component names are displayed as badges with file icons
  6. Test with special regex characters in search queries to ensure proper escaping

Additional Comments

The search results now provide better visual feedback by highlighting exactly what matched the search query, making it easier for users to understand why specific pipelines appeared in their search results.

@github-actions
Copy link

github-actions bot commented Mar 2, 2026

🎩 To tophat this PR:

You can add the following URL parameter to your browser to tophat this PR:

`?tophat_location=03-02-pipeline_filters_content_highlight/2ffd4db`

Copy link
Collaborator Author

Mbeaulne commented Mar 2, 2026

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@Mbeaulne Mbeaulne changed the title Pipeline filters: content highlight Add search result highlighting to pipeline rows Mar 2, 2026
@Mbeaulne Mbeaulne marked this pull request as ready for review March 2, 2026 15:34
@Mbeaulne Mbeaulne requested a review from a team as a code owner March 2, 2026 15:34
@Mbeaulne Mbeaulne force-pushed the 03-02-pipeline_filters_content_highlight branch 3 times, most recently from 52ced40 to 199704f Compare March 2, 2026 17:07
@Mbeaulne Mbeaulne force-pushed the 02-27-pipeline_filters branch from fd1b3c9 to caa1934 Compare March 3, 2026 16:17
@Mbeaulne Mbeaulne force-pushed the 03-02-pipeline_filters_content_highlight branch from 199704f to 2ffd4db Compare March 3, 2026 16:17
@Mbeaulne Mbeaulne mentioned this pull request Mar 3, 2026
8 tasks
Copy link

This feels very good to use!

fileEntry,
getMatchMetadata(fileEntry, searchQuery, componentQuery),
],
);

Choose a reason for hiding this comment

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

As determining this filteredPipelines variable gets more complex, I'm just wondering if we should consider wrapping it in a useMemo that explicitly controls when it is calculated / processed (e.g. when the search text changes), or if the React compiler work we did will be smart enough to do that?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

react compiler should handle this

const matchedComponentNames: string[] = [];
if (componentQuery) {
const impl = fileEntry.componentRef.spec.implementation;
if ("graph" in impl) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Use existing type guard for this

return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
}

export function HighlightText({ text, query, className }: HighlightTextProps) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

NIT: add to react-compiler config

isSelected?: boolean;
onSelect?: (checked: boolean) => void;
searchQuery?: string;
matchedFields?: { label: string; value: string }[];
Copy link
Collaborator

Choose a reason for hiding this comment

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

Use MatchedField instead

searchQuery,
componentQuery,
}: {
matchedFields?: { label: string; value: string }[];
Copy link
Collaborator

Choose a reason for hiding this comment

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

Use MatchedField

const seen = new Set<string>();
for (const task of Object.values(impl.graph.tasks)) {
const refName = task.componentRef.name ?? "";
const specName = task.componentRef.spec?.name ?? "";
Copy link
Collaborator

@maxy-shpfy maxy-shpfy Mar 5, 2026

Choose a reason for hiding this comment

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

NIT: I see that both condiotionals excludes seen.has(), so we can do early return:

if(seen.has(..)) {continue;} 

Comment on lines +99 to +101
if (componentQuery) {
const impl = fileEntry.componentRef.spec.implementation;
if ("graph" in impl) {
Copy link
Collaborator

@maxy-shpfy maxy-shpfy Mar 5, 2026

Choose a reason for hiding this comment

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

These nested "if"s are hard to read. I advise to introduce helper (type guard) and re-use everywhere. Also use early return

Comment on lines +107 to +119
if (refName.toLowerCase().includes(q) && !seen.has(refName)) {
seen.add(refName);
matchedComponentNames.push(refName);
}
if (
specName.toLowerCase().includes(q) &&
specName !== refName &&
!seen.has(specName)
) {
seen.add(specName);
matchedComponentNames.push(specName);
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we have a case where spec !== componentRef.name - they are supposed to be the same and identical? or is it depends on how we saved it?

Otherwise we could simplify this code.

Copy link
Collaborator

@maxy-shpfy maxy-shpfy left a comment

Choose a reason for hiding this comment

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

Tophatted -works well! I would love to improve readability in usePipelineFilters

@Mbeaulne Mbeaulne force-pushed the 03-02-pipeline_filters_content_highlight branch from 2ffd4db to 4e3da05 Compare March 5, 2026 17:12
@Mbeaulne Mbeaulne force-pushed the 02-27-pipeline_filters branch 2 times, most recently from 0d83f2e to 11e5ca9 Compare March 5, 2026 17:13
@Mbeaulne Mbeaulne force-pushed the 03-02-pipeline_filters_content_highlight branch from 4e3da05 to ed41519 Compare March 5, 2026 17:13
@Mbeaulne Mbeaulne force-pushed the 03-02-pipeline_filters_content_highlight branch from ed41519 to dc17873 Compare March 5, 2026 17:25
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.

3 participants