Repository navigation
feat: add team selector to virtual server forms - #240
mareksagan wants to merge 3 commits into
Conversation
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>
|
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: |
marekdano
left a comment
There was a problem hiding this comment.
@mareksagan - Thanks for your contribution!
The change is well scoped and reuses useTeamScope and TeamSelect.
LGTM 🚀
|
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 |
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved team-selection defects can retain or submit the wrong team, alongside request-recovery, validation, and accessibility issues.
6 open issues
Preserve explicit team choices separately from create draft values · New Allow choosing an available team when the saved team is missing · New Clear team selection errors when a team resolves automatically · New Ignore stale sidebar team selections after the team list loads · New Show team request failures and allow retry · New Announce team selection errors when no selector is shown · New
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
teamIdto 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>


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 threadsteamIdthrough the form model.team. A single team resolves silently.team_idon create and update payloads for team visibility only.Validation
npm run typecheck,npm run lint,npm run format:checknpm run test:coverage: 3521 tests, 3520 passed (1 pre-existing skip); coverage thresholds greennpx vite build