jedcunningham commented on code in PR #31123: URL: https://github.com/apache/airflow/pull/31123#discussion_r1213677212
########## airflow/www/static/js/cluster-activity/live-metrics/DagRuns.tsx: ########## @@ -0,0 +1,126 @@ +/*! + * 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 React from "react"; +import { + Box, + BoxProps, + Card, + CardBody, + CardHeader, + Center, + Flex, + Heading, + Link, + Table, + Tbody, + Td, + Text, + Th, + Thead, + Tr, +} from "@chakra-ui/react"; +import { useDagRuns } from "src/api"; +import { formatDuration, getDuration } from "src/datetime_utils"; +import LoadingWrapper from "src/components/LoadingWrapper"; + +const DagRuns = (props: BoxProps) => { + const { data, isError } = useDagRuns({ + dagId: "~", + state: ["running"], + orderBy: "start_date", + limit: 5, + }); + + return ( + <Center {...props}> + <LoadingWrapper hasData={!!data} isError={isError}> + <Card w="100%"> + <CardHeader textAlign="center" p={3}> + <Heading size="md">Dag Runs</Heading> + </CardHeader> + <CardBody> + <Flex flexDirection="column" mb={5}> + <Text as="b" color="blue.600"> + Top 5 longest Dag Runs to finish: + </Text> + <Box mt={2}> + {data?.totalEntries !== undefined && data.totalEntries > 0 ? ( + <Table + size="sm" + style={{ tableLayout: "fixed", width: "100%" }} + > + <Thead> + <Tr> + <Th>Dag Id</Th> + <Th>Run Type</Th> + <Th>Duration</Th> + </Tr> + </Thead> + <Tbody> + {data?.dagRuns?.map((dagRun) => ( Review Comment: My bad, not sure what I was looking at last week. I do see where it's [filtered](https://github.com/apache/airflow/blob/7db42fe6655c28330e80b8a062ef3e07968d6e76/airflow/api_connexion/endpoints/dag_run_endpoint.py#L230) now. I think I might have mistakenly thought this was driven by the changes in `views.py`, which don't have filtering. So yeah, no concerns here! -- 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]
