Skip to content

Commit 8d97c74

Browse files
committed
Merge branch 'ignore-logical-errors-for-ui' into 'master'
feat(ui): ignore errors that occured during logical data/dump restore See merge request postgres-ai/database-lab!700
2 parents d410d09 + acf0b28 commit 8d97c74

File tree

6 files changed

+118
-53
lines changed

6 files changed

+118
-53
lines changed

ui/packages/ce/src/api/configs/updateConfig.ts

+2
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export const updateConfig = async (req: Config) => {
3131
databases: postUniqueDatabases(req.databases),
3232
customOptions: postUniqueCustomOptions(req.pgDumpCustomOptions),
3333
parallelJobs: req.dumpParallelJobs,
34+
ignoreErrors: req.dumpIgnoreErrors,
3435
source: {
3536
connection: {
3637
dbname: req.dbname,
@@ -48,6 +49,7 @@ export const updateConfig = async (req: Config) => {
4849
req.pgRestoreCustomOptions,
4950
),
5051
parallelJobs: req.restoreParallelJobs,
52+
ignoreErrors: req.restoreIgnoreErrors,
5153
},
5254
},
5355
},

ui/packages/shared/pages/Configuration/InputWithTooltip/index.tsx

+5-2
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ export const InputWithTooltip = ({
5959
error={Boolean(error)}
6060
onChange={onChange}
6161
disabled={disabled}
62+
InputLabelProps={{
63+
shrink: true,
64+
}}
6265
/>
6366
<Tooltip interactive content={<p>{tooltipText()}</p>}>
6467
<InfoIcon className={styles.infoIcon} />
@@ -82,7 +85,7 @@ export const InputWithChip = ({
8285
handleDeleteChip: (
8386
event: React.FormEvent<HTMLInputElement>,
8487
uniqueValue: string,
85-
label: string
88+
label: string,
8689
) => void
8790
label: string
8891
id: string
@@ -91,7 +94,7 @@ export const InputWithChip = ({
9194
const classes = useStyles()
9295

9396
return (
94-
<Box mt={2} mb={2}>
97+
<Box mt={2} mb={1}>
9598
<Box display="flex" alignItems="center">
9699
<TextField
97100
className={classNames(

ui/packages/shared/pages/Configuration/index.tsx

+100-50
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ export const Configuration = observer(
287287
<Box>
288288
<Header retrievalMode="logical" setOpen={handleModalClick} />
289289
<Box>
290-
<Box mb={2}>
290+
<Box>
291291
<FormControlLabel
292292
control={
293293
<Checkbox
@@ -415,7 +415,7 @@ export const Configuration = observer(
415415
}
416416
/>
417417
</Box>
418-
<Box mb={3}>
418+
<Box mb={1}>
419419
<ConfigSectionTitle tag="retrieval" />
420420
<Box mt={1}>
421421
<Typography className={styles.subsection}>
@@ -472,18 +472,20 @@ export const Configuration = observer(
472472
formik.setFieldValue('dbname', e.target.value)
473473
}
474474
/>
475-
<InputWithChip
476-
value={formik.values.databases}
477-
label="Databases"
478-
id="databases"
479-
tooltipText={tooltipText.databases}
480-
handleDeleteChip={handleDeleteChip}
481-
disabled={isConfigurationDisabled}
482-
onChange={(e) =>
483-
formik.setFieldValue('databases', e.target.value)
484-
}
485-
/>
486475
<Box mt={2}>
476+
<InputWithChip
477+
value={formik.values.databases}
478+
label="Databases"
479+
id="databases"
480+
tooltipText={tooltipText.databases}
481+
handleDeleteChip={handleDeleteChip}
482+
disabled={isConfigurationDisabled}
483+
onChange={(e) =>
484+
formik.setFieldValue('databases', e.target.value)
485+
}
486+
/>
487+
</Box>
488+
<Box mt={2} mb={3}>
487489
<Button
488490
variant="primary"
489491
size="medium"
@@ -498,6 +500,51 @@ export const Configuration = observer(
498500
)}
499501
</Button>
500502
</Box>
503+
<InputWithTooltip
504+
label="pg_dump jobs"
505+
value={formik.values.dumpParallelJobs}
506+
tooltipText={tooltipText.dumpParallelJobs}
507+
disabled={isConfigurationDisabled}
508+
onChange={(e) =>
509+
formik.setFieldValue('dumpParallelJobs', e.target.value)
510+
}
511+
/>
512+
{dleEdition !== 'community' && (
513+
<InputWithChip
514+
value={formik.values.pgDumpCustomOptions}
515+
label="pg_dump customOptions"
516+
id="pgDumpCustomOptions"
517+
tooltipText={tooltipText.pgDumpCustomOptions}
518+
handleDeleteChip={handleDeleteChip}
519+
disabled={isConfigurationDisabled}
520+
onChange={(e) =>
521+
formik.setFieldValue(
522+
'pgDumpCustomOptions',
523+
e.target.value,
524+
)
525+
}
526+
/>
527+
)}
528+
<FormControlLabel
529+
style={{ maxWidth: 'max-content' }}
530+
control={
531+
<Checkbox
532+
name="dumpIgnoreErrors"
533+
checked={formik.values.dumpIgnoreErrors}
534+
disabled={isConfigurationDisabled}
535+
onChange={(e) =>
536+
formik.setFieldValue(
537+
'dumpIgnoreErrors',
538+
e.target.checked,
539+
)
540+
}
541+
classes={{
542+
root: classes.checkboxRoot,
543+
}}
544+
/>
545+
}
546+
label={'Ignore errors during logical data dump'}
547+
/>
501548
{(connectionStatus && connectionRes) || dbSourceError ? (
502549
<ResponseMessage
503550
type={dbSourceError ? 'error' : connectionStatus}
@@ -506,40 +553,23 @@ export const Configuration = observer(
506553
) : null}
507554
</Box>
508555
</Box>
509-
<InputWithTooltip
510-
label="pg_dump jobs"
511-
value={formik.values.dumpParallelJobs}
512-
tooltipText={tooltipText.dumpParallelJobs}
513-
disabled={isConfigurationDisabled}
514-
onChange={(e) =>
515-
formik.setFieldValue('dumpParallelJobs', e.target.value)
516-
}
517-
/>
518-
<InputWithTooltip
519-
label="pg_restore jobs"
520-
value={formik.values.restoreParallelJobs}
521-
tooltipText={tooltipText.restoreParallelJobs}
522-
disabled={isConfigurationDisabled}
523-
onChange={(e) =>
524-
formik.setFieldValue('restoreParallelJobs', e.target.value)
525-
}
526-
/>
527-
{dleEdition !== 'community' && (
528-
<>
529-
<InputWithChip
530-
value={formik.values.pgDumpCustomOptions}
531-
label="pg_dump customOptions"
532-
id="pgDumpCustomOptions"
533-
tooltipText={tooltipText.pgDumpCustomOptions}
534-
handleDeleteChip={handleDeleteChip}
535-
disabled={isConfigurationDisabled}
536-
onChange={(e) =>
537-
formik.setFieldValue(
538-
'pgDumpCustomOptions',
539-
e.target.value,
540-
)
541-
}
542-
/>
556+
<Box>
557+
<Box>
558+
<Typography className={styles.subsection}>
559+
Subsection "retrieval.spec.logicalRestore"
560+
</Typography>
561+
<span className={classes.grayText}>Restoring options.</span>
562+
</Box>
563+
<InputWithTooltip
564+
label="pg_restore jobs"
565+
value={formik.values.restoreParallelJobs}
566+
tooltipText={tooltipText.restoreParallelJobs}
567+
disabled={isConfigurationDisabled}
568+
onChange={(e) =>
569+
formik.setFieldValue('restoreParallelJobs', e.target.value)
570+
}
571+
/>
572+
{dleEdition !== 'community' && (
543573
<InputWithChip
544574
value={formik.values.pgRestoreCustomOptions}
545575
label="pg_restore customOptions"
@@ -554,9 +584,29 @@ export const Configuration = observer(
554584
)
555585
}
556586
/>
557-
</>
558-
)}
559-
<Box>
587+
)}
588+
<FormControlLabel
589+
style={{ maxWidth: 'max-content' }}
590+
control={
591+
<Checkbox
592+
name="restoreIgnoreErrors"
593+
checked={formik.values.restoreIgnoreErrors}
594+
disabled={isConfigurationDisabled}
595+
onChange={(e) =>
596+
formik.setFieldValue(
597+
'restoreIgnoreErrors',
598+
e.target.checked,
599+
)
600+
}
601+
classes={{
602+
root: classes.checkboxRoot,
603+
}}
604+
/>
605+
}
606+
label={'Ignore errors during logical data restore'}
607+
/>
608+
</Box>
609+
<Box mt={1}>
560610
<Typography className={styles.subsection}>
561611
Subsection "retrieval.refresh"
562612
</Typography>

ui/packages/shared/pages/Configuration/styles.module.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
.chipContainer {
2222
width: 350px;
2323
max-width: 100%;
24-
margin-bottom: 1.25rem;
24+
margin-bottom: 0;
2525
}
2626

2727
.databasesContainer {

ui/packages/shared/pages/Configuration/useForm.ts

+4
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ export type FormValues = {
2222
password: string
2323
databases: string
2424
dumpParallelJobs: string
25+
dumpIgnoreErrors: boolean
2526
restoreParallelJobs: string
27+
restoreIgnoreErrors: boolean
2628
pgDumpCustomOptions: string
2729
pgRestoreCustomOptions: string
2830
}
@@ -54,6 +56,8 @@ export const useForm = (onSubmit: (values: FormValues) => void) => {
5456
restoreParallelJobs: '',
5557
pgDumpCustomOptions: '',
5658
pgRestoreCustomOptions: '',
59+
dumpIgnoreErrors: false,
60+
restoreIgnoreErrors: false,
5761
},
5862
validationSchema: Schema,
5963
onSubmit,

ui/packages/shared/types/api/entities/config.ts

+6
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export type configTypes = {
3131
customOptions?: string[]
3232
databases?: DatabaseType | null
3333
parallelJobs?: string | number
34+
ignoreErrors?: boolean
3435
source?: {
3536
connection?: {
3637
dbname?: string
@@ -46,6 +47,7 @@ export type configTypes = {
4647
options?: {
4748
customOptions?: string[]
4849
parallelJobs?: string | number
50+
ignoreErrors?: boolean
4951
}
5052
}
5153
}
@@ -81,8 +83,12 @@ export const formatConfig = (config: configTypes) => {
8183
),
8284
dumpParallelJobs:
8385
config.retrieval?.spec?.logicalDump?.options?.parallelJobs,
86+
dumpIgnoreErrors:
87+
config.retrieval?.spec?.logicalDump?.options?.ignoreErrors,
8488
restoreParallelJobs:
8589
config.retrieval?.spec?.logicalRestore?.options?.parallelJobs,
90+
restoreIgnoreErrors:
91+
config.retrieval?.spec?.logicalRestore?.options?.ignoreErrors,
8692
pgDumpCustomOptions: formatDumpCustomOptions(
8793
(config.retrieval?.spec?.logicalDump?.options
8894
?.customOptions as string[]) || null,

0 commit comments

Comments
 (0)