mirror of
https://github.com/pelican-dev/panel.git
synced 2025-06-28 00:31:07 +02:00
Schedule task improvements (#1468)
This commit is contained in:
parent
68f72b9b4d
commit
4d0aabe91e
@ -6,6 +6,7 @@ use App\Facades\Activity;
|
||||
use App\Models\Schedule;
|
||||
use App\Models\Task;
|
||||
use Filament\Forms\Components\Field;
|
||||
use Filament\Forms\Set;
|
||||
use Filament\Tables\Actions\DeleteAction;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
@ -45,10 +46,11 @@ class TasksRelationManager extends RelationManager
|
||||
Select::make('action')
|
||||
->required()
|
||||
->live()
|
||||
->disableOptionWhen(fn (string $value): bool => $value === Task::ACTION_BACKUP && $schedule->server->backup_limit === 0)
|
||||
->disableOptionWhen(fn (string $value) => $value === Task::ACTION_BACKUP && $schedule->server->backup_limit === 0)
|
||||
->options($this->getActionOptions())
|
||||
->selectablePlaceholder(false)
|
||||
->default(Task::ACTION_POWER),
|
||||
->default(Task::ACTION_POWER)
|
||||
->afterStateUpdated(fn ($state, Set $set) => $set('payload', $state === Task::ACTION_POWER ? 'restart' : null)),
|
||||
Textarea::make('payload')
|
||||
->hidden(fn (Get $get) => $get('action') === Task::ACTION_POWER)
|
||||
->label(fn (Get $get) => $this->getActionOptions(false)[$get('action')] ?? 'Payload'),
|
||||
@ -81,7 +83,8 @@ class TasksRelationManager extends RelationManager
|
||||
$schedule = $this->getOwnerRecord();
|
||||
|
||||
return $table
|
||||
->reorderable('sequence_id', true)
|
||||
->reorderable('sequence_id')
|
||||
->defaultSort('sequence_id')
|
||||
->columns([
|
||||
TextColumn::make('action')
|
||||
->state(fn (Task $task) => $this->getActionOptions()[$task->action] ?? $task->action),
|
||||
|
Loading…
x
Reference in New Issue
Block a user