Files
Joshen Lim ad37074869 Clean up JWT keys page (#51745)
## Context

Initial feedback was mainly that the "Previously used keys" table was
scrollable while the top table wasn't which was a bit inconsistent UX,
so this PR addresses that but also makes a couple of UI adjustments to
the JWT keys page to tidy things up

### Before
<img width="1142" height="912" alt="image"
src="https://github.com/user-attachments/assets/ca5f8bc6-8b73-4d96-9055-24a39544fc06"
/>

### After
- Removed color indicators + badges on the key's status and ID - reckon
these are unnecessary signals and plain texts work fine. Opted for
`text-foreground-lighter` for keys which status isn't `in_use`, mainly
to highlight the current key which is the most important imo
- Removed icons for status and type, also reckon unnecessary as they
don't really communicate the context much quicker than their texts
- Removed "Legacy" prefix on the type column (e.g for HS256) - reckon
unnecessary, we don't label this as legacy either in the create standby
key dialog, doesn't really communicate any implications
- Standardized widths of status, key id, type, and last used columns -
these values are fixed and won't deviate, so fixing the widths will
allow a more uniform layout across the 3 tables
- Prioritise order of "current" key above "standby" key
- Use ButtonTooltip + default variant for the "More actions" CTA, also
removed the "Actions" header text
- "Last rotated at" column only shows up on `xl` viewport breakpoint
rather than `lg`
- Remove a number of unnecessary class names that were applied on the
`Table` components

<img width="1145" height="909" alt="image"
src="https://github.com/user-attachments/assets/af596931-a126-4883-999b-829a9c9359fc"
/>
2026-10-15 10:44:50 +08:00

40 lines
1.9 KiB
TypeScript

import { JwtSecretUpdateError, JwtSecretUpdateProgress } from '@supabase/shared-types/out/events'
import { JWTSigningKey } from '@/data/jwt-signing-keys/jwt-signing-keys-query'
export const statusLabels: Record<JWTSigningKey['status'], string> = {
in_use: 'Current',
standby: 'Standby',
previously_used: 'Previous',
revoked: 'Revoked',
}
export const statusColors: Record<JWTSigningKey['status'], string> = {
standby: 'bg-surface-300 text-foreground border border-foreground-muted',
in_use: 'bg-brand-200 text-brand-600 border-brand-500',
previously_used: 'bg-warning-200 text-warning-600 border-warning-500',
revoked: 'bg-destructive-200 text-destructive-600 border-destructive-500',
}
export const JWT_SECRET_UPDATE_ERROR_MESSAGES = {
[JwtSecretUpdateError.APIServicesConfigurationUpdateFailed]:
'failed to update configuration for API services',
[JwtSecretUpdateError.APIServicesRestartFailed]: 'failed to restart API services',
[JwtSecretUpdateError.DatabaseAdminAPIConfigurationUpdateFailed]:
'failed to update configuration for database admin API',
[JwtSecretUpdateError.PostgreSQLRestartFailed]: 'failed to restart PostgreSQL service',
[JwtSecretUpdateError.SupabaseAPIKeyUpdateFailed]: 'failed to update Supabase API key',
[JwtSecretUpdateError.APIGatewayUpdateFailed]: 'failed to update API Gateway',
}
export const JWT_SECRET_UPDATE_PROGRESS_MESSAGES = {
[JwtSecretUpdateProgress.RestartedAPIServices]: 'restarted API services',
[JwtSecretUpdateProgress.RestartedPostgreSQL]: 'restarted PostgreSQL service',
[JwtSecretUpdateProgress.Started]: 'started updating',
[JwtSecretUpdateProgress.UpdatedAPIServicesConfiguration]:
'updated configuration for API services',
[JwtSecretUpdateProgress.UpdatedDatabaseAdminAPIConfiguration]:
'updated configuration for database admin API',
[JwtSecretUpdateProgress.UpdatedAPIGatewayConfiguration]: 'updated configuration for API Gateway',
}