You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by bb...@apache.org on 2024/11/13 21:55:56 UTC
(airflow) branch main updated: Readd state to DagRunInfo (#43987)
This is an automated email from the ASF dual-hosted git repository.
bbovenzi pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 517132d60ba Readd state to DagRunInfo (#43987)
517132d60ba is described below
commit 517132d60bac707fc7e8b513c3f80f31d4c5e9b3
Author: Brent Bovenzi <br...@astronomer.io>
AuthorDate: Wed Nov 13 16:55:48 2024 -0500
Readd state to DagRunInfo (#43987)
---
airflow/ui/src/components/DagRunInfo.tsx | 47 +++++++++++++++++++++-------
airflow/ui/src/pages/DagsList/Dag/Header.tsx | 1 +
airflow/ui/src/pages/DagsList/DagCard.tsx | 1 +
airflow/ui/src/pages/DagsList/DagsList.tsx | 1 +
airflow/ui/src/pages/DagsList/LatestRun.tsx | 41 ------------------------
5 files changed, 38 insertions(+), 53 deletions(-)
diff --git a/airflow/ui/src/components/DagRunInfo.tsx b/airflow/ui/src/components/DagRunInfo.tsx
index 7add29b8e75..4cc2f702737 100644
--- a/airflow/ui/src/components/DagRunInfo.tsx
+++ b/airflow/ui/src/components/DagRunInfo.tsx
@@ -16,11 +16,13 @@
* specific language governing permissions and limitations
* under the License.
*/
-import { VStack, Text } from "@chakra-ui/react";
+import { VStack, Text, Box, HStack } from "@chakra-ui/react";
import dayjs from "dayjs";
+import type { DAGRunResponse } from "openapi/requests/types.gen";
import Time from "src/components/Time";
import { Tooltip } from "src/components/ui";
+import { stateColor } from "src/utils/stateColor";
type Props = {
readonly dataIntervalEnd?: string | null;
@@ -28,6 +30,7 @@ type Props = {
readonly endDate?: string | null;
readonly nextDagrunCreateAfter?: string | null;
readonly startDate?: string | null;
+ readonly state?: DAGRunResponse["state"];
};
const DagRunInfo = ({
@@ -36,39 +39,59 @@ const DagRunInfo = ({
endDate,
nextDagrunCreateAfter,
startDate,
+ state,
}: Props) =>
Boolean(dataIntervalStart) && Boolean(dataIntervalEnd) ? (
<Tooltip
content={
<VStack align="left" gap={0}>
- <Text>
- Data Interval Start: <Time datetime={dataIntervalStart} />
- </Text>
- <Text>
- Data Interval End: <Time datetime={dataIntervalEnd} />
- </Text>
+ {state === undefined ? undefined : <Text>State: {state}</Text>}
{Boolean(nextDagrunCreateAfter) ? (
<Text>
Run After: <Time datetime={nextDagrunCreateAfter} />
</Text>
) : undefined}
{Boolean(startDate) ? (
- <Text>Start Date: {startDate}</Text>
+ <Text>
+ Start Date: <Time datetime={startDate} />
+ </Text>
+ ) : undefined}
+ {Boolean(endDate) ? (
+ <Text>
+ End Date: <Time datetime={endDate} />
+ </Text>
) : undefined}
- {Boolean(endDate) ? <Text>End Date: {endDate}</Text> : undefined}
- {Boolean(startDate) && Boolean(endDate) ? (
+ {Boolean(startDate) ? (
<Text>
Duration:{" "}
{dayjs.duration(dayjs(endDate).diff(startDate)).asSeconds()}s
</Text>
) : undefined}
+ <Text>
+ Data Interval Start: <Time datetime={dataIntervalStart} />
+ </Text>
+ <Text>
+ Data Interval End: <Time datetime={dataIntervalEnd} />
+ </Text>
</VStack>
}
showArrow
>
- <Text fontSize="sm">
+ <HStack fontSize="sm">
<Time datetime={dataIntervalStart} showTooltip={false} />
- </Text>
+ {state === undefined ? undefined : (
+ <>
+ <Box
+ bg={stateColor[state]}
+ borderRadius="50%"
+ height={2}
+ minW={2}
+ width={2}
+ />
+ <Text color={stateColor[state]}>{state}</Text>
+ </>
+ )}
+ </HStack>
</Tooltip>
) : undefined;
diff --git a/airflow/ui/src/pages/DagsList/Dag/Header.tsx b/airflow/ui/src/pages/DagsList/Dag/Header.tsx
index 0a2d98924a9..c4f6f9bd6dc 100644
--- a/airflow/ui/src/pages/DagsList/Dag/Header.tsx
+++ b/airflow/ui/src/pages/DagsList/Dag/Header.tsx
@@ -81,6 +81,7 @@ export const Header = ({
dataIntervalStart={latestRun.data_interval_start}
endDate={latestRun.end_date}
startDate={latestRun.start_date}
+ state={latestRun.state}
/>
) : undefined}
</VStack>
diff --git a/airflow/ui/src/pages/DagsList/DagCard.tsx b/airflow/ui/src/pages/DagsList/DagCard.tsx
index 65bd1d75f80..a2c67b4eb8c 100644
--- a/airflow/ui/src/pages/DagsList/DagCard.tsx
+++ b/airflow/ui/src/pages/DagsList/DagCard.tsx
@@ -94,6 +94,7 @@ export const DagCard = ({ dag }: Props) => {
dataIntervalStart={latestRun.data_interval_start}
endDate={latestRun.end_date}
startDate={latestRun.start_date}
+ state={latestRun.state}
/>
) : undefined}
</VStack>
diff --git a/airflow/ui/src/pages/DagsList/DagsList.tsx b/airflow/ui/src/pages/DagsList/DagsList.tsx
index 2b8d2dc0231..e30a1a6df08 100644
--- a/airflow/ui/src/pages/DagsList/DagsList.tsx
+++ b/airflow/ui/src/pages/DagsList/DagsList.tsx
@@ -108,6 +108,7 @@ const columns: Array<ColumnDef<DAGWithLatestDagRunsResponse>> = [
dataIntervalStart={original.latest_dag_runs[0].data_interval_start}
endDate={original.latest_dag_runs[0].end_date}
startDate={original.latest_dag_runs[0].start_date}
+ state={original.latest_dag_runs[0].state}
/>
) : undefined,
enableSorting: false,
diff --git a/airflow/ui/src/pages/DagsList/LatestRun.tsx b/airflow/ui/src/pages/DagsList/LatestRun.tsx
deleted file mode 100644
index fa61dcb1570..00000000000
--- a/airflow/ui/src/pages/DagsList/LatestRun.tsx
+++ /dev/null
@@ -1,41 +0,0 @@
-/*!
- * 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, HStack, Text } from "@chakra-ui/react";
-
-import type { DAGRunResponse } from "openapi/requests/types.gen";
-import Time from "src/components/Time";
-import { stateColor } from "src/utils/stateColor";
-
-type Props = {
- readonly latestRun?: DAGRunResponse;
-};
-
-export const LatestRun = ({ latestRun }: Props) =>
- latestRun ? (
- <HStack fontSize="sm">
- <Time datetime={latestRun.start_date} />
- <Box
- bg={stateColor[latestRun.state]}
- borderRadius="50%"
- height={2}
- width={2}
- />
- <Text color={stateColor[latestRun.state]}>{latestRun.state}</Text>
- </HStack>
- ) : undefined;