logs-preview.ts100 lines · main
| 1 | // @ts-nocheck |
| 2 | import { RegistryDefinations } from '../types' |
| 3 | |
| 4 | /** |
| 5 | * Shortcuts scoped to the LogsPreviewer component — used by Function Logs, |
| 6 | * Function Invocations, and the Logs Explorer page. They are page-scoped: |
| 7 | * each shortcut is only active while LogsPreviewer is mounted. |
| 8 | * |
| 9 | * Grid-related bindings (start-nav, toggle-all, toggle-row, escape) mirror the |
| 10 | * Auth Users / Table Editor patterns so the keyboard model stays consistent |
| 11 | * across our react-data-grid surfaces. |
| 12 | */ |
| 13 | export const LOGS_PREVIEW_SHORTCUT_IDS = { |
| 14 | LOGS_PREVIEW_REFRESH: 'logs-preview.refresh', |
| 15 | LOGS_PREVIEW_TOGGLE_CHART: 'logs-preview.toggle-chart', |
| 16 | LOGS_PREVIEW_LOAD_OLDER: 'logs-preview.load-older', |
| 17 | LOGS_PREVIEW_TOGGLE_DATE_PICKER: 'logs-preview.toggle-date-picker', |
| 18 | LOGS_PREVIEW_TOGGLE_ALL_SELECTION: 'logs-preview.toggle-all-selection', |
| 19 | LOGS_PREVIEW_TOGGLE_ROW_SELECTION: 'logs-preview.toggle-row-selection', |
| 20 | LOGS_PREVIEW_EXIT_SELECTION: 'logs-preview.exit-selection', |
| 21 | LOGS_PREVIEW_CLOSE_PANEL: 'logs-preview.close-panel', |
| 22 | LOGS_PREVIEW_START_NAV_DOWN: 'logs-preview.start-nav-down', |
| 23 | LOGS_PREVIEW_START_NAV_UP: 'logs-preview.start-nav-up', |
| 24 | } |
| 25 | |
| 26 | export type LogsPreviewShortcutId = |
| 27 | (typeof LOGS_PREVIEW_SHORTCUT_IDS)[keyof typeof LOGS_PREVIEW_SHORTCUT_IDS] |
| 28 | |
| 29 | export const logsPreviewRegistry: RegistryDefinations<LogsPreviewShortcutId> = { |
| 30 | [LOGS_PREVIEW_SHORTCUT_IDS.LOGS_PREVIEW_REFRESH]: { |
| 31 | id: LOGS_PREVIEW_SHORTCUT_IDS.LOGS_PREVIEW_REFRESH, |
| 32 | label: 'Refresh logs', |
| 33 | sequence: ['Shift+R'], |
| 34 | showInSettings: false, |
| 35 | options: { ignoreInputs: true, registerInCommandMenu: true }, |
| 36 | }, |
| 37 | [LOGS_PREVIEW_SHORTCUT_IDS.LOGS_PREVIEW_TOGGLE_CHART]: { |
| 38 | id: LOGS_PREVIEW_SHORTCUT_IDS.LOGS_PREVIEW_TOGGLE_CHART, |
| 39 | label: 'Toggle histogram', |
| 40 | sequence: ['Shift+H'], |
| 41 | showInSettings: false, |
| 42 | options: { ignoreInputs: true, registerInCommandMenu: true }, |
| 43 | }, |
| 44 | [LOGS_PREVIEW_SHORTCUT_IDS.LOGS_PREVIEW_LOAD_OLDER]: { |
| 45 | id: LOGS_PREVIEW_SHORTCUT_IDS.LOGS_PREVIEW_LOAD_OLDER, |
| 46 | label: 'Load older logs', |
| 47 | sequence: ['Shift+L'], |
| 48 | showInSettings: false, |
| 49 | options: { ignoreInputs: true, registerInCommandMenu: true }, |
| 50 | }, |
| 51 | [LOGS_PREVIEW_SHORTCUT_IDS.LOGS_PREVIEW_TOGGLE_DATE_PICKER]: { |
| 52 | id: LOGS_PREVIEW_SHORTCUT_IDS.LOGS_PREVIEW_TOGGLE_DATE_PICKER, |
| 53 | label: 'Open time range picker', |
| 54 | sequence: ['Shift+P'], |
| 55 | showInSettings: false, |
| 56 | options: { ignoreInputs: true, registerInCommandMenu: true }, |
| 57 | }, |
| 58 | [LOGS_PREVIEW_SHORTCUT_IDS.LOGS_PREVIEW_TOGGLE_ALL_SELECTION]: { |
| 59 | id: LOGS_PREVIEW_SHORTCUT_IDS.LOGS_PREVIEW_TOGGLE_ALL_SELECTION, |
| 60 | label: 'Toggle selection on all displayed logs', |
| 61 | sequence: ['Mod+A'], |
| 62 | showInSettings: false, |
| 63 | options: { ignoreInputs: true }, |
| 64 | }, |
| 65 | [LOGS_PREVIEW_SHORTCUT_IDS.LOGS_PREVIEW_TOGGLE_ROW_SELECTION]: { |
| 66 | id: LOGS_PREVIEW_SHORTCUT_IDS.LOGS_PREVIEW_TOGGLE_ROW_SELECTION, |
| 67 | label: 'Toggle selection on current row', |
| 68 | sequence: ['Shift+Space'], |
| 69 | showInSettings: false, |
| 70 | options: { ignoreInputs: true }, |
| 71 | }, |
| 72 | [LOGS_PREVIEW_SHORTCUT_IDS.LOGS_PREVIEW_EXIT_SELECTION]: { |
| 73 | id: LOGS_PREVIEW_SHORTCUT_IDS.LOGS_PREVIEW_EXIT_SELECTION, |
| 74 | label: 'Clear log selection', |
| 75 | sequence: ['Escape'], |
| 76 | showInSettings: false, |
| 77 | options: { ignoreInputs: true, conflictBehavior: 'allow' }, |
| 78 | }, |
| 79 | [LOGS_PREVIEW_SHORTCUT_IDS.LOGS_PREVIEW_CLOSE_PANEL]: { |
| 80 | id: LOGS_PREVIEW_SHORTCUT_IDS.LOGS_PREVIEW_CLOSE_PANEL, |
| 81 | label: 'Close log details panel', |
| 82 | sequence: ['Escape'], |
| 83 | showInSettings: false, |
| 84 | options: { ignoreInputs: true, conflictBehavior: 'allow' }, |
| 85 | }, |
| 86 | [LOGS_PREVIEW_SHORTCUT_IDS.LOGS_PREVIEW_START_NAV_DOWN]: { |
| 87 | id: LOGS_PREVIEW_SHORTCUT_IDS.LOGS_PREVIEW_START_NAV_DOWN, |
| 88 | label: 'Move focus into logs grid', |
| 89 | sequence: ['ArrowDown'], |
| 90 | showInSettings: false, |
| 91 | options: { ignoreInputs: true }, |
| 92 | }, |
| 93 | [LOGS_PREVIEW_SHORTCUT_IDS.LOGS_PREVIEW_START_NAV_UP]: { |
| 94 | id: LOGS_PREVIEW_SHORTCUT_IDS.LOGS_PREVIEW_START_NAV_UP, |
| 95 | label: 'Move focus into logs grid', |
| 96 | sequence: ['ArrowUp'], |
| 97 | showInSettings: false, |
| 98 | options: { ignoreInputs: true }, |
| 99 | }, |
| 100 | } |