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


##########
airflow-core/src/airflow/ui/src/pages/TaskInstance/Logs/Logs.tsx:
##########
@@ -83,6 +84,9 @@ export const Logs = () => {
     tryNumber: tryNumber === 0 ? 1 : tryNumber,
   });
 
+  const externalLogName = useConfig("external_log_name") as string;
+  const showExternalLogRedirect = useConfig("show_external_log_redirect") as 
boolean;

Review Comment:
   In other places of the code we seem to prefer this construct.
   ```suggestion
     const showExternalLogRedirect = 
Boolean(useConfig("show_external_log_redirect"));
   ```



##########
airflow-core/src/airflow/ui/src/pages/TaskInstance/Logs/ExternalLogLink.tsx:
##########
@@ -0,0 +1,64 @@
+/*!
+ * 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 { Button } from "@chakra-ui/react";
+import { useParams } from "react-router-dom";
+
+import { useTaskInstanceServiceGetExternalLogUrl } from "openapi/queries";
+import type { TaskInstanceResponse } from "openapi/requests/types.gen";
+
+type Props = {
+  readonly externalLogName: string;
+  readonly taskInstance: TaskInstanceResponse;
+  readonly tryNumber: number;
+};
+
+export const ExternalLogLink = ({ externalLogName, taskInstance, tryNumber }: 
Props) => {
+  const { dagId = "", mapIndex = "-1", runId = "", taskId = "" } = useParams();
+
+  const {
+    data: externalLogData,
+    error,
+    isLoading,
+  } = useTaskInstanceServiceGetExternalLogUrl(
+    {
+      dagId,
+      dagRunId: runId,
+      mapIndex: parseInt(mapIndex, 10),
+      taskId,
+      tryNumber,
+    },
+    undefined,
+    {
+      enabled: Boolean(taskInstance) && Boolean(tryNumber),
+      retry: false,
+    },
+  );
+
+  if (Boolean(error) || isLoading || externalLogData?.url === undefined) {
+    return undefined;
+  }
+
+  return (
+    <Button asChild colorScheme="blue" variant="outline">
+      <a href={externalLogData.url} rel="noreferrer" target="_blank">

Review Comment:
   Its still missing here



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