Skip to content

Commit a9c5f41

Browse files
authored
Change innodb_flush_neighbors type to number with min/max constraints (#33)
* Change innodb_flush_neighbors type to number with min/max constraints * Refactor input change handling to check for null or undefined values instead of empty strings * Fix ConfigField value handling to check for undefined and null values
1 parent b908896 commit a9c5f41

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

src/artifacts/index.tsx

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const ConfigField = ({ name, field, onChange, value }) => {
2222

2323
{field.type === 'select' ? (
2424
<select
25-
value={value || ''}
25+
value={value !== undefined && value !== null ? value : ''}
2626
onChange={(e) => onChange(name, e.target.value)}
2727
className="w-full p-2 border border-gray-300 rounded-md bg-white text-black"
2828
>
@@ -44,7 +44,7 @@ const ConfigField = ({ name, field, onChange, value }) => {
4444
) : (
4545
<input
4646
type={field.type}
47-
value={value || ''}
47+
value={value !== undefined && value !== null ? value : ''}
4848
min={field.min}
4949
max={field.max}
5050
pattern={field.pattern}
@@ -333,9 +333,11 @@ const MySQLConfigForm = ({ databaseId, onDatabaseIdChange }) => {
333333
example: 25
334334
},
335335
innodb_flush_neighbors: {
336-
type: 'select',
337-
options: [0, 1, 2],
336+
type: 'number',
337+
min: 0,
338+
max: 2,
338339
description: 'Specifies whether flushing a page from the InnoDB buffer pool also flushes other dirty pages in the same extent. 0: disables this functionality, 1: flushes contiguous dirty pages, 2: flushes dirty pages in the same extent.',
340+
example: 1
339341
},
340342
innodb_read_io_threads: {
341343
type: 'number',
@@ -374,7 +376,7 @@ const MySQLConfigForm = ({ databaseId, onDatabaseIdChange }) => {
374376

375377

376378
const handleInputChange = (name, value) => {
377-
if (value === '') {
379+
if (value === null || value === undefined) {
378380
const newConfig = { ...config };
379381
delete newConfig[name];
380382
setConfig(newConfig);
@@ -856,7 +858,7 @@ const PostgreSQLConfigForm = ({ databaseId, onDatabaseIdChange }) => {
856858

857859

858860
const handleInputChange = (name, value) => {
859-
if (value === '') {
861+
if (value === null || value === undefined) {
860862
const newConfig = { ...config };
861863
delete newConfig[name];
862864
setConfig(newConfig);
@@ -1011,7 +1013,7 @@ volatile-ttl: Evict keys with expiration only, shortest time-to-live (TTL) first
10111013
};
10121014

10131015
const handleInputChange = (name, value) => {
1014-
if (value === '') {
1016+
if (value === null || value === undefined) {
10151017
const newConfig = { ...config };
10161018
delete newConfig[name];
10171019
setConfig(newConfig);
@@ -1086,7 +1088,7 @@ const MongoConfigForm = ({ databaseId, onDatabaseIdChange }) => {
10861088

10871089

10881090
const handleInputChange = (name, value) => {
1089-
if (value === '') {
1091+
if (value === null || value === undefined) {
10901092
const newConfig = { ...config };
10911093
delete newConfig[name];
10921094
setConfig(newConfig);
@@ -1376,7 +1378,7 @@ const OpenSearchConfigForm = ({ databaseId, onDatabaseIdChange }) => {
13761378

13771379

13781380
const handleInputChange = (name, value) => {
1379-
if (value === '') {
1381+
if (value === null || value === undefined) {
13801382
const newConfig = { ...config };
13811383
delete newConfig[name];
13821384
setConfig(newConfig);
@@ -1683,7 +1685,7 @@ const KafkaConfigForm = ({ databaseId, onDatabaseIdChange }) => {
16831685

16841686

16851687
const handleInputChange = (name, value) => {
1686-
if (value === '') {
1688+
if (value === null || value === undefined) {
16871689
const newConfig = { ...config };
16881690
delete newConfig[name];
16891691
setConfig(newConfig);
@@ -1827,7 +1829,7 @@ const DatabaseConfigApp = () => {
18271829
{/* Footer */}
18281830
<div className="text-center text-gray-600 py-8">
18291831
<p className="text-sm">
1830-
Thoughtfully crafted by DigitalOceans Solutions Architects team. We hope you found it useful.{' '}
1832+
Thoughtfully crafted by DigitalOcean's Solutions Architects team. We hope you found it useful. {' '}
18311833
<span role="img" aria-label="heart" className="text-red-500">❤️</span>
18321834
</p>
18331835
<p className="text-sm mt-2">

0 commit comments

Comments
 (0)