1
0
mirror of https://github.com/garraflavatra/rolens.git synced 2025-07-17 05:24:06 +00:00
Files
rolens/frontend/src/organisms/connection/index.svelte

60 lines
1.4 KiB
Svelte
Raw Normal View History

2023-01-16 20:03:56 +01:00
<script>
import Icon from '$components/icon.svelte';
import hostTree from '$lib/stores/hosttree';
import sharedState from '$lib/stores/sharedstate';
import CollectionView from './collection/index.svelte';
import DatabaseView from './database/index.svelte';
import HostView from './host/index.svelte';
2023-02-15 19:27:51 +01:00
import HostTree from './hosttree.svelte';
2023-01-16 20:03:56 +01:00
let path = [];
2023-01-16 20:03:56 +01:00
$: activeHostKey = path[0];
$: activeDbKey = path[1];
$: activeCollKey = path[2];
2023-01-28 13:25:14 +01:00
2023-05-27 21:18:47 +02:00
$: sharedState.currentHost.set(activeHostKey);
$: sharedState.currentDb.set(activeDbKey);
$: sharedState.currentColl.set(activeCollKey);
2023-01-16 20:03:56 +01:00
</script>
2023-01-23 13:17:07 +01:00
<div class="tree">
<div class="tree-buttons">
<button class="button-small" on:click={hostTree.newHost}>
<Icon name="+" /> New host
</button>
</div>
<HostTree bind:path />
2023-01-23 13:17:07 +01:00
</div>
2023-01-16 20:03:56 +01:00
{#if activeCollKey}
<CollectionView
collection={$hostTree[activeHostKey]?.databases[activeDbKey]?.collections?.[activeCollKey]}
hostKey={activeHostKey}
dbKey={activeDbKey}
collKey={activeCollKey}
/>
{:else if activeDbKey}
<DatabaseView
database={$hostTree[activeHostKey]?.databases[activeDbKey]}
hostKey={activeHostKey}
dbKey={activeDbKey}
/>
2023-06-07 21:52:43 +02:00
{:else if activeHostKey}
<HostView
host={$hostTree[activeHostKey]}
2023-06-07 21:52:43 +02:00
hostKey={activeHostKey}
/>
{/if}
2023-01-16 20:03:56 +01:00
<style>
2023-01-23 13:17:07 +01:00
.tree {
padding: 0.5rem;
background-color: #fff;
}
.tree-buttons {
margin-bottom: 1rem;
}
</style>