This is an automated email from the ASF dual-hosted git repository.

pierrejeambrun pushed a commit to branch v3-0-test
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/v3-0-test by this push:
     new c87c13ec4ca [v3-0-test] feat: auto refresh for `HistoricalMetrics` 
(#49830) (#49898)
c87c13ec4ca is described below

commit c87c13ec4caa159db0fc2fa2b12467371a0c674d
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Mon Apr 28 17:46:30 2025 +0200

    [v3-0-test] feat: auto refresh for `HistoricalMetrics` (#49830) (#49898)
    
    (cherry picked from commit cdf394bc9302ed983dec8839063886d90cab8eea)
    
    Co-authored-by: Guan Ming(Wesley) Chiu 
<105915352+guan404m...@users.noreply.github.com>
    Co-authored-by: pierrejeambrun <pierrejb...@gmail.com>
---
 .../Dashboard/HistoricalMetrics/HistoricalMetrics.tsx     | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git 
a/airflow-core/src/airflow/ui/src/pages/Dashboard/HistoricalMetrics/HistoricalMetrics.tsx
 
b/airflow-core/src/airflow/ui/src/pages/Dashboard/HistoricalMetrics/HistoricalMetrics.tsx
index fd42d13b8d2..898776f5427 100644
--- 
a/airflow-core/src/airflow/ui/src/pages/Dashboard/HistoricalMetrics/HistoricalMetrics.tsx
+++ 
b/airflow-core/src/airflow/ui/src/pages/Dashboard/HistoricalMetrics/HistoricalMetrics.tsx
@@ -25,6 +25,7 @@ import { useAssetServiceGetAssetEvents, 
useDashboardServiceHistoricalMetrics } f
 import { AssetEvents } from "src/components/Assets/AssetEvents";
 import { ErrorAlert } from "src/components/ErrorAlert";
 import TimeRangeSelector from "src/components/TimeRangeSelector";
+import { useAutoRefresh } from "src/utils";
 
 import { DagRunMetrics } from "./DagRunMetrics";
 import { MetricSectionSkeleton } from "./MetricSectionSkeleton";
@@ -38,9 +39,17 @@ export const HistoricalMetrics = () => {
   const [endDate, setEndDate] = useState(now.toISOString());
   const [assetSortBy, setAssetSortBy] = useState("-timestamp");
 
-  const { data, error, isLoading } = useDashboardServiceHistoricalMetrics({
-    startDate,
-  });
+  const refetchInterval = useAutoRefresh({});
+
+  const { data, error, isLoading } = useDashboardServiceHistoricalMetrics(
+    {
+      startDate,
+    },
+    undefined,
+    {
+      refetchInterval,
+    },
+  );
 
   const dagRunTotal = data
     ? Object.values(data.dag_run_states).reduce((partialSum, value) => 
partialSum + value, 0)

Reply via email to