diff --git a/frontend/src/components/common/Game/AdminMenu.vue b/frontend/src/components/common/Game/AdminMenu.vue index 6d997965a..b9ba6b239 100644 --- a/frontend/src/components/common/Game/AdminMenu.vue +++ b/frontend/src/components/common/Game/AdminMenu.vue @@ -7,6 +7,8 @@ import storeCollections, { type Collection } from "@/stores/collections"; import storeHeartbeat from "@/stores/heartbeat"; import type { SimpleRom } from "@/stores/roms"; import storeRoms from "@/stores/roms"; +import storeScanning from "@/stores/scanning"; +import socket from "@/services/socket"; import type { Events } from "@/types/emitter"; import type { Emitter } from "mitt"; import { storeToRefs } from "pinia"; @@ -23,6 +25,7 @@ const auth = storeAuth(); const collectionsStore = storeCollections(); const romsStore = storeRoms(); const { favCollection } = storeToRefs(collectionsStore); +const scanningStore = storeScanning(); async function switchFromFavourites() { if (!favCollection.value) { @@ -115,6 +118,23 @@ async function resetLastPlayed() { return; }); } + +async function onScan() { + scanningStore.set(true); + emitter?.emit("snackbarShow", { + msg: `Refreshing ${props.rom.name} metadata...`, + icon: "mdi-loading mdi-spin", + color: "romm-accent-1", + }); + + if (!socket.connected) socket.connect(); + socket.emit("scan", { + platforms: [props.rom.platform_id], + roms_ids: [props.rom.id], + type: "quick", // Quick scan so we can filter by selected roms + apis: heartbeat.getMetadataOptions().map((s) => s.value), + }); +}