make server settings page more compact

This commit is contained in:
Boy132 2025-09-04 11:58:05 +02:00
parent 740b4a6553
commit ba8383b5a0
2 changed files with 16 additions and 22 deletions

View File

@ -50,7 +50,7 @@ class Settings extends ServerFormPage
]) ])
->schema([ ->schema([
TextInput::make('name') TextInput::make('name')
->label(trans('server/setting.server_info.name')) ->label(trans('server/setting.server_info.server_name'))
->disabled(fn (Server $server) => !auth()->user()->can(Permission::ACTION_SETTINGS_RENAME, $server)) ->disabled(fn (Server $server) => !auth()->user()->can(Permission::ACTION_SETTINGS_RENAME, $server))
->required() ->required()
->columnSpan([ ->columnSpan([
@ -79,14 +79,19 @@ class Settings extends ServerFormPage
->columnSpan([ ->columnSpan([
'default' => 1, 'default' => 1,
'sm' => 1, 'sm' => 1,
'md' => 3, 'md' => 2,
'lg' => 5, 'lg' => 4,
]) ])
->disabled(), ->disabled(),
TextInput::make('id') TextInput::make('id')
->label(trans('server/setting.server_info.id')) ->label(trans('server/setting.server_info.id'))
->disabled() ->disabled()
->columnSpan(1), ->columnSpan(1),
TextInput::make('node.name')
->label(trans('server/setting.server_info.node_name'))
->formatStateUsing(fn (Server $server) => $server->node->name)
->disabled()
->columnSpan(1),
]), ]),
Fieldset::make() Fieldset::make()
->label(trans('server/setting.server_info.limits.title')) ->label(trans('server/setting.server_info.limits.title'))
@ -146,15 +151,7 @@ class Settings extends ServerFormPage
->disabled() ->disabled()
->formatStateUsing(fn ($state, Server $server) => !$state ? trans('server/setting.server_info.limits.no_allocations') : $server->allocations->count() . ' ' .trans('server/setting.server_info.limits.of') . ' ' . $state), ->formatStateUsing(fn ($state, Server $server) => !$state ? trans('server/setting.server_info.limits.no_allocations') : $server->allocations->count() . ' ' .trans('server/setting.server_info.limits.of') . ' ' . $state),
]), ]),
]), Fieldset::make(trans('server/setting.server_info.sftp.title'))
Section::make(trans('server/setting.node_info.title'))
->columnSpanFull()
->schema([
TextInput::make('node.name')
->label(trans('server/setting.node_info.name'))
->formatStateUsing(fn (Server $server) => $server->node->name)
->disabled(),
Fieldset::make(trans('server/setting.node_info.sftp.title'))
->columnSpanFull() ->columnSpanFull()
->hidden(fn (Server $server) => !auth()->user()->can(Permission::ACTION_FILE_SFTP, $server)) ->hidden(fn (Server $server) => !auth()->user()->can(Permission::ACTION_FILE_SFTP, $server))
->columns([ ->columns([
@ -165,13 +162,13 @@ class Settings extends ServerFormPage
]) ])
->schema([ ->schema([
TextInput::make('connection') TextInput::make('connection')
->label(trans('server/setting.node_info.sftp.connection')) ->label(trans('server/setting.server_info.sftp.connection'))
->columnSpan(1) ->columnSpan(1)
->disabled() ->disabled()
->copyable(fn () => request()->isSecure()) ->copyable(fn () => request()->isSecure())
->hintAction( ->hintAction(
Action::make('connect_sftp') Action::make('connect_sftp')
->label(trans('server/setting.node_info.sftp.action')) ->label(trans('server/setting.server_info.sftp.action'))
->color('success') ->color('success')
->icon('tabler-plug') ->icon('tabler-plug')
->url(function (Server $server) { ->url(function (Server $server) {
@ -186,15 +183,15 @@ class Settings extends ServerFormPage
return 'sftp://' . auth()->user()->username . '.' . $server->uuid_short . '@' . $fqdn . ':' . $server->node->daemon_sftp; return 'sftp://' . auth()->user()->username . '.' . $server->uuid_short . '@' . $fqdn . ':' . $server->node->daemon_sftp;
}), }),
TextInput::make('username') TextInput::make('username')
->label(trans('server/setting.node_info.sftp.username')) ->label(trans('server/setting.server_info.sftp.username'))
->columnSpan(1) ->columnSpan(1)
->copyable(fn () => request()->isSecure()) ->copyable(fn () => request()->isSecure())
->disabled() ->disabled()
->formatStateUsing(fn (Server $server) => auth()->user()->username . '.' . $server->uuid_short), ->formatStateUsing(fn (Server $server) => auth()->user()->username . '.' . $server->uuid_short),
TextEntry::make('password') TextEntry::make('password')
->label(trans('server/setting.node_info.sftp.password')) ->label(trans('server/setting.server_info.sftp.password'))
->columnSpan(1) ->columnSpan(1)
->label(trans('server/setting.node_info.sftp.password_body')), ->label(trans('server/setting.server_info.sftp.password_body')),
]), ]),
]), ]),
Section::make(trans('server/setting.reinstall.title')) Section::make(trans('server/setting.reinstall.title'))

View File

@ -5,13 +5,14 @@ return [
'server_info' => [ 'server_info' => [
'title' => 'Server Information', 'title' => 'Server Information',
'information' => 'Information', 'information' => 'Information',
'name' => 'Server Name', 'server_name' => 'Server Name',
'notification_name' => 'Updated Server Name', 'notification_name' => 'Updated Server Name',
'description' => 'Server Description', 'description' => 'Server Description',
'notification_description' => 'Updated Server Description', 'notification_description' => 'Updated Server Description',
'failed' => 'Failed', 'failed' => 'Failed',
'uuid' => 'Server UUID', 'uuid' => 'Server UUID',
'id' => 'Server ID', 'id' => 'Server ID',
'node_name' => 'Node Name',
'limits' => [ 'limits' => [
'title' => 'Limits', 'title' => 'Limits',
'unlimited' => 'Unlimited', 'unlimited' => 'Unlimited',
@ -24,10 +25,6 @@ return [
'allocations' => 'Allocations', 'allocations' => 'Allocations',
'no_allocations' => 'No Additional Allocations', 'no_allocations' => 'No Additional Allocations',
], ],
],
'node_info' => [
'title' => 'Node Information',
'name' => 'Node Name',
'sftp' => [ 'sftp' => [
'title' => 'SFTP Information', 'title' => 'SFTP Information',
'connection' => 'Connection', 'connection' => 'Connection',