Skip to content

Commit

Permalink
refactor(database-config): 移除未使用的模板保存和连接历史功能
Browse files Browse the repository at this point in the history
移除了数据库配置表单中未使用的模板保存和连接历史功能,以简化组件并提高可维护性。

Refactor the DatabaseConfigForm component by removing the unused saveAsTemplate and showConnectionHistory functions. This change simplifies the component and improves maintainability.
  • Loading branch information
www.zerocode.net.cn committed Sep 8, 2024
1 parent 659ef9c commit f5dcdb1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
14 changes: 2 additions & 12 deletions src/pages/database-config/DatabaseConfigForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
import React, { useEffect, useState } from 'react';

const { Option } = Select;
const { Title, Text } = Typography;
const { Text } = Typography;

const DATABASE_CONFIG_URL = '/ncnb/dataSources';

Expand Down Expand Up @@ -71,16 +71,6 @@ const DatabaseConfigForm: React.FC<DatabaseConfigFormProps> = ({ initialValues,
}
};

const saveAsTemplate = () => {
message.success('模板保存成功');
// 实际实现中,这里应该调用API保存模板
};

const showConnectionHistory = () => {
message.info('显示连接历史');
// 实际实现中,这里应该打开一个显示连接历史的模态框或抽屉
};

const dbTypeMap: Record<string, string> = {
mysql: 'MySQL',
postgresql: 'PostgreSQL',
Expand Down Expand Up @@ -170,7 +160,7 @@ const DatabaseConfigForm: React.FC<DatabaseConfigFormProps> = ({ initialValues,
port: 3306,
...initialValues,
}}
onValuesChange={(changedValues, allValues) => {
onValuesChange={(changedValues) => {
if (connectionType === 'host' && !changedValues.url) {
updateJdbcUrl();
}
Expand Down
2 changes: 1 addition & 1 deletion src/utils/databaseUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const getDriverClassName = (type: string) => {
}
};

export const generateJdbcUrl = (type: string, host: string, port: string, databaseName: string) => {
export const generateJdbcUrl = (type: string, host: string, port: number, databaseName: string) => {
switch (type.toLowerCase()) {
case 'mysql':
return `jdbc:mysql://${host}:${port}/${databaseName}`;
Expand Down

0 comments on commit f5dcdb1

Please sign in to comment.