mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-20 14:34:44 +02:00
Fix egg variable saving
This commit is contained in:
parent
3ad622dd69
commit
dfaff50ca1
@ -77,23 +77,37 @@ class EggResource extends Resource
|
||||
->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.'),
|
||||
]),
|
||||
Forms\Components\Tabs\Tab::make('Variables')
|
||||
Forms\Components\Tabs\Tab::make('Egg Variables')
|
||||
->columnSpanFull()
|
||||
// ->columns(2)
|
||||
->schema([
|
||||
Forms\Components\Repeater::make('Blah')
|
||||
Forms\Components\Repeater::make('variables')
|
||||
->grid(3)
|
||||
->relationship('variables')
|
||||
->name('name')
|
||||
->columns(1)
|
||||
->columnSpan(1)
|
||||
->itemLabel(fn (array $state) => $state['name'])
|
||||
->mutateRelationshipDataBeforeCreateUsing(function (array $data): array {
|
||||
$data['default_value'] ??= '';
|
||||
$data['description'] ??= '';
|
||||
$data['rules'] ??= '';
|
||||
|
||||
return $data;
|
||||
})
|
||||
->mutateRelationshipDataBeforeSaveUsing(function (array $data): array {
|
||||
$data['default_value'] ??= '';
|
||||
$data['description'] ??= '';
|
||||
$data['rules'] ??= '';
|
||||
|
||||
return $data;
|
||||
})
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('name')->live()->maxLength(191)->columnSpanFull(),
|
||||
Forms\Components\TextInput::make('name')->live()->maxLength(191)->columnSpanFull()->required(),
|
||||
Forms\Components\Textarea::make('description')->columnSpanFull(),
|
||||
Forms\Components\TextInput::make('env_variable')->maxLength(191),
|
||||
Forms\Components\TextInput::make('env_variable')->maxLength(191)->required(),
|
||||
Forms\Components\TextInput::make('default_value')->maxLength(191),
|
||||
Forms\Components\Textarea::make('rules')->rows(3)->columnSpanFull()->required(),
|
||||
Forms\Components\Textarea::make('rules')->rows(3)->columnSpanFull(),
|
||||
]),
|
||||
]),
|
||||
Forms\Components\Tabs\Tab::make('Install Script')
|
||||
|
@ -56,7 +56,7 @@ class EggVariable extends Model
|
||||
'default_value' => 'string',
|
||||
'user_viewable' => 'boolean',
|
||||
'user_editable' => 'boolean',
|
||||
'rules' => 'required|string',
|
||||
'rules' => 'string',
|
||||
];
|
||||
|
||||
protected $attributes = [
|
||||
|
Loading…
x
Reference in New Issue
Block a user