antonio-mello-ai commented on code in PR #62831:
URL: https://github.com/apache/airflow/pull/62831#discussion_r2897691170


##########
airflow-core/src/airflow/ui/src/components/PoolBar.tsx:
##########
@@ -67,7 +71,14 @@ export const PoolBar = ({
         {preparedSlots
           .filter((slot) => barSlots.includes(slot.slotType) && slot.slotValue 
> 0)
           .map((slot) => {
-            const flexValue = slot.slotValue / totalSlots || 0;
+            const usedSlots = preparedSlots
+              .filter((s) => barSlots.includes(s.slotType) && s.slotValue > 0 
&& s.slotType !== "open")
+              .reduce((sum, s) => sum + s.slotValue, 0);
+            const flexValue = isUnlimited
+              ? slot.slotType === "open"
+                ? Math.max(1, usedSlots) // open takes at least as much space 
as all used slots combined
+                : slot.slotValue
+              : slot.slotValue / totalSlots || 0;

Review Comment:
   Addressed in the second commit. I extracted `displayedSlots` before the JSX 
return — it applies the same filter once, and `usedSlots` is computed from that 
filtered list (just excluding `open`). No more re-filtering from 
`preparedSlots`.



##########
airflow-core/src/airflow/ui/src/components/PoolBar.tsx:
##########
@@ -67,7 +71,14 @@ export const PoolBar = ({
         {preparedSlots
           .filter((slot) => barSlots.includes(slot.slotType) && slot.slotValue 
> 0)
           .map((slot) => {
-            const flexValue = slot.slotValue / totalSlots || 0;
+            const usedSlots = preparedSlots

Review Comment:
   Done — moved it out of the `.map()` in the second commit. Both 
`displayedSlots` and `usedSlots` are now computed once before the JSX return.



-- 
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]

Reply via email to