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

pierrejeambrun 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 04b76225fbb Fix UI keeps poking pools API when no permission (#56163) 
(#56626)
04b76225fbb is described below

commit 04b76225fbbcb91810eb7e05a56a9879b3b03b98
Author: Pierre Jeambrun <[email protected]>
AuthorDate: Tue Oct 14 08:57:38 2025 -0700

    Fix UI keeps poking pools API when no permission (#56163) (#56626)
    
    (cherry picked from commit 9ed441418e42833ad48a1137587108dcb598f710)
    
    Co-authored-by: Yiming Peng <[email protected]>
---
 .../pages/Dashboard/PoolSummary/PoolSummary.tsx    | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git 
a/airflow-core/src/airflow/ui/src/pages/Dashboard/PoolSummary/PoolSummary.tsx 
b/airflow-core/src/airflow/ui/src/pages/Dashboard/PoolSummary/PoolSummary.tsx
index 3ce4e40a932..e2d897b01b1 100644
--- 
a/airflow-core/src/airflow/ui/src/pages/Dashboard/PoolSummary/PoolSummary.tsx
+++ 
b/airflow-core/src/airflow/ui/src/pages/Dashboard/PoolSummary/PoolSummary.tsx
@@ -21,8 +21,9 @@ import { useTranslation } from "react-i18next";
 import { BiTargetLock } from "react-icons/bi";
 import { Link as RouterLink } from "react-router-dom";
 
-import { useAuthLinksServiceGetAuthMenus } from "openapi/queries";
+import { type PoolServiceGetPoolsDefaultResponse, 
useAuthLinksServiceGetAuthMenus } from "openapi/queries";
 import { usePoolServiceGetPools } from "openapi/queries/queries";
+import type { ApiError } from "openapi/requests";
 import { PoolBar } from "src/components/PoolBar";
 import { useAutoRefresh } from "src/utils";
 import { type Slots, slotKeys } from "src/utils/slots";
@@ -30,12 +31,25 @@ import { type Slots, slotKeys } from "src/utils/slots";
 export const PoolSummary = () => {
   const { t: translate } = useTranslation("dashboard");
   const refetchInterval = useAutoRefresh({});
-  const { data, isLoading } = usePoolServiceGetPools(undefined, undefined, {
-    refetchInterval,
-  });
   const { data: authLinks } = useAuthLinksServiceGetAuthMenus();
   const hasPoolsAccess = authLinks?.authorized_menu_items.includes("Pools");
 
+  const { data, error, isLoading } = 
usePoolServiceGetPools<PoolServiceGetPoolsDefaultResponse, ApiError>(
+    undefined,
+    undefined,
+    {
+      refetchInterval: (query) => {
+        const apiError = query.state.error;
+
+        return apiError?.status === 403 ? false : refetchInterval;
+      },
+    },
+  );
+
+  if (error?.status === 403) {
+    return undefined;
+  }
+
   const pools = data?.pools;
   const totalSlots = pools?.reduce((sum, pool) => sum + pool.slots, 0) ?? 0;
   const aggregatePool: Slots = {

Reply via email to