({
currentScript,
envNames,
dispatchCurrentScript,
saveScript,
}: SettingsTabProps)
| 15 | }; |
| 16 | |
| 17 | function SettingsTab({ |
| 18 | currentScript, |
| 19 | envNames, |
| 20 | dispatchCurrentScript, |
| 21 | saveScript, |
| 22 | }: SettingsTabProps) { |
| 23 | const { colorMode } = useColorMode(); |
| 24 | |
| 25 | const setCronExpression = useCallback( |
| 26 | (cronExpression: string) => { |
| 27 | dispatchCurrentScript({ |
| 28 | type: CurrentScriptActionType.PATCH_DATA, |
| 29 | data: { cronExpression }, |
| 30 | }); |
| 31 | }, |
| 32 | [dispatchCurrentScript], |
| 33 | ); |
| 34 | |
| 35 | const setSelectedEnvName = useCallback( |
| 36 | (selectedEnvName: string) => { |
| 37 | dispatchCurrentScript({ |
| 38 | type: CurrentScriptActionType.PATCH_DATA, |
| 39 | data: { selectedEnvName }, |
| 40 | }); |
| 41 | }, |
| 42 | [dispatchCurrentScript], |
| 43 | ); |
| 44 | |
| 45 | const setEnabled = useCallback( |
| 46 | (enabled: boolean) => { |
| 47 | saveScript({ |
| 48 | ...currentScript, |
| 49 | data: { |
| 50 | ...currentScript.data, |
| 51 | enabled, |
| 52 | lastRun: enabled ? Date.now() : undefined, |
| 53 | }, |
| 54 | }); |
| 55 | dispatchCurrentScript({ |
| 56 | type: CurrentScriptActionType.PATCH_DATA, |
| 57 | data: { enabled }, |
| 58 | }); |
| 59 | }, |
| 60 | [currentScript, dispatchCurrentScript, saveScript], |
| 61 | ); |
| 62 | |
| 63 | return ( |
| 64 | <div style={{ display: 'flex', alignItems: 'center' }}> |
| 65 | <div> |
| 66 | <div style={{ display: 'flex', alignItems: 'center', marginBottom: '8px' }}> |
| 67 | <Text fontSize="sm" fontWeight="bold" color="gray.500" mr="2"> |
| 68 | Cron Configuration |
| 69 | </Text> |
| 70 | <Tooltip |
| 71 | label="Configure the script as a cron job to run periodically on the server. Visit the docs for more information." |
| 72 | fontSize="md" |
| 73 | > |
| 74 | <QuestionOutlineIcon color="gray.500" /> |
nothing calls this directly
no test coverage detected