mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-20 00:34:44 +02:00
Merge pull request #137 from pelican-dev/feature/72
Allow Egg Variables to be orderable/sortable
This commit is contained in:
commit
edf9bc6f4d
4
.gitignore
vendored
4
.gitignore
vendored
@ -34,3 +34,7 @@ resources/lang/locales.js
|
|||||||
/public/hot
|
/public/hot
|
||||||
result
|
result
|
||||||
docker-compose.yaml
|
docker-compose.yaml
|
||||||
|
|
||||||
|
public/css/filament-monaco-editor/
|
||||||
|
|
||||||
|
public/js/filament-monaco-editor/
|
||||||
|
@ -27,24 +27,53 @@ class EggResource extends Resource
|
|||||||
->schema([
|
->schema([
|
||||||
Forms\Components\Tabs::make()->tabs([
|
Forms\Components\Tabs::make()->tabs([
|
||||||
Forms\Components\Tabs\Tab::make('Configuration')
|
Forms\Components\Tabs\Tab::make('Configuration')
|
||||||
->columns(2)
|
->columns(['default' => 1, 'sm' => 1, 'md' => 2, 'lg' => 4])
|
||||||
->schema([
|
->schema([
|
||||||
Forms\Components\TextInput::make('name')->required()->maxLength(191)
|
Forms\Components\TextInput::make('name')
|
||||||
|
->required()
|
||||||
|
->maxLength(191)
|
||||||
|
->columnSpan(['default' => 1, 'sm' => 1, 'md' => 2, 'lg' => 2])
|
||||||
->helperText('A simple, human-readable name to use as an identifier for this Egg.'),
|
->helperText('A simple, human-readable name to use as an identifier for this Egg.'),
|
||||||
Forms\Components\Textarea::make('description')->rows(5)
|
Forms\Components\TextInput::make('uuid')
|
||||||
|
->disabled()
|
||||||
|
->columnSpan(['default' => 1, 'sm' => 1, 'md' => 2, 'lg' => 2])
|
||||||
|
->helperText('This is the globally unique identifier for this Egg which Wings uses as an identifier.'),
|
||||||
|
Forms\Components\Textarea::make('description')
|
||||||
|
->rows(3)
|
||||||
|
->columnSpan(['default' => 1, 'sm' => 1, 'md' => 2, 'lg' => 2])
|
||||||
->helperText('A description of this Egg that will be displayed throughout the Panel as needed.'),
|
->helperText('A description of this Egg that will be displayed throughout the Panel as needed.'),
|
||||||
Forms\Components\TextInput::make('uuid')->disabled()
|
Forms\Components\TextInput::make('author')
|
||||||
->helperText('This is the globally unique identifier for this Egg which the Daemon uses as an identifier.'),
|
->required()
|
||||||
Forms\Components\TextInput::make('author')->required()->maxLength(191)->disabled()
|
->maxLength(191)
|
||||||
|
->disabled()
|
||||||
|
->columnSpan(['default' => 1, 'sm' => 1, 'md' => 2, 'lg' => 2])
|
||||||
->helperText('The author of this version of the Egg. Uploading a new Egg configuration from a different author will change this.'),
|
->helperText('The author of this version of the Egg. Uploading a new Egg configuration from a different author will change this.'),
|
||||||
Forms\Components\Toggle::make('force_outgoing_ip')->required()
|
Forms\Components\Textarea::make('startup')
|
||||||
|
->rows(2)
|
||||||
|
->columnSpanFull()
|
||||||
|
->required()
|
||||||
|
->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')
|
||||||
|
->helperText('A list of files that the end user is not allowed to edit.')
|
||||||
|
->columnSpan(['default' => 1, 'sm' => 1, 'md' => 2, 'lg' => 2]),
|
||||||
|
Forms\Components\TagsInput::make('features')
|
||||||
|
->placeholder('Add Feature')
|
||||||
|
->helperText('')
|
||||||
|
->columnSpan(['default' => 1, 'sm' => 1, 'md' => 2, 'lg' => 2]),
|
||||||
|
Forms\Components\Toggle::make('force_outgoing_ip')
|
||||||
->helperText("Forces all outgoing network traffic to have its Source IP NATed to the IP of the server's primary allocation IP.
|
->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.
|
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."),
|
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)
|
Forms\Components\Toggle::make('script_is_privileged')
|
||||||
->helperText('The default startup command that should be used for new servers using this Egg.'),
|
->helperText('The docker images available to servers using this egg.'),
|
||||||
|
Forms\Components\TextInput::make('update_url')
|
||||||
|
->disabled()
|
||||||
|
->helperText('Not implemented.')
|
||||||
|
->columnSpan(['default' => 1, 'sm' => 1, 'md' => 2, 'lg' => 2]),
|
||||||
Forms\Components\KeyValue::make('docker_images')
|
Forms\Components\KeyValue::make('docker_images')
|
||||||
->columnSpanFull()
|
->columnSpanFull()
|
||||||
|
->required()
|
||||||
->addActionLabel('Add Image')
|
->addActionLabel('Add Image')
|
||||||
->keyLabel('Name')
|
->keyLabel('Name')
|
||||||
->valueLabel('Image URI')
|
->valueLabel('Image URI')
|
||||||
@ -52,41 +81,41 @@ class EggResource extends Resource
|
|||||||
]),
|
]),
|
||||||
|
|
||||||
Forms\Components\Tabs\Tab::make('Process Management')
|
Forms\Components\Tabs\Tab::make('Process Management')
|
||||||
->columns(2)
|
->columns()
|
||||||
->schema([
|
->schema([
|
||||||
Forms\Components\Select::make('config_from')
|
Forms\Components\Select::make('config_from')
|
||||||
->label('Copy Settings From')
|
->label('Copy Settings From')
|
||||||
->placeholder('None')
|
->placeholder('None')
|
||||||
->relationship('configFrom', 'name', ignoreRecord: true)
|
->relationship('configFrom', 'name', ignoreRecord: true)
|
||||||
->helperText('If you would like to default to settings from another Egg select it from the menu above.'),
|
->helperText('If you would like to default to settings from another Egg select it from the menu above.'),
|
||||||
|
|
||||||
Forms\Components\TextInput::make('config_stop')
|
Forms\Components\TextInput::make('config_stop')
|
||||||
->maxLength(191)
|
->maxLength(191)
|
||||||
->label('Stop Command')
|
->label('Stop Command')
|
||||||
->helperText('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.'),
|
->helperText('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.'),
|
||||||
|
|
||||||
Forms\Components\Textarea::make('config_startup')->rows(10)->json()
|
Forms\Components\Textarea::make('config_startup')->rows(10)->json()
|
||||||
->label('Start Configuration')
|
->label('Start Configuration')
|
||||||
->helperText('List of values the daemon should be looking for when booting a server to determine completion.'),
|
->helperText('List of values the daemon should be looking for when booting a server to determine completion.'),
|
||||||
|
|
||||||
Forms\Components\Textarea::make('config_files')->rows(10)->json()
|
Forms\Components\Textarea::make('config_files')->rows(10)->json()
|
||||||
->label('Configuration Files')
|
->label('Configuration Files')
|
||||||
->helperText('This should be a JSON representation of configuration files to modify and what parts should be changed.'),
|
->helperText('This should be a JSON representation of configuration files to modify and what parts should be changed.'),
|
||||||
|
|
||||||
Forms\Components\Textarea::make('config_logs')->rows(10)->json()
|
Forms\Components\Textarea::make('config_logs')->rows(10)->json()
|
||||||
->label('Log Configuration')
|
->label('Log Configuration')
|
||||||
->helperText('This should be a JSON representation of where log files are stored, and whether or not the daemon should be creating custom logs.'),
|
->helperText('This should be a JSON representation of where log files are stored, and whether or not the daemon should be creating custom logs.'),
|
||||||
]),
|
]),
|
||||||
Forms\Components\Tabs\Tab::make('Egg Variables')
|
Forms\Components\Tabs\Tab::make('Egg Variables')
|
||||||
->columnSpanFull()
|
->columnSpanFull()
|
||||||
// ->columns(2)
|
->columns(2)
|
||||||
->schema([
|
->schema([
|
||||||
Forms\Components\Repeater::make('variables')
|
Forms\Components\Repeater::make('variables')
|
||||||
->grid(3)
|
->grid()
|
||||||
->relationship('variables')
|
->relationship('variables')
|
||||||
->name('name')
|
->name('name')
|
||||||
->columns(1)
|
->columns(2)
|
||||||
->columnSpan(1)
|
->reorderable()
|
||||||
|
->collapsible()
|
||||||
|
->collapsed()
|
||||||
|
->orderColumn()
|
||||||
|
->columnSpan(2)
|
||||||
->itemLabel(fn (array $state) => $state['name'])
|
->itemLabel(fn (array $state) => $state['name'])
|
||||||
->mutateRelationshipDataBeforeCreateUsing(function (array $data): array {
|
->mutateRelationshipDataBeforeCreateUsing(function (array $data): array {
|
||||||
$data['default_value'] ??= '';
|
$data['default_value'] ??= '';
|
||||||
@ -108,14 +137,14 @@ class EggResource extends Resource
|
|||||||
->debounce(750)
|
->debounce(750)
|
||||||
->maxLength(191)
|
->maxLength(191)
|
||||||
->columnSpanFull()
|
->columnSpanFull()
|
||||||
->afterStateUpdated(fn (Forms\Set $set, $state) =>
|
->afterStateUpdated(fn (Forms\Set $set, $state) => $set('env_variable', str($state)->trim()->snake()->upper()->toString())
|
||||||
$set('env_variable', str($state)->trim()->snake()->upper()->toString())
|
|
||||||
)
|
)
|
||||||
->required(),
|
->required(),
|
||||||
Forms\Components\Textarea::make('description')->columnSpanFull(),
|
Forms\Components\Textarea::make('description')->columnSpanFull(),
|
||||||
Forms\Components\TextInput::make('env_variable')
|
Forms\Components\TextInput::make('env_variable')
|
||||||
->label('Environment Variable')
|
->label('Environment Variable')
|
||||||
->maxLength(191)
|
->maxLength(191)
|
||||||
|
->hint(fn ($state) => "{{{$state}}}")
|
||||||
->required(),
|
->required(),
|
||||||
Forms\Components\TextInput::make('default_value')->maxLength(191),
|
Forms\Components\TextInput::make('default_value')->maxLength(191),
|
||||||
Forms\Components\Textarea::make('rules')->rows(3)->columnSpanFull(),
|
Forms\Components\Textarea::make('rules')->rows(3)->columnSpanFull(),
|
||||||
@ -147,11 +176,6 @@ class EggResource extends Resource
|
|||||||
]),
|
]),
|
||||||
|
|
||||||
])->columnSpanFull()->persistTabInQueryString(),
|
])->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(),
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
28
database/migrations/2024_04_20_214441_add_egg_var_sort.php
Normal file
28
database/migrations/2024_04_20_214441_add_egg_var_sort.php
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::table('egg_variables', function (Blueprint $table) {
|
||||||
|
$table->unsignedTinyInteger('sort')->nullable()->after('egg_id');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('egg_variables', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('sort');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
Loading…
x
Reference in New Issue
Block a user