From f33cac7f5cc6b1dd6f594da861038f71517b9bb7 Mon Sep 17 00:00:00 2001 From: Romein van Buren Date: Mon, 7 Aug 2023 14:57:31 +0200 Subject: [PATCH] DB/collection dropping bugfix After dropping a collection or database, the hosttree was not reloaded correctly. Now, dropped databases and collections are correctly removed from the host tree. --- CHANGELOG.md | 11 ++++++++++- frontend/src/lib/stores/hosttree.js | 16 ++++++++++------ 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7521ef5..4a026b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,14 +1,23 @@ ## [Unreleased] +New features: + * Added log view (#53, #54). * Added a shell script editor (#37), plus export/import feature. * Added collection duplication feature (#63). * Find view: paste ID and press Enter (#55). + +Patches: + * Preserve state after switching to another tab (#56). * Find view: ask for confirmation before negligently deleting documents when the user has clicked the '-' button (#58). -* Build script recreates the build output directory after it has been removed (#62). * Set a deadline for counting documents, and added a button to count documents if the deadline has been exceeded. +Bugfixes: + +* Build script recreates the build output directory after it has been removed (#62). +* After dropping a collection or database, the hosttree was not reloaded correctly. Now, dropped databases and collections are correctly removed from the host tree. + ## [v0.2.2] * Added Excel export format (#46). diff --git a/frontend/src/lib/stores/hosttree.js b/frontend/src/lib/stores/hosttree.js index 128c574..9a528eb 100644 --- a/frontend/src/lib/stores/hosttree.js +++ b/frontend/src/lib/stores/hosttree.js @@ -32,7 +32,6 @@ import { TruncateCollection } from '$wails/go/app/App'; - const { set, subscribe } = writable({}); const getValue = () => get({ subscribe }); let hostTreeInited = false; @@ -49,7 +48,14 @@ async function refresh() { host.uri = hostDetails.uri; host.open = async function() { - const { databases: dbNames, status, statusError, systemInfo, systemInfoError } = await OpenConnection(hostKey); + const { + databases: dbNames, + status, + statusError, + systemInfo, + systemInfoError, + } = await OpenConnection(hostKey); + host.status = status; host.statusError = statusError; host.systemInfo = systemInfo; @@ -184,6 +190,7 @@ async function refresh() { collection.drop = async function() { const success = await DropCollection(hostKey, dbKey, collKey); if (success) { + delete database.collections[collKey]; await refresh(); } }; @@ -276,14 +283,11 @@ async function refresh() { }; database.drop = async function() { - const progress = startProgress(`Dropping database "${dbKey}"…`); const success = await DropDatabase(hostKey, dbKey); - if (success) { + delete host.databases[dbKey]; await refresh(); } - - progress.end(); }; database.newCollection = async function() {