diff --git a/frontend/libs/console/legacy-ce/src/lib/features/ConnectDBRedesign/components/ConnectMssqlWidget/schema.ts b/frontend/libs/console/legacy-ce/src/lib/features/ConnectDBRedesign/components/ConnectMssqlWidget/schema.ts index 77a03f1f58b..04e39c5238f 100644 --- a/frontend/libs/console/legacy-ce/src/lib/features/ConnectDBRedesign/components/ConnectMssqlWidget/schema.ts +++ b/frontend/libs/console/legacy-ce/src/lib/features/ConnectDBRedesign/components/ConnectMssqlWidget/schema.ts @@ -16,8 +16,8 @@ export const connectionInfoSchema = z.object({ ]), poolSettings: z .object({ - totalMaxConnections: z.number().optional(), - idleTimeout: z.number().optional(), + totalMaxConnections: z.number().min(0).optional(), + idleTimeout: z.number().min(0).optional(), }) .optional(), }); diff --git a/frontend/libs/console/legacy-ce/src/lib/features/ConnectDBRedesign/components/ConnectPostgresWidget/parts/NumberInput.tsx b/frontend/libs/console/legacy-ce/src/lib/features/ConnectDBRedesign/components/ConnectPostgresWidget/parts/NumberInput.tsx index 8c8ac4c9b84..12a499cbc36 100644 --- a/frontend/libs/console/legacy-ce/src/lib/features/ConnectDBRedesign/components/ConnectPostgresWidget/parts/NumberInput.tsx +++ b/frontend/libs/console/legacy-ce/src/lib/features/ConnectDBRedesign/components/ConnectPostgresWidget/parts/NumberInput.tsx @@ -48,6 +48,7 @@ export const NumberInputField = ({ )} data-testid={name} value={localValue} + onWheelCapture={e => e.currentTarget.blur()} /> diff --git a/frontend/libs/console/legacy-ce/src/lib/features/ConnectDBRedesign/components/ConnectPostgresWidget/parts/PoolSettings.tsx b/frontend/libs/console/legacy-ce/src/lib/features/ConnectDBRedesign/components/ConnectPostgresWidget/parts/PoolSettings.tsx index 7917a04a0f8..7833247f92c 100644 --- a/frontend/libs/console/legacy-ce/src/lib/features/ConnectDBRedesign/components/ConnectPostgresWidget/parts/PoolSettings.tsx +++ b/frontend/libs/console/legacy-ce/src/lib/features/ConnectDBRedesign/components/ConnectPostgresWidget/parts/PoolSettings.tsx @@ -1,5 +1,9 @@ import { InputField } from '../../../../../new-components/Form'; +const commonFieldProps: Partial> = { + onWheelCapture: e => e.currentTarget.blur(), +}; + export const PoolSettings = ({ name }: { name: string }) => { return ( <> @@ -9,6 +13,7 @@ export const PoolSettings = ({ name }: { name: string }) => { label="Total Max Connections" placeholder="1000" tooltip="Maximum number of database connections" + fieldProps={commonFieldProps} /> { label="Idle Timeout" placeholder="180" tooltip="The idle timeout (in seconds) per connection" + fieldProps={commonFieldProps} /> { label="Retries" placeholder="1" tooltip="Number of retries to perform" + fieldProps={commonFieldProps} /> { label="Pool Timeout" placeholder="360" tooltip="Maximum time (in seconds) to wait while acquiring a Postgres connection from the pool" + fieldProps={commonFieldProps} /> { label="Connection Lifetime" placeholder="600" tooltip="Time (in seconds) from connection creation after which the connection should be destroyed and a new one created. A value of 0 indicates we should never destroy an active connection. If 0 is passed, memory from large query results may not be reclaimed." + fieldProps={commonFieldProps} /> ); diff --git a/frontend/libs/console/legacy-ce/src/lib/features/ConnectDBRedesign/components/ConnectPostgresWidget/schema.ts b/frontend/libs/console/legacy-ce/src/lib/features/ConnectDBRedesign/components/ConnectPostgresWidget/schema.ts index 0c1f1df24de..683aa6f9b49 100644 --- a/frontend/libs/console/legacy-ce/src/lib/features/ConnectDBRedesign/components/ConnectPostgresWidget/schema.ts +++ b/frontend/libs/console/legacy-ce/src/lib/features/ConnectDBRedesign/components/ConnectPostgresWidget/schema.ts @@ -5,7 +5,7 @@ import { adaptPostgresConnection } from './utils/adaptResponse'; const numberSchema = z.preprocess( val => parseInt(val as string, 10), - z.union([z.number(), z.nan()]) + z.union([z.number().min(0), z.nan()]) ); export const poolSettingsSchema = z diff --git a/frontend/libs/console/legacy-ce/src/lib/new-components/Form/Input.tsx b/frontend/libs/console/legacy-ce/src/lib/new-components/Form/Input.tsx index 671287fa704..913fa021905 100644 --- a/frontend/libs/console/legacy-ce/src/lib/new-components/Form/Input.tsx +++ b/frontend/libs/console/legacy-ce/src/lib/new-components/Form/Input.tsx @@ -103,6 +103,11 @@ export type InputProps = FieldWrapperPassThroughProps & { * Optional right button */ rightButton?: React.ReactElement; + + /** + * Custom props to be passed to the HTML input element + */ + fieldProps?: React.HTMLProps; }; export const Input = ({ @@ -175,6 +180,7 @@ export const Input = ({ onInput={onInput} disabled={disabled} data-testid={name} + onWheelCapture={fieldProps?.onWheelCapture || undefined} {...fieldProps} /> {showInputEndContainer && ( diff --git a/frontend/libs/console/legacy-ce/src/lib/new-components/Form/InputField.tsx b/frontend/libs/console/legacy-ce/src/lib/new-components/Form/InputField.tsx index 070f4e4b879..5b408393bad 100644 --- a/frontend/libs/console/legacy-ce/src/lib/new-components/Form/InputField.tsx +++ b/frontend/libs/console/legacy-ce/src/lib/new-components/Form/InputField.tsx @@ -87,6 +87,10 @@ export type InputFieldProps = */ inputClassName?: string; rightButton?: ReactElement; + /** + * Custom props to be passed to the HTML input element + */ + fieldProps?: React.HTMLProps; }; export const InputField = >({