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([
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))
->required()
->columnSpan([
@ -79,14 +79,19 @@ class Settings extends ServerFormPage
->columnSpan([
'default' => 1,
'sm' => 1,
'md' => 3,
'lg' => 5,
'md' => 2,
'lg' => 4,
])
->disabled(),
TextInput::make('id')
->label(trans('server/setting.server_info.id'))
->disabled()
->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()
->label(trans('server/setting.server_info.limits.title'))
@ -146,15 +151,7 @@ class Settings extends ServerFormPage
->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),
]),
]),
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'))
Fieldset::make(trans('server/setting.server_info.sftp.title'))
->columnSpanFull()
->hidden(fn (Server $server) => !auth()->user()->can(Permission::ACTION_FILE_SFTP, $server))
->columns([
@ -165,13 +162,13 @@ class Settings extends ServerFormPage
])
->schema([
TextInput::make('connection')
->label(trans('server/setting.node_info.sftp.connection'))
->label(trans('server/setting.server_info.sftp.connection'))
->columnSpan(1)
->disabled()
->copyable(fn () => request()->isSecure())
->hintAction(
Action::make('connect_sftp')
->label(trans('server/setting.node_info.sftp.action'))
->label(trans('server/setting.server_info.sftp.action'))
->color('success')
->icon('tabler-plug')
->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;
}),
TextInput::make('username')
->label(trans('server/setting.node_info.sftp.username'))
->label(trans('server/setting.server_info.sftp.username'))
->columnSpan(1)
->copyable(fn () => request()->isSecure())
->disabled()
->formatStateUsing(fn (Server $server) => auth()->user()->username . '.' . $server->uuid_short),
TextEntry::make('password')
->label(trans('server/setting.node_info.sftp.password'))
->label(trans('server/setting.server_info.sftp.password'))
->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'))

View File

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