import { PlusOutlined } from '@ant-design/icons'; import { uid } from '@formily/shared'; import { ActionContext, SchemaComponent, useCompile, usePlugin } from '@nocobase/client'; import { Button, Dropdown } from 'antd'; import _ from 'lodash'; import React, { useState } from 'react'; import { useTranslation } from 'react-i18next'; import PluginDatabaseConnectionsClient from '../'; import { NAMESPACE } from '../locale'; import { useTestConnectionAction } from '../hooks'; export const CreateDatabaseConnectAction = () => { const [schema, setSchema] = useState({}); const plugin = usePlugin(PluginDatabaseConnectionsClient); const compile = useCompile(); const [visible, setVisible] = useState(false); const { t } = useTranslation(); const [dialect, setDialect] = useState(null); const useDialectDataSource = (field) => { const options = [...plugin.databaseTypes.keys()].map((key) => { const databaseType = plugin.databaseTypes.get(key); return { value: databaseType.name, label: compile(databaseType.label), }; }); field.dataSource = options; }; return (
{ const databaseType = plugin.databaseTypes.get(key); return { key: key, label: compile(databaseType?.label), }; }), }} >
); };