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