mirror of
https://github.com/dbeaver/cloudbeaver.git
synced 2026-09-24 16:04:36 +08:00
fix(core-app): CB-986 parents getting for unloaded node
This commit is contained in:
@@ -284,6 +284,10 @@ export class NavNodeManagerService extends Bootstrap {
|
||||
const parents: string[] = [];
|
||||
let parent = this.getNode(nodeId);
|
||||
|
||||
if (!parent) {
|
||||
return NodeManagerUtils.parentsFromPath(nodeId);
|
||||
}
|
||||
|
||||
while (parent && parent.parentId !== ROOT_NODE_PATH && parent.id !== parent.parentId) {
|
||||
parents.unshift(parent.parentId);
|
||||
parent = this.getNode(parent.parentId);
|
||||
|
||||
@@ -16,6 +16,25 @@ export const NodeManagerUtils = {
|
||||
return connectionNodeId.replace('database://', '');
|
||||
},
|
||||
|
||||
parentsFromPath(nodeId: string): string[] {
|
||||
const parts = nodeId
|
||||
.replace('//', '\\')
|
||||
.split('/');
|
||||
let lastPath = '';
|
||||
const parents: string[] = [];
|
||||
|
||||
for (const part of parts) {
|
||||
if (lastPath !== '') {
|
||||
lastPath += '/';
|
||||
}
|
||||
lastPath += part.replace('\\', '//');
|
||||
|
||||
parents.push(lastPath);
|
||||
}
|
||||
|
||||
return parents;
|
||||
},
|
||||
|
||||
connectionIdToConnectionNodeId(connectionId: string): string {
|
||||
return `database://${connectionId}`;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user