Skip to content

Commit e83ca8e

Browse files
Fix poolbar counts (#53825)
1 parent 69ab304 commit e83ca8e

File tree

3 files changed

+27
-7
lines changed

3 files changed

+27
-7
lines changed

airflow-core/src/airflow/ui/src/components/PoolBar.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* specific language governing permissions and limitations
1717
* under the License.
1818
*/
19-
import { Flex, Link } from "@chakra-ui/react";
19+
import { Flex, Link, Box } from "@chakra-ui/react";
2020
import { useTranslation } from "react-i18next";
2121
import { Link as RouterLink } from "react-router-dom";
2222

@@ -54,13 +54,12 @@ export const PoolBar = ({
5454
alignItems="center"
5555
bg={`${color}.solid`}
5656
color="white"
57-
flex={flexValue}
5857
gap={1}
5958
h="100%"
6059
justifyContent="center"
6160
px={1}
62-
py={0.5}
6361
textAlign="center"
62+
w="100%"
6463
>
6564
{icon}
6665
{slotValue}
@@ -69,11 +68,13 @@ export const PoolBar = ({
6968
);
7069

7170
return color !== "success" && "name" in pool ? (
72-
<Link asChild key={key}>
71+
<Link asChild display="flex" flex={flexValue} key={key}>
7372
<RouterLink to={`/task_instances?state=${color}&pool=${pool.name}`}>{poolContent}</RouterLink>
7473
</Link>
7574
) : (
76-
poolContent
75+
<Box display="flex" flex={flexValue} key={key}>
76+
{poolContent}
77+
</Box>
7778
);
7879
})}
7980
</>

airflow-core/src/airflow/ui/src/pages/Dashboard/PoolSummary/PoolSummary.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,17 @@ export const PoolSummary = () => {
3737
const hasPoolsAccess = authLinks?.authorized_menu_items.includes("Pools");
3838

3939
const pools = data?.pools;
40-
const totalSlots = pools?.reduce((sum, pool) => sum + pool.slots, 0) ?? 0;
40+
const totalSlots =
41+
pools?.reduce(
42+
(sum, pool) =>
43+
sum +
44+
pool.running_slots +
45+
pool.queued_slots +
46+
pool.deferred_slots +
47+
pool.scheduled_slots +
48+
pool.open_slots,
49+
0,
50+
) ?? 0;
4151
const aggregatePool: Slots = {
4252
deferred_slots: 0,
4353
open_slots: 0,

airflow-core/src/airflow/ui/src/pages/Pools/PoolBarCard.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,16 @@ const PoolBarCard = ({ pool }: PoolBarCardProps) => {
6464

6565
<Box margin={4}>
6666
<Flex bg="gray.muted" borderRadius="md" h="20px" overflow="hidden" w="100%">
67-
<PoolBar pool={pool} totalSlots={pool.slots} />
67+
<PoolBar
68+
pool={pool}
69+
totalSlots={
70+
pool.running_slots +
71+
pool.queued_slots +
72+
pool.deferred_slots +
73+
pool.scheduled_slots +
74+
pool.open_slots
75+
}
76+
/>
6877
</Flex>
6978
</Box>
7079
</Box>

0 commit comments

Comments
 (0)