Files
supabase/apps/studio/state/shortcuts/registry/observability-page.ts
Ali Waseem 42c0cb7171 feat(studio): keyboard shortcuts for observability pages (#46277)
## Summary

Wires Linear-style keyboard shortcuts across all observability pages —
refresh, time picker, filters, and sub-page navigation — with hover
tooltips surfacing each binding.

| Page | Shortcut | Action |
| --- | --- | --- |
| Overview | `Shift+R` | Refresh report |
| Overview | `Shift+P` | Open time picker |
| Query Performance | `Shift+R` | Refresh report |
| Query Performance | `R` then `C` | Reset report
(`pg_stat_statements_reset`) |
| Query Performance | `Shift+F` | Search queries |
| Query Performance | `F` then `C` | Reset filters |
| API Gateway | `Shift+R` | Refresh report |
| API Gateway | `Shift+P` | Open time picker |
| API Gateway | `Shift+F` | Add filter |
| API Gateway | `F` then `C` | Reset filters |
| API Gateway | `Shift+S` | Filter requests by service |
| Database | `Shift+R` | Refresh report |
| Database | `Shift+P` | Open time picker |
| Auth | `Shift+R` | Refresh report |
| Auth | `Shift+P` | Open time picker |
| Data API | `Shift+R` | Refresh report |
| Data API | `Shift+P` | Open time picker |
| Storage | `Shift+R` | Refresh report |
| Storage | `Shift+P` | Open time picker |
| Realtime | `Shift+R` | Refresh report |
| Realtime | `Shift+P` | Open time picker |
| Edge Functions | `Shift+R` | Refresh report |
| Edge Functions | `Shift+P` | Open time picker |
| All observability pages | `U` then `O/Q/G/D/P/A/F/S/L` | Jump to
sub-page |

## Test plan

- [ ] Each shortcut fires on its page; tooltip on hover shows the
binding
- [ ] Picker shortcut toggles the popover open/closed without leaving
the tooltip visible
- [ ] Reset-report on Query Performance opens the confirm modal
- [ ] `Escape` on the query search clears the value, then blurs
- [ ] No "Shift+R already registered" / Tooltip controlled-uncontrolled
warnings in the console

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

* **New Features**
* Keyboard shortcuts to navigate Observability pages and perform common
actions (refresh, toggle date picker/interval, focus search, reset
filters, create reports).
* Shortcut hints shown on relevant buttons and controls; date pickers
and interval dropdowns can be controlled via shortcuts.
* Global shortcut groups/registries added for Observability navigation
and page actions.

<!-- review_stack_entry_start -->

[![Review Change
Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/supabase/supabase/pull/46277?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack)

<!-- review_stack_entry_end -->
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-05-25 07:37:16 -06:00

74 lines
3.1 KiB
TypeScript

import { RegistryDefinations } from '../types'
/**
* Shortcuts scoped to Observability report pages. Reuses the existing
* conventions from logs-preview (Shift+R refresh, Shift+P toggle date picker)
* and list-page (Shift+F focus filter/search, F C reset filters,
* Shift+N create new). Pages bind these via `useShortcut` and pass `label`
* overrides where the surface action is more specific than the generic label.
*/
export const OBSERVABILITY_PAGE_SHORTCUT_IDS = {
OBSERVABILITY_REFRESH: 'observability.refresh',
OBSERVABILITY_TOGGLE_DATE_PICKER: 'observability.toggle-date-picker',
OBSERVABILITY_FOCUS_FILTER: 'observability.focus-filter',
OBSERVABILITY_RESET_FILTERS: 'observability.reset-filters',
OBSERVABILITY_NEW_REPORT: 'observability.new-report',
OBSERVABILITY_RESET_REPORT: 'observability.reset-report',
OBSERVABILITY_FILTER_REQUESTS: 'observability.filter-requests',
}
export type ObservabilityPageShortcutId =
(typeof OBSERVABILITY_PAGE_SHORTCUT_IDS)[keyof typeof OBSERVABILITY_PAGE_SHORTCUT_IDS]
export const observabilityPageRegistry: RegistryDefinations<ObservabilityPageShortcutId> = {
[OBSERVABILITY_PAGE_SHORTCUT_IDS.OBSERVABILITY_REFRESH]: {
id: OBSERVABILITY_PAGE_SHORTCUT_IDS.OBSERVABILITY_REFRESH,
label: 'Refresh report',
sequence: ['Shift+R'],
showInSettings: false,
options: { ignoreInputs: true, registerInCommandMenu: true, conflictBehavior: 'allow' },
},
[OBSERVABILITY_PAGE_SHORTCUT_IDS.OBSERVABILITY_TOGGLE_DATE_PICKER]: {
id: OBSERVABILITY_PAGE_SHORTCUT_IDS.OBSERVABILITY_TOGGLE_DATE_PICKER,
label: 'Open time picker',
sequence: ['Shift+P'],
showInSettings: false,
options: { ignoreInputs: true, registerInCommandMenu: true, conflictBehavior: 'allow' },
},
[OBSERVABILITY_PAGE_SHORTCUT_IDS.OBSERVABILITY_FOCUS_FILTER]: {
id: OBSERVABILITY_PAGE_SHORTCUT_IDS.OBSERVABILITY_FOCUS_FILTER,
label: 'Add filter',
sequence: ['Shift+F'],
showInSettings: false,
options: { registerInCommandMenu: true },
},
[OBSERVABILITY_PAGE_SHORTCUT_IDS.OBSERVABILITY_RESET_FILTERS]: {
id: OBSERVABILITY_PAGE_SHORTCUT_IDS.OBSERVABILITY_RESET_FILTERS,
label: 'Reset filters',
sequence: ['F', 'C'],
showInSettings: false,
options: { ignoreInputs: true, registerInCommandMenu: true },
},
[OBSERVABILITY_PAGE_SHORTCUT_IDS.OBSERVABILITY_NEW_REPORT]: {
id: OBSERVABILITY_PAGE_SHORTCUT_IDS.OBSERVABILITY_NEW_REPORT,
label: 'New custom report',
sequence: ['Shift+N'],
showInSettings: false,
options: { ignoreInputs: true, registerInCommandMenu: true },
},
[OBSERVABILITY_PAGE_SHORTCUT_IDS.OBSERVABILITY_RESET_REPORT]: {
id: OBSERVABILITY_PAGE_SHORTCUT_IDS.OBSERVABILITY_RESET_REPORT,
label: 'Reset report',
sequence: ['R', 'C'],
showInSettings: false,
options: { ignoreInputs: true, registerInCommandMenu: true },
},
[OBSERVABILITY_PAGE_SHORTCUT_IDS.OBSERVABILITY_FILTER_REQUESTS]: {
id: OBSERVABILITY_PAGE_SHORTCUT_IDS.OBSERVABILITY_FILTER_REQUESTS,
label: 'Filter requests',
sequence: ['Shift+S'],
showInSettings: false,
options: { ignoreInputs: true, registerInCommandMenu: true },
},
}