mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-30 11:33:59 +00:00
import/export
This commit is contained in:
@@ -63,25 +63,18 @@ function DatabaseSelector() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function SourceTargetConfig({
|
function SourceTargetConfig({ direction, storageTypeField, connectionIdField, databaseNameField, tablesField }) {
|
||||||
isSource = false,
|
|
||||||
isTarget = false,
|
|
||||||
storageTypeField,
|
|
||||||
connectionIdField,
|
|
||||||
databaseNameField,
|
|
||||||
tablesField,
|
|
||||||
}) {
|
|
||||||
const types = [
|
const types = [
|
||||||
{ value: 'database', label: 'Database' },
|
{ value: 'database', label: 'Database', directions: ['source'] },
|
||||||
{ value: 'csv', label: 'CSV file(s)' },
|
{ value: 'csv', label: 'CSV file(s)', directions: ['target'] },
|
||||||
{ value: 'json', label: 'JSON file(s)' },
|
{ value: 'json', label: 'JSON file(s)', directions: [] },
|
||||||
];
|
];
|
||||||
const { values } = useFormikContext();
|
const { values } = useFormikContext();
|
||||||
return (
|
return (
|
||||||
<Column>
|
<Column>
|
||||||
{isSource && <Label>Source configuration</Label>}
|
{direction == 'source' && <Label>Source configuration</Label>}
|
||||||
{isTarget && <Label>Target configuration</Label>}
|
{direction == 'target' && <Label>Target configuration</Label>}
|
||||||
<FormReactSelect options={types} name={storageTypeField} />
|
<FormReactSelect options={types.filter((x) => x.directions.includes(direction))} name={storageTypeField} />
|
||||||
{values[storageTypeField] == 'database' && (
|
{values[storageTypeField] == 'database' && (
|
||||||
<>
|
<>
|
||||||
<Label>Server</Label>
|
<Label>Server</Label>
|
||||||
@@ -100,14 +93,14 @@ export default function ImportExportConfigurator() {
|
|||||||
return (
|
return (
|
||||||
<Wrapper>
|
<Wrapper>
|
||||||
<SourceTargetConfig
|
<SourceTargetConfig
|
||||||
isSource
|
direction="source"
|
||||||
storageTypeField="sourceStorageType"
|
storageTypeField="sourceStorageType"
|
||||||
connectionIdField="sourceConnectionId"
|
connectionIdField="sourceConnectionId"
|
||||||
databaseNameField="sourceDatabaseName"
|
databaseNameField="sourceDatabaseName"
|
||||||
tablesField="sourceTables"
|
tablesField="sourceTables"
|
||||||
/>
|
/>
|
||||||
<SourceTargetConfig
|
<SourceTargetConfig
|
||||||
isTarget
|
direction="target"
|
||||||
storageTypeField="targetStorageType"
|
storageTypeField="targetStorageType"
|
||||||
connectionIdField="targetConnectionId"
|
connectionIdField="targetConnectionId"
|
||||||
databaseNameField="targetDatabaseName"
|
databaseNameField="targetDatabaseName"
|
||||||
|
|||||||
Reference in New Issue
Block a user