Do the icons

This commit is contained in:
Lance Pioch 2024-04-12 02:03:20 -04:00
parent d30471ae6a
commit 21247e91c7

View File

@ -36,12 +36,14 @@ class ServerResource extends Resource
->hidden(), ->hidden(),
Forms\Components\TextInput::make('name') Forms\Components\TextInput::make('name')
->prefixIcon('tabler-server')
->label('Display Name') ->label('Display Name')
->columnSpan(4) ->columnSpan(4)
->required() ->required()
->maxLength(191), ->maxLength(191),
Forms\Components\Select::make('owner_id') Forms\Components\Select::make('owner_id')
->prefixIcon('tabler-user')
->default(auth()->user()->id) ->default(auth()->user()->id)
->label('Owner') ->label('Owner')
->columnSpan(2) ->columnSpan(2)
@ -51,6 +53,7 @@ class ServerResource extends Resource
->required(), ->required(),
Forms\Components\Select::make('node_id') Forms\Components\Select::make('node_id')
->prefixIcon('tabler-server-2')
->default(fn () => Node::query()->latest()->first()->id) ->default(fn () => Node::query()->latest()->first()->id)
->columnSpan(2) ->columnSpan(2)
->live() ->live()
@ -60,12 +63,12 @@ class ServerResource extends Resource
->required(), ->required(),
Forms\Components\Select::make('allocation_id') Forms\Components\Select::make('allocation_id')
->prefixIcon('tabler-network')
->label('Primary Allocation') ->label('Primary Allocation')
->columnSpan(3) ->columnSpan(3)
->disabled(fn (Forms\Get $get) => $get('node_id') === null) ->disabled(fn (Forms\Get $get) => $get('node_id') === null)
->searchable(['ip', 'port', 'ip_alias']) ->searchable(['ip', 'port', 'ip_alias'])
->getOptionLabelFromRecordUsing(fn (Allocation $allocation) => ->getOptionLabelFromRecordUsing(fn (Allocation $allocation) => "$allocation->ip:$allocation->port" .
"$allocation->ip:$allocation->port" .
($allocation->ip_alias ? " ($allocation->ip_alias)" : '') ($allocation->ip_alias ? " ($allocation->ip_alias)" : '')
) )
->placeholder(function (Forms\Get $get) { ->placeholder(function (Forms\Get $get) {
@ -114,6 +117,7 @@ class ServerResource extends Resource
->columnSpanFull(), ->columnSpanFull(),
Forms\Components\Select::make('egg_id') Forms\Components\Select::make('egg_id')
->prefixIcon('tabler-egg')
->columnSpan(2) ->columnSpan(2)
->relationship('egg', 'name') ->relationship('egg', 'name')
->searchable() ->searchable()
@ -140,6 +144,7 @@ class ServerResource extends Resource
->hidden(fn (Forms\Get $get) => $get('custom_image')) ->hidden(fn (Forms\Get $get) => $get('custom_image'))
->disabled(fn (Forms\Get $get) => $get('custom_image')) ->disabled(fn (Forms\Get $get) => $get('custom_image'))
->label('Docker Image') ->label('Docker Image')
->prefixIcon('tabler-brand-docker')
->options(fn (Forms\Get $get) => array_flip(Egg::find($get('egg_id'))->docker_images ?? [])) ->options(fn (Forms\Get $get) => array_flip(Egg::find($get('egg_id'))->docker_images ?? []))
->selectablePlaceholder(false) ->selectablePlaceholder(false)
->columnSpan(2) ->columnSpan(2)
@ -214,7 +219,6 @@ class ServerResource extends Resource
->required() ->required()
->numeric(), ->numeric(),
Forms\Components\TextInput::make('cpu') Forms\Components\TextInput::make('cpu')
->default(0) ->default(0)
->label('CPU Limit') ->label('CPU Limit')
@ -256,6 +260,7 @@ class ServerResource extends Resource
]), ]),
Forms\Components\Textarea::make('startup') Forms\Components\Textarea::make('startup')
->hintIcon('tabler-code')
->label('Startup Command') ->label('Startup Command')
->required() ->required()
->live() ->live()