mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-08-09 08:13:29 +08:00
✨ feat(data-grid): 无主键表支持全列匹配编辑并移除只读限制
- 新增 all-columns 全列匹配行定位策略,无主键/唯一索引时不再强制只读 - 元数据加载失败、索引查询失败等误报场景全部降级为全列匹配编辑 - 修复 resolveQueryLocatorPlan 同步解析异常导致 SQL 结果页签不出现的问题 - 行安全由后端影响行数校验兜底,非单行命中即回滚整个事务 - 同步更新六语言文案与相关测试用例
This commit is contained in:
@@ -35,6 +35,7 @@ const backendApp = vi.hoisted(() => ({
|
||||
const messageApi = vi.hoisted(() => ({
|
||||
error: vi.fn(),
|
||||
warning: vi.fn(),
|
||||
info: vi.fn(),
|
||||
}));
|
||||
|
||||
const dataGridState = vi.hoisted(() => ({
|
||||
@@ -642,7 +643,7 @@ describe('DataViewer safe editing locator', () => {
|
||||
renderer.unmount();
|
||||
});
|
||||
|
||||
it('keeps non-Oracle table preview read-only when no safe locator exists', async () => {
|
||||
it('falls back to all-columns editing when no safe locator exists', async () => {
|
||||
storeState.languagePreference = 'en-US';
|
||||
storeState.connections[0].config.type = 'mysql';
|
||||
storeState.connections[0].config.database = 'main';
|
||||
@@ -655,12 +656,13 @@ describe('DataViewer safe editing locator', () => {
|
||||
|
||||
expect(dataGridState.latestProps?.pkColumns).toEqual([]);
|
||||
expect(dataGridState.latestProps?.editLocator).toMatchObject({
|
||||
strategy: 'none',
|
||||
readOnly: true,
|
||||
reason: 'No primary key or usable unique index was found, so changes cannot be submitted safely.',
|
||||
strategy: 'all-columns',
|
||||
columns: ['ID', 'NAME'],
|
||||
readOnly: false,
|
||||
reason: 'No primary key or unique index was detected, so rows will be located by matching all columns. Edit with care.',
|
||||
});
|
||||
expect(dataGridState.latestProps?.readOnly).toBe(true);
|
||||
expect(messageApi.warning).toHaveBeenCalledWith('Table main.users remains read-only: No primary key or usable unique index was found, so changes cannot be submitted safely.');
|
||||
expect(dataGridState.latestProps?.readOnly).toBe(false);
|
||||
expect(messageApi.info).toHaveBeenCalledWith('No primary key or unique index was detected, so rows will be located by matching all columns. Edit with care.');
|
||||
renderer.unmount();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user