From 3e01e483fb9da1c9352ecd14a44aa61401b94246 Mon Sep 17 00:00:00 2001 From: notCharles Date: Thu, 18 Apr 2024 17:13:17 -0400 Subject: [PATCH] Allow variables to be sorted todo: save order in db in a new column 'sort' --- .gitignore | 4 ++++ app/Filament/Resources/EggResource.php | 21 ++++++++++++--------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index 2c9fda4ca..64fd8ad3a 100644 --- a/.gitignore +++ b/.gitignore @@ -34,3 +34,7 @@ resources/lang/locales.js /public/hot result docker-compose.yaml + +public/css/filament-monaco-editor/ + +public/js/filament-monaco-editor/ diff --git a/app/Filament/Resources/EggResource.php b/app/Filament/Resources/EggResource.php index 019acd035..f8f192d02 100644 --- a/app/Filament/Resources/EggResource.php +++ b/app/Filament/Resources/EggResource.php @@ -37,12 +37,13 @@ class EggResource extends Resource ->helperText('This is the globally unique identifier for this Egg which the Daemon uses as an identifier.'), Forms\Components\TextInput::make('author')->required()->maxLength(191)->disabled() ->helperText('The author of this version of the Egg. Uploading a new Egg configuration from a different author will change this.'), + Forms\Components\Textarea::make('startup')->rows(3)->columnSpanFull() + ->helperText('The default startup command that should be used for new servers using this Egg.'), + Forms\Components\TagsInput::make('file_denylist')->placeholder('denied-file.txt'), Forms\Components\Toggle::make('force_outgoing_ip')->required() ->helperText("Forces all outgoing network traffic to have its Source IP NATed to the IP of the server's primary allocation IP. Required for certain games to work properly when the Node has multiple public IP addresses. Enabling this option will disable internal networking for any servers using this egg, causing them to be unable to internally access other servers on the same node."), - Forms\Components\Textarea::make('startup')->rows(5) - ->helperText('The default startup command that should be used for new servers using this Egg.'), Forms\Components\KeyValue::make('docker_images') ->columnSpanFull() ->addActionLabel('Add Image') @@ -51,6 +52,7 @@ class EggResource extends Resource ->helperText('The docker images available to servers using this egg.'), ]), + Forms\Components\Tabs\Tab::make('Process Management') ->columns(2) ->schema([ @@ -79,21 +81,23 @@ class EggResource extends Resource ]), Forms\Components\Tabs\Tab::make('Variables') ->columnSpanFull() - // ->columns(2) + ->columns(2) ->schema([ Forms\Components\Repeater::make('Blah') - ->grid(3) + ->grid() ->relationship('variables') ->name('name') - ->columns(1) - ->columnSpan(1) + ->columns(2) + ->reorderable()->reorderableWithDragAndDrop() + ->collapsible()->collapsed() + ->columnSpan(2) ->itemLabel(fn (array $state) => $state['name']) ->schema([ Forms\Components\TextInput::make('name')->live()->maxLength(191)->columnSpanFull(), Forms\Components\Textarea::make('description')->columnSpanFull(), - Forms\Components\TextInput::make('env_variable')->maxLength(191), + Forms\Components\TextInput::make('env_variable')->maxLength(191)->required()->hint(fn ($state) => "{{{$state}}}"), Forms\Components\TextInput::make('default_value')->maxLength(191), - Forms\Components\Textarea::make('rules')->rows(3)->columnSpanFull()->required(), + Forms\Components\TextInput::make('rules')->columnSpanFull()->required(), ]), ]), Forms\Components\Tabs\Tab::make('Install Script') @@ -124,7 +128,6 @@ class EggResource extends Resource ])->columnSpanFull()->persistTabInQueryString(), // Forms\Components\TagsInput::make('features'), - // Forms\Components\TagsInput::make('file_denylist')->placeholder('new-file.txt'), // Forms\Components\TextInput::make('update_url'), // Forms\Components\Toggle::make('script_is_privileged')->required(), ]);