More schedule changes
This commit is contained in:
parent
457c910c35
commit
7f76684453
20 changed files with 365 additions and 348 deletions
|
@ -48,13 +48,13 @@ class TaskController extends Controller
|
|||
$this->authorize('list-tasks', $server);
|
||||
$server->js();
|
||||
|
||||
return view('server.tasks.index', [
|
||||
return view('server.schedules.index', [
|
||||
'server' => $server,
|
||||
'node' => $server->node,
|
||||
'tasks' => $server->tasks,
|
||||
'actions' => [
|
||||
'command' => trans('server.tasks.actions.command'),
|
||||
'power' => trans('server.tasks.actions.power'),
|
||||
'command' => trans('server.schedules.actions.command'),
|
||||
'power' => trans('server.schedules.actions.power'),
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ class TaskController extends Controller
|
|||
$this->authorize('create-task', $server);
|
||||
$server->js();
|
||||
|
||||
return view('server.tasks.new', [
|
||||
return view('server.schedules.new', [
|
||||
'server' => $server,
|
||||
'node' => $server->node,
|
||||
]);
|
||||
|
@ -96,9 +96,9 @@ class TaskController extends Controller
|
|||
'_token',
|
||||
]));
|
||||
|
||||
return redirect()->route('server.tasks', $uuid);
|
||||
return redirect()->route('server.schedules', $uuid);
|
||||
} catch (DisplayValidationException $ex) {
|
||||
return redirect()->route('server.tasks.new', $uuid)->withErrors(json_decode($ex->getMessage()))->withInput();
|
||||
return redirect()->route('server.schedules.new', $uuid)->withErrors(json_decode($ex->getMessage()))->withInput();
|
||||
} catch (DisplayException $ex) {
|
||||
Alert::danger($ex->getMessage())->flash();
|
||||
} catch (\Exception $ex) {
|
||||
|
@ -106,7 +106,7 @@ class TaskController extends Controller
|
|||
Alert::danger('An unknown error occured while attempting to create this task.')->flash();
|
||||
}
|
||||
|
||||
return redirect()->route('server.tasks.new', $uuid);
|
||||
return redirect()->route('server.schedules.new', $uuid);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -24,8 +24,8 @@
|
|||
|
||||
namespace Pterodactyl\Http\Controllers\Server\Tasks;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Prologue\Alerts\AlertsMessageBag;
|
||||
use Pterodactyl\Http\Requests\Request;
|
||||
use Illuminate\Contracts\Session\Session;
|
||||
use Pterodactyl\Http\Controllers\Controller;
|
||||
use Pterodactyl\Contracts\Extensions\HashidsInterface;
|
||||
|
@ -99,11 +99,11 @@ class TaskManagementController extends Controller
|
|||
$this->authorize('list-schedules', $server);
|
||||
$this->injectJavascript();
|
||||
|
||||
return view('server.tasks.index', [
|
||||
return view('server.schedules.index', [
|
||||
'schedules' => $this->repository->getServerSchedules($server->id),
|
||||
'actions' => [
|
||||
'command' => trans('server.tasks.actions.command'),
|
||||
'power' => trans('server.tasks.actions.power'),
|
||||
'command' => trans('server.schedule.actions.command'),
|
||||
'power' => trans('server.schedule.actions.power'),
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ class TaskManagementController extends Controller
|
|||
$this->authorize('create-schedule', $server);
|
||||
$this->injectJavascript();
|
||||
|
||||
return view('server.tasks.new');
|
||||
return view('server.schedules.new');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -138,9 +138,9 @@ class TaskManagementController extends Controller
|
|||
$this->authorize('create-schedule', $server);
|
||||
|
||||
$schedule = $this->creationService->handle($server, $request->normalize(), $request->getTasks());
|
||||
$this->alert->success(trans('server.tasks.task_created'))->flash();
|
||||
$this->alert->success(trans('server.schedules.task_created'))->flash();
|
||||
|
||||
return redirect()->route('server.tasks.view', [
|
||||
return redirect()->route('server.schedules.view', [
|
||||
'server' => $server->uuidShort,
|
||||
'task' => $schedule->hashid,
|
||||
]);
|
||||
|
@ -149,7 +149,7 @@ class TaskManagementController extends Controller
|
|||
/**
|
||||
* Return a view to modify a schedule.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Request $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\View\View
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
*/
|
||||
|
@ -165,7 +165,7 @@ class TaskManagementController extends Controller
|
|||
}),
|
||||
]);
|
||||
|
||||
return view('server.tasks.view', ['schedule' => $schedule]);
|
||||
return view('server.schedules.view', ['schedule' => $schedule]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -183,9 +183,9 @@ class TaskManagementController extends Controller
|
|||
$this->authorize('edit-schedule', $server);
|
||||
|
||||
// $this->updateService->handle($task, $request->normalize(), $request->getChainedTasks());
|
||||
$this->alert->success(trans('server.tasks.task_updated'))->flash();
|
||||
// $this->alert->success(trans('server.schedules.task_updated'))->flash();
|
||||
|
||||
return redirect()->route('server.tasks.view', [
|
||||
return redirect()->route('server.schedules.view', [
|
||||
'server' => $server->uuidShort,
|
||||
'task' => $schedule->hashid,
|
||||
]);
|
||||
|
@ -194,7 +194,7 @@ class TaskManagementController extends Controller
|
|||
/**
|
||||
* Delete a parent task from the Panel.
|
||||
*
|
||||
* @param \Pterodactyl\Http\Requests\Request $request
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*
|
||||
* @throws \Illuminate\Auth\Access\AuthorizationException
|
||||
|
@ -205,7 +205,7 @@ class TaskManagementController extends Controller
|
|||
$schedule = $request->attributes->get('schedule');
|
||||
$this->authorize('delete-schedule', $server);
|
||||
|
||||
$this->repository->delete($task->id);
|
||||
$this->repository->delete($schedule->id);
|
||||
|
||||
return response('', 204);
|
||||
}
|
||||
|
|
|
@ -77,10 +77,10 @@ class ScheduleAccess
|
|||
{
|
||||
$server = $this->session->get('server_data.model');
|
||||
|
||||
$scheduleId = $this->hashids->decodeFirst($request->route()->parameter('task'), 0);
|
||||
$scheduleId = $this->hashids->decodeFirst($request->route()->parameter('schedule'), 0);
|
||||
$schedule = $this->repository->getScheduleWithTasks($scheduleId);
|
||||
|
||||
if ($schedule->server_id !== $server->id) {
|
||||
if (object_get($schedule, 'server_id') !== $server->id) {
|
||||
abort(404);
|
||||
}
|
||||
|
||||
|
|
|
@ -42,11 +42,11 @@ class ScheduleCreationFormRequest extends FrontendUserFormRequest
|
|||
'cron_hour' => 'required|string',
|
||||
'cron_minute' => 'required|string',
|
||||
'tasks' => 'sometimes|array|size:4',
|
||||
'tasks.time_value' => 'required_with:chain|max:5',
|
||||
'tasks.time_interval' => 'required_with:chain|max:5',
|
||||
'tasks.action' => 'required_with:chain|max:5',
|
||||
'tasks.payload' => 'required_with:chain|max:5',
|
||||
'tasks.time_value.*' => 'numeric|between:1,60',
|
||||
'tasks.time_value' => 'required_with:tasks|max:5',
|
||||
'tasks.time_interval' => 'required_with:tasks|max:5',
|
||||
'tasks.action' => 'required_with:tasks|max:5',
|
||||
'tasks.payload' => 'required_with:tasks|max:5',
|
||||
'tasks.time_value.*' => 'numeric|between:0,59',
|
||||
'tasks.time_interval.*' => 'string|in:s,m',
|
||||
'tasks.action.*' => 'string|in:power,command',
|
||||
'tasks.payload.*' => 'string',
|
||||
|
|
|
@ -106,12 +106,13 @@ class Permission extends Model implements CleansAttributes
|
|||
'download-files' => null,
|
||||
],
|
||||
'task' => [
|
||||
'list-tasks' => null,
|
||||
'view-task' => null,
|
||||
'toggle-task' => null,
|
||||
'queue-task' => null,
|
||||
'create-task' => null,
|
||||
'delete-task' => null,
|
||||
'list-schedules' => null,
|
||||
'view-schedule' => null,
|
||||
'toggle-schedule' => null,
|
||||
'queue-schedule' => null,
|
||||
'edit-schedule' => null,
|
||||
'create-schedule' => null,
|
||||
'delete-schedule' => null,
|
||||
],
|
||||
'database' => [
|
||||
'view-databases' => null,
|
||||
|
|
|
@ -55,7 +55,7 @@ class Task extends Model implements CleansAttributes, ValidableContract
|
|||
*/
|
||||
protected $fillable = [
|
||||
'schedule_id',
|
||||
'squence_id',
|
||||
'sequence_id',
|
||||
'action',
|
||||
'payload',
|
||||
'time_offset',
|
||||
|
@ -70,7 +70,7 @@ class Task extends Model implements CleansAttributes, ValidableContract
|
|||
protected $casts = [
|
||||
'id' => 'integer',
|
||||
'schedule_id' => 'integer',
|
||||
'squence_id' => 'integer',
|
||||
'sequence_id' => 'integer',
|
||||
'time_offset' => 'integer',
|
||||
'is_queued' => 'boolean',
|
||||
];
|
||||
|
@ -89,7 +89,7 @@ class Task extends Model implements CleansAttributes, ValidableContract
|
|||
*/
|
||||
protected static $applicationRules = [
|
||||
'schedule_id' => 'required',
|
||||
'squence_id' => 'required',
|
||||
'sequence_id' => 'required',
|
||||
'action' => 'required',
|
||||
'payload' => 'required',
|
||||
'time_offset' => 'required',
|
||||
|
@ -100,7 +100,7 @@ class Task extends Model implements CleansAttributes, ValidableContract
|
|||
*/
|
||||
protected static $dataIntegrityRules = [
|
||||
'schedule_id' => 'numeric|exists:schedules,id',
|
||||
'squence_id' => 'numeric|min:1',
|
||||
'sequence_id' => 'numeric|min:1',
|
||||
'action' => 'string',
|
||||
'payload' => 'string',
|
||||
'time_offset' => 'numeric|between:0,900',
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class UpdateOldPermissionsToPointToNewScheduleSystem extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
$permissions = DB::table('permissions')->where('permission', 'like', '%-task%')->get();
|
||||
foreach ($permissions as $record) {
|
||||
$parts = explode('-', $record->permission);
|
||||
if (! in_array(array_get($parts, 1), ['tasks', 'task']) || count($parts) !== 2) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$newPermission = $parts[0] . '-' . str_replace('task', 'schedule', $parts[1]);
|
||||
|
||||
DB::table('permissions')->where('id', '=', $record->id)->update(['permission' => $newPermission]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
$permissions = DB::table('permissions')->where('permission', 'like', '%-schedule%')->get();
|
||||
foreach ($permissions as $record) {
|
||||
$parts = explode('-', $record->permission);
|
||||
if (! in_array(array_get($parts, 1), ['schedules', 'schedule']) || count($parts) !== 2) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$newPermission = $parts[0] . '-' . str_replace('schedule', 'task', $parts[1]);
|
||||
|
||||
DB::table('permissions')->where('id', '=', $record->id)->update(['permission' => $newPermission]);
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because one or more lines are too long
|
@ -19,24 +19,24 @@
|
|||
// SOFTWARE.
|
||||
|
||||
$(document).ready(function () {
|
||||
$('[data-action="delete-task"]').click(function () {
|
||||
$('[data-action="delete-schedule"]').click(function () {
|
||||
var self = $(this);
|
||||
swal({
|
||||
type: 'error',
|
||||
title: 'Delete Task?',
|
||||
text: 'Are you sure you want to delete this task? There is no undo.',
|
||||
title: 'Delete Schedule?',
|
||||
text: 'Are you sure you want to delete this schedule? There is no undo.',
|
||||
showCancelButton: true,
|
||||
allowOutsideClick: true,
|
||||
closeOnConfirm: false,
|
||||
confirmButtonText: 'Delete Task',
|
||||
confirmButtonText: 'Delete Schedule',
|
||||
confirmButtonColor: '#d9534f',
|
||||
showLoaderOnConfirm: true
|
||||
}, function () {
|
||||
$.ajax({
|
||||
method: 'DELETE',
|
||||
url: Router.route('server.tasks.delete', {
|
||||
url: Router.route('server.schedules.delete', {
|
||||
server: Pterodactyl.server.uuidShort,
|
||||
task: self.data('taskid'),
|
||||
schedule: self.data('schedule-id'),
|
||||
}),
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content'),
|
||||
|
@ -45,7 +45,7 @@ $(document).ready(function () {
|
|||
swal({
|
||||
type: 'success',
|
||||
title: '',
|
||||
text: 'Task has been deleted.'
|
||||
text: 'Schedule has been deleted.'
|
||||
});
|
||||
self.parent().parent().slideUp();
|
||||
}).fail(function (jqXHR) {
|
||||
|
@ -53,18 +53,18 @@ $(document).ready(function () {
|
|||
swal({
|
||||
type: 'error',
|
||||
title: 'Whoops!',
|
||||
text: 'An error occured while attempting to delete this task.'
|
||||
text: 'An error occured while attempting to delete this schedule.'
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$('[data-action="toggle-task"]').click(function (event) {
|
||||
$('[data-action="toggle-schedule"]').click(function (event) {
|
||||
var self = $(this);
|
||||
swal({
|
||||
type: 'info',
|
||||
title: 'Toggle Task',
|
||||
text: 'This will toggle the selected task.',
|
||||
title: 'Toggle Schedule',
|
||||
text: 'This will toggle the selected schedule.',
|
||||
showCancelButton: true,
|
||||
allowOutsideClick: true,
|
||||
closeOnConfirm: false,
|
||||
|
@ -73,9 +73,9 @@ $(document).ready(function () {
|
|||
}, function () {
|
||||
$.ajax({
|
||||
method: 'POST',
|
||||
url: Router.route('server.tasks.toggle', {
|
||||
url: Router.route('server.schedules.toggle', {
|
||||
server: Pterodactyl.server.uuidShort,
|
||||
task: self.data('taskid'),
|
||||
schedule: self.data('schedule-id'),
|
||||
}),
|
||||
headers: {
|
||||
'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content'),
|
||||
|
@ -84,7 +84,7 @@ $(document).ready(function () {
|
|||
swal({
|
||||
type: 'success',
|
||||
title: '',
|
||||
text: 'Task has been toggled.'
|
||||
text: 'Schedule has been toggled.'
|
||||
});
|
||||
if (data.status !== 1) {
|
||||
self.parent().parent().addClass('muted muted-hover');
|
||||
|
@ -96,7 +96,7 @@ $(document).ready(function () {
|
|||
swal({
|
||||
type: 'error',
|
||||
title: 'Whoops!',
|
||||
text: 'An error occured while attempting to toggle this task.'
|
||||
text: 'An error occured while attempting to toggle this schedule.'
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -20,9 +20,9 @@
|
|||
|
||||
$(document).ready(function () {
|
||||
function setupSelect2() {
|
||||
$('select[name="chain[time_value][]"]').select2();
|
||||
$('select[name="chain[time_interval][]"]').select2();
|
||||
$('select[name="chain[action][]"]').select2();
|
||||
$('select[name="tasks[time_value][]"]').select2();
|
||||
$('select[name="tasks[time_interval][]"]').select2();
|
||||
$('select[name="tasks[action][]"]').select2();
|
||||
}
|
||||
|
||||
setupSelect2();
|
||||
|
|
|
@ -18,7 +18,7 @@ return [
|
|||
'create_file' => 'Create File',
|
||||
'upload_files' => 'Upload Files',
|
||||
'subusers' => 'Subusers',
|
||||
'task_management' => 'Task Management',
|
||||
'schedules' => 'Schedules',
|
||||
'configuration' => 'Configuration',
|
||||
'port_allocations' => 'Port Allocations',
|
||||
'sftp_settings' => 'SFTP Settings',
|
||||
|
|
|
@ -7,17 +7,30 @@ return [
|
|||
'header_sub' => 'Control your server in real time.',
|
||||
],
|
||||
'schedule' => [
|
||||
'header' => 'Schedule Manager',
|
||||
'header_sub' => 'Manage all of this server\'s schedules in one place.',
|
||||
'current' => 'Current Schedules',
|
||||
'new' => [
|
||||
'header' => 'Create New Schedule',
|
||||
'header_sub' => 'Create a new set of scheduled tasks for this server.',
|
||||
'submit' => 'Create Schedule',
|
||||
],
|
||||
'manage' => [
|
||||
'header' => 'Manage Schedule',
|
||||
'submit' => 'Update Schedule',
|
||||
'delete' => 'Delete Schedule',
|
||||
],
|
||||
'task' => [
|
||||
'time' => 'After',
|
||||
'action' => 'Perform Action',
|
||||
'payload' => 'With Payload',
|
||||
'add_more' => 'Add Another Task',
|
||||
],
|
||||
'actions' => [
|
||||
'command' => 'Send Command',
|
||||
'power' => 'Power Action',
|
||||
],
|
||||
'unnamed' => 'Unnamed Schedule',
|
||||
'setup' => 'Schedule Setup',
|
||||
'day_of_week' => 'Day of Week',
|
||||
'day_of_month' => 'Day of Month',
|
||||
|
@ -89,7 +102,7 @@ return [
|
|||
'file_header' => 'File Management',
|
||||
'subuser_header' => 'Subuser Management',
|
||||
'server_header' => 'Server Management',
|
||||
'task_header' => 'Task Management',
|
||||
'task_header' => 'Schedule Management',
|
||||
'sftp_header' => 'SFTP Management',
|
||||
'database_header' => 'Database Management',
|
||||
'power_start' => [
|
||||
|
@ -188,29 +201,33 @@ return [
|
|||
'title' => 'Edit Startup Command',
|
||||
'description' => 'Allows a user to modify startup variables for a server.',
|
||||
],
|
||||
'list_tasks' => [
|
||||
'title' => 'List Tasks',
|
||||
'description' => 'Allows a user to list all tasks (enabled and disabled) on a server.',
|
||||
'list_schedules' => [
|
||||
'title' => 'List Schedules',
|
||||
'description' => 'Allows a user to list all schedules (enabled and disabled) for this server.',
|
||||
],
|
||||
'view_task' => [
|
||||
'title' => 'View Task',
|
||||
'description' => 'Allows a user to view a specific task\'s details.',
|
||||
'view_schedule' => [
|
||||
'title' => 'View Schedule',
|
||||
'description' => 'Allows a user to view a specific schedule\'s details including all of the assigned tasks.',
|
||||
],
|
||||
'toggle_task' => [
|
||||
'title' => 'Toggle Task',
|
||||
'description' => 'Allows a user to toggle a task on or off.',
|
||||
'toggle_schedule' => [
|
||||
'title' => 'Toggle Schedule',
|
||||
'description' => 'Allows a user to toggle a schedule to be active or inactive.',
|
||||
],
|
||||
'queue_task' => [
|
||||
'title' => 'Queue Task',
|
||||
'description' => 'Allows a user to queue a task to run on next cycle.',
|
||||
'queue_schedule' => [
|
||||
'title' => 'Queue Schedule',
|
||||
'description' => 'Allows a user to queue a schedule to run it\'s tasks on the next process cycle.',
|
||||
],
|
||||
'create_task' => [
|
||||
'title' => 'Create Task',
|
||||
'description' => 'Allows a user to create new tasks.',
|
||||
'edit_schedule' => [
|
||||
'title' => 'Edit Schedule',
|
||||
'description' => 'Allows a user to edit a schedule including all of the schedule\'s tasks. This will allow the user to remove individual tasks, but not delete the schedule itself.',
|
||||
],
|
||||
'delete_task' => [
|
||||
'title' => 'Delete Task',
|
||||
'description' => 'Allows a user to delete a task.',
|
||||
'create_schedule' => [
|
||||
'title' => 'Create Schedule',
|
||||
'description' => 'Allows a user to create a new schedule.',
|
||||
],
|
||||
'delete_schedule' => [
|
||||
'title' => 'Delete Schedule',
|
||||
'description' => 'Allows a user to delete a schedule from the server.',
|
||||
],
|
||||
'view_sftp' => [
|
||||
'title' => 'View SFTP Details',
|
||||
|
|
|
@ -74,4 +74,13 @@ return [
|
|||
'tasks' => 'Tasks',
|
||||
'seconds' => 'Seconds',
|
||||
'minutes' => 'Minutes',
|
||||
'days' => [
|
||||
'sun' => 'Sunday',
|
||||
'mon' => 'Monday',
|
||||
'tues' => 'Tuesday',
|
||||
'wed' => 'Wednesday',
|
||||
'thurs' => 'Thursday',
|
||||
'fri' => 'Friday',
|
||||
'sat' => 'Saturday',
|
||||
],
|
||||
];
|
||||
|
|
|
@ -157,12 +157,12 @@
|
|||
@endcan
|
||||
@can('list-tasks', $server)
|
||||
<li
|
||||
@if(starts_with(Route::currentRouteName(), 'server.tasks'))
|
||||
@if(starts_with(Route::currentRouteName(), 'server.schedules'))
|
||||
class="active"
|
||||
@endif
|
||||
>
|
||||
<a href="{{ route('server.tasks', $server->uuidShort)}}">
|
||||
<i class="fa fa-clock-o"></i> <span>@lang('navigation.server.task_management')</span>
|
||||
<a href="{{ route('server.schedules', $server->uuidShort)}}">
|
||||
<i class="fa fa-clock-o"></i> <span>@lang('navigation.server.schedules')</span>
|
||||
<span class="pull-right-container">
|
||||
<span class="label label-primary pull-right">{{ \Pterodactyl\Models\Schedule::select('id')->where('server_id', $server->id)->where('is_active', 1)->count() }}</span>
|
||||
</span>
|
||||
|
|
|
@ -5,14 +5,14 @@
|
|||
<label class="control-label">@lang('server.schedule.task.time')</label>
|
||||
<div class="row">
|
||||
<div class="col-xs-4">
|
||||
<select name="chain[time_value][]" class="form-control">
|
||||
<select name="tasks[time_value][]" class="form-control">
|
||||
@foreach(range(0, 59) as $number)
|
||||
<option value="{{ $number }}">{{ $number }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-xs-8">
|
||||
<select name="chain[time_interval][]" class="form-control">
|
||||
<select name="tasks[time_interval][]" class="form-control">
|
||||
<option value="s">@lang('strings.seconds')</option>
|
||||
<option value="m">@lang('strings.minutes')</option>
|
||||
</select>
|
||||
|
@ -22,16 +22,16 @@
|
|||
<div class="form-group col-md-3">
|
||||
<label class="control-label">@lang('server.schedule.task.action')</label>
|
||||
<div>
|
||||
<select name="chain[action][]" class="form-control">
|
||||
<option value="command">@lang('server.tasks.actions.command')</option>
|
||||
<option value="power">@lang('server.tasks.actions.power')</option>
|
||||
<select name="tasks[action][]" class="form-control">
|
||||
<option value="command">@lang('server.schedule.actions.command')</option>
|
||||
<option value="power">@lang('server.schedule.actions.power')</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-md-6">
|
||||
<label class="control-label">@lang('server.schedule.task.payload')</label>
|
||||
<div data-attribute="remove-task-element">
|
||||
<input type="text" name="chain[payload][]" class="form-control">
|
||||
<input type="text" name="tasks[payload][]" class="form-control">
|
||||
<div class="input-group-btn hidden">
|
||||
<button type="button" class="btn btn-danger" data-action="remove-task"><i class="fa fa-close"></i></button>
|
||||
</div>
|
||||
|
|
|
@ -20,15 +20,15 @@
|
|||
@extends('layouts.master')
|
||||
|
||||
@section('title')
|
||||
@lang('server.tasks.header')
|
||||
@lang('server.schedules.header')
|
||||
@endsection
|
||||
|
||||
@section('content-header')
|
||||
<h1>@lang('server.tasks.header')<small>@lang('server.tasks.header_sub')</small></h1>
|
||||
<h1>@lang('server.schedule.header')<small>@lang('server.schedule.header_sub')</small></h1>
|
||||
<ol class="breadcrumb">
|
||||
<li><a href="{{ route('index') }}">@lang('strings.home')</a></li>
|
||||
<li><a href="{{ route('server.index', $server->uuidShort) }}">{{ $server->name }}</a></li>
|
||||
<li class="active">@lang('navigation.server.task_management')</li>
|
||||
<li class="active">@lang('navigation.server.schedules')</li>
|
||||
</ol>
|
||||
@endsection
|
||||
|
||||
|
@ -37,9 +37,9 @@
|
|||
<div class="col-xs-12">
|
||||
<div class="box">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">@lang('server.tasks.current')</h3>
|
||||
<h3 class="box-title">@lang('server.schedule.current')</h3>
|
||||
<div class="box-tools">
|
||||
<a href="{{ route('server.tasks.new', $server->uuidShort) }}"><button class="btn btn-primary btn-sm">Create New</button></a>
|
||||
<a href="{{ route('server.schedules.new', $server->uuidShort) }}"><button class="btn btn-primary btn-sm">Create New</button></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-body table-responsive no-padding">
|
||||
|
@ -58,9 +58,9 @@
|
|||
<tr @if(! $schedule->is_active)class="muted muted-hover"@endif>
|
||||
<td class="middle">
|
||||
@can('edit-schedule', $server)
|
||||
<a href="{{ route('server.tasks.view', ['server' => $server->uuidShort, '$schedule' => $schedule->hashid]) }}">{{ $schedule->name }}</a>
|
||||
<a href="{{ route('server.schedules.view', ['server' => $server->uuidShort, '$schedule' => $schedule->hashid]) }}">{{ $schedule->name }}</a>
|
||||
@else
|
||||
{{ $schedule->name }}
|
||||
{{ $schedule->name ?? trans('server.schedule.unnamed') }}
|
||||
@endcan
|
||||
</td>
|
||||
<td class="middle text-center">
|
||||
|
@ -90,10 +90,10 @@
|
|||
@endif
|
||||
</td>
|
||||
@can('delete-schedule', $server)
|
||||
<td class="text-center middle"><a href="#" data-action="delete-task" data-taskid="{{ $schedule->hashid }}"><i class="fa fa-fw fa-trash-o text-danger" data-toggle="tooltip" data-placement="top" title="@lang('strings.delete')"></i></a></td>
|
||||
<td class="text-center middle"><a href="#" data-action="delete-schedule" data-schedule-id="{{ $schedule->hashid }}"><i class="fa fa-fw fa-trash-o text-danger" data-toggle="tooltip" data-placement="top" title="@lang('strings.delete')"></i></a></td>
|
||||
@endcan
|
||||
@can('toggle-schedule', $server)
|
||||
<td class="text-center middle"><a href="#" data-action="toggle-task" data-active="{{ $schedule->active }}" data-taskid="{{ $schedule->hashid }}"><i class="fa fa-fw fa-eye-slash text-primary" data-toggle="tooltip" data-placement="top" title="@lang('server.tasks.toggle')"></i></a></td>
|
||||
<td class="text-center middle"><a href="#" data-action="toggle-schedule" data-active="{{ $schedule->active }}" data-schedule-id="{{ $schedule->hashid }}"><i class="fa fa-fw fa-eye-slash text-primary" data-toggle="tooltip" data-placement="top" title="@lang('server.schedules.toggle')"></i></a></td>
|
||||
@endcan
|
||||
</tr>
|
||||
@endforeach
|
|
@ -20,7 +20,7 @@
|
|||
@extends('layouts.master')
|
||||
|
||||
@section('title')
|
||||
@lang('server.tasks.new.header')
|
||||
@lang('server.schedules.new.header')
|
||||
@endsection
|
||||
|
||||
@section('scripts')
|
||||
|
@ -34,13 +34,13 @@
|
|||
<ol class="breadcrumb">
|
||||
<li><a href="{{ route('index') }}">@lang('strings.home')</a></li>
|
||||
<li><a href="{{ route('server.index', $server->uuidShort) }}">{{ $server->name }}</a></li>
|
||||
<li><a href="{{ route('server.tasks', $server->uuidShort) }}">@lang('navigation.server.task_management')</a></li>
|
||||
<li><a href="{{ route('server.schedules', $server->uuidShort) }}">@lang('navigation.server.schedules')</a></li>
|
||||
<li class="active">@lang('server.schedule.new.header')</li>
|
||||
</ol>
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<form action="{{ route('server.tasks.new', $server->uuidShort) }}" method="POST">
|
||||
<form action="{{ route('server.schedules.new', $server->uuidShort) }}" method="POST">
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="box box-primary">
|
||||
|
@ -61,26 +61,26 @@
|
|||
<div class="form-group">
|
||||
<label for="scheduleDayOfWeek" class="control-label">@lang('server.schedule.day_of_week')</label>
|
||||
<div>
|
||||
<select data-action="update-field" data-field="day_of_week" class="form-control" multiple>
|
||||
<option value="0">@lang('server.tasks.new.sun')</option>
|
||||
<option value="1">@lang('server.tasks.new.mon')</option>
|
||||
<option value="2">@lang('server.tasks.new.tues')</option>
|
||||
<option value="3">@lang('server.tasks.new.wed')</option>
|
||||
<option value="4">@lang('server.tasks.new.thurs')</option>
|
||||
<option value="5">@lang('server.tasks.new.fri')</option>
|
||||
<option value="6">@lang('server.tasks.new.sat')</option>
|
||||
<select data-action="update-field" data-field="cron_day_of_week" class="form-control" multiple>
|
||||
<option value="0">@lang('strings.days.sun')</option>
|
||||
<option value="1">@lang('strings.days.mon')</option>
|
||||
<option value="2">@lang('strings.days.tues')</option>
|
||||
<option value="3">@lang('strings.days.wed')</option>
|
||||
<option value="4">@lang('strings.days.thurs')</option>
|
||||
<option value="5">@lang('strings.days.fri')</option>
|
||||
<option value="6">@lang('strings.days.sat')</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="text" id="scheduleDayOfWeek" class="form-control" name="day_of_week" value="{{ old('day_of_week') }}" />
|
||||
<input type="text" id="scheduleDayOfWeek" class="form-control" name="cron_day_of_week" value="{{ old('cron_day_of_week') }}" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-6 col-md-3">
|
||||
<div class="form-group">
|
||||
<label for="scheduleDayOfMonth" class="control-label">@lang('server.schedule.day_of_month')</label>
|
||||
<div>
|
||||
<select data-action="update-field" data-field="day_of_month" class="form-control" multiple>
|
||||
<select data-action="update-field" data-field="cron_day_of_month" class="form-control" multiple>
|
||||
@foreach(range(1, 31) as $i)
|
||||
<option value="{{ $i }}">{{ $i }}</option>
|
||||
@endforeach
|
||||
|
@ -88,14 +88,14 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="text" id="scheduleDayOfMonth" class="form-control" name="day_of_month" value="{{ old('day_of_month') }}" />
|
||||
<input type="text" id="scheduleDayOfMonth" class="form-control" name="cron_day_of_month" value="{{ old('cron_day_of_month') }}" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-6 col-md-3">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="scheduleHour" class="control-label">@lang('server.schedule.hour')</label>
|
||||
<div>
|
||||
<select data-action="update-field" data-field="hour" class="form-control" multiple>
|
||||
<select data-action="update-field" data-field="cron_hour" class="form-control" multiple>
|
||||
@foreach(range(0, 23) as $i)
|
||||
<option value="{{ $i }}">{{ str_pad($i, 2, '0', STR_PAD_LEFT) }}:00</option>
|
||||
@endforeach
|
||||
|
@ -103,14 +103,14 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
<input type="text" id="scheduleHour" class="form-control" name="hour" value="{{ old('hour') }}" />
|
||||
<input type="text" id="scheduleHour" class="form-control" name="cron_hour" value="{{ old('cron_hour') }}" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-6 col-md-3">
|
||||
<div class="form-group">
|
||||
<label for="scheduleMinute" class="control-label">@lang('server.schedule.minute')</label>
|
||||
<div>
|
||||
<select data-action="update-field" data-field="minute" class="form-control" multiple>
|
||||
<select data-action="update-field" data-field="cron_minute" class="form-control" multiple>
|
||||
@foreach(range(0, 55) as $i)
|
||||
@if($i % 5 === 0)
|
||||
<option value="{{ $i }}">_ _:{{ str_pad($i, 2, '0', STR_PAD_LEFT) }}</option>
|
||||
|
@ -120,7 +120,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="text" id="scheduleMinute" class="form-control" name="minute" value="{{ old('minute') }}" />
|
||||
<input type="text" id="scheduleMinute" class="form-control" name="cron_minute" value="{{ old('cron_minute') }}" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -136,7 +136,7 @@
|
|||
<div class="box box-primary" id="containsTaskList">
|
||||
@include('partials.schedules.task-template')
|
||||
<div class="box-footer with-border" id="taskAppendBefore">
|
||||
<div class="pull-left">
|
||||
<div>
|
||||
<p class="text-muted small">@lang('server.schedule.task_help')</p>
|
||||
</div>
|
||||
<div class="pull-right">
|
177
resources/themes/pterodactyl/server/schedules/view.blade.php
Normal file
177
resources/themes/pterodactyl/server/schedules/view.blade.php
Normal file
|
@ -0,0 +1,177 @@
|
|||
{{-- Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com> --}}
|
||||
|
||||
{{-- Permission is hereby granted, free of charge, to any person obtaining a copy --}}
|
||||
{{-- of this software and associated documentation files (the "Software"), to deal --}}
|
||||
{{-- in the Software without restriction, including without limitation the rights --}}
|
||||
{{-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell --}}
|
||||
{{-- copies of the Software, and to permit persons to whom the Software is --}}
|
||||
{{-- furnished to do so, subject to the following conditions: --}}
|
||||
|
||||
{{-- The above copyright notice and this permission notice shall be included in all --}}
|
||||
{{-- copies or substantial portions of the Software. --}}
|
||||
|
||||
{{-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR --}}
|
||||
{{-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, --}}
|
||||
{{-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE --}}
|
||||
{{-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER --}}
|
||||
{{-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, --}}
|
||||
{{-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE --}}
|
||||
{{-- SOFTWARE. --}}
|
||||
@extends('layouts.master')
|
||||
|
||||
@section('title')
|
||||
@lang('server.schedules.edit.header')
|
||||
@endsection
|
||||
|
||||
@section('scripts')
|
||||
{{-- This has to be loaded before the AdminLTE theme to avoid dropdown issues. --}}
|
||||
{!! Theme::css('vendor/select2/select2.min.css') !!}
|
||||
@parent
|
||||
@endsection
|
||||
|
||||
@section('content-header')
|
||||
<h1>@lang('server.schedule.manage.header')<small>{{ $schedule->name }}</small></h1>
|
||||
<ol class="breadcrumb">
|
||||
<li><a href="{{ route('index') }}">@lang('strings.home')</a></li>
|
||||
<li><a href="{{ route('server.index', $server->uuidShort) }}">{{ $server->name }}</a></li>
|
||||
<li><a href="{{ route('server.schedules', $server->uuidShort) }}">@lang('navigation.server.schedules')</a></li>
|
||||
<li class="active">@lang('server.schedule.manage.header')</li>
|
||||
</ol>
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<form action="{{ route('server.schedules.view', ['server' => $server->uuidShort, 'schedule' => $schedule->hashid]) }}" method="POST">
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="box box-primary">
|
||||
<div class="box-body">
|
||||
<div class="row">
|
||||
<div class="form-group col-xs-12">
|
||||
<label class="control-label" for="scheduleName">@lang('strings.name') <span class="field-optional"></span></label>
|
||||
<div>
|
||||
<input type="text" name="name" class="form-control" id="scheduleName" value="{{ old('name', $schedule->name) }}" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-6 col-md-3">
|
||||
<div class="form-group">
|
||||
<label for="scheduleDayOfWeek" class="control-label">@lang('server.schedule.day_of_week')</label>
|
||||
<div>
|
||||
<select data-action="update-field" data-field="cron_day_of_week" class="form-control" multiple>
|
||||
<option value="0">@lang('strings.days.sun')</option>
|
||||
<option value="1">@lang('strings.days.mon')</option>
|
||||
<option value="2">@lang('strings.days.tues')</option>
|
||||
<option value="3">@lang('strings.days.wed')</option>
|
||||
<option value="4">@lang('strings.days.thurs')</option>
|
||||
<option value="5">@lang('strings.days.fri')</option>
|
||||
<option value="6">@lang('strings.days.sat')</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="text" id="scheduleDayOfWeek" class="form-control" name="cron_day_of_week" value="{{ old('cron_day_of_week', $schedule->cron_day_of_week) }}" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-6 col-md-3">
|
||||
<div class="form-group">
|
||||
<label for="scheduleDayOfMonth" class="control-label">@lang('server.schedule.day_of_month')</label>
|
||||
<div>
|
||||
<select data-action="update-field" data-field="cron_day_of_month" class="form-control" multiple>
|
||||
@foreach(range(1, 31) as $i)
|
||||
<option value="{{ $i }}">{{ $i }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="text" id="scheduleDayOfMonth" class="form-control" name="cron_day_of_month" value="{{ old('cron_day_of_month', $schedule->cron_day_of_month) }}" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-6 col-md-3">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="scheduleHour" class="control-label">@lang('server.schedule.hour')</label>
|
||||
<div>
|
||||
<select data-action="update-field" data-field="cron_hour" class="form-control" multiple>
|
||||
@foreach(range(0, 23) as $i)
|
||||
<option value="{{ $i }}">{{ str_pad($i, 2, '0', STR_PAD_LEFT) }}:00</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
<input type="text" id="scheduleHour" class="form-control" name="cron_hour" value="{{ old('cron_hour', $schedule->cron_hour) }}" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-xs-6 col-md-3">
|
||||
<div class="form-group">
|
||||
<label for="scheduleMinute" class="control-label">@lang('server.schedule.minute')</label>
|
||||
<div>
|
||||
<select data-action="update-field" data-field="cron_minute" class="form-control" multiple>
|
||||
@foreach(range(0, 55) as $i)
|
||||
@if($i % 5 === 0)
|
||||
<option value="{{ $i }}">_ _:{{ str_pad($i, 2, '0', STR_PAD_LEFT) }}</option>
|
||||
@endif
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="text" id="scheduleMinute" class="form-control" name="cron_minute" value="{{ old('cron_minute', $schedule->cron_minute) }}" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-footer with-border">
|
||||
<p class="small text-muted no-margin-bottom">@lang('server.schedule.time_help')</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="box box-primary" id="containsTaskList">
|
||||
@include('partials.schedules.task-template')
|
||||
<div class="box-footer with-border" id="taskAppendBefore">
|
||||
<div>
|
||||
<p class="text-muted small">@lang('server.schedule.task_help')</p>
|
||||
</div>
|
||||
<div class="pull-left">
|
||||
<button type="submit" class="btn btn-sm btn-danger muted muted-hover" id="deleteButton" name="_method" value="DELETE"><i class="fa fa-trash-o"></i></button>
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
{!! csrf_field() !!}
|
||||
<button type="button" class="btn btn-sm btn-default" data-action="add-new-task"><i class="fa fa-plus"></i> @lang('server.schedule.task.add_more')</button>
|
||||
<button type="submit" class="btn btn-sm btn-success" name="_method" value="PATCH">@lang('server.schedule.manage.submit')</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
@endsection
|
||||
|
||||
@section('footer-scripts')
|
||||
@parent
|
||||
{!! Theme::js('js/frontend/server.socket.js') !!}
|
||||
{!! Theme::js('vendor/select2/select2.full.min.js') !!}
|
||||
{!! Theme::js('js/frontend/tasks/view-actions.js') !!}
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$('#deleteButton').on('mouseenter', function () {
|
||||
$(this).find('i').html(' @lang('server.schedule.manage.delete')');
|
||||
}).on('mouseleave', function () {
|
||||
$(this).find('i').html('');
|
||||
});
|
||||
$.each(Pterodactyl.tasks, function (index, value) {
|
||||
var element = (index !== 0) ? $('button[data-action="add-new-task"]').trigger('click').data('element') : $('div[data-target="task-clone"]');
|
||||
var timeValue = (value.time_offset > 59) ? value.time_offset / 60 : value.time_offset;
|
||||
var timeInterval = (value.time_offset > 59) ? 'm' : 's';
|
||||
element.find('select[name="tasks[time_value][]"]').val(timeValue).trigger('change');
|
||||
element.find('select[name="tasks[time_interval][]"]').val(timeInterval).trigger('change');
|
||||
element.find('select[name="tasks[action][]"]').val(value.action).trigger('change');
|
||||
element.find('input[name="tasks[payload][]"]').val(value.payload);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endsection
|
|
@ -1,230 +0,0 @@
|
|||
{{-- Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com> --}}
|
||||
|
||||
{{-- Permission is hereby granted, free of charge, to any person obtaining a copy --}}
|
||||
{{-- of this software and associated documentation files (the "Software"), to deal --}}
|
||||
{{-- in the Software without restriction, including without limitation the rights --}}
|
||||
{{-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell --}}
|
||||
{{-- copies of the Software, and to permit persons to whom the Software is --}}
|
||||
{{-- furnished to do so, subject to the following conditions: --}}
|
||||
|
||||
{{-- The above copyright notice and this permission notice shall be included in all --}}
|
||||
{{-- copies or substantial portions of the Software. --}}
|
||||
|
||||
{{-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR --}}
|
||||
{{-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, --}}
|
||||
{{-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE --}}
|
||||
{{-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER --}}
|
||||
{{-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, --}}
|
||||
{{-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE --}}
|
||||
{{-- SOFTWARE. --}}
|
||||
@extends('layouts.master')
|
||||
|
||||
@section('title')
|
||||
@lang('server.tasks.edit.header')
|
||||
@endsection
|
||||
|
||||
@section('scripts')
|
||||
{{-- This has to be loaded before the AdminLTE theme to avoid dropdown issues. --}}
|
||||
{!! Theme::css('vendor/select2/select2.min.css') !!}
|
||||
@parent
|
||||
@endsection
|
||||
|
||||
@section('content-header')
|
||||
<h1>@lang('server.tasks.edit.header')<small>{{ $task->name }}</small></h1>
|
||||
<ol class="breadcrumb">
|
||||
<li><a href="{{ route('index') }}">@lang('strings.home')</a></li>
|
||||
<li><a href="{{ route('server.index', $server->uuidShort) }}">{{ $server->name }}</a></li>
|
||||
<li><a href="{{ route('server.tasks', $server->uuidShort) }}">@lang('navigation.server.task_management')</a></li>
|
||||
<li class="active">@lang('server.users.update')</li>
|
||||
</ol>
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<form action="{{ route('server.tasks.view', ['server' => $server->uuidShort, 'task' => $task->hashid]) }}" method="POST">
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="box box-primary">
|
||||
<div class="box-body">
|
||||
<div class="row">
|
||||
<div class="form-group col-xs-12">
|
||||
<label class="control-label">@lang('server.tasks.new.task_name'):</label>
|
||||
<div>
|
||||
<input type="text" name="name" class="form-control" value="{{ old('name', $task->name) }}" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-3 col-sm-6">
|
||||
<div class="box">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">@lang('server.tasks.new.day_of_week')</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<div class="row">
|
||||
<div class="form-group col-md-12">
|
||||
<div>
|
||||
<select data-action="update-field" data-field="day_of_week" class="form-control" multiple>
|
||||
<option value="0">@lang('server.tasks.new.sun')</option>
|
||||
<option value="1">@lang('server.tasks.new.mon')</option>
|
||||
<option value="2">@lang('server.tasks.new.tues')</option>
|
||||
<option value="3">@lang('server.tasks.new.wed')</option>
|
||||
<option value="4">@lang('server.tasks.new.thurs')</option>
|
||||
<option value="5">@lang('server.tasks.new.fri')</option>
|
||||
<option value="6">@lang('server.tasks.new.sat')</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
<label class="control-label">@lang('server.tasks.new.custom')</label>
|
||||
<div>
|
||||
<input type="text" class="form-control" name="day_of_week" value="{{ old('day_of_week', $task->day_of_week) }}"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3 col-sm-6">
|
||||
<div class="box">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">@lang('server.tasks.new.day_of_month')</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<div class="row">
|
||||
<div class="form-group col-md-12">
|
||||
<div>
|
||||
<select data-action="update-field" data-field="day_of_month" class="form-control" multiple>
|
||||
@foreach(range(1, 31) as $i)
|
||||
<option value="{{ $i }}">{{ $i }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
<label class="control-label">@lang('server.tasks.new.custom')</label>
|
||||
<div>
|
||||
<input type="text" class="form-control" name="day_of_month" value="{{ old('day_of_month', $task->day_of_month) }}"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3 col-sm-6">
|
||||
<div class="box">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">@lang('server.tasks.new.hour')</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<div class="row">
|
||||
<div class="form-group col-md-12">
|
||||
<div>
|
||||
<select data-action="update-field" data-field="hour" class="form-control" multiple>
|
||||
@foreach(range(0, 23) as $i)
|
||||
<option value="{{ $i }}">{{ str_pad($i, 2, '0', STR_PAD_LEFT) }}:00</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
<label class="control-label">@lang('server.tasks.new.custom')</label>
|
||||
<div>
|
||||
<input type="text" class="form-control" name="hour" value="{{ old('hour', $task->hour) }}"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3 col-sm-6">
|
||||
<div class="box">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">@lang('server.tasks.new.minute')</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<div class="row">
|
||||
<div class="form-group col-md-12">
|
||||
<div>
|
||||
<select data-action="update-field" data-field="minute" class="form-control" multiple>
|
||||
@foreach(range(0, 55) as $i)
|
||||
@if($i % 5 === 0)
|
||||
<option value="{{ $i }}">_ _:{{ str_pad($i, 2, '0', STR_PAD_LEFT) }}</option>
|
||||
@endif
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
<label class="control-label">@lang('server.tasks.new.custom')</label>
|
||||
<div>
|
||||
<input type="text" class="form-control" name="minute" value="{{ old('minute', $task->minute) }}"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<div class="box box-primary">
|
||||
<div class="box-body">
|
||||
<div class="row">
|
||||
<div class="form-group col-md-4">
|
||||
<label class="control-label">@lang('server.tasks.new.type'):</label>
|
||||
<div>
|
||||
<select name="action" class="form-control">
|
||||
<option value="command" @if($task->action === 'command')selected @endif>@lang('server.tasks.actions.command')</option>
|
||||
<option value="power" @if($task->action === 'power')selected @endif>@lang('server.tasks.actions.power')</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group col-md-8">
|
||||
<label class="control-label">@lang('server.tasks.new.payload'):</label>
|
||||
<div>
|
||||
<input type="text" name="data" class="form-control" value="{{ old('data', $task->data) }}">
|
||||
<span class="text-muted small">@lang('server.tasks.new.payload_help')</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="box-footer with-border" id="chainLastSegment">
|
||||
<div class="pull-left">
|
||||
<p class="text-muted small">Times for chain arguments are relative to the previous argument.</p>
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
{!! csrf_field() !!}
|
||||
<button type="button" class="btn btn-sm btn-default" data-action="add-chain"><i class="fa fa-plus"></i> New Chain Argument</button>
|
||||
<button type="submit" name="_method" value="PATCH" class="btn btn-sm btn-success">@lang('server.tasks.edit.submit')</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
@include('partials.tasks.chain-template')
|
||||
@endsection
|
||||
|
||||
@section('footer-scripts')
|
||||
@parent
|
||||
{!! Theme::js('js/frontend/server.socket.js') !!}
|
||||
{!! Theme::js('vendor/select2/select2.full.min.js') !!}
|
||||
{!! Theme::js('js/frontend/tasks/view-actions.js') !!}
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
$.each(Pterodactyl.chained, function (index, value) {
|
||||
var element = $('button[data-action="add-chain"]').trigger('click').data('element');
|
||||
var timeValue = (value.chain_delay > 60) ? value.chain_delay / 60 : value.chain_delay;
|
||||
var timeInterval = (value.chain_delay > 60) ? 'm' : 's';
|
||||
element.find('select[name="chain[time_value][]"]').val(timeValue).trigger('change');
|
||||
element.find('select[name="chain[time_interval][]"]').val(timeInterval).trigger('change');
|
||||
element.find('select[name="chain[action][]"]').val(value.action).trigger('change');
|
||||
element.find('input[name="chain[payload][]"]').val(value.data);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endsection
|
|
@ -91,16 +91,16 @@ Route::group(['prefix' => 'users'], function () {
|
|||
|
|
||||
*/
|
||||
Route::group(['prefix' => 'schedules'], function () {
|
||||
Route::get('/', 'Tasks\TaskManagementController@index')->name('server.tasks');
|
||||
Route::get('/new', 'Tasks\TaskManagementController@create')->name('server.tasks.new');
|
||||
Route::get('/view/{schedule}', 'Tasks\TaskManagementController@view')->middleware(ScheduleAccess::class)->name('server.tasks.view');
|
||||
Route::get('/', 'Tasks\TaskManagementController@index')->name('server.schedules');
|
||||
Route::get('/new', 'Tasks\TaskManagementController@create')->name('server.schedules.new');
|
||||
Route::get('/view/{schedule}', 'Tasks\TaskManagementController@view')->middleware(ScheduleAccess::class)->name('server.schedules.view');
|
||||
|
||||
Route::post('/new', 'Tasks\TaskManagementController@store');
|
||||
|
||||
Route::patch('/view/{schedule}', 'Tasks\TaskManagementController@update')->middleware(ScheduleAccess::class);
|
||||
Route::patch('/view/{schedule}/toggle', 'Tasks\TaskToggleController@index')->middleware(ScheduleAccess::class)->name('server.tasks.toggle');
|
||||
Route::patch('/view/{schedule}/toggle', 'Tasks\TaskToggleController@index')->middleware(ScheduleAccess::class)->name('server.schedules.toggle');
|
||||
|
||||
Route::delete('/view/{schedule}/delete', 'Tasks\TaskManagementController@delete')->middleware(ScheduleAccess::class)->name('server.tasks.delete');
|
||||
Route::delete('/view/{schedule}/delete', 'Tasks\TaskManagementController@delete')->middleware(ScheduleAccess::class)->name('server.schedules.delete');
|
||||
});
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue