mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-29 10:54:46 +02:00
Add variable permission to edit/create egg + export
This commit is contained in:
parent
29e1bd4757
commit
44e9da93b6
@ -3,6 +3,7 @@
|
|||||||
namespace App\Filament\Resources\EggResource\Pages;
|
namespace App\Filament\Resources\EggResource\Pages;
|
||||||
|
|
||||||
use App\Filament\Resources\EggResource;
|
use App\Filament\Resources\EggResource;
|
||||||
|
use App\Models\Egg;
|
||||||
use Filament\Actions;
|
use Filament\Actions;
|
||||||
use Filament\Resources\Pages\EditRecord;
|
use Filament\Resources\Pages\EditRecord;
|
||||||
use AbdelhamidErrahmouni\FilamentMonacoEditor\MonacoEditor;
|
use AbdelhamidErrahmouni\FilamentMonacoEditor\MonacoEditor;
|
||||||
@ -55,7 +56,8 @@ class EditEgg extends EditRecord
|
|||||||
->helperText('')
|
->helperText('')
|
||||||
->columnSpan(['default' => 1, 'sm' => 1, 'md' => 2, 'lg' => 2]),
|
->columnSpan(['default' => 1, 'sm' => 1, 'md' => 2, 'lg' => 2]),
|
||||||
Forms\Components\Toggle::make('force_outgoing_ip')
|
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.
|
->hintIcon('tabler-question-mark')
|
||||||
|
->hintIconTooltip("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\Hidden::make('script_is_privileged')
|
Forms\Components\Hidden::make('script_is_privileged')
|
||||||
@ -102,23 +104,22 @@ class EditEgg extends EditRecord
|
|||||||
]),
|
]),
|
||||||
Forms\Components\Tabs\Tab::make('Egg Variables')
|
Forms\Components\Tabs\Tab::make('Egg Variables')
|
||||||
->columnSpanFull()
|
->columnSpanFull()
|
||||||
->columns(2)
|
|
||||||
->schema([
|
->schema([
|
||||||
Forms\Components\Repeater::make('variables')
|
Forms\Components\Repeater::make('variables')
|
||||||
->grid()
|
->label('')
|
||||||
|
->grid(2)
|
||||||
->relationship('variables')
|
->relationship('variables')
|
||||||
->name('name')
|
->name('name')
|
||||||
->columns(2)
|
|
||||||
->reorderable()
|
->reorderable()
|
||||||
->collapsible()
|
->collapsible()->collapsed()
|
||||||
->collapsed()
|
|
||||||
->orderColumn()
|
->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'] ??= '';
|
||||||
$data['description'] ??= '';
|
$data['description'] ??= '';
|
||||||
$data['rules'] ??= '';
|
$data['rules'] ??= '';
|
||||||
|
$data['user_viewable'] ??= '';
|
||||||
|
$data['user_editable'] ??= '';
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
})
|
})
|
||||||
@ -126,6 +127,8 @@ class EditEgg extends EditRecord
|
|||||||
$data['default_value'] ??= '';
|
$data['default_value'] ??= '';
|
||||||
$data['description'] ??= '';
|
$data['description'] ??= '';
|
||||||
$data['rules'] ??= '';
|
$data['rules'] ??= '';
|
||||||
|
$data['user_viewable'] ??= '';
|
||||||
|
$data['user_editable'] ??= '';
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
})
|
})
|
||||||
@ -148,6 +151,11 @@ class EditEgg extends EditRecord
|
|||||||
->hintIconTooltip(fn ($state) => "{{{$state}}}")
|
->hintIconTooltip(fn ($state) => "{{{$state}}}")
|
||||||
->required(),
|
->required(),
|
||||||
Forms\Components\TextInput::make('default_value')->maxLength(191),
|
Forms\Components\TextInput::make('default_value')->maxLength(191),
|
||||||
|
Forms\Components\Fieldset::make('User Permissions')
|
||||||
|
->schema([
|
||||||
|
Forms\Components\Checkbox::make('user_viewable')->label('Viewable'),
|
||||||
|
Forms\Components\Checkbox::make('user_editable')->label('Editable'),
|
||||||
|
]),
|
||||||
Forms\Components\TextInput::make('rules')->columnSpanFull(),
|
Forms\Components\TextInput::make('rules')->columnSpanFull(),
|
||||||
]),
|
]),
|
||||||
]),
|
]),
|
||||||
@ -184,7 +192,15 @@ class EditEgg extends EditRecord
|
|||||||
protected function getHeaderActions(): array
|
protected function getHeaderActions(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
Actions\DeleteAction::make(),
|
Actions\DeleteAction::make()
|
||||||
|
->disabled(fn (Egg $egg): bool => $egg->servers_count <= 0)
|
||||||
|
->label(fn (Egg $egg): string => $egg->servers_count <= 0 ? 'Egg In Use' : 'Delete Egg'),
|
||||||
|
Actions\ExportAction::make()
|
||||||
|
->icon('tabler-download')
|
||||||
|
->label('Export Egg')
|
||||||
|
->color('primary')
|
||||||
|
// TODO uses old admin panel export service
|
||||||
|
->url(fn (Egg $egg): string => route('admin.eggs.export', ['egg' => $egg['id']])),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user