styled database hosts layout

This commit is contained in:
Scai 2024-04-15 01:55:44 +03:00
parent 5c8097d9b7
commit e1c6545507

View File

@ -5,6 +5,7 @@ namespace App\Filament\Resources;
use App\Filament\Resources\DatabaseHostResource\Pages; use App\Filament\Resources\DatabaseHostResource\Pages;
use App\Models\DatabaseHost; use App\Models\DatabaseHost;
use Filament\Forms; use Filament\Forms;
use Filament\Forms\Components\Section;
use Filament\Forms\Form; use Filament\Forms\Form;
use Filament\Resources\Resource; use Filament\Resources\Resource;
use Filament\Tables; use Filament\Tables;
@ -22,40 +23,45 @@ class DatabaseHostResource extends Resource
{ {
return $form return $form
->schema([ ->schema([
Forms\Components\TextInput::make('host') Section::make()->schema([
->helperText('The IP address or Domain name that should be used when attempting to connect to this MySQL host from this Panel to create new databases.') Forms\Components\TextInput::make('host')
->required() ->helperText('The IP address or Domain name that should be used when attempting to connect to this MySQL host from this Panel to create new databases.')
->live() ->required()
->debounce(500) ->live()
->afterStateUpdated(fn ($state, Forms\Set $set) => $set('name', $state)) ->debounce(500)
->maxLength(191), ->afterStateUpdated(fn ($state, Forms\Set $set) => $set('name', $state))
Forms\Components\TextInput::make('port') ->maxLength(191),
->helperText('The port that MySQL is running on for this host.') Forms\Components\TextInput::make('port')
->required() ->helperText('The port that MySQL is running on for this host.')
->numeric() ->required()
->default(3306) ->numeric()
->minValue(0) ->default(3306)
->maxValue(65535), ->minValue(0)
Forms\Components\TextInput::make('username') ->maxValue(65535),
->helperText('The username of an account that has enough permissions to create new users and databases on the system.') Forms\Components\TextInput::make('username')
->required() ->helperText('The username of an account that has enough permissions to create new users and databases on the system.')
->maxLength(191), ->required()
Forms\Components\TextInput::make('password') ->maxLength(191),
->helperText('The password for the database user.') Forms\Components\TextInput::make('password')
->password() ->helperText('The password for the database user.')
->revealable() ->password()
->maxLength(191) ->revealable()
->required(), ->maxLength(191)
Forms\Components\TextInput::make('name') ->required(),
->helperText('A short identifier used to distinguish this location from others. Must be between 1 and 60 characters, for example, us.nyc.lvl3.') Forms\Components\TextInput::make('name')
->required() ->helperText('A short identifier used to distinguish this location from others. Must be between 1 and 60 characters, for example, us.nyc.lvl3.')
->maxLength(60), ->required()
Forms\Components\Select::make('node_id') ->maxLength(60),
->searchable() Forms\Components\Select::make('node_id')
->preload() ->searchable()
->helperText('This setting only defaults to this database host when adding a database to a server on the selected node.') ->preload()
->label('Linked Node') ->helperText('This setting only defaults to this database host when adding a database to a server on the selected node.')
->relationship('node', 'name'), ->label('Linked Node')
->relationship('node', 'name'),
])->columns([
'default' => 1,
'lg' => 2,
]),
]); ]);
} }