pierrejeambrun commented on code in PR #66610:
URL: https://github.com/apache/airflow/pull/66610#discussion_r3461031217


##########
airflow-core/src/airflow/ui/src/pages/Run/CallbackLogViewer.tsx:
##########
@@ -0,0 +1,184 @@
+/*!
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import { Box, Button, Heading, HStack, Text } from "@chakra-ui/react";
+import type { TFunction } from "i18next";
+import { useMemo, useState } from "react";
+import { useTranslation } from "react-i18next";
+import { FiFileText } from "react-icons/fi";
+import innerText from "react-innertext";
+
+import { useDeadlinesServiceGetCallbackLogs } from "openapi/queries";
+import type { TaskInstanceState, TaskInstancesLogResponse } from 
"openapi/requests/types.gen";
+import { StateBadge } from "src/components/StateBadge";
+import { renderStructuredLog } from "src/components/renderStructuredLog";
+import { Dialog } from "src/components/ui";
+import { TaskLogContent } from "src/pages/TaskInstance/Logs/TaskLogContent";
+import type { ParsedLogEntry } from "src/queries/useLogs";
+import { parseStreamingLogContent } from "src/utils/logs";
+
+type CallbackLogViewerProps = {
+  readonly callbackId: string;
+  readonly callbackState?: TaskInstanceState | null;
+  readonly dagId: string;
+  readonly dagRunId: string;
+};
+
+/**
+ * Parse callback log data using the same structured log rendering pipeline
+ * as the task instance logs, providing consistent formatting, grouping, and 
display.
+ */
+const parseCallbackLogs = (
+  data: TaskInstancesLogResponse["content"],
+  translate: TFunction,
+): Array<ParsedLogEntry> => {
+  let lineNumber = 0;
+  const lineNumbers = data.map((datum) => {
+    const text = typeof datum === "string" ? datum : datum.event;
+
+    if (text.includes("::group::") || text.includes("::endgroup::")) {
+      return undefined;
+    }
+    const current = lineNumber;
+

Review Comment:
   Looks duplicated from the current parseLog function we can probably re-use 
some pieces instead.



-- 
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