Files
supabase/apps/studio/state/shortcuts/referenceGroups.ts
Ali Waseem 2cb7f0c078 feat(studio): add keyboard shortcuts for unified logs (#46680)
Adds the final set of keyboard shortcuts to the Unified Logs page and
converts the last hardcoded `keydown` listener (detail-panel prev/next)
to the shared shortcut registry. Each action also surfaces its keybind
in a registry-driven tooltip.

Closes FE-3415.

## Shortcuts

| Action | Shortcut | Notes |
| --- | --- | --- |
| Refresh logs | `Shift+R` | new |
| Download logs | `Shift+E` | new — opens export dropdown |
| Focus filter bar | `Shift+F` | new |
| Clear filters | `F` then `C` | new |
| Copy selected as JSON | `Mod+Shift+J` | new — reuses
`results.copy-json` |
| Copy selected as Markdown | `Mod+Shift+M` | new — reuses
`results.copy-markdown` |
| Previous / next log (detail panel) | `↑` / `↓` | converted from
hardcoded listener |
| Close details panel | `Escape` | new |

Existing shared `data-table.*` shortcuts kept as-is: toggle sidebar
(`Mod+B`), live mode (`Mod+J`), reset filters (`Mod+Esc`), reset columns
(`Mod+U`), reset focus (`Mod+.`).

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Added keyboard shortcuts for Unified Logs: copy selected rows as
JSON/Markdown, navigate rows, refresh, clear/reset filters, download,
and focus filter — shortcuts show in the command menu and display
badges/hints in menus and buttons.
* **Refactor**
* Shortcut handling unified across log controls; shortcuts
enable/disable based on context and a new "Logs" group appears in the
shortcut reference.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-06-05 09:21:20 -06:00

96 lines
3.8 KiB
TypeScript

export const SHORTCUT_REFERENCE_GROUPS = {
GLOBAL_ACTIONS: 'global.actions',
NAVIGATION_GLOBAL: 'navigation.global',
NAVIGATION_ORG_SETTINGS: 'navigation.org-settings',
ORG_PROJECTS: 'org.projects',
ORG_TEAM: 'org.team',
ORG_INTEGRATIONS: 'org.integrations',
ORG_OAUTH_APPS: 'org.oauth-apps',
ORG_PRIVATE_APPS: 'org.private-apps',
ORG_AUDIT_LOGS: 'org.audit-logs',
NAVIGATION_DATABASE: 'navigation.database',
NAVIGATION_AUTH: 'navigation.auth',
NAVIGATION_STORAGE: 'navigation.storage',
NAVIGATION_FUNCTIONS: 'navigation.functions',
NAVIGATION_FUNCTION_DETAIL: 'navigation.function-detail',
NAVIGATION_REALTIME: 'navigation.realtime',
NAVIGATION_OBSERVABILITY: 'navigation.observability',
NAVIGATION_ADVISORS: 'navigation.advisors',
NAVIGATION_PROJECT_SETTINGS: 'navigation.project-settings',
NAVIGATION_INTEGRATIONS_DETAIL: 'navigation.integrations-detail',
UNIFIED_LOGS: 'unified-logs',
} as const
export const SHORTCUT_REFERENCE_GROUP_LABELS: Record<string, string> = {
[SHORTCUT_REFERENCE_GROUPS.GLOBAL_ACTIONS]: 'Global Actions',
[SHORTCUT_REFERENCE_GROUPS.NAVIGATION_GLOBAL]: 'Global Navigation',
[SHORTCUT_REFERENCE_GROUPS.NAVIGATION_ORG_SETTINGS]: 'Org Settings Navigation',
[SHORTCUT_REFERENCE_GROUPS.ORG_PROJECTS]: 'Projects',
[SHORTCUT_REFERENCE_GROUPS.ORG_TEAM]: 'Team',
[SHORTCUT_REFERENCE_GROUPS.ORG_INTEGRATIONS]: 'Integrations',
[SHORTCUT_REFERENCE_GROUPS.ORG_OAUTH_APPS]: 'OAuth Apps',
[SHORTCUT_REFERENCE_GROUPS.ORG_PRIVATE_APPS]: 'Private Apps',
[SHORTCUT_REFERENCE_GROUPS.ORG_AUDIT_LOGS]: 'Audit Logs',
[SHORTCUT_REFERENCE_GROUPS.NAVIGATION_DATABASE]: 'Database Navigation',
[SHORTCUT_REFERENCE_GROUPS.NAVIGATION_AUTH]: 'Auth Navigation',
[SHORTCUT_REFERENCE_GROUPS.NAVIGATION_STORAGE]: 'Storage Navigation',
[SHORTCUT_REFERENCE_GROUPS.NAVIGATION_FUNCTIONS]: 'Edge Functions Navigation',
[SHORTCUT_REFERENCE_GROUPS.NAVIGATION_FUNCTION_DETAIL]: 'Edge Function Tabs',
[SHORTCUT_REFERENCE_GROUPS.NAVIGATION_REALTIME]: 'Realtime Navigation',
[SHORTCUT_REFERENCE_GROUPS.NAVIGATION_OBSERVABILITY]: 'Observability Navigation',
[SHORTCUT_REFERENCE_GROUPS.NAVIGATION_ADVISORS]: 'Advisors Navigation',
[SHORTCUT_REFERENCE_GROUPS.NAVIGATION_PROJECT_SETTINGS]: 'Project Settings Navigation',
[SHORTCUT_REFERENCE_GROUPS.NAVIGATION_INTEGRATIONS_DETAIL]: 'Integration Tabs',
[SHORTCUT_REFERENCE_GROUPS.UNIFIED_LOGS]: 'Logs',
}
export const SHORTCUT_REFERENCE_GROUP_ORDER = [
'command-menu',
'shortcuts',
SHORTCUT_REFERENCE_GROUPS.GLOBAL_ACTIONS,
SHORTCUT_REFERENCE_GROUPS.NAVIGATION_GLOBAL,
SHORTCUT_REFERENCE_GROUPS.NAVIGATION_ORG_SETTINGS,
SHORTCUT_REFERENCE_GROUPS.ORG_PROJECTS,
SHORTCUT_REFERENCE_GROUPS.ORG_TEAM,
SHORTCUT_REFERENCE_GROUPS.ORG_INTEGRATIONS,
SHORTCUT_REFERENCE_GROUPS.ORG_OAUTH_APPS,
SHORTCUT_REFERENCE_GROUPS.ORG_PRIVATE_APPS,
SHORTCUT_REFERENCE_GROUPS.ORG_AUDIT_LOGS,
SHORTCUT_REFERENCE_GROUPS.NAVIGATION_DATABASE,
SHORTCUT_REFERENCE_GROUPS.NAVIGATION_AUTH,
'auth-users',
SHORTCUT_REFERENCE_GROUPS.NAVIGATION_STORAGE,
'storage-buckets',
'storage-explorer',
SHORTCUT_REFERENCE_GROUPS.NAVIGATION_FUNCTIONS,
'functions-list',
SHORTCUT_REFERENCE_GROUPS.NAVIGATION_FUNCTION_DETAIL,
'functions-detail',
'functions-overview',
SHORTCUT_REFERENCE_GROUPS.NAVIGATION_REALTIME,
'realtime-inspector',
SHORTCUT_REFERENCE_GROUPS.NAVIGATION_OBSERVABILITY,
'observability-page',
SHORTCUT_REFERENCE_GROUPS.NAVIGATION_ADVISORS,
'advisors-page',
SHORTCUT_REFERENCE_GROUPS.NAVIGATION_PROJECT_SETTINGS,
'api-keys',
'jwt-keys',
'log-drains',
SHORTCUT_REFERENCE_GROUPS.NAVIGATION_INTEGRATIONS_DETAIL,
'logs-preview',
'nav',
'ai-assistant',
'inline-editor',
'sql-editor',
'results',
'data-table',
'table-editor',
'schema-visualizer',
'list-page',
'platform-webhooks',
'action-bar',
'operation-queue',
'unified-logs',
]