mirror of
https://github.com/rommapp/romm.git
synced 2026-12-03 10:33:22 +01:00
fixed scan sockets
This commit is contained in:
@@ -34,25 +34,27 @@ socket.on("scan:scanning_platform", ({ name, slug, id }) => {
|
||||
});
|
||||
|
||||
socket.on("scan:scanning_rom", ({ platform_name, platform_slug, ...rom }) => {
|
||||
romsStore.add([rom]);
|
||||
if (isFiltered) {
|
||||
romsStore.setFiltered(
|
||||
romsStore.filteredRoms,
|
||||
galleryFilter.filterUnmatched,
|
||||
galleryFilter.selectedGenre,
|
||||
galleryFilter.selectedFranchise,
|
||||
galleryFilter.selectedCollection,
|
||||
galleryFilter.selectedCompany
|
||||
);
|
||||
} else {
|
||||
romsStore.setFiltered(
|
||||
romsStore.allRoms,
|
||||
galleryFilter.filterUnmatched,
|
||||
galleryFilter.selectedGenre,
|
||||
galleryFilter.selectedFranchise,
|
||||
galleryFilter.selectedCollection,
|
||||
galleryFilter.selectedCompany
|
||||
);
|
||||
if (romsStore.platform.name === platform_name) {
|
||||
romsStore.add([rom]);
|
||||
if (isFiltered) {
|
||||
romsStore.setFiltered(
|
||||
romsStore.filteredRoms,
|
||||
galleryFilter.filterUnmatched,
|
||||
galleryFilter.selectedGenre,
|
||||
galleryFilter.selectedFranchise,
|
||||
galleryFilter.selectedCollection,
|
||||
galleryFilter.selectedCompany
|
||||
);
|
||||
} else {
|
||||
romsStore.setFiltered(
|
||||
romsStore.allRoms,
|
||||
galleryFilter.filterUnmatched,
|
||||
galleryFilter.selectedGenre,
|
||||
galleryFilter.selectedFranchise,
|
||||
galleryFilter.selectedCollection,
|
||||
galleryFilter.selectedCompany
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
let scannedPlatform = scanningPlatforms.value.find(
|
||||
|
||||
@@ -44,6 +44,7 @@ function toggleEmulation() {
|
||||
</v-col>
|
||||
<v-col>
|
||||
<v-tooltip
|
||||
class="tooltip"
|
||||
text="Emulation not currently supported"
|
||||
location="bottom"
|
||||
:disabled="emulationSupported"
|
||||
@@ -79,3 +80,9 @@ function toggleEmulation() {
|
||||
</v-col>
|
||||
</v-row>
|
||||
</template>
|
||||
<style scoped>
|
||||
.tooltip :deep(.v-overlay__content) {
|
||||
background: rgba(201, 201, 201, 0.98) !important;
|
||||
color: rgb(41, 41, 41) !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -22,27 +22,6 @@ emitter?.on("showUploadRomDialog", (platformWhereUpload) => {
|
||||
show.value = true;
|
||||
});
|
||||
|
||||
socket.on("scan:done", () => {
|
||||
scanningStore.set(false);
|
||||
socket.disconnect();
|
||||
emitter?.emit("refreshDrawer", null);
|
||||
emitter?.emit("snackbarShow", {
|
||||
msg: "Scan completed successfully!",
|
||||
icon: "mdi-check-bold",
|
||||
color: "green",
|
||||
});
|
||||
});
|
||||
|
||||
socket.on("scan:done_ko", (msg) => {
|
||||
scanningStore.set(false);
|
||||
emitter?.emit("snackbarShow", {
|
||||
msg: `Scan couldn't be completed. Something went wrong: ${msg}`,
|
||||
icon: "mdi-close-circle",
|
||||
color: "red",
|
||||
});
|
||||
socket.disconnect();
|
||||
});
|
||||
|
||||
// Functions
|
||||
async function uploadRoms() {
|
||||
if (!platform.value) return;
|
||||
@@ -95,17 +74,12 @@ async function uploadRoms() {
|
||||
color: "red",
|
||||
timeout: 4000,
|
||||
});
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
function closeDialog() {
|
||||
show.value = false;
|
||||
}
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
socket.off("scan:done");
|
||||
socket.off("scan:done_ko");
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
@@ -19,31 +19,6 @@ const romsStore = storeRoms();
|
||||
const scanningStore = storeScanning();
|
||||
const route = useRoute();
|
||||
|
||||
socket.on("scan:scanning_rom", ({ id }) => {
|
||||
const rom = romsStore.selectedRoms.find((r) => r.id === id);
|
||||
if (rom) romsStore.removeFromSelection(rom);
|
||||
});
|
||||
|
||||
socket.on("scan:done", () => {
|
||||
scanningStore.set(false);
|
||||
emitter?.emit("snackbarShow", {
|
||||
msg: "Scan completed successfully!",
|
||||
icon: "mdi-check-bold",
|
||||
color: "green",
|
||||
});
|
||||
socket.disconnect();
|
||||
});
|
||||
|
||||
socket.on("scan:done_ko", (msg: string) => {
|
||||
scanningStore.set(false);
|
||||
emitter?.emit("snackbarShow", {
|
||||
msg: `Scan couldn't be completed. Something went wrong: ${msg}`,
|
||||
icon: "mdi-close-circle",
|
||||
color: "red",
|
||||
});
|
||||
socket.disconnect();
|
||||
});
|
||||
|
||||
// Functions
|
||||
async function onScan() {
|
||||
scanningStore.set(true);
|
||||
|
||||
Reference in New Issue
Block a user