Skip to content

Commit 607184e

Browse files
Schedule Fixes
Limiting Schedule name 75>255 Moved Payload to bottom of new task window Closes pterodactyl#2346
1 parent 79f616f commit 607184e

File tree

3 files changed

+41
-40
lines changed

3 files changed

+41
-40
lines changed

app/Models/Schedule.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ class Schedule extends Model
103103
*/
104104
public static $validationRules = [
105105
'server_id' => 'required|exists:servers,id',
106-
'name' => 'nullable|string|max:255',
106+
'name' => 'nullable|string|max:75',
107107
'cron_day_of_week' => 'required|string',
108108
'cron_day_of_month' => 'required|string',
109109
'cron_hour' => 'required|string',

resources/scripts/components/server/schedules/ScheduleTaskRow.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export default ({ schedule, task }: Props) => {
8181
<div css={tw`md:ml-6 mt-2`}>
8282
{task.action === 'backup' &&
8383
<p css={tw`text-xs uppercase text-neutral-400 mb-1`}>Ignoring files & folders:</p>}
84-
<div css={tw`font-mono bg-neutral-800 rounded py-1 px-2 text-sm w-auto whitespace-pre inline-block`}>
84+
<div css={tw`font-mono bg-neutral-800 rounded py-1 px-2 text-sm w-auto inline-block break-all`}>
8585
{task.payload}
8686
</div>
8787
</div>

resources/scripts/components/server/schedules/TaskDetailsModal.tsx

Lines changed: 39 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -57,45 +57,46 @@ const TaskDetailsForm = ({ isEditingTask }: { isEditingTask: boolean }) => {
5757
</FormikField>
5858
</FormikFieldWrapper>
5959
</div>
60-
<div css={tw`flex-1`}>
61-
{action === 'command' ?
62-
<Field
63-
name={'payload'}
64-
label={'Payload'}
65-
description={'The command to send to the server when this task executes.'}
66-
/>
67-
:
68-
action === 'power' ?
69-
<div>
70-
<Label>Payload</Label>
71-
<FormikFieldWrapper name={'payload'}>
72-
<FormikField as={Select} name={'payload'}>
73-
<option value={'start'}>Start the server</option>
74-
<option value={'restart'}>Restart the server</option>
75-
<option value={'stop'}>Stop the server</option>
76-
<option value={'kill'}>Terminate the server</option>
77-
</FormikField>
78-
</FormikFieldWrapper>
79-
</div>
80-
:
81-
<div>
82-
<Label>Ignored Files</Label>
83-
<FormikFieldWrapper
84-
name={'payload'}
85-
description={'Optional. Include the files and folders to be excluded in this backup. By default, the contents of your .pteroignore file will be used.'}
86-
>
87-
<FormikField as={Textarea} name={'payload'} css={tw`h-32`}/>
88-
</FormikFieldWrapper>
89-
</div>
90-
}
60+
<div css={tw`flex-1 ml-6`}>
61+
<Field
62+
name={'timeOffset'}
63+
label={'Time offset (in seconds)'}
64+
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.'}
65+
/>
9166
</div>
9267
</div>
9368
<div css={tw`mt-6`}>
94-
<Field
95-
name={'timeOffset'}
96-
label={'Time offset (in seconds)'}
97-
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.'}
98-
/>
69+
{action === 'command' ?
70+
<div>
71+
<Label>Payload</Label>
72+
<FormikFieldWrapper name={'payload'}>
73+
<FormikField as={Textarea} name={'payload'} rows={6} />
74+
</FormikFieldWrapper>
75+
</div>
76+
:
77+
action === 'power' ?
78+
<div>
79+
<Label>Payload</Label>
80+
<FormikFieldWrapper name={'payload'}>
81+
<FormikField as={Select} name={'payload'}>
82+
<option value={'start'}>Start the server</option>
83+
<option value={'restart'}>Restart the server</option>
84+
<option value={'stop'}>Stop the server</option>
85+
<option value={'kill'}>Terminate the server</option>
86+
</FormikField>
87+
</FormikFieldWrapper>
88+
</div>
89+
:
90+
<div>
91+
<Label>Ignored Files</Label>
92+
<FormikFieldWrapper
93+
name={'payload'}
94+
description={'Optional. Include the files and folders to be excluded in this backup. By default, the contents of your .pteroignore file will be used.'}
95+
>
96+
<FormikField as={Textarea} name={'payload'} rows={6} />
97+
</FormikFieldWrapper>
98+
</div>
99+
}
99100
</div>
100101
<div css={tw`flex justify-end mt-6`}>
101102
<Button type={'submit'} disabled={isSubmitting}>
@@ -162,8 +163,8 @@ export default ({ task, schedule, onDismissed }: Props) => {
162163
onDismissed={() => onDismissed()}
163164
showSpinnerOverlay={isSubmitting}
164165
>
165-
<FlashMessageRender byKey={'schedule:task'} css={tw`mb-4`}/>
166-
<TaskDetailsForm isEditingTask={typeof task !== 'undefined'}/>
166+
<FlashMessageRender byKey={'schedule:task'} css={tw`mb-4`} />
167+
<TaskDetailsForm isEditingTask={typeof task !== 'undefined'} />
167168
</Modal>
168169
)}
169170
</Formik>

0 commit comments

Comments
 (0)