Use tabs instead

This commit is contained in:
Lance Pioch 2024-04-04 20:16:14 -04:00
parent a96c53f407
commit 95570724e6
2 changed files with 23 additions and 17 deletions

View File

@ -148,6 +148,7 @@ class CreateNode extends CreateRecord
->hidden() ->hidden()
->columnSpanFull() ->columnSpanFull()
->rows(5), ->rows(5),
Forms\Components\Hidden::make('skipValidation')->default(true), Forms\Components\Hidden::make('skipValidation')->default(true),
]); ]);
} }
@ -155,7 +156,7 @@ class CreateNode extends CreateRecord
protected function getRedirectUrlParameters(): array protected function getRedirectUrlParameters(): array
{ {
return [ return [
'step' => 'configuration', 'tab' => '-configuration-tab',
]; ];
} }
} }

View File

@ -6,6 +6,7 @@ use App\Filament\Resources\NodeResource;
use App\Models\Node; use App\Models\Node;
use Filament\Actions; use Filament\Actions;
use Filament\Forms; use Filament\Forms;
use Filament\Forms\Components\Tabs;
use Filament\Forms\Components\Wizard; use Filament\Forms\Components\Wizard;
use Filament\Resources\Pages\EditRecord; use Filament\Resources\Pages\EditRecord;
use Illuminate\Support\HtmlString; use Illuminate\Support\HtmlString;
@ -17,19 +18,25 @@ class EditNode extends EditRecord
public function form(Forms\Form $form): Forms\Form public function form(Forms\Form $form): Forms\Form
{ {
return $form return $form->schema([
->schema([ Tabs::make('Tabs')
Wizard::make([ ->columns(4)
Forms\Components\Wizard\Step::make('Basic') ->persistTabInQueryString()
->description('') ->columnSpanFull()
->tabs([
Tabs\Tab::make('Basic Settings')
->icon('tabler-server')
->schema((new CreateNode())->form($form)->getComponents()), ->schema((new CreateNode())->form($form)->getComponents()),
Forms\Components\Wizard\Step::make('Configuration') Tabs\Tab::make('Advanced Settings')
->description('') ->icon('tabler-server-cog'),
Tabs\Tab::make('Configuration')
->icon('tabler-code')
->schema([ ->schema([
Forms\Components\Placeholder::make('instructions') Forms\Components\Placeholder::make('instructions')
->columnSpanFull() ->columnSpanFull()
->content(new HtmlString(' ->content(new HtmlString('
This file should be placed in your daemon\'s root directory (usually <code>/etc/pelican</code>) in a file called <code>config.yml</code>. This file should be placed in your daemon\'s root directory
(usually <code>/etc/pelican</code>) in a file called <code>config.yml</code>.
')), ')),
Forms\Components\Textarea::make('config') Forms\Components\Textarea::make('config')
->label('Configuration File') ->label('Configuration File')
@ -38,15 +45,13 @@ class EditNode extends EditRecord
->hintAction(CopyAction::make()) ->hintAction(CopyAction::make())
->columnSpanFull(), ->columnSpanFull(),
]), ]),
Tabs\Tab::make('Allocations')
->icon('tabler-plug-connected')
->schema([
// ...
]),
]) ])
->columns(4) ]);
->persistStepInQueryString()
->columnSpanFull()
// ->startOnStep($this->getStartStep())
// ->cancelAction($this->getCancelFormAction())
// ->submitAction($this->getSubmitFormAction())
// ->skippable($this->hasSkippableSteps()),
]);
} }
protected function mutateFormDataBeforeFill(array $data): array protected function mutateFormDataBeforeFill(array $data): array