@@ -7,40 +7,31 @@ import { Badge, Button, Combobox, type ComboboxOption, Skeleton } from '@/compon
77import { Input } from '@/components/ui'
88import { cn } from '@/lib/core/utils/cn'
99import { formatDateTime } from '@/lib/core/utils/formatting'
10+ import { AuditResourceType } from '@/lib/audit/log'
1011import type { EnterpriseAuditLogEntry } from '@/app/api/v1/audit-logs/format'
1112import { type AuditLogFilters , useAuditLogs } from '@/ee/audit-logs/hooks/audit-logs'
1213
1314const logger = createLogger ( 'AuditLogs' )
1415
16+ const ACRONYMS = new Set ( [ 'API' , 'BYOK' , 'MCP' , 'OAuth' ] )
17+
18+ function formatResourceLabel ( key : string ) : string {
19+ const words = key . split ( '_' )
20+ return words
21+ . map ( ( w ) => {
22+ const upper = w . toUpperCase ( )
23+ if ( ACRONYMS . has ( upper ) ) return upper
24+ return w . charAt ( 0 ) . toUpperCase ( ) + w . slice ( 1 ) . toLowerCase ( )
25+ } )
26+ . join ( ' ' )
27+ . replace ( 'OAUTH' , 'OAuth' )
28+ }
29+
1530const RESOURCE_TYPE_OPTIONS : ComboboxOption [ ] = [
1631 { label : 'All Types' , value : '' } ,
17- { label : 'API Key' , value : 'api_key' } ,
18- { label : 'Billing' , value : 'billing' } ,
19- { label : 'BYOK Key' , value : 'byok_key' } ,
20- { label : 'Chat' , value : 'chat' } ,
21- { label : 'Connector' , value : 'connector' } ,
22- { label : 'Credential' , value : 'credential' } ,
23- { label : 'Credential Set' , value : 'credential_set' } ,
24- { label : 'Custom Tool' , value : 'custom_tool' } ,
25- { label : 'Document' , value : 'document' } ,
26- { label : 'Environment' , value : 'environment' } ,
27- { label : 'File' , value : 'file' } ,
28- { label : 'Folder' , value : 'folder' } ,
29- { label : 'Form' , value : 'form' } ,
30- { label : 'Knowledge Base' , value : 'knowledge_base' } ,
31- { label : 'MCP Server' , value : 'mcp_server' } ,
32- { label : 'Notification' , value : 'notification' } ,
33- { label : 'OAuth' , value : 'oauth' } ,
34- { label : 'Organization' , value : 'organization' } ,
35- { label : 'Password' , value : 'password' } ,
36- { label : 'Permission Group' , value : 'permission_group' } ,
37- { label : 'Schedule' , value : 'schedule' } ,
38- { label : 'Skill' , value : 'skill' } ,
39- { label : 'Table' , value : 'table' } ,
40- { label : 'Template' , value : 'template' } ,
41- { label : 'Webhook' , value : 'webhook' } ,
42- { label : 'Workflow' , value : 'workflow' } ,
43- { label : 'Workspace' , value : 'workspace' } ,
32+ ...( Object . entries ( AuditResourceType ) as [ string , string ] [ ] )
33+ . map ( ( [ key , value ] ) => ( { label : formatResourceLabel ( key ) , value } ) )
34+ . sort ( ( a , b ) => a . label . localeCompare ( b . label ) ) ,
4435]
4536
4637const DATE_RANGE_OPTIONS : ComboboxOption [ ] = [
0 commit comments