mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-07-01 18:21:32 +08:00
🐛 fix(sidebar): 修复视图定位慢加载误报
- 兼容 table-prefixed key 的视图兜底定位 - 区分对象树仍在加载与真实未找到状态 - 补充 sidebarLocate 与 Sidebar 定位回归测试
This commit is contained in:
@@ -660,6 +660,47 @@ describe('sidebarLocate', () => {
|
||||
]);
|
||||
});
|
||||
|
||||
it('falls back to a visual table-like node with a table-prefixed key for a view request', () => {
|
||||
const target = resolveSidebarLocateTarget({
|
||||
tabId: 'stale-view-tab-id',
|
||||
connectionId: 'conn-1',
|
||||
dbName: 'SYSDBA',
|
||||
tableName: 'V_ACCOUNT',
|
||||
objectGroup: 'views',
|
||||
}, { groupBySchema: false });
|
||||
|
||||
const tree = [
|
||||
{
|
||||
key: 'conn-1',
|
||||
children: [
|
||||
{
|
||||
key: 'conn-1-SYSDBA',
|
||||
dataRef: { id: 'conn-1', dbName: 'SYSDBA' },
|
||||
children: [
|
||||
{
|
||||
key: 'conn-1-SYSDBA-tables',
|
||||
children: [
|
||||
{
|
||||
key: 'conn-1-SYSDBA-table-V_ACCOUNT',
|
||||
type: 'table',
|
||||
dataRef: {},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
expect(findSidebarNodePathForLocate(tree, target)).toEqual([
|
||||
'conn-1',
|
||||
'conn-1-SYSDBA',
|
||||
'conn-1-SYSDBA-tables',
|
||||
'conn-1-SYSDBA-table-V_ACCOUNT',
|
||||
]);
|
||||
});
|
||||
|
||||
it('finds a view node by title when the tree node is missing object metadata', () => {
|
||||
const target = resolveSidebarLocateTarget({
|
||||
tabId: 'stale-view-tab-id',
|
||||
|
||||
@@ -402,7 +402,7 @@ const getVisualNodeObjectName = (
|
||||
? [`${target.databaseKey}-trigger-`]
|
||||
: target.objectGroup === 'routines'
|
||||
? [`${target.databaseKey}-routine-`]
|
||||
: [`${target.databaseKey}-`];
|
||||
: [`${target.databaseKey}-table-`, `${target.databaseKey}-`];
|
||||
|
||||
const matchedPrefix = keyPrefixes.find((prefix) => nodeKey.startsWith(prefix));
|
||||
return matchedPrefix ? nodeKey.slice(matchedPrefix.length) : '';
|
||||
|
||||
Reference in New Issue
Block a user