Apply new eslint rules; default to prettier for styling
This commit is contained in:
parent
f22cce8881
commit
dc84af9937
218 changed files with 3876 additions and 3564 deletions
|
@ -34,9 +34,9 @@ const EditScheduleModal = ({ schedule }: Props) => {
|
|||
const { addError, clearFlashes } = useFlash();
|
||||
const { dismiss } = useContext(ModalContext);
|
||||
|
||||
const uuid = ServerContext.useStoreState(state => state.server.data!.uuid);
|
||||
const appendSchedule = ServerContext.useStoreActions(actions => actions.schedules.appendSchedule);
|
||||
const [ showCheatsheet, setShowCheetsheet ] = useState(false);
|
||||
const uuid = ServerContext.useStoreState((state) => state.server.data!.uuid);
|
||||
const appendSchedule = ServerContext.useStoreActions((actions) => actions.schedules.appendSchedule);
|
||||
const [showCheatsheet, setShowCheetsheet] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
return () => {
|
||||
|
@ -59,12 +59,12 @@ const EditScheduleModal = ({ schedule }: Props) => {
|
|||
onlyWhenOnline: values.onlyWhenOnline,
|
||||
isActive: values.enabled,
|
||||
})
|
||||
.then(schedule => {
|
||||
.then((schedule) => {
|
||||
setSubmitting(false);
|
||||
appendSchedule(schedule);
|
||||
dismiss();
|
||||
})
|
||||
.catch(error => {
|
||||
.catch((error) => {
|
||||
console.error(error);
|
||||
|
||||
setSubmitting(false);
|
||||
|
@ -75,32 +75,34 @@ const EditScheduleModal = ({ schedule }: Props) => {
|
|||
return (
|
||||
<Formik
|
||||
onSubmit={submit}
|
||||
initialValues={{
|
||||
name: schedule?.name || '',
|
||||
minute: schedule?.cron.minute || '*/5',
|
||||
hour: schedule?.cron.hour || '*',
|
||||
dayOfMonth: schedule?.cron.dayOfMonth || '*',
|
||||
month: schedule?.cron.month || '*',
|
||||
dayOfWeek: schedule?.cron.dayOfWeek || '*',
|
||||
enabled: schedule?.isActive ?? true,
|
||||
onlyWhenOnline: schedule?.onlyWhenOnline ?? true,
|
||||
} as Values}
|
||||
initialValues={
|
||||
{
|
||||
name: schedule?.name || '',
|
||||
minute: schedule?.cron.minute || '*/5',
|
||||
hour: schedule?.cron.hour || '*',
|
||||
dayOfMonth: schedule?.cron.dayOfMonth || '*',
|
||||
month: schedule?.cron.month || '*',
|
||||
dayOfWeek: schedule?.cron.dayOfWeek || '*',
|
||||
enabled: schedule?.isActive ?? true,
|
||||
onlyWhenOnline: schedule?.onlyWhenOnline ?? true,
|
||||
} as Values
|
||||
}
|
||||
>
|
||||
{({ isSubmitting }) => (
|
||||
<Form>
|
||||
<h3 css={tw`text-2xl mb-6`}>{schedule ? 'Edit schedule' : 'Create new schedule'}</h3>
|
||||
<FlashMessageRender byKey={'schedule:edit'} css={tw`mb-6`}/>
|
||||
<FlashMessageRender byKey={'schedule:edit'} css={tw`mb-6`} />
|
||||
<Field
|
||||
name={'name'}
|
||||
label={'Schedule name'}
|
||||
description={'A human readable identifier for this schedule.'}
|
||||
/>
|
||||
<div css={tw`grid grid-cols-2 sm:grid-cols-5 gap-4 mt-6`}>
|
||||
<Field name={'minute'} label={'Minute'}/>
|
||||
<Field name={'hour'} label={'Hour'}/>
|
||||
<Field name={'dayOfMonth'} label={'Day of month'}/>
|
||||
<Field name={'month'} label={'Month'}/>
|
||||
<Field name={'dayOfWeek'} label={'Day of week'}/>
|
||||
<Field name={'minute'} label={'Minute'} />
|
||||
<Field name={'hour'} label={'Hour'} />
|
||||
<Field name={'dayOfMonth'} label={'Day of month'} />
|
||||
<Field name={'month'} label={'Month'} />
|
||||
<Field name={'dayOfWeek'} label={'Day of week'} />
|
||||
</div>
|
||||
<p css={tw`text-neutral-400 text-xs mt-2`}>
|
||||
The schedule system supports the use of Cronjob syntax when defining when tasks should begin
|
||||
|
@ -112,13 +114,13 @@ const EditScheduleModal = ({ schedule }: Props) => {
|
|||
description={'Show the cron cheatsheet for some examples.'}
|
||||
label={'Show Cheatsheet'}
|
||||
defaultChecked={showCheatsheet}
|
||||
onChange={() => setShowCheetsheet(s => !s)}
|
||||
onChange={() => setShowCheetsheet((s) => !s)}
|
||||
/>
|
||||
{showCheatsheet &&
|
||||
{showCheatsheet && (
|
||||
<div css={tw`block md:flex w-full`}>
|
||||
<ScheduleCheatsheetCards/>
|
||||
<ScheduleCheatsheetCards />
|
||||
</div>
|
||||
}
|
||||
)}
|
||||
</div>
|
||||
<div css={tw`mt-6 bg-neutral-700 border border-neutral-800 shadow-inner p-4 rounded`}>
|
||||
<FormikSwitch
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue