This is an automated email from the ASF dual-hosted git repository.
bbovenzi pushed a commit to branch v3-1-test
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/v3-1-test by this push:
new 7c221031cc6 [v3-1-test] Add auto refresh to backfill banner (#56226)
(#56774)
7c221031cc6 is described below
commit 7c221031cc62052bc3b5260222f9c35d32832d90
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Fri Oct 17 11:54:43 2025 -0400
[v3-1-test] Add auto refresh to backfill banner (#56226) (#56774)
* auto refresh added
* fixed unnecessary formatting
* fix(ui): tidy BackfillBanner and restore EOF newline
* added the empty line
(cherry picked from commit 380fa70343bc9f261e21bb9d9506d689aa4c8e57)
Co-authored-by: Omar Eltomy <[email protected]>
---
.../ui/src/components/Banner/BackfillBanner.tsx | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
diff --git
a/airflow-core/src/airflow/ui/src/components/Banner/BackfillBanner.tsx
b/airflow-core/src/airflow/ui/src/components/Banner/BackfillBanner.tsx
index 82fad574ed5..522a541fc40 100644
--- a/airflow-core/src/airflow/ui/src/components/Banner/BackfillBanner.tsx
+++ b/airflow-core/src/airflow/ui/src/components/Banner/BackfillBanner.tsx
@@ -29,6 +29,8 @@ import {
useBackfillServicePauseBackfill,
useBackfillServiceUnpauseBackfill,
} from "openapi/queries";
+import type { BackfillResponse } from "openapi/requests/types.gen";
+import { useAutoRefresh } from "src/utils";
import Time from "../Time";
import { Button, ProgressBar } from "../ui";
@@ -48,10 +50,21 @@ const buttonProps = {
const BackfillBanner = ({ dagId }: Props) => {
const { t: translate } = useTranslation("components");
- const { data, isLoading } = useBackfillServiceListBackfillsUi({
- dagId,
- });
- const [backfill] = data?.backfills.filter((bf) => bf.completed_at === null)
?? [];
+ const refetchInterval = useAutoRefresh({ dagId });
+
+ const { data, isLoading } = useBackfillServiceListBackfillsUi(
+ {
+ dagId,
+ },
+ undefined,
+ {
+ refetchInterval: (query) =>
+ query.state.data?.backfills.some((bf: BackfillResponse) =>
bf.completed_at === null && !bf.is_paused)
+ ? refetchInterval
+ : false,
+ },
+ );
+ const [backfill] = data?.backfills.filter((bf: BackfillResponse) =>
bf.completed_at === null) ?? [];
const queryClient = useQueryClient();
const onSuccess = async () => {
@@ -64,7 +77,6 @@ const BackfillBanner = ({ dagId }: Props) => {
const { isPending: isUnPausePending, mutate: unpauseMutate } =
useBackfillServiceUnpauseBackfill({
onSuccess,
});
-
const { isPending: isStopPending, mutate: stopPending } =
useBackfillServiceCancelBackfill({ onSuccess });
const togglePause = () => {