jedcunningham commented on code in PR #31123:
URL: https://github.com/apache/airflow/pull/31123#discussion_r1205978353


##########
airflow/www/static/js/cluster-activity/live-metrics/Dags.tsx:
##########
@@ -0,0 +1,74 @@
+/*!
+ * 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 {
+  BoxProps,
+  Card,
+  CardBody,
+  CardHeader,
+  Center,
+  Flex,
+  Heading,
+  Text,
+} from "@chakra-ui/react";
+import { useDags } from "src/api";
+import LoadingWrapper from "src/components/LoadingWrapper";
+
+const Dags = (props: BoxProps) => {
+  const { data: dataOnlyUnpaused, isError: isErrorUnpaused } = useDags({
+    paused: false,
+  });
+
+  const { data, isError } = useDags({});
+
+  return (
+    <Center {...props}>
+      <LoadingWrapper
+        hasData={!!data && !!dataOnlyUnpaused}
+        isError={isError || isErrorUnpaused}
+      >
+        <Card w="100%">
+          <CardHeader textAlign="center" p={3}>
+            <Heading size="md">DAGs</Heading>
+          </CardHeader>
+          <CardBody>
+            <Flex flexDirection="column" mb={5}>
+              <Text as="b" color="blue.600">
+                Number of unpaused DAGs:
+              </Text>

Review Comment:
   I feel like this section might look better without this chunk of text.



##########
airflow/www/static/js/cluster-activity/live-metrics/Dags.tsx:
##########
@@ -0,0 +1,74 @@
+/*!
+ * 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 {
+  BoxProps,
+  Card,
+  CardBody,
+  CardHeader,
+  Center,
+  Flex,
+  Heading,
+  Text,
+} from "@chakra-ui/react";
+import { useDags } from "src/api";
+import LoadingWrapper from "src/components/LoadingWrapper";
+
+const Dags = (props: BoxProps) => {
+  const { data: dataOnlyUnpaused, isError: isErrorUnpaused } = useDags({
+    paused: false,
+  });
+
+  const { data, isError } = useDags({});
+
+  return (
+    <Center {...props}>
+      <LoadingWrapper
+        hasData={!!data && !!dataOnlyUnpaused}
+        isError={isError || isErrorUnpaused}
+      >
+        <Card w="100%">
+          <CardHeader textAlign="center" p={3}>
+            <Heading size="md">DAGs</Heading>
+          </CardHeader>
+          <CardBody>
+            <Flex flexDirection="column" mb={5}>
+              <Text as="b" color="blue.600">
+                Number of unpaused DAGs:
+              </Text>
+              <Flex justifyContent="center" mt={2}>
+                <Heading as="b" size="xl">
+                  {dataOnlyUnpaused?.totalEntries}
+                </Heading>
+              </Flex>
+            </Flex>
+            <Flex justifyContent="end" textAlign="right">
+              <Text size="md" color="gray.500">
+                on a total of <Text as="b">{data?.totalEntries}</Text> DAGs

Review Comment:
   Maybe reword this section so we don't need it?
   
   ```suggestion
                   unpaused DAGs out of <Text 
as="b">{data?.totalEntries}</Text> total DAGs
   ```
   
   or something.



##########
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:
   I'm not sure we should expose dag_ids to viewers if they don't also have 
read on that specific DAG. Maybe we hide this from viewers instead of trying to 
filter? Thoughts?
   
   The rest are generic enough I don't think it matters, but this specifically 
makes me at least want to have the conversation.



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

Review Comment:
   Same here, maybe move the "5 longest" into the heading a few lines up?



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