1
0
mirror of https://github.com/garraflavatra/rolens.git synced 2025-07-21 06:48:04 +00:00

Multiple improvements to the frontend

* Consistent usage of modal footer
* Remove hosts
* Moved hosts to dedicated store
This commit is contained in:
2023-05-31 20:20:39 +02:00
parent 27dc1f9117
commit 415efe9ac4
17 changed files with 163 additions and 112 deletions

View File

@ -1,6 +1,6 @@
<script>
import { startProgress } from '$lib/progress';
import { connections } from '$lib/stores/connections';
import connections from '$lib/stores/connections';
import { Hosts, RenameCollection } from '$wails/go/app/App';
import { EnterText } from '$wails/go/ui/UI';
import { EventsOn } from '$wails/runtime/runtime';
@ -10,8 +10,9 @@
import HostDetail from './hostdetail.svelte';
import HostTree from './hosttree.svelte';
import sharedState from '$lib/stores/sharedstate';
import Icon from '$components/icon.svelte';
import hosts from '$lib/stores/hosts';
export let hosts = {};
export let activeHostKey = '';
export let activeDbKey = '';
export let activeCollKey = '';
@ -25,10 +26,6 @@
$: sharedState.currentDb.set(activeDbKey);
$: sharedState.currentColl.set(activeCollKey);
async function getHosts() {
hosts = await Hosts();
}
export function createHost() {
hostDetailKey = '';
showHostDetail = true;
@ -89,12 +86,16 @@
EventsOn('CreateHost', createHost);
EventsOn('CreateDatabase', createDatabase);
EventsOn('CreateCollection', createCollection);
onMount(getHosts);
</script>
<div class="tree">
<div class="tree-buttons">
<button class="button-small" on:click={createHost}>
<Icon name="+" /> New host
</button>
</div>
<HostTree
{hosts}
bind:activeHostKey
bind:activeCollKey
bind:activeDbKey
@ -114,21 +115,22 @@
hostKey={activeHostKey}
dbKey={activeDbKey}
collectionKey={activeCollKey}
{hosts}
/>
<HostDetail
bind:show={showHostDetail}
on:reload={getHosts}
on:reload={hosts.update}
hostKey={activeHostKey}
{hosts}
/>
<DumpInfo bind:info={exportInfo} {hosts} />
<DumpInfo bind:info={exportInfo} />
<style>
.tree {
padding: 0.5rem;
background-color: #fff;
}
.tree-buttons {
margin-bottom: 1rem;
}
</style>