bbovenzi commented on code in PR #44854:
URL: https://github.com/apache/airflow/pull/44854#discussion_r1905531833
##########
airflow/ui/src/components/TaskInstanceTooltip.tsx:
##########
@@ -18,42 +18,54 @@
*/
import { Box, Text } from "@chakra-ui/react";
-import type { TaskInstanceHistoryResponse, TaskInstanceResponse } from
"openapi/requests/types.gen";
+import type {
+ TaskInstanceHistoryResponse,
+ TaskInstanceResponse,
+ GridTaskInstanceSummary,
+} from "openapi/requests/types.gen";
import Time from "src/components/Time";
import { Tooltip, type TooltipProps } from "src/components/ui";
type Props = {
- readonly taskInstance: TaskInstanceHistoryResponse | TaskInstanceResponse;
+ readonly taskInstance?: GridTaskInstanceSummary |
TaskInstanceHistoryResponse | TaskInstanceResponse;
} & Omit<TooltipProps, "content">;
-const TaskInstanceTooltip = ({ children, taskInstance }: Props) => (
- <Tooltip
- content={
- <Box>
- <Text>Run ID: {taskInstance.dag_run_id}</Text>
- <Text>
- Start Date: <Time datetime={taskInstance.start_date} />
- </Text>
- <Text>
- End Date: <Time datetime={taskInstance.end_date} />
- </Text>
- {taskInstance.try_number > 1 && <Text>Try Number:
{taskInstance.try_number}</Text>}
- <Text>Duration: {taskInstance.duration?.toFixed(2) ?? 0}s</Text>
- <Text>State: {taskInstance.state}</Text>
- </Box>
- }
- key={taskInstance.dag_run_id}
- positioning={{
- offset: {
- crossAxis: 5,
- mainAxis: 5,
- },
- placement: "bottom-start",
- }}
- showArrow
- >
- {children}
- </Tooltip>
-);
+const TaskInstanceTooltip = ({ children, positioning, taskInstance, ...rest }:
Props) =>
+ taskInstance === undefined ? (
+ children
+ ) : (
+ <Tooltip
+ {...rest}
+ content={
+ <Box>
+ {"dag_run_id" in taskInstance ? <Text>Run ID:
{taskInstance.dag_run_id}</Text> : undefined}
+ <Text>
+ Start Date: <Time datetime={taskInstance.start_date} />
+ </Text>
+ <Text>
+ End Date: <Time datetime={taskInstance.end_date} />
+ </Text>
+ {taskInstance.try_number > 1 && <Text>Try Number:
{taskInstance.try_number}</Text>}
+ {"duration" in taskInstance ? (
+ <Text>Duration: {taskInstance.duration?.toFixed(2) ?? 0}s</Text>
+ ) : undefined}
+ <Text>State: {taskInstance.state}</Text>
+ </Box>
+ }
+ key={taskInstance.task_id}
+ portalled
+ positioning={{
+ offset: {
+ crossAxis: 5,
+ mainAxis: 5,
+ },
+ placement: "bottom-start",
+ ...positioning,
+ }}
+ showArrow
Review Comment:
I think we just need to add that to our theme file to make `showArrow` true
by default
--
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]