You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by ka...@apache.org on 2025/04/23 18:34:16 UTC
(airflow) branch v3-0-test updated (7da4f858e39 -> 69dabd72d1d)
This is an automated email from the ASF dual-hosted git repository.
kaxilnaik pushed a change to branch v3-0-test
in repository https://gitbox.apache.org/repos/asf/airflow.git
from 7da4f858e39 Update plugin documentation for Airflow 3 plugins (#49632)
new d4d79f6c772 Bump stylelint (#49638)
new c0025ae3f60 Add count to Stats Cards in Dashboard (#49519)
new 333736e464d AIP-38: merge Backfill and Trigger Dag Run (#49490)
new 69dabd72d1d AIP-38: enhance layout for `RunBackfillForm` (#49609)
The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../components/DagActions/RunBackfillButton.tsx | 45 ---------
.../src/components/DagActions/RunBackfillForm.tsx | 71 +++++++++-----
.../src/components/DagActions/RunBackfillModal.tsx | 47 ---------
.../src/components/TriggerDag/TriggerDAGForm.tsx | 4 +-
.../src/components/TriggerDag/TriggerDAGModal.tsx | 109 +++++++++++++++++----
.../src/airflow/ui/src/pages/Dag/Header.tsx | 2 -
.../airflow/ui/src/pages/Dashboard/Dashboard.tsx | 14 +--
.../src/pages/Dashboard/Stats/DAGImportErrors.tsx | 68 ++++++-------
.../src/pages/Dashboard/Stats/DagFilterButton.tsx | 44 ---------
.../airflow/ui/src/pages/Dashboard/Stats/Stats.tsx | 103 ++++++++++++++-----
.../ui/src/pages/Dashboard/Stats/StatsCard.tsx | 80 +++++++++++++++
.../airflow/providers/fab/www/package-lock.json | 56 +++++------
.../fab/src/airflow/providers/fab/www/package.json | 2 +-
13 files changed, 360 insertions(+), 285 deletions(-)
delete mode 100644 airflow-core/src/airflow/ui/src/components/DagActions/RunBackfillButton.tsx
delete mode 100644 airflow-core/src/airflow/ui/src/components/DagActions/RunBackfillModal.tsx
delete mode 100644 airflow-core/src/airflow/ui/src/pages/Dashboard/Stats/DagFilterButton.tsx
create mode 100644 airflow-core/src/airflow/ui/src/pages/Dashboard/Stats/StatsCard.tsx
(airflow) 03/04: AIP-38: merge Backfill and Trigger Dag Run (#49490)
Posted by ka...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
kaxilnaik pushed a commit to branch v3-0-test
in repository https://gitbox.apache.org/repos/asf/airflow.git
commit 333736e464d7a6f9d6e89974d2352df8109ec4bc
Author: Guan Ming(Wesley) Chiu <10...@users.noreply.github.com>
AuthorDate: Mon Apr 21 21:43:13 2025 +0800
AIP-38: merge Backfill and Trigger Dag Run (#49490)
(cherry picked from commit 6b6867d0d60494bc0588fe724afe1c58ee001828)
---
.../components/DagActions/RunBackfillButton.tsx | 45 ---------
.../src/components/DagActions/RunBackfillForm.tsx | 2 +-
.../src/components/DagActions/RunBackfillModal.tsx | 47 ---------
.../src/components/TriggerDag/TriggerDAGForm.tsx | 4 +-
.../src/components/TriggerDag/TriggerDAGModal.tsx | 109 +++++++++++++++++----
.../src/airflow/ui/src/pages/Dag/Header.tsx | 2 -
6 files changed, 93 insertions(+), 116 deletions(-)
diff --git a/airflow-core/src/airflow/ui/src/components/DagActions/RunBackfillButton.tsx b/airflow-core/src/airflow/ui/src/components/DagActions/RunBackfillButton.tsx
deleted file mode 100644
index 90b43d106ec..00000000000
--- a/airflow-core/src/airflow/ui/src/components/DagActions/RunBackfillButton.tsx
+++ /dev/null
@@ -1,45 +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 { useDisclosure } from "@chakra-ui/react";
-import { RiArrowGoBackFill } from "react-icons/ri";
-
-import type { DAGResponse, DAGWithLatestDagRunsResponse } from "openapi/requests/types.gen";
-
-import { Button } from "../ui";
-import RunBackfillModal from "./RunBackfillModal";
-
-type Props = {
- readonly dag: DAGResponse | DAGWithLatestDagRunsResponse;
-};
-
-const RunBackfillButton: React.FC<Props> = ({ dag }) => {
- const { onClose, onOpen, open } = useDisclosure();
-
- return (
- <>
- <Button aria-label="Run Backfill" onClick={onOpen} variant="outline">
- <RiArrowGoBackFill />
- Run Backfill
- </Button>
- <RunBackfillModal dag={dag} onClose={onClose} open={open} />
- </>
- );
-};
-
-export default RunBackfillButton;
diff --git a/airflow-core/src/airflow/ui/src/components/DagActions/RunBackfillForm.tsx b/airflow-core/src/airflow/ui/src/components/DagActions/RunBackfillForm.tsx
index 1bbacf6dced..112631563e3 100644
--- a/airflow-core/src/airflow/ui/src/components/DagActions/RunBackfillForm.tsx
+++ b/airflow-core/src/airflow/ui/src/components/DagActions/RunBackfillForm.tsx
@@ -116,7 +116,7 @@ const RunBackfillForm = ({ dag, onClose }: RunBackfillFormProps) => {
return (
<>
- <VStack alignItems="stretch" gap={2} p={10}>
+ <VStack alignItems="stretch" gap={2} pt={4}>
<Box>
<Text fontSize="md" fontWeight="medium" mb={1}>
Date Range
diff --git a/airflow-core/src/airflow/ui/src/components/DagActions/RunBackfillModal.tsx b/airflow-core/src/airflow/ui/src/components/DagActions/RunBackfillModal.tsx
deleted file mode 100644
index 8e48fd60268..00000000000
--- a/airflow-core/src/airflow/ui/src/components/DagActions/RunBackfillModal.tsx
+++ /dev/null
@@ -1,47 +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 { Heading } from "@chakra-ui/react";
-import React from "react";
-
-import type { DAGResponse, DAGWithLatestDagRunsResponse } from "openapi/requests/types.gen";
-import { Dialog } from "src/components/ui";
-
-import RunBackfillForm from "./RunBackfillForm";
-
-type RunBackfillModalProps = {
- readonly dag: DAGResponse | DAGWithLatestDagRunsResponse;
- readonly onClose: () => void;
- readonly open: boolean;
-};
-
-const RunBackfillModal: React.FC<RunBackfillModalProps> = ({ dag, onClose, open }) => (
- <Dialog.Root lazyMount onOpenChange={onClose} open={open} size="xl" unmountOnExit>
- <Dialog.Content backdrop>
- <Dialog.Header bg="blue.muted">
- <Heading size="xl">Run Backfill</Heading>
- </Dialog.Header>
- <Dialog.CloseTrigger />
- <Dialog.Body>
- <RunBackfillForm dag={dag} onClose={onClose} />
- </Dialog.Body>
- </Dialog.Content>
- </Dialog.Root>
-);
-
-export default RunBackfillModal;
diff --git a/airflow-core/src/airflow/ui/src/components/TriggerDag/TriggerDAGForm.tsx b/airflow-core/src/airflow/ui/src/components/TriggerDag/TriggerDAGForm.tsx
index 112d58175f8..c0f420dcf9d 100644
--- a/airflow-core/src/airflow/ui/src/components/TriggerDag/TriggerDAGForm.tsx
+++ b/airflow-core/src/airflow/ui/src/components/TriggerDag/TriggerDAGForm.tsx
@@ -121,7 +121,7 @@ const TriggerDAGForm = ({ dagId, isPaused, onClose, open }: TriggerDAGFormProps)
collapsible
defaultValue={[flexibleFormDefaultSection]}
mb={4}
- mt={4}
+ mt={8}
size="lg"
variant="enclosed"
>
@@ -132,7 +132,7 @@ const TriggerDAGForm = ({ dagId, isPaused, onClose, open }: TriggerDAGFormProps)
<Accordion.Item key="advancedOptions" value="advancedOptions">
<Accordion.ItemTrigger cursor="button">Advanced Options</Accordion.ItemTrigger>
<Accordion.ItemContent>
- <Box p={5}>
+ <Box p={4}>
<Controller
control={control}
name="logicalDate"
diff --git a/airflow-core/src/airflow/ui/src/components/TriggerDag/TriggerDAGModal.tsx b/airflow-core/src/airflow/ui/src/components/TriggerDag/TriggerDAGModal.tsx
index b762604410e..9d35fd95efa 100644
--- a/airflow-core/src/airflow/ui/src/components/TriggerDag/TriggerDAGModal.tsx
+++ b/airflow-core/src/airflow/ui/src/components/TriggerDag/TriggerDAGModal.tsx
@@ -16,13 +16,21 @@
* specific language governing permissions and limitations
* under the License.
*/
-import { Heading, VStack } from "@chakra-ui/react";
-import React from "react";
+import { Heading, VStack, HStack, Spinner, Center, Text } from "@chakra-ui/react";
+import React, { useState } from "react";
+import { useDagServiceGetDag } from "openapi/queries";
import { Dialog } from "src/components/ui";
+import { RadioCardItem, RadioCardRoot } from "src/components/ui/RadioCard";
+import RunBackfillForm from "../DagActions/RunBackfillForm";
import TriggerDAGForm from "./TriggerDAGForm";
+enum RunMode {
+ BACKFILL = "backfill",
+ SINGLE = "single",
+}
+
type TriggerDAGModalProps = {
readonly dagDisplayName: string;
readonly dagId: string;
@@ -37,22 +45,85 @@ const TriggerDAGModal: React.FC<TriggerDAGModalProps> = ({
isPaused,
onClose,
open,
-}) => (
- <Dialog.Root lazyMount onOpenChange={onClose} open={open} size="xl" unmountOnExit>
- <Dialog.Content backdrop>
- <Dialog.Header paddingBottom={0}>
- <VStack align="start" gap={4}>
- <Heading size="xl">Trigger Dag - {dagDisplayName}</Heading>
- </VStack>
- </Dialog.Header>
-
- <Dialog.CloseTrigger />
-
- <Dialog.Body>
- <TriggerDAGForm dagId={dagId} isPaused={isPaused} onClose={onClose} open={open} />
- </Dialog.Body>
- </Dialog.Content>
- </Dialog.Root>
-);
+}) => {
+ const [runMode, setRunMode] = useState<RunMode>(RunMode.SINGLE);
+ const {
+ data: dag,
+ isError,
+ isLoading,
+ } = useDagServiceGetDag(
+ {
+ dagId,
+ },
+ undefined,
+ {
+ enabled: open,
+ },
+ );
+
+ const hasSchedule = dag?.timetable_summary !== null;
+
+ return (
+ <Dialog.Root lazyMount onOpenChange={onClose} open={open} size="xl" unmountOnExit>
+ <Dialog.Content backdrop>
+ <Dialog.Header paddingBottom={0}>
+ <VStack align="start" gap={2} width="100%">
+ <Heading size="xl">
+ {runMode === RunMode.SINGLE ? "Trigger DAG" : "Run Backfill"} - {dagDisplayName}
+ </Heading>
+ </VStack>
+ </Dialog.Header>
+
+ <Dialog.CloseTrigger />
+
+ <Dialog.Body>
+ {isLoading ? (
+ <Center py={6}>
+ <VStack>
+ <Spinner size="lg" />
+ <Text mt={2}>Loading DAG information...</Text>
+ </VStack>
+ </Center>
+ ) : isError ? (
+ <Center py={6}>
+ <Text color="red.500">Failed to load DAG information. Please try again.</Text>
+ </Center>
+ ) : (
+ <>
+ {dag && hasSchedule ? (
+ <RadioCardRoot
+ my={4}
+ onChange={(event) => {
+ setRunMode((event.target as HTMLInputElement).value as RunMode);
+ }}
+ value={runMode}
+ >
+ <HStack align="stretch">
+ <RadioCardItem
+ description="Trigger a single run of this DAG"
+ label="Single Run"
+ value={RunMode.SINGLE}
+ />
+ <RadioCardItem
+ description="Run this DAG for a range of dates"
+ label="Backfill"
+ value={RunMode.BACKFILL}
+ />
+ </HStack>
+ </RadioCardRoot>
+ ) : undefined}
+
+ {runMode === RunMode.SINGLE ? (
+ <TriggerDAGForm dagId={dagId} isPaused={isPaused} onClose={onClose} open={open} />
+ ) : (
+ hasSchedule && dag && <RunBackfillForm dag={dag} onClose={onClose} />
+ )}
+ </>
+ )}
+ </Dialog.Body>
+ </Dialog.Content>
+ </Dialog.Root>
+ );
+};
export default TriggerDAGModal;
diff --git a/airflow-core/src/airflow/ui/src/pages/Dag/Header.tsx b/airflow-core/src/airflow/ui/src/pages/Dag/Header.tsx
index 969894a4d38..94874dd8aea 100644
--- a/airflow-core/src/airflow/ui/src/pages/Dag/Header.tsx
+++ b/airflow-core/src/airflow/ui/src/pages/Dag/Header.tsx
@@ -22,7 +22,6 @@ import { useParams } from "react-router-dom";
import type { DAGDetailsResponse, DAGWithLatestDagRunsResponse } from "openapi/requests/types.gen";
import { DagIcon } from "src/assets/DagIcon";
import ParseDag from "src/components/DagActions/ParseDag";
-import RunBackfillButton from "src/components/DagActions/RunBackfillButton";
import DagRunInfo from "src/components/DagRunInfo";
import { DagVersion } from "src/components/DagVersion";
import DisplayMarkdownButton from "src/components/DisplayMarkdownButton";
@@ -99,7 +98,6 @@ export const Header = ({
text="Dag Docs"
/>
)}
- {dag.timetable_summary === null ? undefined : <RunBackfillButton dag={dag} />}
<ParseDag dagId={dag.dag_id} fileToken={dag.file_token} />
</>
)
(airflow) 02/04: Add count to Stats Cards in Dashboard (#49519)
Posted by ka...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
kaxilnaik pushed a commit to branch v3-0-test
in repository https://gitbox.apache.org/repos/asf/airflow.git
commit c0025ae3f60eba8e6a3ead3625ae2fafba77250a
Author: Guan Ming(Wesley) Chiu <10...@users.noreply.github.com>
AuthorDate: Thu Apr 24 01:09:08 2025 +0800
Add count to Stats Cards in Dashboard (#49519)
* AIP-38: enhence stats in dashboard
* fix: use semantic tokens
Co-authored-by: Brent Bovenzi <46...@users.noreply.github.com>
* fix: apply suggestions from code review
Co-authored-by: Brent Bovenzi <br...@gmail.com>
* fix: replace flex with hstack
* fix: add missing icon
Co-authored-by: Brent Bovenzi <46...@users.noreply.github.com>
---------
Co-authored-by: Brent Bovenzi <46...@users.noreply.github.com>
Co-authored-by: Brent Bovenzi <br...@gmail.com>
(cherry picked from commit 86cdef22b11e67313e03b61b63e57cc878dad470)
---
.../airflow/ui/src/pages/Dashboard/Dashboard.tsx | 14 +--
.../src/pages/Dashboard/Stats/DAGImportErrors.tsx | 68 ++++++--------
.../src/pages/Dashboard/Stats/DagFilterButton.tsx | 44 ---------
.../airflow/ui/src/pages/Dashboard/Stats/Stats.tsx | 103 ++++++++++++++++-----
.../ui/src/pages/Dashboard/Stats/StatsCard.tsx | 80 ++++++++++++++++
5 files changed, 195 insertions(+), 114 deletions(-)
diff --git a/airflow-core/src/airflow/ui/src/pages/Dashboard/Dashboard.tsx b/airflow-core/src/airflow/ui/src/pages/Dashboard/Dashboard.tsx
index 5dba0f697cc..7d096275b2c 100644
--- a/airflow-core/src/airflow/ui/src/pages/Dashboard/Dashboard.tsx
+++ b/airflow-core/src/airflow/ui/src/pages/Dashboard/Dashboard.tsx
@@ -31,7 +31,7 @@ export const Dashboard = () => {
const alerts = useConfig("dashboard_alert") as Array<UIAlert>;
return (
- <Box>
+ <Box px={4}>
<VStack alignItems="start">
{alerts.length > 0 ? (
<Accordion.Root collapsible defaultValue={["ui_alerts"]}>
@@ -54,15 +54,17 @@ export const Dashboard = () => {
</Accordion.Item>
</Accordion.Root>
) : undefined}
- <Heading mb={4}>Welcome</Heading>
+ <Heading mb={2} size="2xl">
+ Welcome,
+ </Heading>
</VStack>
<Box>
- <Health />
- </Box>
- <Box mt={5}>
<Stats />
</Box>
- <Box mt={5}>
+ <Box mt={8}>
+ <Health />
+ </Box>
+ <Box mt={8}>
<HistoricalMetrics />
</Box>
</Box>
diff --git a/airflow-core/src/airflow/ui/src/pages/Dashboard/Stats/DAGImportErrors.tsx b/airflow-core/src/airflow/ui/src/pages/Dashboard/Stats/DAGImportErrors.tsx
index 0f90d6638d3..6a4a8350953 100644
--- a/airflow-core/src/airflow/ui/src/pages/Dashboard/Stats/DAGImportErrors.tsx
+++ b/airflow-core/src/airflow/ui/src/pages/Dashboard/Stats/DAGImportErrors.tsx
@@ -16,22 +16,21 @@
* 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 ?? [];
@@ -39,44 +38,35 @@ export const DAGImportErrors = ({ iconOnly = false }: { readonly iconOnly?: bool
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}
+ icon={<LuFileWarning />}
+ isLoading={isLoading}
+ label="Dag Import Errors"
+ onClick={onOpen}
+ />
)}
+ <DAGImportErrorsModal importErrors={importErrors} onClose={onClose} open={open} />
</Box>
);
};
diff --git a/airflow-core/src/airflow/ui/src/pages/Dashboard/Stats/DagFilterButton.tsx b/airflow-core/src/airflow/ui/src/pages/Dashboard/Stats/DagFilterButton.tsx
deleted file mode 100644
index 0ac6490ae79..00000000000
--- a/airflow-core/src/airflow/ui/src/pages/Dashboard/Stats/DagFilterButton.tsx
+++ /dev/null
@@ -1,44 +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, Text, Button, Badge, type BadgeProps } from "@chakra-ui/react";
-import { FiChevronRight } from "react-icons/fi";
-import { Link as RouterLink } from "react-router-dom";
-
-import { capitalize } from "src/utils";
-
-// TODO: Add badge count once API is available
-
-type Props = {
- readonly filter: string;
- readonly link: string;
-} & BadgeProps;
-
-export const DagFilterButton = ({ children, filter, link, ...rest }: Props) => (
- <RouterLink to={link}>
- <Button alignItems="center" borderRadius="md" display="flex" gap={2} variant="outline">
- <Box alignItems="center" display="flex" gap={1}>
- <Badge borderRadius="full" p={1} variant="solid" {...rest}>
- {children}
- </Badge>
- <Text fontWeight="bold">{capitalize(filter)} Dags</Text>
- <FiChevronRight />
- </Box>
- </Button>
- </RouterLink>
-);
diff --git a/airflow-core/src/airflow/ui/src/pages/Dashboard/Stats/Stats.tsx b/airflow-core/src/airflow/ui/src/pages/Dashboard/Stats/Stats.tsx
index 70fe310a36e..085a348fa7a 100644
--- a/airflow-core/src/airflow/ui/src/pages/Dashboard/Stats/Stats.tsx
+++ b/airflow-core/src/airflow/ui/src/pages/Dashboard/Stats/Stats.tsx
@@ -19,30 +19,83 @@
import { Box, Flex, Heading, HStack } from "@chakra-ui/react";
import { FiClipboard, FiZap } from "react-icons/fi";
-import { StateIcon } from "src/components/StateIcon";
+import { useDagServiceGetDags } from "openapi/queries";
import { DAGImportErrors } from "./DAGImportErrors";
-import { DagFilterButton } from "./DagFilterButton";
-
-export const Stats = () => (
- <Box>
- <Flex color="fg.muted" my={2}>
- <FiClipboard />
- <Heading ml={1} size="xs">
- Links
- </Heading>
- </Flex>
- <HStack>
- <DagFilterButton colorPalette="failed" filter="failed" link="dags?last_dag_run_state=failed">
- <StateIcon state="failed" />
- </DagFilterButton>
- <DAGImportErrors />
- <DagFilterButton colorPalette="running" filter="running" link="dags?last_dag_run_state=running">
- <StateIcon state="running" />
- </DagFilterButton>
- <DagFilterButton colorPalette="blue" filter="active" link="dags?paused=false">
- <FiZap />
- </DagFilterButton>
- </HStack>
- </Box>
-);
+import { StatsCard } from "./StatsCard";
+
+export const Stats = () => {
+ const { data: activeDagsData, isLoading: isActiveDagsLoading } = useDagServiceGetDags({
+ paused: false,
+ });
+
+ const { data: failedDagsData, isLoading: isFailedDagsLoading } = useDagServiceGetDags({
+ lastDagRunState: "failed",
+ });
+
+ const { data: queuedDagsData, isLoading: isQueuedDagsLoading } = useDagServiceGetDags({
+ lastDagRunState: "queued",
+ });
+
+ const { data: runningDagsData, isLoading: isRunningDagsLoading } = useDagServiceGetDags({
+ lastDagRunState: "running",
+ });
+
+ const activeDagsCount = activeDagsData?.total_entries ?? 0;
+ const failedDagsCount = failedDagsData?.total_entries ?? 0;
+ const queuedDagsCount = queuedDagsData?.total_entries ?? 0;
+ const runningDagsCount = runningDagsData?.total_entries ?? 0;
+
+ return (
+ <Box>
+ <Flex alignItems="center" color="fg.muted" my={2}>
+ <FiClipboard />
+ <Heading ml={1} size="xs">
+ Stats
+ </Heading>
+ </Flex>
+
+ <HStack columns={{ base: 1, lg: 5, md: 3 }} gap={4}>
+ <StatsCard
+ colorScheme="failed"
+ count={failedDagsCount}
+ isLoading={isFailedDagsLoading}
+ label="Failed dags"
+ link="dags?last_dag_run_state=failed"
+ state="failed"
+ />
+
+ <DAGImportErrors />
+
+ {queuedDagsCount > 0 ? (
+ <StatsCard
+ colorScheme="queued"
+ count={queuedDagsCount}
+ isLoading={isQueuedDagsLoading}
+ label="Queued dags"
+ link="dags?last_dag_run_state=queued"
+ state="queued"
+ />
+ ) : undefined}
+
+ <StatsCard
+ colorScheme="running"
+ count={runningDagsCount}
+ isLoading={isRunningDagsLoading}
+ label="Running dags"
+ link="dags?last_dag_run_state=running"
+ state="running"
+ />
+
+ <StatsCard
+ colorScheme="blue"
+ count={activeDagsCount}
+ icon={<FiZap />}
+ isLoading={isActiveDagsLoading}
+ label="Active dags"
+ link="dags?paused=false"
+ />
+ </HStack>
+ </Box>
+ );
+};
diff --git a/airflow-core/src/airflow/ui/src/pages/Dashboard/Stats/StatsCard.tsx b/airflow-core/src/airflow/ui/src/pages/Dashboard/Stats/StatsCard.tsx
new file mode 100644
index 00000000000..d49c7bba124
--- /dev/null
+++ b/airflow-core/src/airflow/ui/src/pages/Dashboard/Stats/StatsCard.tsx
@@ -0,0 +1,80 @@
+/*!
+ * 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, Skeleton, Text } from "@chakra-ui/react";
+import { FiChevronRight } from "react-icons/fi";
+import { Link as RouterLink } from "react-router-dom";
+
+import type { TaskInstanceState } from "openapi/requests/types.gen";
+import { StateBadge } from "src/components/StateBadge";
+import { capitalize } from "src/utils";
+
+export const StatsCard = ({
+ colorScheme,
+ count,
+ icon,
+ isLoading = false,
+ label,
+ link,
+ onClick,
+ state,
+}: {
+ readonly colorScheme: string;
+ readonly count: number;
+ readonly icon?: React.ReactNode;
+ readonly isLoading?: boolean;
+ readonly label: string;
+ readonly link?: string;
+ readonly onClick?: () => void;
+ readonly state?: TaskInstanceState | null;
+}) => {
+ if (isLoading) {
+ return <Skeleton borderRadius="lg" height="42px" width="175px" />;
+ }
+
+ const content = (
+ <HStack
+ alignItems="center"
+ borderRadius="lg"
+ borderWidth={1}
+ color="fg.emphasized"
+ cursor="pointer"
+ p={2}
+ >
+ <StateBadge colorPalette={colorScheme} mr={2} state={state}>
+ {icon}
+ {count}
+ </StateBadge>
+
+ <Text color="fg" fontSize="sm" fontWeight="bold">
+ {capitalize(label)}
+ </Text>
+ <FiChevronRight size={16} />
+ </HStack>
+ );
+
+ if (onClick) {
+ return (
+ <Box as="button" onClick={onClick}>
+ {content}
+ </Box>
+ );
+ }
+
+ return <RouterLink to={link ?? "#"}>{content}</RouterLink>;
+};
(airflow) 01/04: Bump stylelint (#49638)
Posted by ka...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
kaxilnaik pushed a commit to branch v3-0-test
in repository https://gitbox.apache.org/repos/asf/airflow.git
commit d4d79f6c77288ddf99de696c13cfef7b78359dcd
Author: Dependabot [bot] <49...@users.noreply.github.com>
AuthorDate: Wed Apr 23 12:57:31 2025 -0400
Bump stylelint (#49638)
Bumps the fab-ui-package-updates group with 1 update in the /providers/fab/src/airflow/providers/fab/www directory: [stylelint](https://github.com/stylelint/stylelint).
Updates `stylelint` from 16.18.0 to 16.19.0
- [Release notes](https://github.com/stylelint/stylelint/releases)
- [Changelog](https://github.com/stylelint/stylelint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/stylelint/stylelint/compare/16.18.0...16.19.0)
---
updated-dependencies:
- dependency-name: stylelint
dependency-version: 16.19.0
dependency-type: direct:development
update-type: version-update:semver-minor
dependency-group: fab-ui-package-updates
...
Signed-off-by: dependabot[bot] <su...@github.com>
Co-authored-by: dependabot[bot] <49...@users.noreply.github.com>
(cherry picked from commit d2755fc52e13db4816fa69409c16ac777b5f7c9f)
---
.../airflow/providers/fab/www/package-lock.json | 56 +++++++++++-----------
.../fab/src/airflow/providers/fab/www/package.json | 2 +-
2 files changed, 29 insertions(+), 29 deletions(-)
diff --git a/providers/fab/src/airflow/providers/fab/www/package-lock.json b/providers/fab/src/airflow/providers/fab/www/package-lock.json
index caf22430e3b..8c172984bc7 100644
--- a/providers/fab/src/airflow/providers/fab/www/package-lock.json
+++ b/providers/fab/src/airflow/providers/fab/www/package-lock.json
@@ -33,7 +33,7 @@
"moment": "^2.29.4",
"moment-locales-webpack-plugin": "^1.2.0",
"prettier": "^3.5.3",
- "stylelint": "^16.18.0",
+ "stylelint": "^16.19.0",
"terser-webpack-plugin": "<6.0.0",
"url-loader": "4.1.1",
"webpack": "^5.99.5",
@@ -2830,20 +2830,20 @@
"dev": true
},
"node_modules/cacheable": {
- "version": "1.8.9",
- "resolved": "https://registry.npmjs.org/cacheable/-/cacheable-1.8.9.tgz",
- "integrity": "sha512-FicwAUyWnrtnd4QqYAoRlNs44/a1jTL7XDKqm5gJ90wz1DQPlC7U2Rd1Tydpv+E7WAr4sQHuw8Q8M3nZMAyecQ==",
+ "version": "1.8.10",
+ "resolved": "https://registry.npmjs.org/cacheable/-/cacheable-1.8.10.tgz",
+ "integrity": "sha512-0ZnbicB/N2R6uziva8l6O6BieBklArWyiGx4GkwAhLKhSHyQtRfM9T1nx7HHuHDKkYB/efJQhz3QJ6x/YqoZzA==",
"dev": true,
"license": "MIT",
"dependencies": {
- "hookified": "^1.7.1",
- "keyv": "^5.3.1"
+ "hookified": "^1.8.1",
+ "keyv": "^5.3.2"
}
},
"node_modules/cacheable/node_modules/keyv": {
- "version": "5.3.2",
- "resolved": "https://registry.npmjs.org/keyv/-/keyv-5.3.2.tgz",
- "integrity": "sha512-Lji2XRxqqa5Wg+CHLVfFKBImfJZ4pCSccu9eVWK6w4c2SDFLd8JAn1zqTuSFnsxb7ope6rMsnIHfp+eBbRBRZQ==",
+ "version": "5.3.3",
+ "resolved": "https://registry.npmjs.org/keyv/-/keyv-5.3.3.tgz",
+ "integrity": "sha512-Rwu4+nXI9fqcxiEHtbkvoes2X+QfkTRo1TMkPfwzipGsJlJO/z69vqB4FNl9xJ3xCpAcbkvmEabZfPzrwN3+gQ==",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -4598,15 +4598,15 @@
}
},
"node_modules/flat-cache": {
- "version": "6.1.7",
- "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-6.1.7.tgz",
- "integrity": "sha512-qwZ4xf1v1m7Rc9XiORly31YaChvKt6oNVHuqqZcoED/7O+ToyNVGobKsIAopY9ODcWpEDKEBAbrSOCBHtNQvew==",
+ "version": "6.1.8",
+ "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-6.1.8.tgz",
+ "integrity": "sha512-R6MaD3nrJAtO7C3QOuS79ficm2pEAy++TgEUD8ii1LVlbcgZ9DtASLkt9B+RZSFCzm7QHDMlXPsqqB6W2Pfr1Q==",
"dev": true,
"license": "MIT",
"dependencies": {
"cacheable": "^1.8.9",
"flatted": "^3.3.3",
- "hookified": "^1.7.1"
+ "hookified": "^1.8.1"
}
},
"node_modules/flatted": {
@@ -4971,9 +4971,9 @@
}
},
"node_modules/hookified": {
- "version": "1.8.1",
- "resolved": "https://registry.npmjs.org/hookified/-/hookified-1.8.1.tgz",
- "integrity": "sha512-GrO2l93P8xCWBSTBX9l2BxI78VU/MAAYag+pG8curS3aBGy0++ZlxrQ7PdUOUVMbn5BwkGb6+eRrnf43ipnFEA==",
+ "version": "1.8.2",
+ "resolved": "https://registry.npmjs.org/hookified/-/hookified-1.8.2.tgz",
+ "integrity": "sha512-5nZbBNP44sFCDjSoB//0N7m508APCgbQ4mGGo1KJGBYyCKNHfry1Pvd0JVHZIxjdnqn8nFRBAN/eFB6Rk/4w5w==",
"dev": true,
"license": "MIT"
},
@@ -5743,9 +5743,9 @@
}
},
"node_modules/known-css-properties": {
- "version": "0.35.0",
- "resolved": "https://registry.npmjs.org/known-css-properties/-/known-css-properties-0.35.0.tgz",
- "integrity": "sha512-a/RAk2BfKk+WFGhhOCAYqSiFLc34k8Mt/6NWRI4joER0EYUzXIcFivjjnoD3+XU1DggLn/tZc3DOAgke7l8a4A==",
+ "version": "0.36.0",
+ "resolved": "https://registry.npmjs.org/known-css-properties/-/known-css-properties-0.36.0.tgz",
+ "integrity": "sha512-A+9jP+IUmuQsNdsLdcg6Yt7voiMF/D4K83ew0OpJtpu+l34ef7LaohWV0Rc6KNvzw6ZDizkqfyB5JznZnzuKQA==",
"dev": true,
"license": "MIT"
},
@@ -7882,9 +7882,9 @@
}
},
"node_modules/stylelint": {
- "version": "16.18.0",
- "resolved": "https://registry.npmjs.org/stylelint/-/stylelint-16.18.0.tgz",
- "integrity": "sha512-OXb68qzesv7J70BSbFwfK3yTVLEVXiQ/ro6wUE4UrSbKCMjLLA02S8Qq3LC01DxKyVjk7z8xh35aB4JzO3/sNA==",
+ "version": "16.19.0",
+ "resolved": "https://registry.npmjs.org/stylelint/-/stylelint-16.19.0.tgz",
+ "integrity": "sha512-BJzc5mo/ez0H/ZSl3UbxGdkK/s0kFGsF5/k6IGu4z8wJ1qp49WrOS9RxswvcN6HMirt0g/iiJqOwLHTbWv49IQ==",
"dev": true,
"funding": [
{
@@ -7911,7 +7911,7 @@
"debug": "^4.3.7",
"fast-glob": "^3.3.3",
"fastest-levenshtein": "^1.0.16",
- "file-entry-cache": "^10.0.7",
+ "file-entry-cache": "^10.0.8",
"global-modules": "^2.0.0",
"globby": "^11.1.0",
"globjoin": "^0.1.4",
@@ -7919,7 +7919,7 @@
"ignore": "^7.0.3",
"imurmurhash": "^0.1.4",
"is-plain-object": "^5.0.0",
- "known-css-properties": "^0.35.0",
+ "known-css-properties": "^0.36.0",
"mathml-tag-names": "^2.1.3",
"meow": "^13.2.0",
"micromatch": "^4.0.8",
@@ -7988,13 +7988,13 @@
}
},
"node_modules/stylelint/node_modules/file-entry-cache": {
- "version": "10.0.7",
- "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-10.0.7.tgz",
- "integrity": "sha512-txsf5fu3anp2ff3+gOJJzRImtrtm/oa9tYLN0iTuINZ++EyVR/nRrg2fKYwvG/pXDofcrvvb0scEbX3NyW/COw==",
+ "version": "10.0.8",
+ "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-10.0.8.tgz",
+ "integrity": "sha512-FGXHpfmI4XyzbLd3HQ8cbUcsFGohJpZtmQRHr8z8FxxtCe2PcpgIlVLwIgunqjvRmXypBETvwhV4ptJizA+Y1Q==",
"dev": true,
"license": "MIT",
"dependencies": {
- "flat-cache": "^6.1.7"
+ "flat-cache": "^6.1.8"
}
},
"node_modules/stylelint/node_modules/ignore": {
diff --git a/providers/fab/src/airflow/providers/fab/www/package.json b/providers/fab/src/airflow/providers/fab/www/package.json
index 574c17f7502..5db4b03ff85 100644
--- a/providers/fab/src/airflow/providers/fab/www/package.json
+++ b/providers/fab/src/airflow/providers/fab/www/package.json
@@ -59,7 +59,7 @@
"moment": "^2.29.4",
"moment-locales-webpack-plugin": "^1.2.0",
"prettier": "^3.5.3",
- "stylelint": "^16.18.0",
+ "stylelint": "^16.19.0",
"terser-webpack-plugin": "<6.0.0",
"url-loader": "4.1.1",
"webpack": "^5.99.5",
(airflow) 04/04: AIP-38: enhance layout for `RunBackfillForm` (#49609)
Posted by ka...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
kaxilnaik pushed a commit to branch v3-0-test
in repository https://gitbox.apache.org/repos/asf/airflow.git
commit 69dabd72d1df97d29d2d6382f7a243e76457c13e
Author: Guan Ming(Wesley) Chiu <10...@users.noreply.github.com>
AuthorDate: Thu Apr 24 02:11:45 2025 +0800
AIP-38: enhance layout for `RunBackfillForm` (#49609)
* feat: enhence layout for backfillForm
* fix: use chakra's `Field` component
Co-authored-by: Brent Bovenzi <46...@users.noreply.github.com>
---------
Co-authored-by: Brent Bovenzi <46...@users.noreply.github.com>
(cherry picked from commit c651b61d3cf2d554b38a61b00fd161ee4f60702a)
---
.../src/components/DagActions/RunBackfillForm.tsx | 69 ++++++++++++++--------
1 file changed, 43 insertions(+), 26 deletions(-)
diff --git a/airflow-core/src/airflow/ui/src/components/DagActions/RunBackfillForm.tsx b/airflow-core/src/airflow/ui/src/components/DagActions/RunBackfillForm.tsx
index 112631563e3..544876efa2f 100644
--- a/airflow-core/src/airflow/ui/src/components/DagActions/RunBackfillForm.tsx
+++ b/airflow-core/src/airflow/ui/src/components/DagActions/RunBackfillForm.tsx
@@ -16,16 +16,17 @@
* specific language governing permissions and limitations
* under the License.
*/
-import { Input, Box, Spacer, HStack, Field, VStack, Flex, Text } from "@chakra-ui/react";
+import { Input, Box, Spacer, HStack, Field, VStack, Flex, Text, Skeleton } from "@chakra-ui/react";
import { useEffect, useState } from "react";
import { useForm, Controller, useWatch } from "react-hook-form";
import type { DAGResponse, DAGWithLatestDagRunsResponse, BackfillPostBody } from "openapi/requests/types.gen";
-import { Alert, Button } from "src/components/ui";
+import { Button } from "src/components/ui";
import { reprocessBehaviors } from "src/constants/reprocessBehaviourParams";
import { useCreateBackfill } from "src/queries/useCreateBackfill";
import { useCreateBackfillDryRun } from "src/queries/useCreateBackfillDryRun";
import { useTogglePause } from "src/queries/useTogglePause";
+import { pluralize } from "src/utils";
import { ErrorAlert } from "../ErrorAlert";
import { Checkbox } from "../ui/Checkbox";
@@ -47,7 +48,7 @@ const RunBackfillForm = ({ dag, onClose }: RunBackfillFormProps) => {
dag_run_conf: {},
from_date: "",
max_active_runs: 1,
- reprocess_behavior: "failed",
+ reprocess_behavior: "none",
run_backwards: false,
to_date: "",
},
@@ -114,11 +115,25 @@ const RunBackfillForm = ({ dag, onClose }: RunBackfillFormProps) => {
total_entries: 0,
};
+ const inlineMessage =
+ !Boolean(values.from_date) || !Boolean(values.to_date) ? undefined : isPendingDryRun ? (
+ <Skeleton height="20px" width="100px" />
+ ) : affectedTasks.total_entries > 0 ? (
+ <Text color="fg.success" fontSize="sm">
+ {pluralize("run", affectedTasks.total_entries)} will be triggered
+ </Text>
+ ) : (
+ <Text color="fg.error" fontSize="sm" fontWeight="medium">
+ No runs matching selected criteria.
+ </Text>
+ );
+
return (
<>
+ <ErrorAlert error={errors.date ?? error} />
<VStack alignItems="stretch" gap={2} pt={4}>
<Box>
- <Text fontSize="md" fontWeight="medium" mb={1}>
+ <Text fontSize="md" fontWeight="semibold" mb={3}>
Date Range
</Text>
<HStack w="full">
@@ -127,6 +142,7 @@ const RunBackfillForm = ({ dag, onClose }: RunBackfillFormProps) => {
name="from_date"
render={({ field }) => (
<Field.Root invalid={Boolean(errors.date)}>
+ <Field.Label>From</Field.Label>
<Input
{...field}
max={dataIntervalEnd || today}
@@ -142,6 +158,7 @@ const RunBackfillForm = ({ dag, onClose }: RunBackfillFormProps) => {
name="to_date"
render={({ field }) => (
<Field.Root invalid={Boolean(errors.date)}>
+ <Field.Label>To</Field.Label>
<Input
{...field}
max={today}
@@ -155,6 +172,7 @@ const RunBackfillForm = ({ dag, onClose }: RunBackfillFormProps) => {
/>
</HStack>
</Box>
+ <Box>{inlineMessage}</Box>
<Spacer />
<Controller
control={control}
@@ -166,7 +184,9 @@ const RunBackfillForm = ({ dag, onClose }: RunBackfillFormProps) => {
field.onChange(event);
}}
>
- <RadioCardLabel fontSize="md">Reprocess Behaviour</RadioCardLabel>
+ <RadioCardLabel fontSize="md" fontWeight="semibold" mb={3}>
+ Reprocess Behaviour
+ </RadioCardLabel>
<HStack>
{reprocessBehaviors.map((item) => (
<RadioCardItem
@@ -182,16 +202,6 @@ const RunBackfillForm = ({ dag, onClose }: RunBackfillFormProps) => {
)}
/>
<Spacer />
- <Controller
- control={control}
- name="run_backwards"
- render={({ field }) => (
- <Checkbox checked={field.value} colorPalette="blue" onChange={field.onChange}>
- Run Backwards
- </Checkbox>
- )}
- />
- <Spacer />
<Controller
control={control}
name="max_active_runs"
@@ -210,18 +220,25 @@ const RunBackfillForm = ({ dag, onClose }: RunBackfillFormProps) => {
)}
/>
<Spacer />
- {affectedTasks.total_entries > 0 ? (
- <Alert>{affectedTasks.total_entries} runs will be triggered</Alert>
- ) : (
- <Alert>No runs matching selected criteria.</Alert>
- )}
+ <Controller
+ control={control}
+ name="run_backwards"
+ render={({ field }) => (
+ <Checkbox checked={field.value} colorPalette="blue" onChange={field.onChange}>
+ Run Backwards
+ </Checkbox>
+ )}
+ />
+ <Spacer />
+ {dag.is_paused ? (
+ <>
+ <Checkbox checked={unpause} colorPalette="blue" onChange={() => setUnpause(!unpause)}>
+ Unpause {dag.dag_display_name} on trigger
+ </Checkbox>
+ <Spacer />
+ </>
+ ) : undefined}
</VStack>
- {dag.is_paused ? (
- <Checkbox checked={unpause} colorPalette="blue" onChange={() => setUnpause(!unpause)}>
- Unpause {dag.dag_display_name} on trigger
- </Checkbox>
- ) : undefined}
- <ErrorAlert error={errors.date ?? error} />
<Box as="footer" display="flex" justifyContent="flex-end" mt={4}>
<HStack w="full">
<Spacer />