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 e83ca8e96aa Fix poolbar counts (#53825)
e83ca8e96aa is described below
commit e83ca8e96aa5c32b73ca8f73ac86277310626dd3
Author: Pierre Jeambrun <[email protected]>
AuthorDate: Mon Jul 28 21:08:16 2025 +0200
Fix poolbar counts (#53825)
---
airflow-core/src/airflow/ui/src/components/PoolBar.tsx | 11 ++++++-----
.../ui/src/pages/Dashboard/PoolSummary/PoolSummary.tsx | 12 +++++++++++-
airflow-core/src/airflow/ui/src/pages/Pools/PoolBarCard.tsx | 11 ++++++++++-
3 files changed, 27 insertions(+), 7 deletions(-)
diff --git a/airflow-core/src/airflow/ui/src/components/PoolBar.tsx
b/airflow-core/src/airflow/ui/src/components/PoolBar.tsx
index 81fc83c09df..a0cfdb700e8 100644
--- a/airflow-core/src/airflow/ui/src/components/PoolBar.tsx
+++ b/airflow-core/src/airflow/ui/src/components/PoolBar.tsx
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-import { Flex, Link } from "@chakra-ui/react";
+import { Flex, Link, Box } from "@chakra-ui/react";
import { useTranslation } from "react-i18next";
import { Link as RouterLink } from "react-router-dom";
@@ -54,13 +54,12 @@ export const PoolBar = ({
alignItems="center"
bg={`${color}.solid`}
color="white"
- flex={flexValue}
gap={1}
h="100%"
justifyContent="center"
px={1}
- py={0.5}
textAlign="center"
+ w="100%"
>
{icon}
{slotValue}
@@ -69,11 +68,13 @@ export const PoolBar = ({
);
return color !== "success" && "name" in pool ? (
- <Link asChild key={key}>
+ <Link asChild display="flex" flex={flexValue} key={key}>
<RouterLink
to={`/task_instances?state=${color}&pool=${pool.name}`}>{poolContent}</RouterLink>
</Link>
) : (
- poolContent
+ <Box display="flex" flex={flexValue} key={key}>
+ {poolContent}
+ </Box>
);
})}
</>
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 8446542e402..f6e31fa263b 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
@@ -37,7 +37,17 @@ export const PoolSummary = () => {
const hasPoolsAccess = authLinks?.authorized_menu_items.includes("Pools");
const pools = data?.pools;
- const totalSlots = pools?.reduce((sum, pool) => sum + pool.slots, 0) ?? 0;
+ const totalSlots =
+ pools?.reduce(
+ (sum, pool) =>
+ sum +
+ pool.running_slots +
+ pool.queued_slots +
+ pool.deferred_slots +
+ pool.scheduled_slots +
+ pool.open_slots,
+ 0,
+ ) ?? 0;
const aggregatePool: Slots = {
deferred_slots: 0,
open_slots: 0,
diff --git a/airflow-core/src/airflow/ui/src/pages/Pools/PoolBarCard.tsx
b/airflow-core/src/airflow/ui/src/pages/Pools/PoolBarCard.tsx
index 2e0403592c3..59a48a88722 100644
--- a/airflow-core/src/airflow/ui/src/pages/Pools/PoolBarCard.tsx
+++ b/airflow-core/src/airflow/ui/src/pages/Pools/PoolBarCard.tsx
@@ -64,7 +64,16 @@ const PoolBarCard = ({ pool }: PoolBarCardProps) => {
<Box margin={4}>
<Flex bg="gray.muted" borderRadius="md" h="20px" overflow="hidden"
w="100%">
- <PoolBar pool={pool} totalSlots={pool.slots} />
+ <PoolBar
+ pool={pool}
+ totalSlots={
+ pool.running_slots +
+ pool.queued_slots +
+ pool.deferred_slots +
+ pool.scheduled_slots +
+ pool.open_slots
+ }
+ />
</Flex>
</Box>
</Box>