fix: Update root key permissions button labels#3880
Conversation
The change uses a ternary operator to check: 1. First, if the component is busy/loading - shows `LOADING` 2. If not busy, checks if `editMode` is true - shows `EDIT_PERMISSIONS` 3. Otherwise - shows the default `SELECT_PERMISSIONS` This provides a more contextually appropriate button label when users are editing an existing root key versus creating a new one.
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
📝 WalkthroughWalkthroughAdds a new UI message key Changes
Sequence Diagram(s)sequenceDiagram
actor User
participant Dialog as RootKeyDialog
participant Btn as PermissionsButton
User->>Dialog: Open dialog
Note over Dialog: compute state: isBusy, editMode
Dialog->>Btn: Render with label
alt isBusy
Btn-->>User: Show loading / disabled
else not busy
alt editMode == true
Btn-->>User: "Edit Permissions"
else
Btn-->>User: "Select Permissions"
end
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Assessment against linked issues
Assessment against linked issues: Out-of-scope changes
Suggested labels
Suggested reviewers
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. 📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: ASSERTIVE Plan: Pro 💡 Knowledge Base configuration:
You can enable these sources in your CodeRabbit configuration. 📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (3)**/*.{js,jsx,ts,tsx}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
**/*.{ts,tsx}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
**/*.{env,js,ts,go}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
🧠 Learnings (1)📓 Common learnings⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
🔇 Additional comments (1)
✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
|
Thank you for following the naming conventions for pull request titles! 🙏 |
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
apps/dashboard/app/(app)/settings/root-keys/components/root-key/root-key-dialog.tsx (1)
90-93: Don’t block clearing all permissions in edit modeDisabling the primary action when selectedPermissions.length is 0 prevents users from removing all permissions on an existing key. Require at least one permission only for create flows.
Apply:
- disabled={!hasChanges || isMutating || !selectedPermissions.length} + disabled={ + !hasChanges || + isMutating || + (!editMode && selectedPermissions.length === 0) + }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
apps/dashboard/app/(app)/settings/root-keys/components/root-key/constants.ts(1 hunks)apps/dashboard/app/(app)/settings/root-keys/components/root-key/root-key-dialog.tsx(1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{js,jsx,ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.{js,jsx,ts,tsx}: Use Biome for formatting and linting in TypeScript/JavaScript projects
Prefer named exports over default exports in TypeScript/JavaScript, except for Next.js pages
Files:
apps/dashboard/app/(app)/settings/root-keys/components/root-key/root-key-dialog.tsxapps/dashboard/app/(app)/settings/root-keys/components/root-key/constants.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.{ts,tsx}: Follow strict TypeScript configuration
Use Zod for runtime validation in TypeScript projects
Files:
apps/dashboard/app/(app)/settings/root-keys/components/root-key/root-key-dialog.tsxapps/dashboard/app/(app)/settings/root-keys/components/root-key/constants.ts
**/*.{env,js,ts,go}
📄 CodeRabbit inference engine (CLAUDE.md)
All environment variables must follow the format: UNKEY_<SERVICE_NAME>_VARNAME
Files:
apps/dashboard/app/(app)/settings/root-keys/components/root-key/constants.ts
🧠 Learnings (1)
📓 Common learnings
Learnt from: MichaelUnkey
PR: unkeyed/unkey#3173
File: apps/docs/security/delete-protection.mdx:32-36
Timestamp: 2025-04-22T17:33:28.162Z
Learning: In the Unkey dashboard UI for delete protection, the button/link to initiate the process is labeled "Disable Delete Protection" while the confirmation button is labeled "Disable API Delete Protection". The documentation should maintain these different labels to match the actual UI.
Learnt from: MichaelUnkey
PR: unkeyed/unkey#3173
File: apps/docs/security/delete-protection.mdx:21-24
Timestamp: 2025-04-22T17:34:04.438Z
Learning: In the Unkey dashboard UI for enabling delete protection, the button/link to initiate the process is labeled "Enable Delete Protection" while the confirmation button is labeled "Enable API Delete Protection". The documentation should maintain these different labels to match the actual UI.
🧬 Code graph analysis (1)
apps/dashboard/app/(app)/settings/root-keys/components/root-key/root-key-dialog.tsx (1)
apps/dashboard/app/(app)/settings/root-keys/components/root-key/constants.ts (1)
ROOT_KEY_MESSAGES(9-63)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: Test API / API Test Local
- GitHub Check: Build / Build
- GitHub Check: Test Go API Local / Test
- GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (1)
apps/dashboard/app/(app)/settings/root-keys/components/root-key/constants.ts (1)
31-35: Confirm documentation for root-key permissions labels
No occurrences of “Select Permissions…” or “Edit Permissions” were found under apps/docs. Verify whether any related docs or screenshots require updating to match the UI labels.
apps/dashboard/app/(app)/settings/root-keys/components/root-key/constants.ts
Show resolved
Hide resolved
apps/dashboard/app/(app)/settings/root-keys/components/root-key/root-key-dialog.tsx
Show resolved
Hide resolved
…y/constants.ts Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
What does this PR do?
The change uses a ternary operator to check:
LOADINGeditModeis true - showsEDIT_PERMISSIONSSELECT_PERMISSIONSThis provides a more contextually appropriate button label when users are editing an existing root key versus creating a new one.
Fixes #3823
Type of change
How should this be tested?
Checklist
Required
pnpm buildpnpm fmtconsole.logsgit pull origin mainAppreciated
Summary by CodeRabbit