Skip to content

feat: add team selector to virtual server forms - #240

Open
mareksagan wants to merge 3 commits into
contextforge-org:mainfrom
mareksagan:feat/virtual-server-team-selector
Open

mareksagan wants to merge 3 commits into
contextforge-org:mainfrom
mareksagan:feat/virtual-server-team-selector

Conversation

@mareksagan

Copy link
Copy Markdown

Summary

Virtual server forms had no team picker. Team-scoped creates sent team_id: null, so the assignment never reached the API. This adds the picker and threads teamId through the form model.

  • Show a team selector when visibility is team. A single team resolves silently.
  • Pre-select the server's own team on edit and pin it across sessions that start on "All teams".
  • Block submit with an accessible message when team visibility has no resolvable team.
  • Send team_id on create and update payloads for team visibility only.

Validation

  • npm run typecheck, npm run lint, npm run format:check
  • npm run test:coverage: 3521 tests, 3520 passed (1 pre-existing skip); coverage thresholds green
  • npx vite build
  • Playwright (mocked API): 282 passed (2 pre-existing skips)

Virtual server forms had no team picker. Team-scoped creates sent
team_id: null, so the assignment never reached the API.

Show a team selector when visibility is team. A single team resolves
silently. Pre-select the server's own team on edit and pin it across
sessions that start on "All teams". Block submit with an accessible
message when team visibility has no resolvable team. Send team_id on
create and update payloads for team visibility only.

Signed-off-by: Marek Sagan <marek.sagan@protonmail.com>
@mareksagan

Copy link
Copy Markdown
Author

Hi @gcgoncalves @marekdano — ready for review. The workflow runs also wait on first-time-contributor approval; I cannot request reviewers from a fork.

All CI gates pass locally: format:check, lint, typecheck, vite build, test:coverage (thresholds green), and the mocked Playwright suite (282 passed). Happy to adjust anything.

@marekdano marekdano left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@mareksagan - Thanks for your contribution!

The change is well scoped and reuses useTeamScope and TeamSelect.
LGTM 🚀

@gcgoncalves

gcgoncalves commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

I'd like to get @a-effort eyes on the UX here for this selector (I'm not exaclty sure on the CLS here, though the form has to accomodate the extra field).

Screen.Recording.2026-11-13.at.11.30.12.mov

@marekdano
marekdano requested a review from a-effort November 13, 2026 11:34

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Unresolved team-selection defects can retain or submit the wrong team, alongside request-recovery, validation, and accessibility issues.

6 open issues
What changed in this PR

Adds team selection to virtual server forms so team-scoped submissions carry a team assignment through the existing create and update flows.

Changes:

  • Integrates the shared team selector and team-resolution logic into the form.
  • Adds teamId to form state and validates that team visibility has a team.
  • Adds localized validation messages and tests for selection, edit initialization, and blocked submissions.
File Description
src/​pages/​CreateServer.test.tsx Adds authentication context to page tests.
src/​i18n/​locales/​pt-BR/​gateways.json Adds Portuguese team-required validation text.
src/​i18n/​locales/​es-ES/​gateways.json Adds Spanish team-required validation text.
src/​i18n/​locales/​en-US/​gateways.json Adds English team-required validation text.
src/​hooks/​useCreateServerForm.ts Tracks, validates, and returns the selected team.
src/​hooks/​useCreateServerForm.test.tsx Tests team state and validation behavior.
src/​components/​gateways/​CreateServerForm.tsx Connects team resolution and the conditional selector.
src/​components/​gateways/​CreateServerForm.test.tsx Tests team selection, edit preservation, and validation feedback.

Review effort: Balanced

Keep the name field stable while the visibility options toggle the
team selector. Render the selector under the name field instead of
above it so the fields the user is working through do not shift.

Signed-off-by: Marek Sagan <marek.sagan@protonmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants