From d4ce9900c876265cfcb23f6d60b7a4c52540463f Mon Sep 17 00:00:00 2001 From: Romein van Buren Date: Sat, 11 Feb 2023 11:22:02 +0100 Subject: [PATCH] Export/dump... wip --- .../src/components/directorychooser.svelte | 19 +++ .../export/{dumpinfo.svelte => export.svelte} | 67 +++++++++-- .../connection/export/exportinfo.svelte | 3 - .../src/organisms/connection/index.svelte | 13 +- frontend/src/organisms/settings/index.svelte | 7 ++ frontend/wailsjs/go/app/App.d.ts | 4 + frontend/wailsjs/go/app/App.js | 8 ++ frontend/wailsjs/go/models.ts | 6 + internal/app/app.go | 74 ++++++++++++ internal/app/app_environment.go | 37 ------ internal/app/database_export.go | 113 ++++++++++++++++++ internal/app/hosts.go | 22 ++-- internal/app/settings.go | 73 ++--------- internal/app/views.go | 18 +-- 14 files changed, 323 insertions(+), 141 deletions(-) create mode 100644 frontend/src/components/directorychooser.svelte rename frontend/src/organisms/connection/export/{dumpinfo.svelte => export.svelte} (64%) delete mode 100644 frontend/src/organisms/connection/export/exportinfo.svelte delete mode 100644 internal/app/app_environment.go create mode 100644 internal/app/database_export.go diff --git a/frontend/src/components/directorychooser.svelte b/frontend/src/components/directorychooser.svelte new file mode 100644 index 0000000..3b854b4 --- /dev/null +++ b/frontend/src/components/directorychooser.svelte @@ -0,0 +1,19 @@ + + + + + diff --git a/frontend/src/organisms/connection/export/dumpinfo.svelte b/frontend/src/organisms/connection/export/export.svelte similarity index 64% rename from frontend/src/organisms/connection/export/dumpinfo.svelte rename to frontend/src/organisms/connection/export/export.svelte index 2c24195..f176b43 100644 --- a/frontend/src/organisms/connection/export/dumpinfo.svelte +++ b/frontend/src/organisms/connection/export/export.svelte @@ -1,12 +1,30 @@ - -
+ +
+ +
@@ -106,11 +142,15 @@ />
- + +
+ +
+
diff --git a/frontend/src/organisms/connection/export/exportinfo.svelte b/frontend/src/organisms/connection/export/exportinfo.svelte deleted file mode 100644 index 5f85575..0000000 --- a/frontend/src/organisms/connection/export/exportinfo.svelte +++ /dev/null @@ -1,3 +0,0 @@ - diff --git a/frontend/src/organisms/connection/index.svelte b/frontend/src/organisms/connection/index.svelte index f5d0e6e..b51b80a 100644 --- a/frontend/src/organisms/connection/index.svelte +++ b/frontend/src/organisms/connection/index.svelte @@ -9,8 +9,7 @@ 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'; + import Export from './export/export.svelte'; import Hint from '../../components/hint.svelte'; export let hosts = {}; @@ -29,7 +28,6 @@ let newCollKey = ''; let exportInfo; - let dumpInfo; async function getHosts() { hosts = await Hosts(); @@ -74,6 +72,8 @@ function exportCollection(collKey) { exportInfo = { + type: 'export', + filetype: 'json', hostKey: activeHostKey, dbKey: activeDbKey, collKeys: [ collKey ], @@ -81,7 +81,9 @@ } function dumpCollection(collKey) { - dumpInfo = { + exportInfo = { + type: 'dump', + filetype: 'bson', hostKey: activeHostKey, dbKey: activeDbKey, collKeys: [ collKey ], @@ -125,8 +127,7 @@ {hosts} /> - - + {#if newDb} diff --git a/frontend/src/organisms/settings/index.svelte b/frontend/src/organisms/settings/index.svelte index 6d21596..593e26a 100644 --- a/frontend/src/organisms/settings/index.svelte +++ b/frontend/src/organisms/settings/index.svelte @@ -1,4 +1,5 @@