mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-29 13:14:45 +02:00
fix egg variables on server edit page
This commit is contained in:
parent
ad2e48cfc1
commit
2328f07473
@ -103,7 +103,7 @@ class EditNode extends EditRecord
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do not add non numerical ports
|
// Do not add non-numerical ports
|
||||||
$update = true;
|
$update = true;
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
|
@ -9,6 +9,7 @@ use App\Models\Allocation;
|
|||||||
use App\Models\Egg;
|
use App\Models\Egg;
|
||||||
use App\Models\Node;
|
use App\Models\Node;
|
||||||
use App\Models\Server;
|
use App\Models\Server;
|
||||||
|
use App\Models\ServerVariable;
|
||||||
use App\Repositories\Daemon\DaemonServerRepository;
|
use App\Repositories\Daemon\DaemonServerRepository;
|
||||||
use App\Services\Allocations\AssignmentService;
|
use App\Services\Allocations\AssignmentService;
|
||||||
use Closure;
|
use Closure;
|
||||||
@ -486,24 +487,24 @@ class ServerResource extends Resource
|
|||||||
->schema([
|
->schema([
|
||||||
Forms\Components\TextInput::make('variable_value')
|
Forms\Components\TextInput::make('variable_value')
|
||||||
->rules([
|
->rules([
|
||||||
fn (Forms\Get $get): Closure => function (string $attribute, $value, Closure $fail) use ($get) {
|
fn (ServerVariable $variable): Closure => function (string $attribute, $value, Closure $fail) use ($variable) {
|
||||||
$validator = Validator::make(['validatorkey' => $value], [
|
$validator = Validator::make(['validatorkey' => $value], [
|
||||||
'validatorkey' => $get('rules'),
|
'validatorkey' => $variable->variable->rules,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if ($validator->fails()) {
|
if ($validator->fails()) {
|
||||||
$message = str($validator->errors()->first())->replace('validatorkey', $get('name'));
|
$message = str($validator->errors()->first())->replace('validatorkey', $variable->variable->name);
|
||||||
|
|
||||||
$fail($message);
|
$fail($message);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
->label(fn (Forms\Get $get) => $get('name'))
|
->label(fn (ServerVariable $variable) => $variable->variable->name)
|
||||||
//->hint('Rule')
|
//->hint('Rule')
|
||||||
->hintIcon('tabler-code')
|
->hintIcon('tabler-code')
|
||||||
->hintIconTooltip(fn (Forms\Get $get) => $get('rules'))
|
->hintIconTooltip(fn (ServerVariable $variable) => $variable->variable->rules)
|
||||||
->prefix(fn (Forms\Get $get) => '{{' . $get('env_variable') . '}}')
|
->prefix(fn (ServerVariable $variable) => '{{' . $variable->variable->env_variable . '}}')
|
||||||
->helperText(fn (Forms\Get $get) => empty($get('description')) ? '—' : $get('description'))
|
->helperText(fn (ServerVariable $variable) => $variable->variable->description ?: '—')
|
||||||
->maxLength(191),
|
->maxLength(191),
|
||||||
|
|
||||||
Forms\Components\Hidden::make('variable_id')->default(0),
|
Forms\Components\Hidden::make('variable_id')->default(0),
|
||||||
@ -596,7 +597,7 @@ class ServerResource extends Resource
|
|||||||
public static function table(Table $table): Table
|
public static function table(Table $table): Table
|
||||||
{
|
{
|
||||||
return $table
|
return $table
|
||||||
->searchable(false)
|
->searchable()
|
||||||
->columns([
|
->columns([
|
||||||
Tables\Columns\TextColumn::make('status')
|
Tables\Columns\TextColumn::make('status')
|
||||||
->default('unknown')
|
->default('unknown')
|
||||||
@ -641,6 +642,7 @@ class ServerResource extends Resource
|
|||||||
->sortable(),
|
->sortable(),
|
||||||
Tables\Columns\TextColumn::make('node.name')
|
Tables\Columns\TextColumn::make('node.name')
|
||||||
->icon('tabler-server-2')
|
->icon('tabler-server-2')
|
||||||
|
->searchable()
|
||||||
->url(fn (Server $server): string => route('filament.admin.resources.nodes.edit', ['record' => $server->node]))
|
->url(fn (Server $server): string => route('filament.admin.resources.nodes.edit', ['record' => $server->node]))
|
||||||
->sortable(),
|
->sortable(),
|
||||||
Tables\Columns\TextColumn::make('egg.name')
|
Tables\Columns\TextColumn::make('egg.name')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user