From 6f86825acfdbc921e5eb3e8045ba18edf7f68124 Mon Sep 17 00:00:00 2001 From: Kavya Katal Date: Fri, 19 Sep 2025 02:48:07 +0530 Subject: [PATCH 1/2] UI(Pools, Dashboard): Hide deferred chip unless pool counts deferred tasks --- .../src/airflow/ui/src/components/PoolBar.tsx | 16 ++++++++++++++++ .../pages/Dashboard/PoolSummary/PoolSummary.tsx | 6 ++++++ 2 files changed, 22 insertions(+) diff --git a/airflow-core/src/airflow/ui/src/components/PoolBar.tsx b/airflow-core/src/airflow/ui/src/components/PoolBar.tsx index c8abc717a272a..bf8ddae78b937 100644 --- a/airflow-core/src/airflow/ui/src/components/PoolBar.tsx +++ b/airflow-core/src/airflow/ui/src/components/PoolBar.tsx @@ -42,13 +42,28 @@ export const PoolBar = ({ const slotValue = pool[key]; const flexValue = slotValue / totalSlots || 0; + // Hide empty segments if (flexValue === 0) { return undefined; } + // NEW: If this segment represents "deferred_slots" and the current pool + // is configured NOT to include deferred in occupied slots, hide this chip. + // (We only have the flag on real pools; aggregated "Slots" objects don't carry it) + const isDeferredKey = key === "deferred_slots"; + + if ( + isDeferredKey && + "include_deferred" in pool && // type guard: only PoolResponse has this + !pool.include_deferred + ) { + return undefined; + } + const slotType = key.replace("_slots", ""); const poolCount = poolsWithSlotType ? poolsWithSlotType[key] : 0; const tooltipContent = `${translate(`pools.${slotType}`)}: ${slotValue} (${poolCount} ${translate("pools.pools", { count: poolCount })})`; + const poolContent = ( ); + // Keep existing behavior: make non-"success" segments clickable to Task Instances return color !== "success" && "name" in pool ? ( { const pools = data?.pools; const totalSlots = pools?.reduce((sum, pool) => sum + pool.slots, 0) ?? 0; + const aggregatePool: Slots = { deferred_slots: 0, open_slots: 0, @@ -58,6 +59,11 @@ export const PoolSummary = () => { slotKeys.forEach((slotKey) => { const slotValue = pool[slotKey]; + // NEW: only include deferred slots from pools that count deferred + if (slotKey === "deferred_slots" && !pool.include_deferred) { + return; + } + if (slotValue > 0) { aggregatePool[slotKey] += slotValue; poolsWithSlotType[slotKey] += 1; From bb793ecd26548370fb082c6e8d9ff37b63ac0155 Mon Sep 17 00:00:00 2001 From: Kavya Katal Date: Wed, 24 Sep 2025 22:03:39 +0530 Subject: [PATCH 2/2] Reduced comments --- airflow-core/src/airflow/ui/src/components/PoolBar.tsx | 3 --- 1 file changed, 3 deletions(-) diff --git a/airflow-core/src/airflow/ui/src/components/PoolBar.tsx b/airflow-core/src/airflow/ui/src/components/PoolBar.tsx index bf8ddae78b937..68fcf5ef9781b 100644 --- a/airflow-core/src/airflow/ui/src/components/PoolBar.tsx +++ b/airflow-core/src/airflow/ui/src/components/PoolBar.tsx @@ -42,12 +42,10 @@ export const PoolBar = ({ const slotValue = pool[key]; const flexValue = slotValue / totalSlots || 0; - // Hide empty segments if (flexValue === 0) { return undefined; } - // NEW: If this segment represents "deferred_slots" and the current pool // is configured NOT to include deferred in occupied slots, hide this chip. // (We only have the flag on real pools; aggregated "Slots" objects don't carry it) const isDeferredKey = key === "deferred_slots"; @@ -84,7 +82,6 @@ export const PoolBar = ({ ); - // Keep existing behavior: make non-"success" segments clickable to Task Instances return color !== "success" && "name" in pool ? (