refactor: replace TeamDialog with TeamSheet and improve teams table layout - #3757
Conversation
|
Warning Review limit reached
More reviews will be available in 3 minutes and 43 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThis PR refactors the team management interface by migrating from a Dialog-based modal to a Sheet-based side panel. It introduces loading state propagation from query hooks through the component hierarchy, replaces the shared FormFooter with inline sticky action controls, and redesigns the pagination UI with updated button styling and accessibility attributes. ChangesTeams Sheet Redesign and Loading State
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
88d07d4 to
200db11
Compare
200db11 to
d94a2e4
Compare
92fb78c to
181c2ae
Compare
d94a2e4 to
cbad6b0
Compare
181c2ae to
1f01017
Compare
TeamDialog with TeamSheet and improve teams table layout
cbad6b0 to
6da4fd4
Compare
1f01017 to
72c07b4
Compare
Confidence Score: 5/5Safe to merge — purely a UI refactor with no changes to data-fetching logic, auth, or backend contracts. All three changed files are UI-only. The Dialog → Sheet swap is self-contained, the isLoading guard prevents a known premature empty-state flash, and the layout changes are confined to flex/grow utilities. The SheetContent's custom-scrollbar utility supplies overflow:auto so sticky header and footer positioning work correctly. No files require special attention. Important Files Changed
Reviews (5): Last reviewed commit: "chore: moved team creation from popup to..." | Re-trigger Greptile |
24f0262 to
0ed3e1e
Compare
f6486ca to
051f5c7
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
ui/app/workspace/governance/views/teamSheet.tsx (1)
225-287: 🛠️ Refactor suggestion | 🟠 Major | 🏗️ Heavy liftAdd a Zod schema as the source-of-truth for TeamSheet form validation
ui/app/workspace/governance/views/teamSheet.tsxbuilds validation via the customValidator(useMemo) and blocks submit withvalidator.isValid()/toast.error(...)(lines ~225-287, ~296-303), with no Zod schema (nozod/Zod/zodResolverimports/usages) present for this form. Introduce a Zod schema for this form’s validation contract (including the cross-row uniqueresetDurationrule and the token/request rate-limit rules) and use it as the single source of truth forhandleSubmit.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@ui/app/workspace/governance/views/teamSheet.tsx` around lines 225 - 287, Replace the ad-hoc Validator logic in the useMemo (validator) with a Zod schema that becomes the single source-of-truth for TeamSheet form validation: import zod, define a schema that mirrors formData (name, budgets array with maxLimit and resetDuration, tokenMaxLimit/tokenResetDuration, requestMaxLimit/requestResetDuration), add refinements for per-budget min values and a .superRefine or refine to enforce cross-row uniqueness of resetDuration among budgets with maxLimit present, and add conditional refinements so tokenResetDuration is required when tokenMaxLimit is set (and similarly for requestResetDuration/requestMaxLimit) and enforce minLimit >= 1 for token/request limits; then wire schema validation into handleSubmit (use zod.safeParse or a zodResolver if using react-hook-form) to block submit and surface errors instead of calling validator.isValid(), and remove or deprecate the existing Validator usage (function names to locate: validator, formData, useMemo block, tokenMaxLimitNum, requestMaxLimitNum, handleSubmit).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@ui/app/workspace/governance/views/teamSheet.tsx`:
- Around line 756-763: The Cancel footer Button in teamSheet.tsx is missing a
stable data-testid which breaks E2E tests; update the Button JSX (the Cancel
action using props onCancel and disabled={loading}) to include a consistent
data-testid attribute (e.g., data-testid="team-sheet-cancel-button") so test
harnesses can reliably select it; ensure the attribute is added to the same
Button element that renders the Cancel action and matches the naming convention
used elsewhere in this form.
---
Outside diff comments:
In `@ui/app/workspace/governance/views/teamSheet.tsx`:
- Around line 225-287: Replace the ad-hoc Validator logic in the useMemo
(validator) with a Zod schema that becomes the single source-of-truth for
TeamSheet form validation: import zod, define a schema that mirrors formData
(name, budgets array with maxLimit and resetDuration,
tokenMaxLimit/tokenResetDuration, requestMaxLimit/requestResetDuration), add
refinements for per-budget min values and a .superRefine or refine to enforce
cross-row uniqueness of resetDuration among budgets with maxLimit present, and
add conditional refinements so tokenResetDuration is required when tokenMaxLimit
is set (and similarly for requestResetDuration/requestMaxLimit) and enforce
minLimit >= 1 for token/request limits; then wire schema validation into
handleSubmit (use zod.safeParse or a zodResolver if using react-hook-form) to
block submit and surface errors instead of calling validator.isValid(), and
remove or deprecate the existing Validator usage (function names to locate:
validator, formData, useMemo block, tokenMaxLimitNum, requestMaxLimitNum,
handleSubmit).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 8ec2001c-86a9-432e-bf8f-dbc2b05b7035
📒 Files selected for processing (3)
ui/app/_fallbacks/enterprise/components/user-groups/teamsView.tsxui/app/workspace/governance/views/teamSheet.tsxui/app/workspace/governance/views/teamsTable.tsx
0ed3e1e to
bc81d85
Compare
051f5c7 to
7703dab
Compare
bc81d85 to
f91817e
Compare
7703dab to
2ace481
Compare
Merge activity
|
…le layout (#3757) ## Summary Replaces the team create/edit `Dialog` with a `Sheet` (slide-over panel) to provide a more spacious, scrollable editing experience. Also improves the teams table layout to fill the viewport height and updates the pagination controls to a more compact style. ## Changes - Renamed `teamDialog.tsx` → `teamSheet.tsx` and replaced the `Dialog` component with a `Sheet`, giving the form a full-height side panel with a sticky header and sticky footer action bar. - Replaced the generic `FormFooter` component with inline `Cancel` and `Submit` buttons inside the sheet footer, adding a `Tooltip` to surface validation errors and permission warnings directly on the disabled submit button. - Added `isFetching` from `useGetTeamsQuery` and passed it down as `isLoading` to `TeamsTable`, preventing a premature empty state render while data is still loading. - Updated the outer container in `TeamsView` to use `h-[calc(100vh_-_50px)] flex flex-col overflow-y-auto` so the table fills the available viewport height. - Made the teams table layout flex/grow so the table body expands to fill available space, with a sticky `TableHeader` and a `grow` table container. - Reworked pagination into a compact style using ghost icon-only prev/next buttons and a "Page X of Y" indicator with localized entry counts. ## Type of change - [ ] Bug fix - [ ] Feature - [x] Refactor - [ ] Documentation - [ ] Chore/CI ## Affected areas - [ ] Core (Go) - [ ] Transports (HTTP) - [ ] Providers/Integrations - [ ] Plugins - [x] UI (React) - [ ] Docs ## How to test ```sh cd ui pnpm i || npm i pnpm build || npm run build ``` 1. Navigate to the Governance → Teams page. 2. Verify the teams table fills the viewport height with a sticky header and compact pagination footer. 3. Click **Create Team** — confirm a sheet slides in from the right instead of a modal dialog. 4. Attempt to submit with invalid data — confirm the tooltip on the disabled submit button shows the relevant validation error. 5. Click outside the sheet — confirm it does not close (interaction outside is prevented). 6. Press Escape or click Cancel — confirm the sheet closes correctly. 7. Edit an existing team and save — confirm the sheet closes and the table refreshes. ## Screenshots/Recordings Before/after screenshots recommended showing the dialog → sheet transition and the updated table layout. ## Breaking changes - [x] No ## Related issues ## Security considerations None. ## Checklist - [ ] I read `docs/contributing/README.md` and followed the guidelines - [ ] I added/updated tests where appropriate - [ ] I updated documentation where needed - [ ] I verified builds succeed (Go and UI) - [ ] I verified the CI pipeline passes locally if applicable

Summary
Replaces the team create/edit
Dialogwith aSheet(slide-over panel) to provide a more spacious, scrollable editing experience. Also improves the teams table layout to fill the viewport height and updates the pagination controls to a more compact style.Changes
teamDialog.tsx→teamSheet.tsxand replaced theDialogcomponent with aSheet, giving the form a full-height side panel with a sticky header and sticky footer action bar.FormFootercomponent with inlineCancelandSubmitbuttons inside the sheet footer, adding aTooltipto surface validation errors and permission warnings directly on the disabled submit button.isFetchingfromuseGetTeamsQueryand passed it down asisLoadingtoTeamsTable, preventing a premature empty state render while data is still loading.TeamsViewto useh-[calc(100vh_-_50px)] flex flex-col overflow-y-autoso the table fills the available viewport height.TableHeaderand agrowtable container.Type of change
Affected areas
How to test
Screenshots/Recordings
Before/after screenshots recommended showing the dialog → sheet transition and the updated table layout.
Breaking changes
Related issues
Security considerations
None.
Checklist
docs/contributing/README.mdand followed the guidelines