mirror of
https://github.com/dbeaver/cloudbeaver.git
synced 2026-09-24 16:04:36 +08:00
Merge pull request #913 from dbeaver/fix/sql-editor-linking
fix(core-app): CB-1675 show error message if can't find the node
This commit is contained in:
@@ -12,6 +12,7 @@ import { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import { IFolderExplorerContext, useExecutor, useObjectRef, useObservableRef, useUserData } from '@cloudbeaver/core-blocks';
|
||||
import { ConnectionInfoResource } from '@cloudbeaver/core-connections';
|
||||
import { useService } from '@cloudbeaver/core-di';
|
||||
import { NotificationService } from '@cloudbeaver/core-events';
|
||||
import { ISyncExecutor, SyncExecutor } from '@cloudbeaver/core-executor';
|
||||
import { CachedMapAllKey, ResourceKeyUtils } from '@cloudbeaver/core-sdk';
|
||||
import { MetadataMap, throttle } from '@cloudbeaver/core-utils';
|
||||
@@ -101,6 +102,7 @@ export interface IElementsTree {
|
||||
}
|
||||
|
||||
export function useElementsTree(options: IOptions): IElementsTree {
|
||||
const notificationService = useService(NotificationService);
|
||||
const navNodeInfoResource = useService(NavNodeInfoResource);
|
||||
const navTreeResource = useService(NavTreeResource);
|
||||
const connectionInfoResource = useService(ConnectionInfoResource);
|
||||
@@ -162,7 +164,7 @@ export function useElementsTree(options: IOptions): IElementsTree {
|
||||
}
|
||||
},
|
||||
|
||||
getNestedChildren(nodeId: string): string [] {
|
||||
getNestedChildren(nodeId: string): string[] {
|
||||
const nestedChildren: string[] = [];
|
||||
const prevChildren = elementsTree.getNodeChildren(nodeId);
|
||||
nestedChildren.push(...prevChildren);
|
||||
@@ -357,7 +359,14 @@ export function useElementsTree(options: IOptions): IElementsTree {
|
||||
}
|
||||
},
|
||||
async show(nodeId: string, path: string[]): Promise<void> {
|
||||
const preloaded = await navTreeResource.preloadNodeParents(path);
|
||||
const preloaded = await navTreeResource.preloadNodeParents(path, nodeId);
|
||||
|
||||
if (!preloaded) {
|
||||
notificationService.logError({
|
||||
title: 'app_navigationTree_node_not_found',
|
||||
message: nodeId,
|
||||
});
|
||||
}
|
||||
|
||||
if (preloaded) {
|
||||
runInAction(() => {
|
||||
@@ -366,12 +375,10 @@ export function useElementsTree(options: IOptions): IElementsTree {
|
||||
state.expanded = true;
|
||||
}
|
||||
|
||||
const node = navNodeInfoResource.get(nodeId);
|
||||
const node = navNodeInfoResource.get(nodeId)!;
|
||||
|
||||
if (node) {
|
||||
this.select(node, false, false);
|
||||
this.actions.execute({ type: 'show', nodeId });
|
||||
}
|
||||
this.select(node, false, false);
|
||||
this.actions.execute({ type: 'show', nodeId });
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ export default [
|
||||
['app_navigationTree_settings_folders_title', 'Folders'],
|
||||
['app_navigationTree_settings_folders_description', 'Open any node as tree root node'],
|
||||
['app_navigationTree_node_empty', 'Empty'],
|
||||
['app_navigationTree_node_not_found', "Can't find the node"],
|
||||
['app_navigationTree_connection_view', 'Connection view'],
|
||||
['app_navigationTree_connection_view_option_simple', 'Simple'],
|
||||
['app_navigationTree_connection_view_option_advanced', 'Advanced'],
|
||||
|
||||
@@ -24,6 +24,7 @@ export default [
|
||||
['app_navigationTree_settings_folders_title', 'Folders'],
|
||||
['app_navigationTree_settings_folders_description', 'Open any node as tree root node'],
|
||||
['app_navigationTree_node_empty', 'Empty'],
|
||||
['app_navigationTree_node_not_found', "Can't find the node"],
|
||||
['app_navigationTree_connection_view', 'Vista di connessione'],
|
||||
['app_navigationTree_connection_view_option_simple', 'Semplice'],
|
||||
['app_navigationTree_connection_view_option_advanced', 'Avanzato'],
|
||||
|
||||
@@ -30,6 +30,7 @@ export default [
|
||||
['app_navigationTree_settings_folders_description', 'Позволяет открыть любой узел как начальный'],
|
||||
|
||||
['app_navigationTree_node_empty', 'Пусто'],
|
||||
['app_navigationTree_node_not_found', 'Не удалось найти элемент'],
|
||||
['app_navigationTree_connection_view', 'Отображение'],
|
||||
['app_navigationTree_connection_view_option_simple', 'Упрощенное'],
|
||||
['app_navigationTree_connection_view_option_advanced', 'Продвинутое'],
|
||||
|
||||
@@ -25,6 +25,7 @@ export default [
|
||||
['app_navigationTree_node_empty', 'Empty'],
|
||||
['app_navigationTree_openNodeTab', '打开'],
|
||||
['app_navigationTree_connection_view', '连接视图'],
|
||||
['app_navigationTree_node_not_found', "Can't find the node"],
|
||||
['app_navigationTree_connection_view_option_simple', '简单'],
|
||||
['app_navigationTree_connection_view_option_advanced', '完善'],
|
||||
['app_navigationTree_connection_view_option_custom', '自定义'],
|
||||
|
||||
Reference in New Issue
Block a user