mirror of
https://github.com/rommapp/romm.git
synced 2026-06-28 23:06:11 +00:00
Revive the fullpage loading spinner
This commit is contained in:
@@ -61,6 +61,7 @@ from handler.metadata import (
|
||||
meta_ra_handler,
|
||||
meta_ss_handler,
|
||||
)
|
||||
from handler.metadata.ss_handler import get_preferred_media_types
|
||||
from logger.formatter import BLUE
|
||||
from logger.formatter import highlight as hl
|
||||
from logger.logger import log
|
||||
@@ -752,16 +753,26 @@ async def update_rom(
|
||||
return DetailedRomSchema.from_orm_with_request(rom, request)
|
||||
|
||||
cleaned_data: dict[str, Any] = {
|
||||
"igdb_id": safe_int(data.get("igdb_id")) or rom.igdb_id,
|
||||
"sgdb_id": safe_int(data.get("sgdb_id")) or rom.sgdb_id,
|
||||
"moby_id": safe_int(data.get("moby_id")) or rom.moby_id,
|
||||
"ss_id": safe_int(data.get("ss_id")) or rom.ss_id,
|
||||
"ra_id": safe_int(data.get("ra_id")) or rom.ra_id,
|
||||
"launchbox_id": safe_int(data.get("launchbox_id")) or rom.launchbox_id,
|
||||
"hasheous_id": safe_int(data.get("hasheous_id")) or rom.hasheous_id,
|
||||
"tgdb_id": safe_int(data.get("tgdb_id")) or rom.tgdb_id,
|
||||
"flashpoint_id": safe_int(data.get("flashpoint_id")) or rom.flashpoint_id,
|
||||
"hltb_id": safe_int(data.get("hltb_id")) or rom.hltb_id,
|
||||
"igdb_id": safe_int(data["igdb_id"]) if "igdb_id" in data else rom.igdb_id,
|
||||
"sgdb_id": safe_int(data["sgdb_id"]) if "sgdb_id" in data else rom.sgdb_id,
|
||||
"moby_id": safe_int(data["moby_id"]) if "moby_id" in data else rom.moby_id,
|
||||
"ss_id": safe_int(data["ss_id"]) if "ss_id" in data else rom.ss_id,
|
||||
"ra_id": safe_int(data["ra_id"]) if "ra_id" in data else rom.ra_id,
|
||||
"launchbox_id": (
|
||||
safe_int(data["launchbox_id"])
|
||||
if "launchbox_id" in data
|
||||
else rom.launchbox_id
|
||||
),
|
||||
"hasheous_id": (
|
||||
safe_int(data["hasheous_id"]) if "hasheous_id" in data else rom.hasheous_id
|
||||
),
|
||||
"tgdb_id": safe_int(data["tgdb_id"]) if "tgdb_id" in data else rom.tgdb_id,
|
||||
"flashpoint_id": (
|
||||
safe_int(data["flashpoint_id"])
|
||||
if "flashpoint_id" in data
|
||||
else rom.flashpoint_id
|
||||
),
|
||||
"hltb_id": safe_int(data["hltb_id"]) if "hltb_id" in data else rom.hltb_id,
|
||||
}
|
||||
|
||||
# Add raw metadata parsing
|
||||
@@ -918,6 +929,31 @@ async def update_rom(
|
||||
}
|
||||
)
|
||||
|
||||
# Handle RetroAchievements badges when the ID has changed
|
||||
if cleaned_data["ra_id"] and int(cleaned_data["ra_id"]) != rom.ra_id:
|
||||
for ach in cleaned_data["ra_metadata"].get("achievements", []):
|
||||
# Store both normal and locked version
|
||||
badge_url_lock = ach.get("badge_url_lock", None)
|
||||
badge_path_lock = ach.get("badge_path_lock", None)
|
||||
if badge_url_lock and badge_path_lock:
|
||||
await fs_resource_handler.store_ra_badge(
|
||||
badge_url_lock, badge_path_lock
|
||||
)
|
||||
badge_url = ach.get("badge_url", None)
|
||||
badge_path = ach.get("badge_path", None)
|
||||
if badge_url and badge_path:
|
||||
await fs_resource_handler.store_ra_badge(badge_url, badge_path)
|
||||
|
||||
# Handle special media files from Screenscraper when the ID has changed
|
||||
if cleaned_data["ss_id"] and int(cleaned_data["ss_id"]) != rom.ss_id:
|
||||
preferred_media_types = get_preferred_media_types()
|
||||
for media_type in preferred_media_types:
|
||||
if cleaned_data["ss_metadata"].get(f"{media_type.value}_path"):
|
||||
await fs_resource_handler.store_media_file(
|
||||
cleaned_data["ss_metadata"][f"{media_type.value}_url"],
|
||||
cleaned_data["ss_metadata"][f"{media_type.value}_path"],
|
||||
)
|
||||
|
||||
log.debug(
|
||||
f"Updating {hl(cleaned_data.get('name', ''), color=BLUE)} [{hl(cleaned_data.get('fs_name', ''))}] with data {cleaned_data}"
|
||||
)
|
||||
|
||||
31
frontend/src/components/common/Dialog/LoadingDialog.vue
Normal file
31
frontend/src/components/common/Dialog/LoadingDialog.vue
Normal file
@@ -0,0 +1,31 @@
|
||||
<script setup lang="ts">
|
||||
import type { Emitter } from "mitt";
|
||||
import { ref, inject } from "vue";
|
||||
import type { Events } from "@/types/emitter";
|
||||
|
||||
const show = ref(false);
|
||||
const scrim = ref(false);
|
||||
|
||||
const emitter = inject<Emitter<Events>>("emitter");
|
||||
emitter?.on("showLoadingDialog", (args) => {
|
||||
show.value = args.loading;
|
||||
scrim.value = args.scrim;
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<v-dialog
|
||||
:model-value="show"
|
||||
:scrim="scrim"
|
||||
scroll-strategy="none"
|
||||
width="auto"
|
||||
persistent
|
||||
>
|
||||
<v-progress-circular
|
||||
:width="3"
|
||||
:size="70"
|
||||
color="romm-accent-1"
|
||||
indeterminate
|
||||
/>
|
||||
</v-dialog>
|
||||
</template>
|
||||
@@ -92,7 +92,6 @@ async function handleRomUpdate(
|
||||
},
|
||||
successMessage: string,
|
||||
) {
|
||||
show.value = false;
|
||||
emitter?.emit("showLoadingDialog", { loading: true, scrim: true });
|
||||
|
||||
await romApi
|
||||
@@ -306,7 +305,6 @@ function handleRomUpdateFromMetadata(updatedRom: UpdateRom) {
|
||||
:rules="[(value: string) => !!value || t('common.required')]"
|
||||
:label="t('common.name')"
|
||||
variant="outlined"
|
||||
@keyup.enter="updateRom"
|
||||
class="my-4"
|
||||
/>
|
||||
<v-text-field
|
||||
@@ -319,7 +317,6 @@ function handleRomUpdateFromMetadata(updatedRom: UpdateRom) {
|
||||
: t('rom.filename')
|
||||
"
|
||||
variant="outlined"
|
||||
@keyup.enter="updateRom"
|
||||
class="my-4"
|
||||
>
|
||||
<template #details>
|
||||
|
||||
@@ -5,6 +5,8 @@ import { inject, onBeforeMount } from "vue";
|
||||
import EditUserDialog from "@/components/Settings/Administration/Users/Dialog/EditUser.vue";
|
||||
import AddRomsToCollectionDialog from "@/components/common/Collection/Dialog/AddRoms.vue";
|
||||
import RemoveRomsFromCollectionDialog from "@/components/common/Collection/Dialog/RemoveRoms.vue";
|
||||
import LoadingDialog from "@/components/common/Dialog/LoadingDialog.vue";
|
||||
import SearchCoverDialog from "@/components/common/Dialog/SearchCover.vue";
|
||||
import DeleteSavesDialog from "@/components/common/Game/Dialog/Asset/DeleteSaves.vue";
|
||||
import DeleteStatesDialog from "@/components/common/Game/Dialog/Asset/DeleteStates.vue";
|
||||
import SelectSaveDialog from "@/components/common/Game/Dialog/Asset/SelectSave.vue";
|
||||
@@ -20,7 +22,6 @@ import MainAppBar from "@/components/common/Navigation/MainAppBar.vue";
|
||||
import NewVersionDialog from "@/components/common/NewVersionDialog.vue";
|
||||
import Notification from "@/components/common/Notifications/Notification.vue";
|
||||
import UploadProgress from "@/components/common/Notifications/UploadProgress.vue";
|
||||
import SearchCoverDialog from "@/components/common/SearchCover.vue";
|
||||
import storeCollections from "@/stores/collections";
|
||||
import storeNavigation from "@/stores/navigation";
|
||||
import storePlatforms from "@/stores/platforms";
|
||||
@@ -71,6 +72,8 @@ onBeforeMount(async () => {
|
||||
<MainAppBar />
|
||||
<router-view />
|
||||
|
||||
<UploadProgress />
|
||||
<LoadingDialog />
|
||||
<MatchRomDialog />
|
||||
<EditRomDialog />
|
||||
<SearchCoverDialog />
|
||||
@@ -80,10 +83,7 @@ onBeforeMount(async () => {
|
||||
<EditUserDialog />
|
||||
<NoteDialog />
|
||||
<ShowQRCodeDialog />
|
||||
|
||||
<NewVersionDialog />
|
||||
<UploadProgress />
|
||||
|
||||
<UploadSavesDialog />
|
||||
<DeleteSavesDialog />
|
||||
<UploadStatesDialog />
|
||||
|
||||
Reference in New Issue
Block a user