From 5eba93559de81ad47e370a2f34b49e28c967ab87 Mon Sep 17 00:00:00 2001 From: Jan Prochazka Date: Sat, 5 Mar 2022 18:58:13 +0100 Subject: [PATCH] redis key tree --- packages/web/src/widgets/DbKeysSubTree.svelte | 9 ++++----- .../web/src/widgets/DbKeysTreeNode.svelte | 20 +++++++++++++++++++ .../dbgate-plugin-redis/src/backend/driver.js | 1 + 3 files changed, 25 insertions(+), 5 deletions(-) create mode 100644 packages/web/src/widgets/DbKeysTreeNode.svelte diff --git a/packages/web/src/widgets/DbKeysSubTree.svelte b/packages/web/src/widgets/DbKeysSubTree.svelte index 61721306..ac9b664d 100644 --- a/packages/web/src/widgets/DbKeysSubTree.svelte +++ b/packages/web/src/widgets/DbKeysSubTree.svelte @@ -1,16 +1,15 @@ -{#each $keys || [] as key} -
- {key.text} -
+{#each $items || [] as item} + {/each} diff --git a/packages/web/src/widgets/DbKeysTreeNode.svelte b/packages/web/src/widgets/DbKeysTreeNode.svelte new file mode 100644 index 00000000..d315238c --- /dev/null +++ b/packages/web/src/widgets/DbKeysTreeNode.svelte @@ -0,0 +1,20 @@ + + +
(isExpanded = !isExpanded)}> + {item.text} +
+ +{#if isExpanded} + +{/if} diff --git a/plugins/dbgate-plugin-redis/src/backend/driver.js b/plugins/dbgate-plugin-redis/src/backend/driver.js index c2870085..0ea87ecc 100644 --- a/plugins/dbgate-plugin-redis/src/backend/driver.js +++ b/plugins/dbgate-plugin-redis/src/backend/driver.js @@ -102,6 +102,7 @@ const driver = { res[keySplit[rootSplit.length]] = { text: keySplit[rootSplit.length], type: 'dir', + root: keySplit.slice(0, rootSplit.length + 1).join(':'), }; } }