-
Notifications
You must be signed in to change notification settings - Fork 593
Open
Description
Add the ability to manage identity-level ratelimits through the context menu, applying full replacement model and affecting all keys for that identity.
Acceptance Criteria
Context Menu Update
- New menu item added to existing context menu:
- Edit ratelimits... (with gauge icon)
- Positioned after "Edit metadata..."
- Menu item opens ratelimits dialog
Edit Ratelimits Feature
- Dialog opens showing current ratelimits as form fields
- Each ratelimit displays:
- Name (text input, required)
- Limit (number input, min 1, required)
- Duration (number input in milliseconds, min 1000, required)
- Auto-apply (checkbox)
- Delete button (trash icon)
- "Add Ratelimit" button to add new ratelimit entry
- Delete button removes ratelimit from form (hidden if only 1 exists)
- Warning banner: "
⚠️ These limits apply to ALL keys for this identity" - Inline validation for each field:
- Name cannot be empty
- Limit must be positive integer
- Duration must be >= 1000ms
- Name must be unique (no duplicates)
- Validation error messages appear under invalid fields
- Submit button labeled "Update Ratelimits"
- Submit button disabled until all fields valid
- Success toast: "Ratelimits updated successfully"
- Error toast with user-friendly messages
- Optimistic UI update (ratelimit count in table)
- Cancel button closes without saving
- Ability to remove all ratelimits by deleting all entries
- Loading state during save
Technical Notes
- Adapt
RatelimitSetupcomponent fromapps/dashboard/app/(app)/[workspaceSlug]/apis/[apiId]/_components/create-key/components/ratelimit-setup.tsx - Create wrapper component for identity context
- Create
trpc.identity.updateRatelimitsmutation - Full replacement model - send complete ratelimits array
Metadata
Metadata
Assignees
Labels
No labels