diff --git a/packages/tools/src/dbKeysLoader.ts b/packages/tools/src/dbKeysLoader.ts index aafb591c4..428ca10ab 100644 --- a/packages/tools/src/dbKeysLoader.ts +++ b/packages/tools/src/dbKeysLoader.ts @@ -175,3 +175,23 @@ export function dbKeys_reloadFolder(tree: DbKeysTreeModel, root: string): DbKeys }, }; } + +function addFlatItems(tree: DbKeysTreeModel, root: string, res: DbKeysNodeModel[]) { + const item = tree.dirsByKey[root]; + if (!item.isExpanded) { + return false; + } + const children = tree.childrenByKey[root] || []; + for (const child of children) { + res.push(child); + if (child.type == 'dir') { + addFlatItems(tree, child.root, res); + } + } +} + +export function dbKeys_getFlatList(tree: DbKeysTreeModel) { + const res: DbKeysNodeModel[] = []; + addFlatItems(tree, '', res); + return res; +} diff --git a/packages/web/src/stores.ts b/packages/web/src/stores.ts index 623db1fa8..550112a18 100644 --- a/packages/web/src/stores.ts +++ b/packages/web/src/stores.ts @@ -161,6 +161,8 @@ export const lastUsedDefaultActions = writableWithStorage({}, 'lastUsedDefaultAc export const selectedDatabaseObjectAppObject = writable(null); export const focusedConnectionOrDatabase = writable<{ conid: string; database?: string; connection: any }>(null); +export const focusedTreeDbKey = writable<{ key: string; root: string; type: string }>(null); + export const DEFAULT_OBJECT_SEARCH_SETTINGS = { pureName: true, schemaName: false, @@ -408,3 +410,9 @@ connectionAppObjectSearchSettings.subscribe(value => { connectionAppObjectSearchSettingsValue = value; }); export const getConnectionAppObjectSearchSettings = () => connectionAppObjectSearchSettingsValue; + +let focusedTreeDbKeyValue = null; +focusedTreeDbKey.subscribe(value => { + focusedTreeDbKeyValue = value; +}); +export const getFocusedTreeDbKey = () => focusedTreeDbKeyValue; \ No newline at end of file diff --git a/packages/web/src/widgets/AppObjectListHandler.svelte b/packages/web/src/widgets/AppObjectListHandler.svelte index 9cda24d58..fa64c0336 100644 --- a/packages/web/src/widgets/AppObjectListHandler.svelte +++ b/packages/web/src/widgets/AppObjectListHandler.svelte @@ -1,8 +1,7 @@