Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature]: Implement batch testing for data source connectivity and fix table column type issues #502

Merged
merged 2 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/base/src/data/EmitterKey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ enum EmitterKey {
DMS_Sync_Project_Archived_Status = 'DMS_Sync_Project_Archived_Status',
DMS_Refresh_Export_Data_Workflow = 'DMS_Refresh_Export_Data_Workflow',
DMS_Refresh_Sync_Data_Source = 'DMS_Refresh_Sync_Data_Source',
DMS_Refresh_Global_Data_Source = 'DMS_Refresh_Global_Data_Source'
DMS_Refresh_Global_Data_Source = 'DMS_Refresh_Global_Data_Source',
DMS_Batch_Test_Data_Source_Connection = 'DMS_Batch_Test_Data_Source_Connection'
}

export default EmitterKey;
16 changes: 16 additions & 0 deletions packages/base/src/hooks/useStaticTips/index.data.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { ListDBServicesFilterLastConnectionTestStatusEnum } from '@actiontech/shared/lib/api/base/service/DBService/index.enum';
import { t } from '../../locale';

type IStaticEnumDictionary<T extends string> = {
[key in T]: string;
};

export const databaseTestConnectionStatusDictionary: IStaticEnumDictionary<ListDBServicesFilterLastConnectionTestStatusEnum> =
{
[ListDBServicesFilterLastConnectionTestStatusEnum.connect_failed]: t(
'dmsDataSource.batchTestConnection.connectFailed'
),
[ListDBServicesFilterLastConnectionTestStatusEnum.connect_success]: t(
'dmsDataSource.batchTestConnection.connectSucceed'
)
};
22 changes: 22 additions & 0 deletions packages/base/src/hooks/useStaticTips/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { ListDBServicesFilterLastConnectionTestStatusEnum } from '@actiontech/shared/lib/api/base/service/DBService/index.enum';
import { SelectProps } from 'antd';
import { useMemo } from 'react';
import { databaseTestConnectionStatusDictionary } from './index.data';

const useStaticTips = () => {
const generateDatabaseTestConnectionStatusSelectOptions: SelectProps['options'] =
useMemo(() => {
return Object.values(
ListDBServicesFilterLastConnectionTestStatusEnum
).map((v) => ({
label: databaseTestConnectionStatusDictionary[v],
value: v
}));
}, []);

return {
generateDatabaseTestConnectionStatusSelectOptions
};
};

