redis key tree

This commit is contained in:
Jan Prochazka 2022-03-05 18:58:13 +01:00
parent 51942be0a6
commit 5eba93559d
3 changed files with 25 additions and 5 deletions

View File

@ -1,16 +1,15 @@
<script lang="ts">
import { useDatabaseKeys } from '../utility/metadataLoaders';
import DbKeysTreeNode from './DbKeysTreeNode.svelte';
export let conid;
export let database;
export let root;
$: keys = useDatabaseKeys({ conid, database, root });
$: items = useDatabaseKeys({ conid, database, root });
</script>
{#each $keys || [] as key}
<div>
{key.text}
</div>
{#each $items || [] as item}
<DbKeysTreeNode {conid} {database} {root} {item} />
{/each}

View File

@ -0,0 +1,20 @@
<script lang="ts">
import DbKeysSubTree from './DbKeysSubTree.svelte';
export let conid;
export let database;
export let root;
export let item;
let isExpanded;
</script>
<div on:click={() => (isExpanded = !isExpanded)}>
{item.text}
</div>
{#if isExpanded}
<DbKeysSubTree {conid} {database} root={item.root} />
{/if}

View File

@ -102,6 +102,7 @@ const driver = {
res[keySplit[rootSplit.length]] = {
text: keySplit[rootSplit.length],
type: 'dir',
root: keySplit.slice(0, rootSplit.length + 1).join(':'),
};
}
}