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


##########
airflow-core/src/airflow/ui/src/pages/Dashboard/Stats/DAGImportErrors.tsx:
##########
@@ -16,67 +16,57 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-import { Box, Text, Button, useDisclosure, Skeleton } from "@chakra-ui/react";
-import { FiChevronRight } from "react-icons/fi";
+import { Box, Button, Skeleton, useDisclosure } from "@chakra-ui/react";
 import { LuFileWarning } from "react-icons/lu";
 
-import { useImportErrorServiceGetImportErrors } from "openapi/queries";
+import { useImportErrorServiceGetImportErrors } from "openapi/queries/queries";
 import { ErrorAlert } from "src/components/ErrorAlert";
 import { StateBadge } from "src/components/StateBadge";
 import { pluralize } from "src/utils";
 
 import { DAGImportErrorsModal } from "./DAGImportErrorsModal";
+import { StatsCard } from "./StatsCard";
 
 export const DAGImportErrors = ({ iconOnly = false }: { readonly iconOnly?: 
boolean }) => {
   const { onClose, onOpen, open } = useDisclosure();
 
   const { data, error, isLoading } = useImportErrorServiceGetImportErrors();
-
   const importErrorsCount = data?.total_entries ?? 0;
   const importErrors = data?.import_errors ?? [];
 
   if (isLoading) {
     return <Skeleton height="9" width="225px" />;
   }
 
+  if (importErrorsCount === 0) {
+    return undefined;
+  }
+
   return (
-    <Box alignItems="center" display="flex" maxH="10px">
+    <Box alignItems="center" display="flex">
       <ErrorAlert error={error} />
-      {importErrorsCount > 0 && (
-        <>
-          {iconOnly ? (
-            <StateBadge
-              as={Button}
-              colorPalette="failed"
-              height={7}
-              onClick={onOpen}
-              title={pluralize("Dag Import Error", importErrorsCount)}
-            >
-              <LuFileWarning size="0.5rem" />
-              {importErrorsCount}
-            </StateBadge>
-          ) : (
-            <Button
-              alignItems="center"
-              borderRadius="md"
-              display="flex"
-              gap={2}
-              onClick={onOpen}
-              variant="outline"
-            >
-              <StateBadge colorPalette="failed">
-                <LuFileWarning />
-                {importErrorsCount}
-              </StateBadge>
-              <Box alignItems="center" display="flex" gap={1}>
-                <Text fontWeight="bold">Dag Import Errors</Text>
-                <FiChevronRight />
-              </Box>
-            </Button>
-          )}
-          <DAGImportErrorsModal importErrors={importErrors} onClose={onClose} 
open={open} />
-        </>
+      {iconOnly ? (
+        <StateBadge
+          as={Button}
+          colorPalette="failed"
+          height={7}
+          onClick={onOpen}
+          title={pluralize("Dag Import Error", importErrorsCount)}
+        >
+          <LuFileWarning size="0.5rem" />
+          {importErrorsCount}
+        </StateBadge>
+      ) : (
+        <StatsCard
+          colorScheme="failed"
+          count={importErrorsCount}
+          isLoading={isLoading}
+          label="Dag Import Errors"
+          onClick={onOpen}
+          state="failed"
+        />

Review Comment:
   Actually, one issue. We lost the `<LuFileWarning />` icon 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]

Reply via email to