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


##########
airflow-core/src/airflow/ui/src/pages/Dag/Overview/DagDeadlines.tsx:
##########
@@ -0,0 +1,172 @@
+/*!
+ * 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 { Badge, Box, Flex, Heading, HStack, Link, Separator, Skeleton, Text, 
VStack } from "@chakra-ui/react";
+import dayjs from "dayjs";
+import { useTranslation } from "react-i18next";
+import { FiAlertTriangle, FiClock } from "react-icons/fi";
+import { Link as RouterLink } from "react-router-dom";
+
+import { useDeadlinesServiceGetDeadlines } from "openapi/queries";
+import type { DeadlineResponse } from "openapi/requests/types.gen";
+import { ErrorAlert } from "src/components/ErrorAlert";
+import Time from "src/components/Time";
+import { useAutoRefresh } from "src/utils";
+
+const LIMIT = 5;
+
+const DeadlineRow = ({ deadline }: { readonly deadline: DeadlineResponse }) => 
(
+  <HStack justifyContent="space-between" px={2} py={1.5} width="100%">
+    <VStack alignItems="flex-start" gap={0}>
+      <Link asChild color="fg.info" fontSize="sm" fontWeight="bold">
+        <RouterLink 
to={`/dags/${deadline.dag_id}/runs/${deadline.dag_run_id}`}>
+          {deadline.dag_run_id}
+        </RouterLink>
+      </Link>
+      {deadline.alert_name !== undefined && deadline.alert_name !== null && 
deadline.alert_name !== "" ? (
+        <Text color="fg.muted" fontSize="xs">
+          {deadline.alert_name}
+        </Text>
+      ) : undefined}
+    </VStack>
+    <Time datetime={deadline.deadline_time} fontSize="sm" />
+  </HStack>
+);
+
+export const DagDeadlines = ({ dagId }: { readonly dagId: string }) => {
+  const { t: translate } = useTranslation("dag");
+  const refetchInterval = useAutoRefresh({ dagId });
+  const now = dayjs().toISOString();
+
+  const {
+    data: pendingData,
+    error: pendingError,
+    isLoading: isPendingLoading,
+  } = useDeadlinesServiceGetDeadlines(
+    {
+      dagId,
+      dagRunId: "~",
+      deadlineTimeGte: now,
+      limit: LIMIT,
+      missed: false,
+      orderBy: ["deadline_time"],
+    },
+    undefined,
+    { refetchInterval },
+  );
+
+  const last24h = dayjs().subtract(24, "hour").toISOString();

Review Comment:
   We should use the start and end date range that already exists in 
Overview.tsx.
   
   
   Also, we should have an options to view more than the 5. Link to another 
page or open a modal with a full list.



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