refactor: edit data soource

This commit is contained in:
katherinehhh 2024-01-22 21:40:25 +08:00
parent 101b60129e
commit cdd0a570f4

View File

@ -16,7 +16,6 @@ import { useForm, useField } from '@formily/react';
import PluginDatabaseConnectionsClient from '../'; import PluginDatabaseConnectionsClient from '../';
import { NAMESPACE } from '../locale'; import { NAMESPACE } from '../locale';
export const EditDatabaseConnectionAction = () => { export const EditDatabaseConnectionAction = () => {
const record = useRecord(); const record = useRecord();
const [schema, setSchema] = useState({}); const [schema, setSchema] = useState({});
@ -56,7 +55,7 @@ export const EditDatabaseConnectionAction = () => {
<a <a
onClick={() => { onClick={() => {
setVisible(true); setVisible(true);
const databaseType = plugin.databaseTypes.get(record.type || 'mysql'); const databaseType = plugin.databaseTypes.get(record.dialect);
setSchema({ setSchema({
type: 'object', type: 'object',
properties: { properties: {
@ -71,7 +70,10 @@ export const EditDatabaseConnectionAction = () => {
}, },
title: compile("{{t('Edit')}}") + ' - ' + compile(record.name), title: compile("{{t('Edit')}}") + ' - ' + compile(record.name),
properties: { properties: {
..._.cloneDeep(databaseType?.properties), body: {
type: 'void',
'x-component': databaseType.DataSourceSettingsForm,
},
footer: { footer: {
type: 'void', type: 'void',
'x-component': 'Action.Drawer.Footer', 'x-component': 'Action.Drawer.Footer',