Andrushika commented on code in PR #71156:
URL: https://github.com/apache/airflow/pull/71156#discussion_r3728182212
##########
airflow-core/src/airflow/ui/src/queries/useLogs.tsx:
##########
@@ -36,10 +41,47 @@ import { parseStreamingLogContent } from "src/utils/logs";
export type ParsedLogEntry = {
element: JSX.Element | string | undefined;
+ getPlainText?: () => string;
group?: { id: number; level: number; parentId?: number; type: "header" |
"line" };
lineNumber?: number;
};
+type GetLogLineTextOptions = {
+ logLevelFilters?: Array<string>;
+ logMessage: string | StructuredLogMessage;
+ showSource?: boolean;
+ showTimestamp?: boolean;
+ sourceFilters?: Array<string>;
+ translate: TFunction;
+};
+
+/**
+ * Plain-text rendering of a single log line — same pipeline as the log
+ * download, with ANSI escape codes stripped. Used to rebuild copied text for
+ * selected rows the virtualizer has unmounted.
+ */
+export const getLogLineText = ({
+ logLevelFilters,
+ logMessage,
+ showSource,
+ showTimestamp,
+ sourceFilters,
+ translate,
+}: GetLogLineTextOptions): string =>
+ Anser.ansiToText(
+ renderStructuredLog({
+ index: 0,
+ logLevelFilters,
+ logLink: "",
+ logMessage,
+ renderingMode: "text",
Review Comment:
One point I want to check: do we want the rebuilt text to match what the
screen shows? Currently the copied log row can come from either JSX text or
plain text, for example (the main difference is the timestamp):
JSX:
```
[2026-08-05 15:59:48] INFO - line 0001 | lorem ipsum dolor sit amet
consectetur adipiscing elit | payload=1
```
plain text:
```
[2026-08-05T07:59:48.737536Z] INFO - line 0001 | lorem ipsum dolor sit amet
consectetur adipiscing elit | payload=1
```
So I think we need to choose one of them for copy formatting. In this PR,
when the user selects partial first and last rows, that text can only come from
the DOM, so the rebuilt middle rows need to move toward the screen format, not
the other way around.
In the follow-up PR, I plan to let the text pipeline take an optional
timestamp formatter (download keeps the raw ISO timestamps), and keep the ▶
marker in the copied group headers for readability. wdyt?
--
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]