export default useStaticTips;
14 changes: 14 additions & 0 deletions packages/base/src/locale/zh-CN/dmsDataSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ export default {
instanceName: '数据源名',
address: '地址',
describe: '描述',
lastTestConnectionStatus: '上一次连接状态',
lastTestConnectionTime: '测试连通性时间',
lastTestConnectionErrorMessage: '测试失败原因',
connectSucceed: '连通性测试成功',
connectFailed: '连通性测试失败',
testConnectionStatusFilterLabel: '数据源连接状态',
role: '角色',
type: '数据源类型',
enabledScanTypes: '启用的扫描类型',
Expand All @@ -25,6 +31,7 @@ export default {
addDatabase: '添加数据源',
addDatabaseSuccess: '添加数据源成功',
addDatabaseSuccessGuide: '到数据源列表查看刚刚添加的数据源',
batchTestDataSourceConnection: '批量测试数据源连通性',

updateDatabase: {
title: '编辑数据源',
Expand Down Expand Up @@ -72,6 +79,13 @@ export default {
errorTitle: '数据源{{instanceName}}连通性测试失败'
},

batchTestConnection: {
notFoundData: '当前列表无数据!',
connectFailed: '连接失败',
connectSucceed: '连接成功',
batchTestConnectionSuccessTips: '执行批量测试数据源连通性成功!'
},

deleteDatabase: {
confirmMessage: '确认删除数据源 "{{name}}"?',
deletingDatabase: '正在删除数据源 "{{name}}"...',
Expand Down
10 changes: 10 additions & 0 deletions packages/base/src/locale/zh-CN/dmsGlobalDataSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ export default {
instanceName: '数据源名',
projectName: '项目名称',
address: '地址',
lastTestConnectionStatus: '上一次连接状态',
testConnectionStatusFilterLabel: '数据源连接状态',
describe: '描述',
role: '角色',
type: '数据源类型',
Expand All @@ -29,7 +31,15 @@ export default {
deleteSuccessTips: '删除数据源"{{name}}"成功'
},

batchTestConnection: {
notFoundData: '当前列表无数据!',
connectFailed: '连接失败',
connectSucceed: '连接成功',
batchTestConnectionSuccessTips: '执行批量测试数据源连通性成功!'
},

addDatabase: '添加数据源',
batchTestDataSourceConnection: '批量测试数据源连通性',
backToList: '返回全局数据源列表',
batchImportDataSource: {
buttonText: '批量导入数据源',
Expand Down
4 changes: 0 additions & 4 deletions packages/base/src/locale/zh-CN/dmsProject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,6 @@ export default {
title: '批量导入数据源',
successTitle: '批量导入数据源成功',
checkSuccess: '校验通过',
testConnectLabel: '请测试数据源联通性',
testConnect: '批量测试数据源连通性',
testConnectSuccess: '测试连通性成功{{count}}个',
testConnectFail: '测试连通性失败{{count}}个,数据源为{{name}}',
requestAuditErrorMessage:
'当前导入信息存在校验失败,请结合下载文件中的提示进行修改,并重新导入'
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,49 +13,49 @@

export const OverviewListColumn: () => ActiontechTableColumn<
IGetDataExportTask,
[],
unknown,
'db_service'
> = () => {
return [
{
dataIndex: 'db_service',
title: () =>
t('dmsDataExport.detail.exportResult.overview.column.dbService'),
render: (_, record: IGetDataExportTask) => {
render: (_, record) => {
return record.db_info?.name ?? '-';
}
},
{
dataIndex: 'status',
title: () =>
t('dmsDataExport.detail.exportResult.overview.column.status'),
render: (status: IGetDataExportTask['status']) => {
render: (status) => {
return <ExportTaskStatus status={status} />;
}
},
{
dataIndex: 'export_type',
title: () =>
t('dmsDataExport.detail.exportResult.overview.column.exportType'),
render: (type: string) => type ?? '-'
render: (type) => type ?? '-'

Check warning on line 40 in packages/base/src/page/DataExportManagement/Detail/components/ExportDetail/OverviewList/column.tsx

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🌿 Branch is not covered

Warning! Not covered branch
},
{
dataIndex: 'export_file_type',
title: () =>
t('dmsDataExport.detail.exportResult.overview.column.exportFileType'),
render: (type: string) => type ?? '-'
render: (type) => type ?? '-'

Check warning on line 46 in packages/base/src/page/DataExportManagement/Detail/components/ExportDetail/OverviewList/column.tsx

View workflow job for this annotation

GitHub Actions / Coverage annotations (🧪 jest-coverage-report-action)

🌿 Branch is not covered

Warning! Not covered branch
},
{
dataIndex: 'export_start_time',
title: () =>
t('dmsDataExport.detail.exportResult.overview.column.exportStartTime'),
render: (time: string) => formatTime(time, '-')
render: (time) => formatTime(time, '-')
},
{
dataIndex: 'export_end_time',
title: () =>
t('dmsDataExport.detail.exportResult.overview.column.exportEndTime'),
render: (time: string) => formatTime(time, '-')
render: (time) => formatTime(time, '-')
}
];
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { ActiontechTable } from '@actiontech/shared/lib/components/ActiontechTable';
import useDataExportDetailReduxManage from '../../../hooks/index.redux';
import { OverviewListAction, OverviewListColumn } from './column';
import { IGetDataExportTask } from '@actiontech/shared/lib/api/base/service/common';
import DataExportTask from '@actiontech/shared/lib/api/base/service/DataExportTask';
import {
useCurrentProject,
Expand Down Expand Up @@ -49,7 +48,7 @@ const OverviewList: React.FC = () => {
? OverviewListAction(downloadLoading, downloadAction)
: undefined
}
onRow={(record: IGetDataExportTask) => {
onRow={(record) => {
return {
onClick() {
updateCurTaskID(record.task_uid ?? '');
Expand Down
Loading
Loading