diff --git a/app/Filament/Resources/DatabaseHostResource/Pages/CreateDatabaseHost.php b/app/Filament/Resources/DatabaseHostResource/Pages/CreateDatabaseHost.php index 60abcf828..8280c95c6 100644 --- a/app/Filament/Resources/DatabaseHostResource/Pages/CreateDatabaseHost.php +++ b/app/Filament/Resources/DatabaseHostResource/Pages/CreateDatabaseHost.php @@ -22,47 +22,56 @@ class CreateDatabaseHost extends CreateRecord { return $form ->schema([ - Section::make()->schema([ - Forms\Components\TextInput::make('host') - ->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.') - ->required() - ->live() - ->debounce(500) - ->afterStateUpdated(fn ($state, Forms\Set $set) => $set('name', $state)) - ->maxLength(191), - Forms\Components\TextInput::make('port') - ->helperText('The port that MySQL is running on for this host.') - ->required() - ->numeric() - ->default(3306) - ->minValue(0) - ->maxValue(65535), - Forms\Components\TextInput::make('username') - ->helperText('The username of an account that has enough permissions to create new users and databases on the system.') - ->required() - ->maxLength(191), - Forms\Components\TextInput::make('password') - ->helperText('The password for the database user.') - ->password() - ->revealable() - ->maxLength(191) - ->required(), - Forms\Components\TextInput::make('name') - ->helperText('A short identifier used to distinguish this location from others. Must be between 1 and 60 characters, for example, us.nyc.lvl3.') - ->required() - ->maxLength(60), - Forms\Components\Select::make('node_id') - ->searchable() - ->preload() - ->helperText('This setting only defaults to this database host when adding a database to a server on the selected node.') - ->label('Linked Node') - ->relationship('node', 'name'), - ])->columns([ - 'default' => 1, - 'lg' => 2, - ]), + Section::make() + ->columns([ + 'default' => 2, + 'sm' => 3, + 'md' => 3, + 'lg' => 4, + ]) + ->schema([ + Forms\Components\TextInput::make('host') + ->columnSpan(2) + ->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.') + ->required() + ->live(onBlur: true) + ->afterStateUpdated(fn ($state, Forms\Set $set) => $set('name', $state)) + ->maxLength(191), + Forms\Components\TextInput::make('port') + ->columnSpan(1) + ->helperText('The port that MySQL is running on for this host.') + ->required() + ->numeric() + ->default(3306) + ->minValue(0) + ->maxValue(65535), + Forms\Components\TextInput::make('max_databases') + ->label('Max databases') + ->helpertext('Blank is unlimited.') + ->numeric(), + Forms\Components\TextInput::make('name') + ->label('Display Name') + ->helperText('A short identifier used to distinguish this location from others. Must be between 1 and 60 characters, for example, us.nyc.lvl3.') + ->required() + ->maxLength(60), + Forms\Components\TextInput::make('username') + ->helperText('The username of an account that has enough permissions to create new users and databases on the system.') + ->required() + ->maxLength(191), + Forms\Components\TextInput::make('password') + ->helperText('The password for the database user.') + ->password() + ->revealable() + ->maxLength(191) + ->required(), + Forms\Components\Select::make('node_id') + ->searchable() + ->preload() + ->helperText('This setting only defaults to this database host when adding a database to a server on the selected node.') + ->label('Linked Node') + ->relationship('node', 'name'), + ]), ]); - } protected function mutateFormDataBeforeCreate(array $data): array diff --git a/app/Filament/Resources/DatabaseHostResource/Pages/EditDatabaseHost.php b/app/Filament/Resources/DatabaseHostResource/Pages/EditDatabaseHost.php index 2f3d84431..6e6c9e658 100644 --- a/app/Filament/Resources/DatabaseHostResource/Pages/EditDatabaseHost.php +++ b/app/Filament/Resources/DatabaseHostResource/Pages/EditDatabaseHost.php @@ -17,45 +17,54 @@ class EditDatabaseHost extends EditRecord { return $form ->schema([ - Section::make()->schema([ - Forms\Components\TextInput::make('host') - ->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.') - ->required() - ->live() - ->debounce(500) - ->afterStateUpdated(fn ($state, Forms\Set $set) => $set('name', $state)) - ->maxLength(191), - Forms\Components\TextInput::make('port') - ->helperText('The port that MySQL is running on for this host.') - ->required() - ->numeric() - ->default(3306) - ->minValue(0) - ->maxValue(65535), - Forms\Components\TextInput::make('username') - ->helperText('The username of an account that has enough permissions to create new users and databases on the system.') - ->required() - ->maxLength(191), - Forms\Components\TextInput::make('password') - ->helperText('The password for the database user.') - ->password() - ->revealable() - ->maxLength(191) - ->required(), - Forms\Components\TextInput::make('name') - ->helperText('A short identifier used to distinguish this location from others. Must be between 1 and 60 characters, for example, us.nyc.lvl3.') - ->required() - ->maxLength(60), - Forms\Components\Select::make('node_id') - ->searchable() - ->preload() - ->helperText('This setting only defaults to this database host when adding a database to a server on the selected node.') - ->label('Linked Node') - ->relationship('node', 'name'), - ])->columns([ - 'default' => 1, - 'lg' => 2, - ]), + Section::make() + ->columns([ + 'default' => 2, + 'sm' => 3, + 'md' => 3, + 'lg' => 4, + ]) + ->schema([ + Forms\Components\TextInput::make('host') + ->columnSpan(2) + ->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.') + ->required() + ->live(onBlur: true) + ->afterStateUpdated(fn ($state, Forms\Set $set) => $set('name', $state)) + ->maxLength(191), + Forms\Components\TextInput::make('port') + ->columnSpan(1) + ->helperText('The port that MySQL is running on for this host.') + ->required() + ->numeric() + ->minValue(0) + ->maxValue(65535), + Forms\Components\TextInput::make('max_databases') + ->label('Max databases') + ->helpertext('Blank is unlimited.') + ->numeric(), + Forms\Components\TextInput::make('name') + ->label('Display Name') + ->helperText('A short identifier used to distinguish this location from others. Must be between 1 and 60 characters, for example, us.nyc.lvl3.') + ->required() + ->maxLength(60), + Forms\Components\TextInput::make('username') + ->helperText('The username of an account that has enough permissions to create new users and databases on the system.') + ->required() + ->maxLength(191), + Forms\Components\TextInput::make('password') + ->helperText('The password for the database user.') + ->password() + ->revealable() + ->maxLength(191) + ->required(), + Forms\Components\Select::make('node_id') + ->searchable() + ->preload() + ->helperText('This setting only defaults to this database host when adding a database to a server on the selected node.') + ->label('Linked Node') + ->relationship('node', 'name'), + ]), ]); }