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

dump/export (wip)

This commit is contained in:
2023-01-28 13:25:14 +01:00
parent 634a655b5f
commit 2d33c6f2ab
11 changed files with 248 additions and 16 deletions

View File

@ -9,6 +9,8 @@
import HostDetail from './hostdetail.svelte';
import Icon from '../../components/icon.svelte';
import { EventsOn } from '../../../wailsjs/runtime/runtime';
import ExportInfo from './export/exportinfo.svelte';
import DumpInfo from './export/dumpinfo.svelte';
export let hosts = {};
export let activeHostKey = '';
@ -25,6 +27,9 @@
let collToRename = '';
let newCollKey = '';
let exportInfo;
let dumpInfo;
async function getHosts() {
hosts = await Hosts();
}
@ -54,7 +59,6 @@
async function renameCollection() {
busy.start();
console.log(newCollKey);
const ok = await RenameCollection(activeHostKey, activeDbKey, collToRename, newCollKey);
if (ok) {
activeCollKey = newCollKey;
@ -73,6 +77,22 @@
busy.end();
}
function exportCollection(collKey) {
exportInfo = {
hostKey: activeHostKey,
dbKey: activeDbKey,
collKeys: [ collKey ],
};
}
function dumpCollection(collKey) {
dumpInfo = {
hostKey: activeHostKey,
dbKey: activeDbKey,
collKeys: [ collKey ],
};
}
EventsOn('CreateHost', createHost);
EventsOn('CreateDatabase', () => newDb = {});
EventsOn('CreateCollection', () => newColl = {});
@ -91,6 +111,8 @@
on:newCollection={() => newColl = {}}
on:editHost={e => editHost(e.detail)}
on:renameCollection={e => openEditCollModal(e.detail)}
on:exportCollection={e => exportCollection(e.detail)}
on:dumpCollection={e => dumpCollection(e.detail)}
/>
</div>
@ -108,6 +130,9 @@
{hosts}
/>
<ExportInfo bind:info={exportInfo} {hosts} />
<DumpInfo bind:info={dumpInfo} {hosts} />
{#if newDb}
<Modal bind:show={newDb}>
<p><strong>Create a database</strong></p>