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) ->rows(2)
->columnSpanFull() ->columnSpanFull()
->helperText(trans('admin/egg.description_help')), ->helperText(trans('admin/egg.description_help')),
Textarea::make('startup') KeyValue::make('startup_commands')
->label(trans('admin/egg.startup')) ->label(trans('admin/egg.startup_commands'))
->rows(3) ->live()
->columnSpanFull() ->columnSpanFull()
->required() ->required()
->placeholder(implode("\n", [ ->addActionLabel(trans('admin/egg.add_startup'))
'java -Xms128M -XX:MaxRAMPercentage=95.0 -jar {{SERVER_JARFILE}}', ->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')), ->helperText(trans('admin/egg.startup_help')),
TagsInput::make('file_denylist') TagsInput::make('file_denylist')
->label(trans('admin/egg.file_denylist')) ->label(trans('admin/egg.file_denylist'))

View File

@ -75,11 +75,14 @@ class EditEgg extends EditRecord
->disabled() ->disabled()
->columnSpan(['default' => 1, 'sm' => 1, 'md' => 2, 'lg' => 2]) ->columnSpan(['default' => 1, 'sm' => 1, 'md' => 2, 'lg' => 2])
->helperText(trans('admin/egg.author_help_edit')), ->helperText(trans('admin/egg.author_help_edit')),
Textarea::make('startup') KeyValue::make('startup_commands')
->label(trans('admin/egg.startup')) ->label(trans('admin/egg.startup_commands'))
->rows(3) ->live()
->columnSpanFull() ->columnSpanFull()
->required() ->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')), ->helperText(trans('admin/egg.startup_help')),
TagsInput::make('file_denylist') TagsInput::make('file_denylist')
->label(trans('admin/egg.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 Filament\Support\Exceptions\Halt;
use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Blade; use Illuminate\Support\Facades\Blade;
use Illuminate\Support\HtmlString; use Illuminate\Support\HtmlString;
use LogicException; use LogicException;
@ -316,7 +317,7 @@ class CreateServer extends CreateRecord
->live() ->live()
->afterStateUpdated(function ($state, Set $set, Get $get, $old) { ->afterStateUpdated(function ($state, Set $set, Get $get, $old) {
$egg = Egg::query()->find($state); $egg = Egg::query()->find($state);
$set('startup', $egg->startup ?? ''); $set('startup', Arr::first($egg->startup_commands, default: ''));
$set('image', ''); $set('image', '');
$variables = $egg->variables ?? []; $variables = $egg->variables ?? [];
@ -391,7 +392,6 @@ class CreateServer extends CreateRecord
->inline(), ->inline(),
Textarea::make('startup') Textarea::make('startup')
->hintIcon('tabler-code')
->label(trans('admin/server.startup_cmd')) ->label(trans('admin/server.startup_cmd'))
->hidden(fn (Get $get) => $get('egg_id') === null) ->hidden(fn (Get $get) => $get('egg_id') === null)
->required() ->required()

View File

@ -602,7 +602,7 @@ class EditServer extends EditRecord
->autosize() ->autosize()
->hintAction(PreviewStartupAction::make('preview')), ->hintAction(PreviewStartupAction::make('preview')),
Textarea::make('defaultStartup') Textarea::make('default_startup')
->hintAction(fn () => request()->isSecure() ? CopyAction::make() : null) ->hintAction(fn () => request()->isSecure() ? CopyAction::make() : null)
->label(trans('admin/server.default_startup')) ->label(trans('admin/server.default_startup'))
->disabled() ->disabled()
@ -611,7 +611,7 @@ class EditServer extends EditRecord
->formatStateUsing(function ($state, Get $get) { ->formatStateUsing(function ($state, Get $get) {
$egg = Egg::query()->find($get('egg_id')); $egg = Egg::query()->find($get('egg_id'));
return $egg->startup; return Arr::first($egg->startup_commands);
}), }),
Repeater::make('server_variables') 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.', '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' => 'Description',
'description_help' => 'A description of this Egg that will be displayed throughout the Panel as needed.', 'description_help' => 'A description of this Egg that will be displayed throughout the Panel as needed.',
'startup' => 'Startup Command', 'add_startup' => 'Add Startup Command',
'startup_help' => 'The default startup command that should be used for new servers using this Egg.', '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' => 'File Denylist',
'file_denylist_help' => 'A list of files that the end user is not allowed to edit.', 'file_denylist_help' => 'A list of files that the end user is not allowed to edit.',
'features' => 'Features', 'features' => 'Features',
@ -51,7 +54,7 @@ return [
'docker_images' => 'Docker Images', 'docker_images' => 'Docker Images',
'docker_name' => 'Image Name', 'docker_name' => 'Image Name',
'docker_uri' => 'Image URI', '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' => '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.', '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.',