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

pierrejeambrun pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new cdf394bc930 feat: auto refresh for `HistoricalMetrics` (#49830)
cdf394bc930 is described below

commit cdf394bc9302ed983dec8839063886d90cab8eea
Author: Guan Ming(Wesley) Chiu <[email protected]>
AuthorDate: Mon Apr 28 22:49:40 2025 +0800

    feat: auto refresh for `HistoricalMetrics` (#49830)
    
    Co-authored-by: pierrejeambrun <[email protected]>
---
 .../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