logs-preview.ts 4.0 KB

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