yimingpeng commented on code in PR #56163:
URL: https://github.com/apache/airflow/pull/56163#discussion_r2403871808
##########
airflow-core/src/airflow/ui/src/pages/Dashboard/PoolSummary/PoolSummary.tsx:
##########
@@ -23,19 +23,30 @@ import { Link as RouterLink } from "react-router-dom";
import { useAuthLinksServiceGetAuthMenus } from "openapi/queries";
import { usePoolServiceGetPools } from "openapi/queries/queries";
+import type { ExpandedApiError } from "src/components/ErrorAlert";
import { PoolBar } from "src/components/PoolBar";
import { useAutoRefresh } from "src/utils";
import { type Slots, slotKeys } from "src/utils/slots";
export const PoolSummary = () => {
const { t: translate } = useTranslation("dashboard");
const refetchInterval = useAutoRefresh({ checkPendingRuns: true });
- const { data, isLoading } = usePoolServiceGetPools(undefined, undefined, {
- refetchInterval,
- });
+
const { data: authLinks } = useAuthLinksServiceGetAuthMenus();
const hasPoolsAccess = authLinks?.authorized_menu_items.includes("Pools");
+ const { data, error, isLoading } = usePoolServiceGetPools(undefined,
undefined, {
+ refetchInterval: (query) => {
+ const apiError = query.state.error as ExpandedApiError | null;
+
+ return apiError?.status === 403 ? false : refetchInterval;
+ },
+ });
+
+ if (Boolean(error) && (error as ExpandedApiError).status === 403) {
+ return undefined;
+ }
+
Review Comment:
Thank you @pierrejeambrun, I believe it has been addressed now. Please let
me know if anything else should be addressed.
When there are no permissions granted on Pools, the UI now looks as expected.
<img width="1776" height="771" alt="image"
src="https://github.com/user-attachments/assets/798a5cd2-c2ee-44c7-87f8-b747d61a4dc7"
/>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]