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


##########
airflow-core/src/airflow/ui/src/pages/TaskInstance/ExtraLinks.tsx:
##########
@@ -38,7 +38,7 @@ export const ExtraLinks = () => {
         {Object.entries(data.extra_links).map(([key, value], _) =>
           value === null ? undefined : (
             <Button asChild colorPalette="blue" key={key} variant="surface">
-              <a href={value} rel="noreferrer" target="_blank">
+              <a href={value} rel="noopener noreferrer" target="_blank">
                 {key}
               </a>
             </Button>

Review Comment:
   Ahh I see where you got the wrong impression from. Let me fix this in 
another PR.



##########
airflow-core/src/airflow/ui/src/pages/TaskInstance/Logs/Logs.tsx:
##########
@@ -94,6 +98,17 @@ export const Logs = () => {
         tryNumber={tryNumber}
         wrap={wrap}
       />
+      {showExternalLogRedirect && externalLogName && taskInstance ? (
+        tryNumber === undefined ? (
+          <p>No try number</p>
+        ) : (

Review Comment:
   ```suggestion
   ```
   
   We don't need this check. `ExternalLogLink` already handles the case if 
there is no try_number



##########
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="noopener noreferrer" target="_blank">
+        View logs in {externalLogName} (attempt {tryNumber})
+      </a>
+    </Button>

Review Comment:
   Let's please just use a `<Link` component from chakr. We shouldn't mix 
buttons and anchors like this.



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