Add cron cheatsheet (#3866)
This commit is contained in:
parent
2680fe4c8e
commit
af4616ccf2
2 changed files with 73 additions and 1 deletions
|
@ -1,4 +1,4 @@
|
|||
import React, { useContext, useEffect } from 'react';
|
||||
import React, { useContext, useEffect, useState } from 'react';
|
||||
import { Schedule } from '@/api/server/schedules/getServerSchedules';
|
||||
import Field from '@/components/elements/Field';
|
||||
import { Form, Formik, FormikHelpers } from 'formik';
|
||||
|
@ -12,6 +12,8 @@ import tw from 'twin.macro';
|
|||
import Button from '@/components/elements/Button';
|
||||
import ModalContext from '@/context/ModalContext';
|
||||
import asModal from '@/hoc/asModal';
|
||||
import Switch from '@/components/elements/Switch';
|
||||
import ScheduleCheatsheetCards from '@/components/server/schedules/ScheduleCheatsheetCards';
|
||||
|
||||
interface Props {
|
||||
schedule?: Schedule;
|
||||
|
@ -34,6 +36,7 @@ const EditScheduleModal = ({ schedule }: Props) => {
|
|||
|
||||
const uuid = ServerContext.useStoreState(state => state.server.data!.uuid);
|
||||
const appendSchedule = ServerContext.useStoreActions(actions => actions.schedules.appendSchedule);
|
||||
const [ showCheatsheet, setShowCheetsheet ] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
return () => {
|
||||
|
@ -103,6 +106,20 @@ const EditScheduleModal = ({ schedule }: Props) => {
|
|||
The schedule system supports the use of Cronjob syntax when defining when tasks should begin
|
||||
running. Use the fields above to specify when these tasks should begin running.
|
||||
</p>
|
||||
<div css={tw`mt-6 bg-neutral-700 border border-neutral-800 shadow-inner p-4 rounded`}>
|
||||
<Switch
|
||||
name={'show_cheatsheet'}
|
||||
description={'Show the cron cheatsheet for some examples.'}
|
||||
label={'Show Cheatsheet'}
|
||||
defaultChecked={showCheatsheet}
|
||||
onChange={() => setShowCheetsheet(s => !s)}
|
||||
/>
|
||||
{showCheatsheet &&
|
||||
<div css={tw`block md:flex w-full`}>
|
||||
<ScheduleCheatsheetCards/>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<div css={tw`mt-6 bg-neutral-700 border border-neutral-800 shadow-inner p-4 rounded`}>
|
||||
<FormikSwitch
|
||||
name={'onlyWhenOnline'}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue