2024-03-24 01:48:03 -04:00
|
|
|
<?php
|
|
|
|
|
|
2024-12-07 15:51:27 +01:00
|
|
|
namespace App\Filament\Admin\Resources\MountResource\Pages;
|
2024-03-24 01:48:03 -04:00
|
|
|
|
2024-12-07 15:51:27 +01:00
|
|
|
use App\Filament\Admin\Resources\MountResource;
|
2024-03-24 01:48:03 -04:00
|
|
|
use Filament\Actions;
|
2024-04-23 19:45:11 -04:00
|
|
|
use Filament\Forms\Components\Group;
|
|
|
|
|
use Filament\Forms\Components\Section;
|
|
|
|
|
use Filament\Forms\Components\Select;
|
2024-10-04 01:15:08 +02:00
|
|
|
use Filament\Forms\Components\Textarea;
|
|
|
|
|
use Filament\Forms\Components\TextInput;
|
|
|
|
|
use Filament\Forms\Components\ToggleButtons;
|
2024-04-23 19:45:11 -04:00
|
|
|
use Filament\Forms\Form;
|
2024-10-04 01:15:08 +02:00
|
|
|
use Filament\Resources\Pages\EditRecord;
|
2024-03-24 01:48:03 -04:00
|
|
|
|
|
|
|
|
class EditMount extends EditRecord
|
|
|
|
|
{
|
|
|
|
|
protected static string $resource = MountResource::class;
|
|
|
|
|
|
2024-04-23 19:45:11 -04:00
|
|
|
public function form(Form $form): Form
|
|
|
|
|
{
|
|
|
|
|
return $form
|
|
|
|
|
->schema([
|
|
|
|
|
Section::make()->schema([
|
2024-06-29 17:38:18 -04:00
|
|
|
TextInput::make('name')
|
2025-02-08 23:16:54 -05:00
|
|
|
->label(trans('admin/mount.name'))
|
2024-04-23 19:45:11 -04:00
|
|
|
->required()
|
2025-02-08 23:16:54 -05:00
|
|
|
->helperText(trans('admin/mount.name_help'))
|
2024-04-23 19:45:11 -04:00
|
|
|
->maxLength(64),
|
2024-06-29 17:38:18 -04:00
|
|
|
ToggleButtons::make('read_only')
|
2025-02-08 23:16:54 -05:00
|
|
|
->label(trans('admin/mount.read_only'))
|
|
|
|
|
->helperText(trans('admin/mount.read_only_help'))
|
2024-04-23 19:45:11 -04:00
|
|
|
->options([
|
2025-02-08 23:16:54 -05:00
|
|
|
false => trans('admin/mount.toggles.writable'),
|
|
|
|
|
true => trans('admin/mount.toggles.read_only'),
|
2024-04-23 19:45:11 -04:00
|
|
|
])
|
|
|
|
|
->icons([
|
|
|
|
|
false => 'tabler-writing',
|
|
|
|
|
true => 'tabler-writing-off',
|
|
|
|
|
])
|
|
|
|
|
->colors([
|
|
|
|
|
false => 'warning',
|
|
|
|
|
true => 'success',
|
|
|
|
|
])
|
|
|
|
|
->inline()
|
|
|
|
|
->default(false)
|
|
|
|
|
->required(),
|
2024-06-29 17:38:18 -04:00
|
|
|
TextInput::make('source')
|
2025-02-08 23:16:54 -05:00
|
|
|
->label(trans('admin/mount.source'))
|
2024-04-23 19:45:11 -04:00
|
|
|
->required()
|
2025-02-08 23:16:54 -05:00
|
|
|
->helperText(trans('admin/mount.source_help'))
|
2024-06-16 19:56:18 +02:00
|
|
|
->maxLength(255),
|
2024-06-29 17:38:18 -04:00
|
|
|
TextInput::make('target')
|
2025-02-08 23:16:54 -05:00
|
|
|
->label(trans('admin/mount.target'))
|
2024-04-23 19:45:11 -04:00
|
|
|
->required()
|
2025-02-08 23:16:54 -05:00
|
|
|
->helperText(trans('admin/mount.target_help'))
|
2024-06-16 19:56:18 +02:00
|
|
|
->maxLength(255),
|
2024-06-29 17:38:18 -04:00
|
|
|
ToggleButtons::make('user_mountable')
|
2024-04-23 19:45:11 -04:00
|
|
|
->hidden()
|
|
|
|
|
->label('User mountable?')
|
|
|
|
|
->options([
|
|
|
|
|
false => 'No',
|
|
|
|
|
true => 'Yes',
|
|
|
|
|
])
|
|
|
|
|
->icons([
|
|
|
|
|
false => 'tabler-user-cancel',
|
|
|
|
|
true => 'tabler-user-bolt',
|
|
|
|
|
])
|
|
|
|
|
->colors([
|
|
|
|
|
false => 'success',
|
|
|
|
|
true => 'warning',
|
|
|
|
|
])
|
|
|
|
|
->default(false)
|
|
|
|
|
->inline()
|
|
|
|
|
->required(),
|
2024-06-29 17:38:18 -04:00
|
|
|
Textarea::make('description')
|
2025-02-08 23:16:54 -05:00
|
|
|
->label(trans('admin/mount.description'))
|
|
|
|
|
->helperText(trans('admin/mount.description_help'))
|
2024-04-23 19:45:11 -04:00
|
|
|
->columnSpanFull(),
|
|
|
|
|
])->columnSpan(1)->columns([
|
|
|
|
|
'default' => 1,
|
|
|
|
|
'lg' => 2,
|
|
|
|
|
]),
|
|
|
|
|
Group::make()->schema([
|
|
|
|
|
Section::make()->schema([
|
|
|
|
|
Select::make('eggs')->multiple()
|
|
|
|
|
->relationship('eggs', 'name')
|
|
|
|
|
->preload(),
|
|
|
|
|
Select::make('nodes')->multiple()
|
|
|
|
|
->relationship('nodes', 'name')
|
|
|
|
|
->searchable(['name', 'fqdn'])
|
|
|
|
|
->preload(),
|
|
|
|
|
]),
|
|
|
|
|
])->columns([
|
|
|
|
|
'default' => 1,
|
|
|
|
|
'lg' => 2,
|
|
|
|
|
]),
|
|
|
|
|
])->columns([
|
|
|
|
|
'default' => 1,
|
|
|
|
|
'lg' => 2,
|
|
|
|
|
]);
|
|
|
|
|
}
|
2024-10-19 18:29:44 -04:00
|
|
|
|
2024-03-24 01:48:03 -04:00
|
|
|
protected function getHeaderActions(): array
|
|
|
|
|
{
|
|
|
|
|
return [
|
|
|
|
|
Actions\DeleteAction::make(),
|
2024-05-13 19:58:01 -04:00
|
|
|
$this->getSaveFormAction()->formId('form'),
|
2024-03-24 01:48:03 -04:00
|
|
|
];
|
|
|
|
|
}
|
2024-05-13 19:58:01 -04:00
|
|
|
|
|
|
|
|
protected function getFormActions(): array
|
|
|
|
|
{
|
|
|
|
|
return [];
|
|
|
|
|
}
|
2024-03-24 01:48:03 -04:00
|
|
|
}
|