Skip to content

Commit

Permalink
Add missing externalId on server creation
Browse files Browse the repository at this point in the history
  • Loading branch information
RMartinOscar committed Jan 4, 2025
1 parent 8f51502 commit a75fc78
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 22 deletions.
55 changes: 33 additions & 22 deletions app/Filament/Admin/Resources/ServerResource/Pages/CreateServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,46 @@ public function form(Form $form): Form
->required()
->maxLength(255),

TextInput::make('external_id')
->label('External ID')
->columnSpan([
'default' => 2,
'sm' => 3,
'md' => 3,
'lg' => 3,
])
->unique()
->maxLength(255),

Select::make('node_id')
->disabledOn('edit')
->prefixIcon('tabler-server-2')
->default(fn () => ($this->node = Node::query()->latest()->first())?->id)
->columnSpan([
'default' => 2,
'sm' => 1,
'md' => 2,
'lg' => 3,
])
->live()
->relationship('node', 'name')
->searchable()
->preload()
->afterStateUpdated(function (Set $set, $state) {
$set('allocation_id', null);
$this->node = Node::find($state);
})
->required(),

Select::make('owner_id')
->preload()
->prefixIcon('tabler-user')
->default(auth()->user()->id)
->label('Owner')
->columnSpan([
'default' => 2,
'sm' => 3,
'md' => 3,
'sm' => 1,
'md' => 2,
'lg' => 3,
])
->relationship('user', 'username')
Expand Down Expand Up @@ -136,26 +167,6 @@ public function form(Form $form): Form
})
->required(),

Select::make('node_id')
->disabledOn('edit')
->prefixIcon('tabler-server-2')
->default(fn () => ($this->node = Node::query()->latest()->first())?->id)
->columnSpan([
'default' => 2,
'sm' => 3,
'md' => 6,
'lg' => 6,
])
->live()
->relationship('node', 'name')
->searchable()
->preload()
->afterStateUpdated(function (Set $set, $state) {
$set('allocation_id', null);
$this->node = Node::find($state);
})
->required(),

Select::make('allocation_id')
->preload()
->live()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ public function form(Form $form): Form
'md' => 2,
'lg' => 3,
])
->unique()
->maxLength(255),
Select::make('node_id')
->label('Node')
Expand Down

0 comments on commit a75fc78

Please sign in to comment.