From 39e09d0d570a96653e1a602ae31982bf095ace5d Mon Sep 17 00:00:00 2001 From: Georges-Antoine Assi Date: Thu, 27 Feb 2025 11:00:40 -0500 Subject: [PATCH 01/11] Switch partial scan to quick so it only scans selected IDs --- frontend/src/components/Gallery/FabOverlay.vue | 2 +- frontend/src/components/common/Game/AdminMenu.vue | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/Gallery/FabOverlay.vue b/frontend/src/components/Gallery/FabOverlay.vue index a7be56d4a..1f7bd1548 100644 --- a/frontend/src/components/Gallery/FabOverlay.vue +++ b/frontend/src/components/Gallery/FabOverlay.vue @@ -52,7 +52,7 @@ async function onScan() { socket.emit("scan", { platforms: [Number(route.params.platform)], roms_ids: romsStore.selectedRoms.map((r) => r.id), - type: "partial", // Quick scan so we can filter by selected roms + type: "quick", // Quick scan so we can filter by selected roms apis: heartbeat.getMetadataOptions().map((s) => s.value), }); } diff --git a/frontend/src/components/common/Game/AdminMenu.vue b/frontend/src/components/common/Game/AdminMenu.vue index 4add6fdd0..64bcdc803 100644 --- a/frontend/src/components/common/Game/AdminMenu.vue +++ b/frontend/src/components/common/Game/AdminMenu.vue @@ -131,7 +131,7 @@ async function onScan() { socket.emit("scan", { platforms: [props.rom.platform_id], roms_ids: [props.rom.id], - type: "partial", // Quick scan so we can filter by selected roms + type: "quick", // Quick scan so we can filter by selected roms apis: heartbeat.getMetadataOptions().map((s) => s.value), }); } From 62953e45ff4a06275b581ec3583745697331bd5e Mon Sep 17 00:00:00 2001 From: Georges-Antoine Assi Date: Thu, 27 Feb 2025 11:06:02 -0500 Subject: [PATCH 02/11] fix logout --- .../src/components/common/Navigation/SettingsDrawer.vue | 6 +++--- frontend/src/stores/config.ts | 4 +--- frontend/src/stores/heartbeat.ts | 4 +--- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/frontend/src/components/common/Navigation/SettingsDrawer.vue b/frontend/src/components/common/Navigation/SettingsDrawer.vue index b4356ab0b..5e5addc28 100644 --- a/frontend/src/components/common/Navigation/SettingsDrawer.vue +++ b/frontend/src/components/common/Navigation/SettingsDrawer.vue @@ -36,14 +36,14 @@ async function logout() { color: "green", }); + // Redirect to login page + await router.push({ name: ROUTES.LOGIN }); + // Clear all pinia stores // @ts-expect-error(2339) getActivePinia()?._s.forEach((store: StateTree) => { store.reset?.(); }); - - // Redirect to login page - await router.push({ name: ROUTES.LOGIN }); }); } diff --git a/frontend/src/stores/config.ts b/frontend/src/stores/config.ts index cb256c5b1..f215e59c9 100644 --- a/frontend/src/stores/config.ts +++ b/frontend/src/stores/config.ts @@ -58,8 +58,6 @@ export default defineStore("config", { isExclusionType(type: string): type is ExclusionTypes { return Object.keys(this.config).includes(type); }, - reset() { - this.config = defaultConfig; - }, + reset() {}, }, }); diff --git a/frontend/src/stores/heartbeat.ts b/frontend/src/stores/heartbeat.ts index fe29bfecd..a21fb7f78 100644 --- a/frontend/src/stores/heartbeat.ts +++ b/frontend/src/stores/heartbeat.ts @@ -32,8 +32,6 @@ export default defineStore("heartbeat", { }, ]).value.filter((s) => !s.disabled); }, - reset() { - this.value = {} as HeartbeatResponse; - }, + reset() {}, }, }); From 1cb66e28ecbe030937ec25ac1e327164d0b5c6ec Mon Sep 17 00:00:00 2001 From: Georges-Antoine Assi Date: Thu, 27 Feb 2025 11:21:51 -0500 Subject: [PATCH 03/11] fix removing game from collection --- backend/handler/database/collections_handler.py | 14 +++++++++----- .../components/Gallery/AppBar/Collection/Base.vue | 2 +- .../AppBar/Collection/CollectionInfoDrawer.vue | 12 +++--------- frontend/src/components/Gallery/FabOverlay.vue | 4 +++- .../common/Collection/Dialog/AddRoms.vue | 2 ++ .../common/Collection/Dialog/RemoveRoms.vue | 2 +- frontend/src/components/common/Game/AdminMenu.vue | 4 +++- frontend/src/components/common/Game/FavBtn.vue | 2 ++ frontend/src/stores/navigation.ts | 2 +- 9 files changed, 25 insertions(+), 19 deletions(-) diff --git a/backend/handler/database/collections_handler.py b/backend/handler/database/collections_handler.py index cfc83f6cd..1a40a1733 100644 --- a/backend/handler/database/collections_handler.py +++ b/backend/handler/database/collections_handler.py @@ -77,16 +77,20 @@ class DBCollectionsHandler(DBBaseHandler): .execution_options(synchronize_session="evaluate") ) - if rom_ids: + if rom_ids is not None: # Delete all existing CollectionRom entries for this collection session.execute( delete(CollectionRom).where(CollectionRom.collection_id == id) ) # Insert new CollectionRom entries for this collection - session.execute( - insert(CollectionRom), - [{"collection_id": id, "rom_id": rom_id} for rom_id in set(rom_ids)], - ) + if rom_ids: + session.execute( + insert(CollectionRom), + [ + {"collection_id": id, "rom_id": rom_id} + for rom_id in set(rom_ids) + ], + ) return session.query(Collection).filter_by(id=id).one() diff --git a/frontend/src/components/Gallery/AppBar/Collection/Base.vue b/frontend/src/components/Gallery/AppBar/Collection/Base.vue index 09f865a77..787c7a308 100644 --- a/frontend/src/components/Gallery/AppBar/Collection/Base.vue +++ b/frontend/src/components/Gallery/AppBar/Collection/Base.vue @@ -31,7 +31,7 @@ const { currentCollection } = storeToRefs(romsStore); >