mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-23 01:06:01 +00:00
fix
This commit is contained in:
@@ -1,20 +1,15 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import FormStyledButton from '../widgets/FormStyledButton';
|
import FormStyledButton from '../widgets/FormStyledButton';
|
||||||
import { Formik, Form, useFormik, useFormikContext } from 'formik';
|
import { useFormikContext } from 'formik';
|
||||||
import styled from 'styled-components';
|
import styled from 'styled-components';
|
||||||
import Select from 'react-select';
|
|
||||||
import { FontIcon } from '../icons';
|
|
||||||
import {
|
import {
|
||||||
FormButtonRow,
|
|
||||||
FormSubmit,
|
|
||||||
FormReactSelect,
|
FormReactSelect,
|
||||||
FormConnectionSelect,
|
FormConnectionSelect,
|
||||||
FormDatabaseSelect,
|
FormDatabaseSelect,
|
||||||
FormTablesSelect,
|
FormTablesSelect,
|
||||||
FormSelectField,
|
|
||||||
FormSchemaSelect,
|
FormSchemaSelect,
|
||||||
} from '../utility/forms';
|
} from '../utility/forms';
|
||||||
import { useConnectionList, useDatabaseList, useDatabaseInfo } from '../utility/metadataLoaders';
|
import { useDatabaseInfo } from '../utility/metadataLoaders';
|
||||||
import TableControl, { TableColumn } from '../utility/TableControl';
|
import TableControl, { TableColumn } from '../utility/TableControl';
|
||||||
import { TextField, SelectField } from '../utility/inputs';
|
import { TextField, SelectField } from '../utility/inputs';
|
||||||
import { getActionOptions, getTargetName, isFileStorage } from './createImpExpScript';
|
import { getActionOptions, getTargetName, isFileStorage } from './createImpExpScript';
|
||||||
@@ -38,14 +33,6 @@ const Column = styled.div`
|
|||||||
flex: 1;
|
flex: 1;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const StyledSelect = styled(Select)`
|
|
||||||
// min-width: 350px;
|
|
||||||
`;
|
|
||||||
|
|
||||||
const OptionsWrapper = styled.div`
|
|
||||||
margin-left: 10px;
|
|
||||||
`;
|
|
||||||
|
|
||||||
const Label = styled.div`
|
const Label = styled.div`
|
||||||
margin: 5px;
|
margin: 5px;
|
||||||
margin-top: 15px;
|
margin-top: 15px;
|
||||||
@@ -65,32 +52,6 @@ const TrashWrapper = styled.div`
|
|||||||
color: blue;
|
color: blue;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
function DatabaseSelector() {
|
|
||||||
const connections = useConnectionList();
|
|
||||||
const connectionOptions = React.useMemo(
|
|
||||||
() =>
|
|
||||||
(connections || []).map((conn) => ({
|
|
||||||
value: conn._id,
|
|
||||||
label: conn.displayName || conn.server,
|
|
||||||
})),
|
|
||||||
[connections]
|
|
||||||
);
|
|
||||||
|
|
||||||
// const databases = useDatabaseList({ conid: _id });
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<Label>Server</Label>
|
|
||||||
<StyledSelect
|
|
||||||
options={connectionOptions}
|
|
||||||
// defaultValue={type}
|
|
||||||
// onChange={setType}
|
|
||||||
menuPortalTarget={document.body}
|
|
||||||
/>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function getFileFilters(storageType) {
|
function getFileFilters(storageType) {
|
||||||
const res = [];
|
const res = [];
|
||||||
if (storageType == 'csv') res.push({ name: 'CSV files', extensions: ['csv'] });
|
if (storageType == 'csv') res.push({ name: 'CSV files', extensions: ['csv'] });
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ export function FormReactSelect({ options, name, isMulti = false }) {
|
|||||||
return (
|
return (
|
||||||
<Select
|
<Select
|
||||||
options={options}
|
options={options}
|
||||||
defaultValue={
|
value={
|
||||||
isMulti
|
isMulti
|
||||||
? options.filter((x) => values[name] && values[name].includes(x.value))
|
? options.filter((x) => values[name] && values[name].includes(x.value))
|
||||||
: options.find((x) => x.value == values[name])
|
: options.find((x) => x.value == values[name])
|
||||||
|
|||||||
Reference in New Issue
Block a user