mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-20 11:16:01 +00:00
next csv params
This commit is contained in:
@@ -21,6 +21,20 @@ const csvFormat: FileFormatDefinition = {
|
||||
],
|
||||
apiName: 'delimiter',
|
||||
},
|
||||
{
|
||||
type: 'checkbox',
|
||||
name: 'quoted',
|
||||
label: 'Quoted',
|
||||
apiName: 'quoted',
|
||||
direction: 'target',
|
||||
},
|
||||
{
|
||||
type: 'checkbox',
|
||||
name: 'header',
|
||||
label: 'Has header row',
|
||||
apiName: 'header',
|
||||
default: true,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ function extractApiParameters(values, direction, format) {
|
||||
const pairs = (format.args || [])
|
||||
.filter((arg) => arg.apiName)
|
||||
.map((arg) => [arg.apiName, values[`${direction}_${format.storageType}_${arg.name}`]])
|
||||
.filter((x) => x[1]);
|
||||
.filter((x) => x[1] != null);
|
||||
return _.fromPairs(pairs);
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ function FormArgument({ arg, namePrefix }) {
|
||||
return <FormTextField label={arg.label} name={name} />;
|
||||
}
|
||||
if (arg.type == 'checkbox') {
|
||||
return <FormCheckboxField label={arg.label} name={name} />;
|
||||
return <FormCheckboxField label={arg.label} name={name} defaultValue={arg.default} />;
|
||||
}
|
||||
if (arg.type == 'select') {
|
||||
return (
|
||||
|
||||
@@ -50,12 +50,14 @@ export function FormTextField({ label, ...other }) {
|
||||
);
|
||||
}
|
||||
|
||||
export function FormCheckboxFieldRaw({ name = undefined, ...other }) {
|
||||
export function FormCheckboxFieldRaw({ name = undefined, defaultValue = undefined, ...other }) {
|
||||
const { values, setFieldValue } = useFormikContext();
|
||||
const handleChange = (event) => {
|
||||
setFieldValue(name, event.target.checked);
|
||||
};
|
||||
return <CheckboxField name={name} checked={!!values[name]} onChange={handleChange} {...other} />;
|
||||
let isChecked = values[name];
|
||||
if (isChecked == null) isChecked = defaultValue;
|
||||
return <CheckboxField name={name} checked={!!isChecked} onChange={handleChange} {...other} />;
|
||||
// return <Field {...other} as={CheckboxField} />;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user