start frontend update

This commit is contained in:
Boy132 2025-09-04 09:22:55 +02:00
parent a4bc001728
commit 4b32eef0c6
5 changed files with 24 additions and 16 deletions

View File

@ -78,14 +78,16 @@ class CreateEgg extends CreateRecord
->rows(2)
->columnSpanFull()
->helperText(trans('admin/egg.description_help')),
Textarea::make('startup')
->label(trans('admin/egg.startup'))
->rows(3)
KeyValue::make('startup_commands')
->label(trans('admin/egg.startup_commands'))
->live()
->columnSpanFull()
->required()
->placeholder(implode("\n", [
'java -Xms128M -XX:MaxRAMPercentage=95.0 -jar {{SERVER_JARFILE}}',
]))
->addActionLabel(trans('admin/egg.add_startup'))
->keyLabel(trans('admin/egg.startup_name'))
->keyPlaceholder('Default')
->valueLabel(trans('admin/egg.startup_command'))
->valuePlaceholder('java -Xms128M -XX:MaxRAMPercentage=95.0 -jar {{SERVER_JARFILE}}')
->helperText(trans('admin/egg.startup_help')),
TagsInput::make('file_denylist')
->label(trans('admin/egg.file_denylist'))

View File

@ -75,11 +75,14 @@ class EditEgg extends EditRecord
->disabled()
->columnSpan(['default' => 1, 'sm' => 1, 'md' => 2, 'lg' => 2])
->helperText(trans('admin/egg.author_help_edit')),
Textarea::make('startup')
->label(trans('admin/egg.startup'))
->rows(3)
KeyValue::make('startup_commands')
->label(trans('admin/egg.startup_commands'))
->live()
->columnSpanFull()
->required()
->addActionLabel(trans('admin/egg.add_startup'))
->keyLabel(trans('admin/egg.startup_name'))
->valueLabel(trans('admin/egg.startup_command'))
->helperText(trans('admin/egg.startup_help')),
TagsInput::make('file_denylist')
->label(trans('admin/egg.file_denylist'))

View File

@ -39,6 +39,7 @@ use Filament\Resources\Pages\CreateRecord;
use Filament\Support\Exceptions\Halt;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\HtmlString;
use LogicException;
@ -316,7 +317,7 @@ class CreateServer extends CreateRecord
->live()
->afterStateUpdated(function ($state, Set $set, Get $get, $old) {
$egg = Egg::query()->find($state);
$set('startup', $egg->startup ?? '');
$set('startup', Arr::first($egg->startup_commands, default: ''));
$set('image', '');
$variables = $egg->variables ?? [];
@ -391,7 +392,6 @@ class CreateServer extends CreateRecord
->inline(),
Textarea::make('startup')
->hintIcon('tabler-code')
->label(trans('admin/server.startup_cmd'))
->hidden(fn (Get $get) => $get('egg_id') === null)
->required()

View File

@ -602,7 +602,7 @@ class EditServer extends EditRecord
->autosize()
->hintAction(PreviewStartupAction::make('preview')),
Textarea::make('defaultStartup')
Textarea::make('default_startup')
->hintAction(fn () => request()->isSecure() ? CopyAction::make() : null)
->label(trans('admin/server.default_startup'))
->disabled()
@ -611,7 +611,7 @@ class EditServer extends EditRecord
->formatStateUsing(function ($state, Get $get) {
$egg = Egg::query()->find($get('egg_id'));
return $egg->startup;
return Arr::first($egg->startup_commands);
}),
Repeater::make('server_variables')

View File

@ -37,8 +37,11 @@ return [
'author_help_edit' => 'The author of this version of the Egg. Uploading a new configuration from a different author will change this.',
'description' => 'Description',
'description_help' => 'A description of this Egg that will be displayed throughout the Panel as needed.',
'startup' => 'Startup Command',
'startup_help' => 'The default startup command that should be used for new servers using this Egg.',
'add_startup' => 'Add Startup Command',
'startup_command' => 'Startup Command',
'startup_commands' => 'Startup Commands',
'startup_name' => 'Startup Name',
'startup_help' => 'The startup commands available to servers using this Egg. The first one is the default.',
'file_denylist' => 'File Denylist',
'file_denylist_help' => 'A list of files that the end user is not allowed to edit.',
'features' => 'Features',
@ -51,7 +54,7 @@ return [
'docker_images' => 'Docker Images',
'docker_name' => 'Image Name',
'docker_uri' => 'Image URI',
'docker_help' => 'The docker images available to servers using this Egg.',
'docker_help' => 'The docker images available to servers using this Egg. The first one is the default.',
'stop_command' => 'Stop Command',
'stop_command_help' => 'The command that should be sent to server processes to stop them gracefully. If you need to send a SIGINT you should enter ^C here.',