functions-detail-nav.ts 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. // @ts-nocheck
  2. import { SHORTCUT_REFERENCE_GROUPS } from '../referenceGroups'
  3. import { RegistryDefinations } from '../types'
  4. /**
  5. * Digit shortcuts (1-5) for jumping between the tabs on a function detail
  6. * page — Overview, Invocations, Logs, Code, Settings.
  7. *
  8. * Active only while EdgeFunctionDetailsLayout is mounted (i.e. the user is
  9. * on a `/project/<ref>/functions/<slug>/*` route). Digits are scoped to this
  10. * layout so they don't burn global keys.
  11. */
  12. export const FUNCTIONS_DETAIL_NAV_SHORTCUT_IDS = {
  13. NAV_FUNCTION_DETAIL_OVERVIEW: 'nav.function-detail-overview',
  14. NAV_FUNCTION_DETAIL_INVOCATIONS: 'nav.function-detail-invocations',
  15. NAV_FUNCTION_DETAIL_LOGS: 'nav.function-detail-logs',
  16. NAV_FUNCTION_DETAIL_CODE: 'nav.function-detail-code',
  17. NAV_FUNCTION_DETAIL_SETTINGS: 'nav.function-detail-settings',
  18. }
  19. export type FunctionsDetailNavShortcutId =
  20. (typeof FUNCTIONS_DETAIL_NAV_SHORTCUT_IDS)[keyof typeof FUNCTIONS_DETAIL_NAV_SHORTCUT_IDS]
  21. export const functionsDetailNavRegistry: RegistryDefinations<FunctionsDetailNavShortcutId> = {
  22. [FUNCTIONS_DETAIL_NAV_SHORTCUT_IDS.NAV_FUNCTION_DETAIL_OVERVIEW]: {
  23. id: FUNCTIONS_DETAIL_NAV_SHORTCUT_IDS.NAV_FUNCTION_DETAIL_OVERVIEW,
  24. label: 'Go to Overview',
  25. sequence: ['1'],
  26. showInSettings: false,
  27. referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_FUNCTION_DETAIL,
  28. },
  29. [FUNCTIONS_DETAIL_NAV_SHORTCUT_IDS.NAV_FUNCTION_DETAIL_INVOCATIONS]: {
  30. id: FUNCTIONS_DETAIL_NAV_SHORTCUT_IDS.NAV_FUNCTION_DETAIL_INVOCATIONS,
  31. label: 'Go to Invocations',
  32. sequence: ['2'],
  33. showInSettings: false,
  34. referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_FUNCTION_DETAIL,
  35. },
  36. [FUNCTIONS_DETAIL_NAV_SHORTCUT_IDS.NAV_FUNCTION_DETAIL_LOGS]: {
  37. id: FUNCTIONS_DETAIL_NAV_SHORTCUT_IDS.NAV_FUNCTION_DETAIL_LOGS,
  38. label: 'Go to Logs',
  39. sequence: ['3'],
  40. showInSettings: false,
  41. referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_FUNCTION_DETAIL,
  42. },
  43. [FUNCTIONS_DETAIL_NAV_SHORTCUT_IDS.NAV_FUNCTION_DETAIL_CODE]: {
  44. id: FUNCTIONS_DETAIL_NAV_SHORTCUT_IDS.NAV_FUNCTION_DETAIL_CODE,
  45. label: 'Go to Code',
  46. sequence: ['4'],
  47. showInSettings: false,
  48. referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_FUNCTION_DETAIL,
  49. },
  50. [FUNCTIONS_DETAIL_NAV_SHORTCUT_IDS.NAV_FUNCTION_DETAIL_SETTINGS]: {
  51. id: FUNCTIONS_DETAIL_NAV_SHORTCUT_IDS.NAV_FUNCTION_DETAIL_SETTINGS,
  52. label: 'Go to Settings',
  53. sequence: ['5'],
  54. showInSettings: false,
  55. referenceGroup: SHORTCUT_REFERENCE_GROUPS.NAVIGATION_FUNCTION_DETAIL,
  56. },
  57. }