commit frontend code

This commit is contained in:
Georges-Antoine Assi
2025-10-16 15:40:27 -04:00
parent 170b3d04b7
commit 7e4e27db62
7 changed files with 22 additions and 21 deletions

View File

@@ -211,6 +211,7 @@ start_bin_rq_worker() {
--path /backend \
--pid /tmp/rq_worker.pid \
--url "${redis_url}" \
--results-ttl "${TASK_RESULT_TTL:-86400}" \
high default low &
}

View File

@@ -10,7 +10,7 @@ export type ScanStats = {
identified_platforms: number;
scanned_roms: number;
added_roms: number;
metadata_roms: number;
identified_roms: number;
scanned_firmware: number;
added_firmware: number;
};

View File

@@ -1,5 +1,6 @@
<script setup lang="ts">
import type { Emitter } from "mitt";
import { storeToRefs } from "pinia";
import { inject, computed } from "vue";
import taskApi from "@/services/api/task";
import storeTasks from "@/stores/tasks";
@@ -27,6 +28,12 @@ const props = withDefaults(
);
const emitter = inject<Emitter<Events>>("emitter");
const tasksStore = storeTasks();
const { taskStatuses } = storeToRefs(tasksStore);
const task = computed(() =>
taskStatuses.value
.filter((task) => !["queued", "started"].includes(task.status))
.find((task) => task.task_name === props.name),
);
function run() {
if (!props.name) return;
@@ -73,7 +80,7 @@ function run() {
variant="outlined"
size="small"
class="text-primary"
:disabled="false"
:disabled="!!task"
:loading="false"
@click="run"
>

View File

@@ -10,22 +10,15 @@ const props = defineProps<{
const cleanupProgress = computed(() => {
const { total_platforms, total_roms, removed_platforms, removed_roms } =
props.cleanupStats;
const totalPlatforms = total_platforms || 0;
const totalRoms = total_roms || 0;
const totalItems = totalPlatforms + totalRoms;
const removedPlatforms = removed_platforms || 0;
const removedRoms = removed_roms || 0;
const removedItems = removedPlatforms + removedRoms;
return {
totalPlatforms: totalPlatforms,
totalRoms: totalRoms,
removedPlatforms: removedPlatforms,
removedRoms: removedRoms,
totalItems: totalItems,
removedItems: removedItems,
percentage:
totalItems > 0 ? Math.round((removedItems / totalItems) * 100) : 100,
totalPlatforms: total_platforms,
totalRoms: total_roms,
removedPlatforms: removed_platforms,
removedRoms: removed_roms,
totalItems: total_platforms + total_roms,
removedItems: removed_platforms + removed_roms,
percentage: Math.round((removed_roms / total_roms) * 100),
};
});
</script>

View File

@@ -14,7 +14,7 @@ const scanProgress = computed(() => {
scanned_platforms,
scanned_roms,
added_roms,
metadata_roms,
identified_roms,
scanned_firmware,
added_firmware,
} = props.scanStats;
@@ -27,7 +27,7 @@ const scanProgress = computed(() => {
roms: `${scanned_roms}/${total_roms}`,
romsPercentage: Math.round((scanned_roms / total_roms) * 100),
addedRoms: added_roms,
metadataRoms: metadata_roms,
metadataRoms: identified_roms,
scannedFirmware: scanned_firmware,
addedFirmware: added_firmware,
};

View File

@@ -20,7 +20,7 @@ export default defineStore("scanning", {
identified_platforms: 0,
scanned_roms: 0,
added_roms: 0,
metadata_roms: 0,
identified_roms: 0,
},
}),
@@ -37,7 +37,7 @@ export default defineStore("scanning", {
identified_platforms: 0,
scanned_roms: 0,
added_roms: 0,
metadata_roms: 0,
identified_roms: 0,
};
},
},

View File

@@ -542,7 +542,7 @@ async function stopScan() {
t("scan.roms-scanned-with-details", {
n_roms: scanStats.scanned_roms,
n_added_roms: scanStats.added_roms,
n_identified_roms: scanStats.metadata_roms,
n_identified_roms: scanStats.identified_roms,
})
}}</span>
</v-chip>