Skip to content

fix(ui): handle pools with unlimited (-1) slots in UI components#62831

Merged
choo121600 merged 4 commits into
apache:mainfrom
antonio-mello-ai:fix/pool-infinity-slots-ui
Mar 13, 2026
Merged

fix(ui): handle pools with unlimited (-1) slots in UI components#62831
choo121600 merged 4 commits into
apache:mainfrom
antonio-mello-ai:fix/pool-infinity-slots-ui

Conversation

@antonio-mello-ai

@antonio-mello-ai antonio-mello-ai commented Mar 3, 2026

Copy link
Copy Markdown
Contributor

Summary

closes: #61115

Fixes the remaining UI portion of #61115. The backend fix was already merged in #61140.

When a pool has slots set to -1 (unlimited), the UI components now properly handle this case:

  • PoolBar.tsx: Detects unlimited pools and renders the open slots segment with symbol instead of computing broken flex ratios from dividing by -1
  • PoolBarCard.tsx: Displays instead of -1 in the pool card header (e.g., my_pool (∞ Slots))
  • PoolSummary.tsx: Correctly aggregates slot counts in the dashboard when any pool is unlimited — avoids corrupting the total by adding -1
  • PoolForm.tsx: Sets min={-1} on the slots input and adds a helper text ("Use -1 for unlimited slots.") so users understand the convention
  • admin.json (en): Added slotsHelperText i18n key

Testing

  1. Create a pool with -1 slots via the API
  2. Navigate to the Pools page — the pool card should show ∞ Slots with a properly rendered bar
  3. Navigate to the Dashboard — the Pool Summary should aggregate correctly
  4. Edit a pool — the form should allow -1 with helper text

Closes #61115

When a pool has slots set to -1 (unlimited), the UI now properly
handles this case instead of showing broken bars or negative values.

Changes:
- PoolBar: render infinity symbol and proportional bar for unlimited pools
- PoolBarCard: display ∞ instead of -1 in pool header
- PoolSummary: correctly aggregate slots when any pool is unlimited
- PoolForm: set min to -1 and add helper text explaining the convention

Closes: apache#61115
@boring-cyborg

boring-cyborg Bot commented Mar 3, 2026

