mirror of
https://github.com/supabase/supabase.git
synced 2026-06-10 21:41:25 +08:00
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 -->
27 lines
810 B
TypeScript
27 lines
810 B
TypeScript
import { X } from 'lucide-react'
|
|
import { Button } from 'ui'
|
|
|
|
import { useDataTable } from './providers/DataTableProvider'
|
|
import { ShortcutTooltip } from '@/components/ui/ShortcutTooltip'
|
|
import { SHORTCUT_IDS } from '@/state/shortcuts/registry'
|
|
import { useShortcut } from '@/state/shortcuts/useShortcut'
|
|
|
|
export function DataTableResetButton() {
|
|
const { table } = useDataTable()
|
|
useShortcut(SHORTCUT_IDS.DATA_TABLE_RESET_FILTERS, () => table.resetColumnFilters(), {
|
|
registerInCommandMenu: true,
|
|
})
|
|
|
|
return (
|
|
<ShortcutTooltip
|
|
shortcutId={SHORTCUT_IDS.DATA_TABLE_RESET_FILTERS}
|
|
label="Reset filters"
|
|
side="left"
|
|
>
|
|
<Button type="default" size="tiny" onClick={() => table.resetColumnFilters()} icon={<X />}>
|
|
Reset
|
|
</Button>
|
|
</ShortcutTooltip>
|
|
)
|
|
}
|