mirror of
https://github.com/supabase/supabase.git
synced 2026-06-14 05:06:27 +08:00
## 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 --> [](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 -->
139 lines
3.6 KiB
TypeScript
139 lines
3.6 KiB
TypeScript
import { IS_PLATFORM } from '@/lib/constants'
|
|
import { SHORTCUT_IDS, type ShortcutId } from '@/state/shortcuts/registry'
|
|
|
|
interface ObservabilityMenuItem {
|
|
name: string
|
|
key: string
|
|
url: string
|
|
shortcutId?: ShortcutId
|
|
}
|
|
|
|
export interface ObservabilityMenuSection {
|
|
title: string
|
|
key: string
|
|
items: ObservabilityMenuItem[]
|
|
}
|
|
|
|
interface GenerateObservabilityMenuOptions {
|
|
ref: string | undefined
|
|
preservedQueryParams: string
|
|
showOverview: boolean
|
|
isSupamonitorEnabled: boolean
|
|
storageSupported: boolean
|
|
isPlatform?: boolean
|
|
}
|
|
|
|
export function generateObservabilityMenuItems(
|
|
options: GenerateObservabilityMenuOptions
|
|
): ObservabilityMenuSection[] {
|
|
const {
|
|
ref,
|
|
preservedQueryParams,
|
|
showOverview,
|
|
isSupamonitorEnabled,
|
|
storageSupported,
|
|
isPlatform = IS_PLATFORM,
|
|
} = options
|
|
|
|
const generalItems: ObservabilityMenuItem[] = [
|
|
...(showOverview
|
|
? [
|
|
{
|
|
name: 'Overview',
|
|
key: 'observability',
|
|
url: `/project/${ref}/observability${preservedQueryParams}`,
|
|
shortcutId: SHORTCUT_IDS.NAV_OBSERVABILITY_OVERVIEW,
|
|
},
|
|
]
|
|
: []),
|
|
...(isSupamonitorEnabled
|
|
? [
|
|
{
|
|
name: 'Query Insights',
|
|
key: 'query-insights',
|
|
url: `/project/${ref}/observability/query-insights${preservedQueryParams}`,
|
|
shortcutId: SHORTCUT_IDS.NAV_OBSERVABILITY_QUERY_PERFORMANCE,
|
|
},
|
|
]
|
|
: [
|
|
{
|
|
name: 'Query Performance',
|
|
key: 'query-performance',
|
|
url: `/project/${ref}/observability/query-performance${preservedQueryParams}`,
|
|
shortcutId: SHORTCUT_IDS.NAV_OBSERVABILITY_QUERY_PERFORMANCE,
|
|
},
|
|
]),
|
|
...(isPlatform
|
|
? [
|
|
{
|
|
name: 'API Gateway',
|
|
key: 'api-overview',
|
|
url: `/project/${ref}/observability/api-overview${preservedQueryParams}`,
|
|
shortcutId: SHORTCUT_IDS.NAV_OBSERVABILITY_API_GATEWAY,
|
|
},
|
|
]
|
|
: []),
|
|
]
|
|
|
|
const productItems: ObservabilityMenuItem[] = [
|
|
{
|
|
name: 'Database',
|
|
key: 'database',
|
|
url: `/project/${ref}/observability/database${preservedQueryParams}`,
|
|
shortcutId: SHORTCUT_IDS.NAV_OBSERVABILITY_DATABASE,
|
|
},
|
|
{
|
|
name: 'Data API',
|
|
key: 'postgrest',
|
|
url: `/project/${ref}/observability/postgrest${preservedQueryParams}`,
|
|
shortcutId: SHORTCUT_IDS.NAV_OBSERVABILITY_DATA_API,
|
|
},
|
|
{
|
|
name: 'Auth',
|
|
key: 'auth',
|
|
url: `/project/${ref}/observability/auth${preservedQueryParams}`,
|
|
shortcutId: SHORTCUT_IDS.NAV_OBSERVABILITY_AUTH,
|
|
},
|
|
{
|
|
name: 'Edge Functions',
|
|
key: 'edge-functions',
|
|
url: `/project/${ref}/observability/edge-functions${preservedQueryParams}`,
|
|
shortcutId: SHORTCUT_IDS.NAV_OBSERVABILITY_FUNCTIONS,
|
|
},
|
|
...(storageSupported
|
|
? [
|
|
{
|
|
name: 'Storage',
|
|
key: 'storage',
|
|
url: `/project/${ref}/observability/storage${preservedQueryParams}`,
|
|
shortcutId: SHORTCUT_IDS.NAV_OBSERVABILITY_STORAGE,
|
|
},
|
|
]
|
|
: []),
|
|
{
|
|
name: 'Realtime',
|
|
key: 'realtime',
|
|
url: `/project/${ref}/observability/realtime${preservedQueryParams}`,
|
|
shortcutId: SHORTCUT_IDS.NAV_OBSERVABILITY_REALTIME,
|
|
},
|
|
]
|
|
|
|
const sections: ObservabilityMenuSection[] = [
|
|
{
|
|
title: 'GENERAL',
|
|
key: 'general-section',
|
|
items: generalItems,
|
|
},
|
|
]
|
|
|
|
if (isPlatform) {
|
|
sections.push({
|
|
title: 'PRODUCT',
|
|
key: 'product-section',
|
|
items: productItems,
|
|
})
|
|
}
|
|
|
|
return sections
|
|
}
|