mirror of
https://github.com/garraflavatra/rolens.git
synced 2025-09-16 13:22:52 +00:00
menu mess
This commit is contained in:
16
frontend/src/lib/stores/sharedstate.js
Normal file
16
frontend/src/lib/stores/sharedstate.js
Normal file
@ -0,0 +1,16 @@
|
||||
import { ReportSharedStateVariable } from '$wails/go/app/App';
|
||||
import { writable } from 'svelte/store';
|
||||
|
||||
function sharedStateStore(name) {
|
||||
const { set, subscribe } = writable();
|
||||
subscribe(newValue => ReportSharedStateVariable(name, newValue));
|
||||
return { set, subscribe };
|
||||
}
|
||||
|
||||
const sharedState = {
|
||||
currentHost: sharedStateStore('currenthost'),
|
||||
currentDb: sharedStateStore('currentdb'),
|
||||
currentColl: sharedStateStore('currentcoll'),
|
||||
};
|
||||
|
||||
export default sharedState;
|
@ -9,6 +9,7 @@
|
||||
import DumpInfo from './dump.svelte';
|
||||
import HostDetail from './hostdetail.svelte';
|
||||
import HostTree from './hosttree.svelte';
|
||||
import sharedState from '$lib/stores/sharedstate';
|
||||
|
||||
export let hosts = {};
|
||||
export let activeHostKey = '';
|
||||
@ -20,6 +21,10 @@
|
||||
let hostDetailKey = '';
|
||||
let exportInfo;
|
||||
|
||||
$: sharedState.currentHost.set(activeHostKey);
|
||||
$: sharedState.currentDb.set(activeDbKey);
|
||||
$: sharedState.currentColl.set(activeCollKey);
|
||||
|
||||
async function getHosts() {
|
||||
hosts = await Hosts();
|
||||
}
|
||||
|
Reference in New Issue
Block a user