mirror of
https://github.com/rommapp/romm.git
synced 2026-06-28 06:46:00 +00:00
Fix 500 error on /api/tasks/status after cleanup_missing_roms task completes
Agent-Logs-Url: https://github.com/rommapp/romm/sessions/f7f2aeec-91a7-482f-a4f6-a921d4bdab66 Co-authored-by: gantoine <3247106+gantoine@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
121a8a2db4
commit
ddb0ee7699
@@ -41,7 +41,7 @@ class UpdateTaskMeta(TypedDict):
|
||||
update_stats: UpdateStats | None
|
||||
|
||||
|
||||
class CleanupStats(TypedDict):
|
||||
class OrphanedResourcesCleanupStats(TypedDict):
|
||||
platforms_in_db: int
|
||||
roms_in_db: int
|
||||
platforms_in_fs: int
|
||||
@@ -50,6 +50,16 @@ class CleanupStats(TypedDict):
|
||||
removed_fs_roms: int
|
||||
|
||||
|
||||
class MissingRomsCleanupStats(TypedDict):
|
||||
platform_id: int | None
|
||||
roms_found: int
|
||||
roms_deleted: int
|
||||
errors: int
|
||||
|
||||
|
||||
CleanupStats = Union[OrphanedResourcesCleanupStats, MissingRomsCleanupStats]
|
||||
|
||||
|
||||
class CleanupTaskMeta(TypedDict):
|
||||
cleanup_stats: CleanupStats | None
|
||||
|
||||
|
||||
2
frontend/src/__generated__/index.ts
generated
2
frontend/src/__generated__/index.ts
generated
@@ -34,6 +34,8 @@ export type { BulkOperationResponse } from './models/BulkOperationResponse';
|
||||
export type { CleanupStats } from './models/CleanupStats';
|
||||
export type { CleanupTaskMeta } from './models/CleanupTaskMeta';
|
||||
export type { CleanupTaskStatusResponse } from './models/CleanupTaskStatusResponse';
|
||||
export type { MissingRomsCleanupStats } from './models/MissingRomsCleanupStats';
|
||||
export type { OrphanedResourcesCleanupStats } from './models/OrphanedResourcesCleanupStats';
|
||||
export type { ClientTokenAdminSchema } from './models/ClientTokenAdminSchema';
|
||||
export type { ClientTokenCreatePayload } from './models/ClientTokenCreatePayload';
|
||||
export type { ClientTokenCreateSchema } from './models/ClientTokenCreateSchema';
|
||||
|
||||
12
frontend/src/__generated__/models/CleanupStats.ts
generated
12
frontend/src/__generated__/models/CleanupStats.ts
generated
@@ -2,12 +2,8 @@
|
||||
/* istanbul ignore file */
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
export type CleanupStats = {
|
||||
platforms_in_db: number;
|
||||
roms_in_db: number;
|
||||
platforms_in_fs: number;
|
||||
roms_in_fs: number;
|
||||
removed_fs_platforms: number;
|
||||
removed_fs_roms: number;
|
||||
};
|
||||
import type { OrphanedResourcesCleanupStats } from './OrphanedResourcesCleanupStats';
|
||||
import type { MissingRomsCleanupStats } from './MissingRomsCleanupStats';
|
||||
|
||||
export type CleanupStats = OrphanedResourcesCleanupStats | MissingRomsCleanupStats;
|
||||
|
||||
|
||||
10
frontend/src/__generated__/models/MissingRomsCleanupStats.ts
generated
Normal file
10
frontend/src/__generated__/models/MissingRomsCleanupStats.ts
generated
Normal file
@@ -0,0 +1,10 @@
|
||||
/* generated using openapi-typescript-codegen -- do not edit */
|
||||
/* istanbul ignore file */
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
export type MissingRomsCleanupStats = {
|
||||
platform_id?: number | null;
|
||||
roms_found: number;
|
||||
roms_deleted: number;
|
||||
errors: number;
|
||||
};
|
||||
12
frontend/src/__generated__/models/OrphanedResourcesCleanupStats.ts
generated
Normal file
12
frontend/src/__generated__/models/OrphanedResourcesCleanupStats.ts
generated
Normal file
@@ -0,0 +1,12 @@
|
||||
/* generated using openapi-typescript-codegen -- do not edit */
|
||||
/* istanbul ignore file */
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
export type OrphanedResourcesCleanupStats = {
|
||||
platforms_in_db: number;
|
||||
roms_in_db: number;
|
||||
platforms_in_fs: number;
|
||||
roms_in_fs: number;
|
||||
removed_fs_platforms: number;
|
||||
removed_fs_roms: number;
|
||||
};
|
||||
@@ -1,13 +1,13 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from "vue";
|
||||
import { useI18n } from "vue-i18n";
|
||||
import type { CleanupStats, CleanupTaskStatusResponse } from "@/__generated__";
|
||||
import type { OrphanedResourcesCleanupStats, CleanupTaskStatusResponse } from "@/__generated__";
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
const props = defineProps<{
|
||||
task: CleanupTaskStatusResponse;
|
||||
cleanupStats: CleanupStats;
|
||||
cleanupStats: OrphanedResourcesCleanupStats;
|
||||
}>();
|
||||
|
||||
const cleanupProgress = computed(() => {
|
||||
|
||||
@@ -3,7 +3,7 @@ import { computed } from "vue";
|
||||
import type {
|
||||
ScanStats,
|
||||
ConversionStats,
|
||||
CleanupStats,
|
||||
OrphanedResourcesCleanupStats,
|
||||
UpdateStats,
|
||||
ScanTaskStatusResponse,
|
||||
ConversionTaskStatusResponse,
|
||||
@@ -32,10 +32,13 @@ const conversionStats = computed((): ConversionStats | null => {
|
||||
return props.task.meta?.conversion_stats || null;
|
||||
});
|
||||
|
||||
const cleanupStats = computed((): CleanupStats | null => {
|
||||
const cleanupStats = computed((): OrphanedResourcesCleanupStats | null => {
|
||||
if (props.task.task_type !== "cleanup") return null;
|
||||
// @ts-ignore
|
||||
return props.task.meta?.cleanup_stats || null;
|
||||
const stats = props.task.meta?.cleanup_stats;
|
||||
// Only show CleanupTaskProgress for orphaned resources cleanup (has platforms_in_db)
|
||||
if (!stats || stats.platforms_in_db === undefined) return null;
|
||||
return stats;
|
||||
});
|
||||
|
||||
const updateStats = computed((): UpdateStats | null => {
|
||||
|
||||
Reference in New Issue
Block a user