advisors-page.ts 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. // @ts-nocheck
  2. import { SHORTCUT_REFERENCE_GROUPS } from '../referenceGroups'
  3. import { RegistryDefinations } from '../types'
  4. /**
  5. * Shortcuts scoped to the Security and Performance Advisor pages — tab digit
  6. * shortcuts, refresh, and detail panel close. The tab digits mirror the
  7. * functions-detail-nav pattern (`ignoreInputs: true` so they don't fire from
  8. * inputs), and `Escape` follows the auth-users close-panel pattern with
  9. * `conflictBehavior: 'allow'` since other surfaces also use Escape.
  10. */
  11. export const ADVISORS_PAGE_SHORTCUT_IDS = {
  12. ADVISORS_TAB_ERRORS: 'advisors-page.tab-errors',
  13. ADVISORS_TAB_WARNINGS: 'advisors-page.tab-warnings',
  14. ADVISORS_TAB_INFO: 'advisors-page.tab-info',
  15. ADVISORS_REFRESH: 'advisors-page.refresh',
  16. ADVISORS_CLOSE_DETAIL: 'advisors-page.close-detail',
  17. }
  18. export type AdvisorsPageShortcutId =
  19. (typeof ADVISORS_PAGE_SHORTCUT_IDS)[keyof typeof ADVISORS_PAGE_SHORTCUT_IDS]
  20. export const advisorsPageRegistry: RegistryDefinations<AdvisorsPageShortcutId> = {
  21. [ADVISORS_PAGE_SHORTCUT_IDS.ADVISORS_TAB_ERRORS]: {
  22. id: ADVISORS_PAGE_SHORTCUT_IDS.ADVISORS_TAB_ERRORS,
  23. label: 'Switch to Errors',
  24. sequence: ['1'],
  25. showInSettings: false,
  26. options: { ignoreInputs: true, registerInCommandMenu: true },
  27. referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_ADVISORS,
  28. },
  29. [ADVISORS_PAGE_SHORTCUT_IDS.ADVISORS_TAB_WARNINGS]: {
  30. id: ADVISORS_PAGE_SHORTCUT_IDS.ADVISORS_TAB_WARNINGS,
  31. label: 'Switch to Warnings',
  32. sequence: ['2'],
  33. showInSettings: false,
  34. options: { ignoreInputs: true, registerInCommandMenu: true },
  35. referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_ADVISORS,
  36. },
  37. [ADVISORS_PAGE_SHORTCUT_IDS.ADVISORS_TAB_INFO]: {
  38. id: ADVISORS_PAGE_SHORTCUT_IDS.ADVISORS_TAB_INFO,
  39. label: 'Switch to Info',
  40. sequence: ['3'],
  41. showInSettings: false,
  42. options: { ignoreInputs: true, registerInCommandMenu: true },
  43. referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_ADVISORS,
  44. },
  45. [ADVISORS_PAGE_SHORTCUT_IDS.ADVISORS_REFRESH]: {
  46. id: ADVISORS_PAGE_SHORTCUT_IDS.ADVISORS_REFRESH,
  47. label: 'Refresh advisor',
  48. sequence: ['Shift+R'],
  49. showInSettings: false,
  50. options: { ignoreInputs: true, registerInCommandMenu: true },
  51. },
  52. [ADVISORS_PAGE_SHORTCUT_IDS.ADVISORS_CLOSE_DETAIL]: {
  53. id: ADVISORS_PAGE_SHORTCUT_IDS.ADVISORS_CLOSE_DETAIL,
  54. label: 'Close lint details panel',
  55. sequence: ['Escape'],
  56. showInSettings: false,
  57. options: { ignoreInputs: true, conflictBehavior: 'allow' },
  58. },
  59. }