functions-detail.ts 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. // @ts-nocheck
  2. import { RegistryDefinations } from '../types'
  3. /**
  4. * Shortcuts scoped to a single edge function's detail layout — active anywhere
  5. * under `/project/<ref>/functions/<slug>/*`.
  6. *
  7. * The test sheet submit is registered here too, since it conceptually belongs
  8. * with the test-related actions even though it's only listened to while the
  9. * sheet is open.
  10. */
  11. export const FUNCTIONS_DETAIL_SHORTCUT_IDS = {
  12. FUNCTION_DETAIL_OPEN_TEST: 'functions-detail.open-test',
  13. FUNCTION_DETAIL_OPEN_DOWNLOAD: 'functions-detail.open-download',
  14. FUNCTION_DETAIL_COPY_URL: 'functions-detail.copy-url',
  15. FUNCTION_DETAIL_SUBMIT_TEST: 'functions-detail.submit-test',
  16. }
  17. export type FunctionsDetailShortcutId =
  18. (typeof FUNCTIONS_DETAIL_SHORTCUT_IDS)[keyof typeof FUNCTIONS_DETAIL_SHORTCUT_IDS]
  19. export const functionsDetailRegistry: RegistryDefinations<FunctionsDetailShortcutId> = {
  20. [FUNCTIONS_DETAIL_SHORTCUT_IDS.FUNCTION_DETAIL_OPEN_TEST]: {
  21. id: FUNCTIONS_DETAIL_SHORTCUT_IDS.FUNCTION_DETAIL_OPEN_TEST,
  22. label: 'Open test sheet',
  23. sequence: ['Shift+T'],
  24. showInSettings: false,
  25. options: { ignoreInputs: true, registerInCommandMenu: true },
  26. },
  27. [FUNCTIONS_DETAIL_SHORTCUT_IDS.FUNCTION_DETAIL_OPEN_DOWNLOAD]: {
  28. id: FUNCTIONS_DETAIL_SHORTCUT_IDS.FUNCTION_DETAIL_OPEN_DOWNLOAD,
  29. label: 'Open download menu',
  30. sequence: ['Shift+D'],
  31. showInSettings: false,
  32. options: { ignoreInputs: true, registerInCommandMenu: true },
  33. },
  34. [FUNCTIONS_DETAIL_SHORTCUT_IDS.FUNCTION_DETAIL_COPY_URL]: {
  35. id: FUNCTIONS_DETAIL_SHORTCUT_IDS.FUNCTION_DETAIL_COPY_URL,
  36. label: 'Copy function URL',
  37. sequence: ['Shift+C'],
  38. showInSettings: false,
  39. options: { ignoreInputs: true, registerInCommandMenu: true },
  40. },
  41. [FUNCTIONS_DETAIL_SHORTCUT_IDS.FUNCTION_DETAIL_SUBMIT_TEST]: {
  42. id: FUNCTIONS_DETAIL_SHORTCUT_IDS.FUNCTION_DETAIL_SUBMIT_TEST,
  43. label: 'Send test request',
  44. sequence: ['Mod+Enter'],
  45. showInSettings: false,
  46. },
  47. }