antonio-mello-ai opened a new pull request, #63467:
URL: https://github.com/apache/airflow/pull/63467

   closes: #58951
   
   ## What
   
   Add text search with match navigation and highlighting to the task instance 
log viewer.
   
   ### Features
   - **Search input** in the log header with match counter, prev/next buttons, 
and clear
   - **Case-insensitive** plaintext search over rendered log lines
   - **Highlight** all matches (yellow) with current match emphasized (orange)
   - **Keyboard navigation**: `/` to focus search, `Enter`/`Shift+Enter` for 
next/prev, `Escape` to clear
   - **Virtual scroll integration**: auto-scrolls to current match via the 
existing `useVirtualizer`
   - **i18n**: all user-facing strings use the existing translation system
   
   ### Files changed
   | File | Change |
   |------|--------|
   | `dag.json` | 3 new translation keys (`logs.search.*`) |
   | `LogSearchInput.tsx` | **New** — extracted search input component |
   | `Logs.tsx` | Search state, match computation via `useMemo`, callbacks |
   | `TaskLogContent.tsx` | Highlight logic (`getHighlightColor`) + 
scroll-to-match `useLayoutEffect` |
   | `TaskLogHeader.tsx` | Receives grouped `search` prop, renders 
`<LogSearchInput>` |
   
   ### Design decisions
   
   **Extracted `LogSearchInput` component**: The search UI (input + hotkey + 
keyboard handlers) was extracted into its own file rather than inlined in 
`TaskLogHeader`. This was necessary because `TaskLogHeader.tsx` was already at 
278 lines (above the project's 250-line `max-lines` lint rule) before this PR. 
Adding the search UI inline would have pushed it to ~340 lines and failed the 
lint hook.
   
   The trade-off: `TaskLogHeader` uses flat props for everything else, but 
receives search props as a grouped `search: LogSearchInputProps` object. This 
is a divergence from the existing pattern. If reviewers prefer flat props, the 
`LogSearchInput` component can still be kept as a separate file — but 
`TaskLogHeader` would need other refactoring to stay within the line limit 
(e.g., extracting the settings menu or filter selects).
   
   **Search over plaintext**: The search runs against the text rendering of 
each log line (same `renderStructuredLog` with `renderingMode: "text"` used by 
the download/clipboard features), ensuring consistency — what you search is 
what you'd see in the downloaded file.
   
   **Match indices as `Set<number>`**: Passed to `TaskLogContent` as a `Set` 
for O(1) lookup during virtual row rendering, since only visible rows are 
checked on each frame.
   
    ^ Add meaningful description above
    Read the **[Pull Request 
Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)**
 for more information.
    In addition, **please follow the [Commit 
Rules](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#committing-guidelines)**.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to