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


##########
airflow/ui/src/pages/TaskInstance/Logs.tsx:
##########
@@ -77,26 +84,47 @@ export const Logs = () => {
 
   return (
     <Box p={2}>
-      <HStack justifyContent="space-between" mb={2}>
-        {taskInstance === undefined || tryNumber === undefined || 
taskInstance.try_number <= 1 ? (
-          <div />
-        ) : (
-          <TaskTrySelect
-            onSelectTryNumber={onSelectTryNumber}
-            selectedTryNumber={tryNumber}
-            taskInstance={taskInstance}
-          />
-        )}
-        <Button aria-label={wrap ? "Unwrap" : "Wrap"} bg="bg.panel" 
onClick={toggleWrap} variant="outline">
-          {wrap ? "Unwrap" : "Wrap"}
-        </Button>
-      </HStack>
+      <TaskLogHeader
+        onSelectTryNumber={onSelectTryNumber}
+        taskInstance={taskInstance}
+        toggleFullscreen={toggleFullscreen}
+        toggleWrap={toggleWrap}
+        tryNumber={tryNumber}
+        wrap={wrap}
+      />
       <ErrorAlert error={error ?? logError} />
       <Skeleton />
       <ProgressBar size="xs" visibility={isLoading || isLoadingLogs ? 
"visible" : "hidden"} />
       <Code overflow="auto" py={3} textWrap={wrap ? "pre" : "nowrap"}>
         <VStack alignItems="flex-start">{data.parsedLogs}</VStack>
       </Code>
+      <Dialog.Root onOpenChange={onOpenChange} open={fullscreen} 
scrollBehavior="inside" size="full">
+        <Dialog.Content backdrop>
+          <Dialog.Header>
+            <Heading size="xl">{taskId}</Heading>
+            <TaskLogHeader
+              isFullscreen
+              onSelectTryNumber={onSelectTryNumber}
+              taskInstance={taskInstance}
+              toggleFullscreen={toggleFullscreen}
+              toggleWrap={toggleWrap}
+              tryNumber={tryNumber}
+              wrap={wrap}
+            />
+          </Dialog.Header>
+
+          <Dialog.CloseTrigger />
+
+          <Dialog.Body>
+            <ErrorAlert error={error ?? logError} />
+            <Skeleton />
+            <ProgressBar size="xs" visibility={isLoading || isLoadingLogs ? 
"visible" : "hidden"} />
+            <Code overflow="auto" py={3} textWrap={wrap ? "pre" : "nowrap"}>
+              <VStack alignItems="flex-start">{data.parsedLogs}</VStack>
+            </Code>

Review Comment:
   This should be factorized, maybe inside a `LogContent` Component. Inside 
that same `Logs` folder. Because for now it repeats, and it will grow bigger 
and bigger with log parsing, and colors, and groups. We will need it at some 
point.
   
   Maybe even bring in the skeleton and progressbar.



##########
airflow/ui/src/components/TaskLogHeader.tsx:
##########
@@ -0,0 +1,66 @@
+/*!
+ * 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 { HStack, IconButton } from "@chakra-ui/react";
+import { MdOutlineOpenInFull } from "react-icons/md";
+
+import type { TaskInstanceResponse } from "openapi/requests/types.gen";
+import { TaskTrySelect } from "src/components/TaskTrySelect";
+import { Button } from "src/components/ui";
+
+type Props = {
+  readonly isFullscreen?: boolean;
+  readonly onSelectTryNumber: (tryNumber: number) => void;
+  readonly taskInstance?: TaskInstanceResponse;
+  readonly toggleFullscreen: () => void;
+  readonly toggleWrap: () => void;
+  readonly tryNumber?: number;
+  readonly wrap: boolean;
+};
+
+export const TaskLogHeader = ({
+  isFullscreen = false,
+  onSelectTryNumber,
+  taskInstance,
+  toggleFullscreen,
+  toggleWrap,
+  tryNumber,
+  wrap,
+}: Props) => (

Review Comment:
   This component is necessary and nice to not overwhelm the `Logs` file. But I 
don't imagine it being reusable. This is really specific to the `Logs.tsx` one. 
Maybe that should be inside `Logs/index.html, Logs/TaskLogHeader.tsx`.



##########
airflow/ui/src/pages/TaskInstance/Logs.tsx:
##########
@@ -110,6 +136,26 @@ export const Logs = () => {
       <Code overflow="auto" py={3} textWrap={wrap ? "pre" : "nowrap"}>
         <VStack alignItems="flex-start">{data.parsedLogs}</VStack>
       </Code>
+      <Dialog.Root
+        onOpenChange={onOpenChange}
+        open={fullscreen}
+        scrollBehavior="inside"
+        size="full"
+      >
+        <Dialog.Content backdrop>
+          <Dialog.Header>
+            <Heading size="xl">Log</Heading>
+          </Dialog.Header>
+
+          <Dialog.CloseTrigger />
+
+          <Dialog.Body>

Review Comment:
   Nice



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