Fix Container/Server Status + Mobile Styling

This commit is contained in:
notCharles 2024-04-22 18:03:34 -04:00
parent 65bfda1034
commit 2f82229048

View File

@ -43,7 +43,7 @@ class ServerResource extends Resource
Forms\Components\ToggleButtons::make('docker')
->label('Container Status')
->hiddenOn('create')
->disableOptionWhen(fn ($state, $value) => $state !== $value)
->inlineLabel()
->formatStateUsing(function ($state, Server $server) {
if ($server->node_id === null) {
return 'unknown';
@ -55,8 +55,8 @@ class ServerResource extends Resource
return $details['state'] ?? 'unknown';
})
->options(collect(ContainerStatus::cases())->mapWithKeys(
fn (ContainerStatus $status) => [$status->value => str($status->value)->ucwords()]
->options(fn ($state) => collect(ContainerStatus::cases())->filter(fn ($containerStatus) => $containerStatus->value === $state)->mapWithKeys(
fn (ContainerStatus $state) => [$state->value => str($state->value)->replace('_', ' ')->ucwords()]
))
->colors(collect(ContainerStatus::cases())->mapWithKeys(
fn (ContainerStatus $status) => [$status->value => $status->color()]
@ -64,17 +64,21 @@ class ServerResource extends Resource
->icons(collect(ContainerStatus::cases())->mapWithKeys(
fn (ContainerStatus $status) => [$status->value => $status->icon()]
))
->grouped()
->columnSpanFull()
->columnSpan([
'default' => 1,
'sm' => 2,
'md' => 2,
'lg' => 3,
])
->inline(),
Forms\Components\ToggleButtons::make('status')
->label('Server State')
->helperText('')
->hiddenOn('create')
->disableOptionWhen(fn ($state, $value) => $state !== $value)
->inlineLabel()
->formatStateUsing(fn ($state) => $state ?? ServerState::Normal)
->options(collect(ServerState::cases())->mapWithKeys(
->options(fn ($state) => collect(ServerState::cases())->filter(fn ($serverState) => $serverState->value === $state)->mapWithKeys(
fn (ServerState $state) => [$state->value => str($state->value)->replace('_', ' ')->ucwords()]
))
->colors(collect(ServerState::cases())->mapWithKeys(
@ -83,8 +87,12 @@ class ServerResource extends Resource
->icons(collect(ServerState::cases())->mapWithKeys(
fn (ServerState $state) => [$state->value => $state->icon()]
))
->grouped()
->columnSpanFull()
->columnSpan([
'default' => 1,
'sm' => 2,
'md' => 2,
'lg' => 3,
])
->inline(),
Forms\Components\TextInput::make('external_id')
@ -420,7 +428,18 @@ class ServerResource extends Resource
Forms\Components\Fieldset::make('Application Feature Limits')
->inlineLabel()
->hiddenOn('create')
->columns(3)
->columnSpan([
'default' => 2,
'sm' => 4,
'md' => 4,
'lg' => 6,
])
->columns([
'default' => 1,
'sm' => 2,
'md' => 3,
'lg' => 3,
])
->schema([
Forms\Components\TextInput::make('allocation_limit')
->suffixIcon('tabler-network')