Add toggle for starting server after install

This commit is contained in:
notCharles 2024-08-24 21:05:43 -04:00
parent 58307c15a3
commit e152efc5f9

View File

@ -321,9 +321,9 @@ class CreateServer extends CreateRecord
->completedIcon('tabler-check')
->columns([
'default' => 1,
'sm' => 2,
'md' => 2,
'lg' => 4,
'sm' => 4,
'md' => 4,
'lg' => 6,
])
->schema([
Forms\Components\Select::make('egg_id')
@ -333,7 +333,7 @@ class CreateServer extends CreateRecord
'default' => 1,
'sm' => 2,
'md' => 2,
'lg' => 3,
'lg' => 4,
])
->searchable()
->preload()
@ -390,29 +390,51 @@ class CreateServer extends CreateRecord
->inline()
->required(),
Forms\Components\ToggleButtons::make('start_on_completion')
->label('Start Server After Install?')
->default(true)
->required()
->columnSpan([
'default' => 1,
'sm' => 1,
'md' => 1,
'lg' => 1,
])
->options([
true => 'Yes',
false => 'No',
])
->colors([
true => 'primary',
false => 'danger',
])
->icons([
true => 'tabler-code',
false => 'tabler-code-off',
])
->inline(),
Forms\Components\Textarea::make('startup')
->hintIcon('tabler-code')
->label('Startup Command')
->hidden(fn (Forms\Get $get) => $get('egg_id') === null)
->required()
->live()
->columnSpan([
'default' => 1,
'sm' => 2,
'md' => 2,
'lg' => 4,
])
->rows(function ($state) {
return str($state)->explode("\n")->reduce(
fn (int $carry, $line) => $carry + floor(strlen($line) / 125),
1
);
}),
})
->columnSpan([
'default' => 1,
'sm' => 4,
'md' => 4,
'lg' => 6,
]),
Forms\Components\Hidden::make('environment')->default([]),
Forms\Components\Hidden::make('start_on_completion')->default(true),
Forms\Components\Section::make('Variables')
->icon('tabler-eggs')
->iconColor('primary')