Allow empty groups for reverse proxy sso auth#563
Conversation
📝 WalkthroughWalkthroughThis PR extends PeerGroupSelector's placeholder capability to accept React nodes alongside strings, refines the reverse proxy authentication modal by exposing bearer authentication state, and enhances AuthSSOModal with integrated user data loading and improved group selection handling. Changes
Sequence DiagramsequenceDiagram
participant ReverseProxyModal
participant AuthSSOModal
participant useUsers Hook
participant PeerGroupSelector
participant OnSave Callback
ReverseProxyModal->>AuthSSOModal: Pass isEnabled={bearerEnabled}
AuthSSOModal->>useUsers Hook: Load users data
useUsers Hook-->>AuthSSOModal: Return users list
AuthSSOModal->>PeerGroupSelector: Render with users prop & <br/>Badge + "All Users" placeholder
PeerGroupSelector-->>AuthSSOModal: User selects groups
AuthSSOModal->>AuthSSOModal: Update groups state
AuthSSOModal->>OnSave Callback: Call onSave with selected groups
OnSave Callback-->>AuthSSOModal: Process save
AuthSSOModal->>AuthSSOModal: Close modal
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
src/modules/reverse-proxy/auth/AuthSSOModal.tsx (1)
29-31:isEditingis now a bare alias forisEnabled.Consider inlining
isEnableddirectly at line 71 ({isEditing ? ...}) or keeping the alias only if you expect the editing condition to diverge fromisEnabledin the future. Either way, no functional issue.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/modules/reverse-proxy/auth/AuthSSOModal.tsx` around lines 29 - 31, The isEditing variable is just a direct alias of isEnabled (const isEditing = isEnabled); remove the unnecessary alias or inline isEnabled where isEditing is used (e.g., replace {isEditing ? ...} with {isEnabled ? ...}) — if you prefer to keep an alias for future divergence, add a comment explaining that intent; update references to isEditing in AuthSSOModal to use isEnabled (or keep/annotate isEditing) and remove the redundant declaration to avoid confusion.src/components/PeerGroupSelector.tsx (1)
79-79:stringis already a subtype ofReact.ReactNode.The union
React.ReactNode | stringis redundant sinceReact.ReactNodealready includesstring. That said, it does document the intent that the component handles string vs. non-string differently (line 400), so it's fine to keep if you prefer the explicitness.♻️ Optional: simplify the type
- placeholder?: React.ReactNode | string; + placeholder?: React.ReactNode;🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/components/PeerGroupSelector.tsx` at line 79, The placeholder prop type is redundant: change the declaration "placeholder?: React.ReactNode | string" in the PeerGroupSelector component to "placeholder?: React.ReactNode" to simplify the type; ensure any usage or conditional logic that treats strings specially (the render/path that checks for string vs non-string in PeerGroupSelector) still works with React.ReactNode (no runtime change needed), and update any related JSDoc/comments to reflect the simplified type.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/components/PeerGroupSelector.tsx`:
- Line 79: The placeholder prop type is redundant: change the declaration
"placeholder?: React.ReactNode | string" in the PeerGroupSelector component to
"placeholder?: React.ReactNode" to simplify the type; ensure any usage or
conditional logic that treats strings specially (the render/path that checks for
string vs non-string in PeerGroupSelector) still works with React.ReactNode (no
runtime change needed), and update any related JSDoc/comments to reflect the
simplified type.
In `@src/modules/reverse-proxy/auth/AuthSSOModal.tsx`:
- Around line 29-31: The isEditing variable is just a direct alias of isEnabled
(const isEditing = isEnabled); remove the unnecessary alias or inline isEnabled
where isEditing is used (e.g., replace {isEditing ? ...} with {isEnabled ? ...})
— if you prefer to keep an alias for future divergence, add a comment explaining
that intent; update references to isEditing in AuthSSOModal to use isEnabled (or
keep/annotate isEditing) and remove the redundant declaration to avoid
confusion.
Summary by CodeRabbit
Release Notes