mirror of
https://github.com/pelican-dev/panel.git
synced 2025-07-28 16:32:36 +02:00
Add restore to simplify form
This commit is contained in:
parent
d4484f5254
commit
48fd3cc84e
@ -461,6 +461,13 @@ class EditServer extends EditRecord
|
|||||||
Forms\Components\Textarea::make('startup')
|
Forms\Components\Textarea::make('startup')
|
||||||
->label('Startup Command')
|
->label('Startup Command')
|
||||||
->required()
|
->required()
|
||||||
|
->hintAction(Forms\Components\Actions\Action::make('startup-restore')
|
||||||
|
->label('Restore Default')
|
||||||
|
->icon('tabler-restore')
|
||||||
|
->action(fn (Forms\Get $get, Forms\Set $set) =>
|
||||||
|
$set('startup', Egg::find($get('egg_id'))?->startup ?? '')
|
||||||
|
)
|
||||||
|
)
|
||||||
->columnSpan([
|
->columnSpan([
|
||||||
'default' => 2,
|
'default' => 2,
|
||||||
'sm' => 4,
|
'sm' => 4,
|
||||||
@ -474,22 +481,6 @@ class EditServer extends EditRecord
|
|||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
|
|
||||||
Forms\Components\Textarea::make('defaultStartup')
|
|
||||||
->hintAction(CopyAction::make())
|
|
||||||
->label('Default Startup Command')
|
|
||||||
->disabled()
|
|
||||||
->formatStateUsing(function ($state, Forms\Get $get, Forms\Set $set) {
|
|
||||||
$egg = Egg::query()->find($get('egg_id'));
|
|
||||||
|
|
||||||
return $egg->startup;
|
|
||||||
})
|
|
||||||
->columnSpan([
|
|
||||||
'default' => 2,
|
|
||||||
'sm' => 4,
|
|
||||||
'md' => 4,
|
|
||||||
'lg' => 6,
|
|
||||||
]),
|
|
||||||
|
|
||||||
Forms\Components\Repeater::make('server_variables')
|
Forms\Components\Repeater::make('server_variables')
|
||||||
->relationship('serverVariables')
|
->relationship('serverVariables')
|
||||||
->grid()
|
->grid()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user