Schedule Fixes

Limiting Schedule name 75>255
Moved Payload to bottom of new task window
Closes #2346
This commit is contained in:
Charles Morgan 2020-09-17 00:01:48 -04:00
parent 79f616f791
commit 607184e578
No known key found for this signature in database
GPG Key ID: D71946CD723249BD
3 changed files with 41 additions and 40 deletions

View File

@ -103,7 +103,7 @@ class Schedule extends Model
*/ */
public static $validationRules = [ public static $validationRules = [
'server_id' => 'required|exists:servers,id', 'server_id' => 'required|exists:servers,id',
'name' => 'nullable|string|max:255', 'name' => 'nullable|string|max:75',
'cron_day_of_week' => 'required|string', 'cron_day_of_week' => 'required|string',
'cron_day_of_month' => 'required|string', 'cron_day_of_month' => 'required|string',
'cron_hour' => 'required|string', 'cron_hour' => 'required|string',

View File

@ -81,7 +81,7 @@ export default ({ schedule, task }: Props) => {
<div css={tw`md:ml-6 mt-2`}> <div css={tw`md:ml-6 mt-2`}>
{task.action === 'backup' && {task.action === 'backup' &&
<p css={tw`text-xs uppercase text-neutral-400 mb-1`}>Ignoring files & folders:</p>} <p css={tw`text-xs uppercase text-neutral-400 mb-1`}>Ignoring files & folders:</p>}
<div css={tw`font-mono bg-neutral-800 rounded py-1 px-2 text-sm w-auto whitespace-pre inline-block`}> <div css={tw`font-mono bg-neutral-800 rounded py-1 px-2 text-sm w-auto inline-block break-all`}>
{task.payload} {task.payload}
</div> </div>
</div> </div>

View File

@ -57,13 +57,22 @@ const TaskDetailsForm = ({ isEditingTask }: { isEditingTask: boolean }) => {
</FormikField> </FormikField>
</FormikFieldWrapper> </FormikFieldWrapper>
</div> </div>
<div css={tw`flex-1`}> <div css={tw`flex-1 ml-6`}>
{action === 'command' ?
<Field <Field
name={'payload'} name={'timeOffset'}
label={'Payload'} label={'Time offset (in seconds)'}
description={'The command to send to the server when this task executes.'} description={'The amount of time to wait after the previous task executes before running this one. If this is the first task on a schedule this will not be applied.'}
/> />
</div>
</div>
<div css={tw`mt-6`}>
{action === 'command' ?
<div>
<Label>Payload</Label>
<FormikFieldWrapper name={'payload'}>
<FormikField as={Textarea} name={'payload'} rows={6} />
</FormikFieldWrapper>
</div>
: :
action === 'power' ? action === 'power' ?
<div> <div>
@ -84,19 +93,11 @@ const TaskDetailsForm = ({ isEditingTask }: { isEditingTask: boolean }) => {
name={'payload'} name={'payload'}
description={'Optional. Include the files and folders to be excluded in this backup. By default, the contents of your .pteroignore file will be used.'} description={'Optional. Include the files and folders to be excluded in this backup. By default, the contents of your .pteroignore file will be used.'}
> >
<FormikField as={Textarea} name={'payload'} css={tw`h-32`}/> <FormikField as={Textarea} name={'payload'} rows={6} />
</FormikFieldWrapper> </FormikFieldWrapper>
</div> </div>
} }
</div> </div>
</div>
<div css={tw`mt-6`}>
<Field
name={'timeOffset'}
label={'Time offset (in seconds)'}
description={'The amount of time to wait after the previous task executes before running this one. If this is the first task on a schedule this will not be applied.'}
/>
</div>
<div css={tw`flex justify-end mt-6`}> <div css={tw`flex justify-end mt-6`}>
<Button type={'submit'} disabled={isSubmitting}> <Button type={'submit'} disabled={isSubmitting}>
{isEditingTask ? 'Save Changes' : 'Create Task'} {isEditingTask ? 'Save Changes' : 'Create Task'}
@ -162,8 +163,8 @@ export default ({ task, schedule, onDismissed }: Props) => {
onDismissed={() => onDismissed()} onDismissed={() => onDismissed()}
showSpinnerOverlay={isSubmitting} showSpinnerOverlay={isSubmitting}
> >
<FlashMessageRender byKey={'schedule:task'} css={tw`mb-4`}/> <FlashMessageRender byKey={'schedule:task'} css={tw`mb-4`} />
<TaskDetailsForm isEditingTask={typeof task !== 'undefined'}/> <TaskDetailsForm isEditingTask={typeof task !== 'undefined'} />
</Modal> </Modal>
)} )}
</Formik> </Formik>