Copy link
Copy Markdown

Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide (https://github.com/apache/airflow/blob/main/contributing-docs/README.rst)
Here are some useful points:

  • Pay attention to the quality of your code (ruff, mypy and type annotations). Our prek-hooks will help you with that.
  • In case of a new feature add useful documentation (in docstrings or in docs/ directory). Adding a new operator? Check this short guide Consider adding an example DAG that shows how users should use it.
  • Consider using Breeze environment for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations.
  • Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
  • Please follow ASF Code of Conduct for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
  • Be sure to read the Airflow Coding style.
  • Always keep your Pull Requests rebased, otherwise your build might fail due to changes not related to your commits.
    Apache Airflow is a community-driven project and together we are making it better 🚀.
    In case of doubts contact the developers at:
    Mailing List: dev@airflow.apache.org
    Slack: https://s.apache.org/airflow-slack

@boring-cyborg boring-cyborg Bot added area:translations area:UI Related to UI/UX. For Frontend Developers. translation:default labels Mar 3, 2026

@pierrejeambrun pierrejeambrun left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looking good. Thanks for the PR this needs a few adjustment / simplification but working as expected. And CI need fixing, some eslint errors.

Comment thread airflow-core/src/airflow/ui/src/components/PoolBar.tsx Outdated
Comment thread airflow-core/src/airflow/ui/src/components/PoolBar.tsx Outdated
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@antonio-mello-ai

Copy link
Copy Markdown
Contributor Author

Thanks @pierrejeambrun — both points addressed:

  1. usedSlots moved out of the loop — it's now computed once before the JSX return, as a constant derived from displayedSlots.

  2. Reuses filtered data — extracted const displayedSlots = preparedSlots.filter(...) and then usedSlots is computed from displayedSlots.filter(s => s.slotType !== "open") instead of re-filtering preparedSlots from scratch. The .map() now iterates displayedSlots directly.

No logic changes — just cleaner data flow.

@eladkal

eladkal commented Mar 10, 2026

Copy link
Copy Markdown
Contributor

static checks are failing

@antonio-mello-ai

Copy link
Copy Markdown
Contributor Author

@eladkal The static check failure (ts-compile-lint-ui) appears to be a flake on main itself — the latest main CI run also shows failures. Our PR only touches Pool UI components and doesn't affect the eslint/tsc pipeline.

Happy to rebase if needed once main is green again.

@pierrejeambrun pierrejeambrun left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@antonio-mello-ai It's not flaky it's failing because of (in PoolBar component)

 const usedSlots = displayedSlots
    .filter((s) => s.slotType !== "open")
    .reduce((sum, s) => sum + s.slotValue, 0);

Identifier "s" is too small and not descriptive enough.

Do you mind fixing this so we can merge it.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@antonio-mello-ai

Copy link
Copy Markdown
Contributor Author

@pierrejeambrun Fixed in 1e07bb4 — renamed s to slot in the filter/reduce chain. Thanks for catching it.

@pierrejeambrun pierrejeambrun left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a few more linting / typing error.

You can run the static check locally. I recommend you install prek and setup the pre-commit hooks so that you will have those checks run locally before pushing your code. More information in our doc airflow/contributing-docs/08_static_code_checks.rst

- Fix indentation in PoolBar.tsx map callback (formatting)
- Fix JSX line break in PoolBarCard.tsx (formatting)
- Widen slotType cast to TaskInstanceState | "open" since
  open_slots produces "open" which is not a TaskInstanceState
- Add explicit cast for StateIcon prop where "open" is already
  filtered out by infoSlots

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@antonio-mello-ai

Copy link
Copy Markdown
Contributor Author

@pierrejeambrun Thanks for the guidance — installed prek locally and set up the pre-commit hooks as recommended.

Fixed in 6ae58d3:

  • Formatting: indentation in PoolBar.tsx map callback + JSX line break in PoolBarCard.tsx (auto-fixed by prek formatter)
  • TypeScript TS2367: widened slotType cast from as TaskInstanceState to as TaskInstanceState | "open" since open_slots produces "open" which isn't a valid TaskInstanceState. Added explicit cast for StateIcon prop where "open" is already filtered out by infoSlots.

All checks passing locally via prek run. Please let me know if anything else needs attention.

@choo121600 choo121600 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good to me :)

@choo121600 choo121600 merged commit b63857e into apache:main Mar 13, 2026
79 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

Backport failed to create: v3-1-test. View the failure log Run details

Note: As of Merging PRs targeted for Airflow 3.X
the committer who merges the PR is responsible for backporting the PRs that are bug fixes (generally speaking) to the maintenance branches.

In matter of doubt please ask in #release-management Slack channel.

Status Branch Result
v3-1-test Commit Link

You can attempt to backport this manually by running:

cherry_picker b63857e v3-1-test

This should apply the commit to the v3-1-test branch and leave the commit in conflict state marking
the files that need manual conflict resolution.

After you have resolved the conflicts, you can continue the backport process by running:

cherry_picker --continue

If you don't have cherry-picker installed, see the installation guide.

Pyasma pushed a commit to Pyasma/airflow that referenced this pull request Mar 13, 2026
…che#62831)

* fix(ui): handle pools with unlimited (-1) slots in UI components

When a pool has slots set to -1 (unlimited), the UI now properly
handles this case instead of showing broken bars or negative values.

Changes:
- PoolBar: render infinity symbol and proportional bar for unlimited pools
- PoolBarCard: display ∞ instead of -1 in pool header
- PoolSummary: correctly aggregate slots when any pool is unlimited
- PoolForm: set min to -1 and add helper text explaining the convention

Closes: apache#61115

* fix(ui): simplify PoolBar unlimited slots computation per review

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(ui): rename short identifier in PoolBar filter/reduce

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(ui): resolve linting and typing errors caught by prek

- Fix indentation in PoolBar.tsx map callback (formatting)
- Fix JSX line break in PoolBarCard.tsx (formatting)
- Widen slotType cast to TaskInstanceState | "open" since
  open_slots produces "open" which is not a TaskInstanceState
- Add explicit cast for StateIcon prop where "open" is already
  filtered out by infoSlots

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
@pierrejeambrun

pierrejeambrun commented Mar 17, 2026

Copy link
Copy Markdown
Member

@choo121600 I believe this needs a manual backport. (To ease release managers pain I think we agreed that this should be done by the people merging the PR)

choo121600 pushed a commit to choo121600/airflow that referenced this pull request Mar 18, 2026
…che#62831)

* fix(ui): handle pools with unlimited (-1) slots in UI components

When a pool has slots set to -1 (unlimited), the UI now properly
handles this case instead of showing broken bars or negative values.

Changes:
- PoolBar: render infinity symbol and proportional bar for unlimited pools
- PoolBarCard: display ∞ instead of -1 in pool header
- PoolSummary: correctly aggregate slots when any pool is unlimited
- PoolForm: set min to -1 and add helper text explaining the convention

Closes: apache#61115

* fix(ui): simplify PoolBar unlimited slots computation per review

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(ui): rename short identifier in PoolBar filter/reduce

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(ui): resolve linting and typing errors caught by prek

- Fix indentation in PoolBar.tsx map callback (formatting)
- Fix JSX line break in PoolBarCard.tsx (formatting)
- Widen slotType cast to TaskInstanceState | "open" since
  open_slots produces "open" which is not a TaskInstanceState
- Add explicit cast for StateIcon prop where "open" is already
  filtered out by infoSlots

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
@choo121600

Copy link
Copy Markdown
Member

@choo121600 I believe this needs a manual backport. (To ease release managers pain I think we agreed that this should be done by the people merging the PR)

Got it, thanks for the heads up!
I’ve created the backport PR: #63872

pierrejeambrun pushed a commit that referenced this pull request Mar 18, 2026
) (#63872)

* fix(ui): handle pools with unlimited (-1) slots in UI components

When a pool has slots set to -1 (unlimited), the UI now properly
handles this case instead of showing broken bars or negative values.

Changes:
- PoolBar: render infinity symbol and proportional bar for unlimited pools
- PoolBarCard: display ∞ instead of -1 in pool header
- PoolSummary: correctly aggregate slots when any pool is unlimited
- PoolForm: set min to -1 and add helper text explaining the convention

Closes: #61115

* fix(ui): simplify PoolBar unlimited slots computation per review



* fix(ui): rename short identifier in PoolBar filter/reduce



* fix(ui): resolve linting and typing errors caught by prek

- Fix indentation in PoolBar.tsx map callback (formatting)
- Fix JSX line break in PoolBarCard.tsx (formatting)
- Widen slotType cast to TaskInstanceState | "open" since
  open_slots produces "open" which is not a TaskInstanceState
- Add explicit cast for StateIcon prop where "open" is already
  filtered out by infoSlots



---------

Co-authored-by: Antonio Mello <ajgcvm@gmail.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
vatsrahul1001 pushed a commit that referenced this pull request Mar 25, 2026
) (#63872)

* fix(ui): handle pools with unlimited (-1) slots in UI components

When a pool has slots set to -1 (unlimited), the UI now properly
handles this case instead of showing broken bars or negative values.

Changes:
- PoolBar: render infinity symbol and proportional bar for unlimited pools
- PoolBarCard: display ∞ instead of -1 in pool header
- PoolSummary: correctly aggregate slots when any pool is unlimited
- PoolForm: set min to -1 and add helper text explaining the convention

Closes: #61115

* fix(ui): simplify PoolBar unlimited slots computation per review



* fix(ui): rename short identifier in PoolBar filter/reduce



* fix(ui): resolve linting and typing errors caught by prek

- Fix indentation in PoolBar.tsx map callback (formatting)
- Fix JSX line break in PoolBarCard.tsx (formatting)
- Widen slotType cast to TaskInstanceState | "open" since
  open_slots produces "open" which is not a TaskInstanceState
- Add explicit cast for StateIcon prop where "open" is already
  filtered out by infoSlots



---------

Co-authored-by: Antonio Mello <ajgcvm@gmail.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:translations area:UI Related to UI/UX. For Frontend Developers. translation:default

Projects

None yet

Development

Successfully merging this pull request may close these issues.

API - UI Handle pools with "-1" infinity slots.

4 participants