feat(jvm/connection): 优化诊断工作台与连接配置体验

- JVM 诊断工作台改为会话优先布局,未建会话前隐藏命令输入

- 优化命令模板、实时输出、审计历史和能力检查卡片展示

- 连接配置表单引入按数据源分组的卡片化布局

- 补充连接配置布局和 JVM 诊断工作台回归测试
This commit is contained in:
Syngnat
2026-04-26 17:18:10 +08:00
parent df4fcab90b
commit 5bbeb7f373
8 changed files with 2593 additions and 1119 deletions

View File

@@ -1,8 +1,10 @@
import { describe, expect, it } from 'vitest';
import {
getConnectionConfigLayoutKindLabel,
getStoredSecretPlaceholder,
normalizeConnectionSecretErrorMessage,
resolveConnectionConfigLayout,
resolveConnectionTestFailureFeedback,
summarizeConnectionTestFailureMessage,
} from './connectionModalPresentation';
@@ -61,4 +63,83 @@ describe('connectionModalPresentation', () => {
'测试失败: 当前端口不是 JMX 远程管理端口',
);
});
it('assigns card-based configuration sections to every supported data source type', () => {
const allTypes = [
'mysql',
'mariadb',
'doris',
'diros',
'sphinx',
'clickhouse',
'postgres',
'sqlserver',
'sqlite',
'duckdb',
'oracle',
'dameng',
'kingbase',
'highgo',
'vastbase',
'mongodb',
'redis',
'tdengine',
'custom',
'jvm',
];
allTypes.forEach((type) => {
const layout = resolveConnectionConfigLayout(type);
expect(layout.sections.length).toBeGreaterThan(0);
expect(layout.sections).toContain('identity');
expect(new Set(layout.sections).size).toBe(layout.sections.length);
});
});
it('keeps datasource-specific connection options in the layout contract', () => {
expect(resolveConnectionConfigLayout('mysql').sections).toEqual([
'identity',
'uri',
'target',
'connectionMode',
'replica',
'credentials',
'databaseScope',
]);
expect(resolveConnectionConfigLayout('mongodb').sections).toEqual([
'identity',
'uri',
'target',
'connectionMode',
'mongoDiscovery',
'replica',
'mongoPolicy',
'credentials',
'databaseScope',
]);
expect(resolveConnectionConfigLayout('redis').sections).toEqual([
'identity',
'uri',
'target',
'connectionMode',
'credentials',
'databaseScope',
]);
expect(resolveConnectionConfigLayout('sqlite').sections).toEqual([
'identity',
'uri',
'fileTarget',
]);
expect(resolveConnectionConfigLayout('custom').sections).toEqual([
'identity',
'customDriver',
'customDsn',
]);
});
it('uses localized labels for layout kinds shown in the modal', () => {
expect(getConnectionConfigLayoutKindLabel('mysql-compatible')).toBe('MySQL 兼容');
expect(getConnectionConfigLayoutKindLabel('file')).toBe('文件型数据库');
});
});