mirror of
https://github.com/rommapp/romm.git
synced 2026-12-04 21:02:21 +01:00
more cleanup of client
This commit is contained in:
@@ -75,7 +75,7 @@ TaskMeta = Union[
|
||||
class TaskExecutionResponse(TypedDict):
|
||||
task_name: str
|
||||
task_id: str
|
||||
status: JobStatus | None
|
||||
status: JobStatus
|
||||
queued_at: str
|
||||
|
||||
|
||||
|
||||
@@ -4,6 +4,6 @@
|
||||
/* eslint-disable */
|
||||
import type { CleanupStats } from './CleanupStats';
|
||||
export type CleanupTaskMeta = {
|
||||
cleanup_stats: CleanupStats;
|
||||
cleanup_stats: (CleanupStats | null);
|
||||
};
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import type { JobStatus } from './JobStatus';
|
||||
export type CleanupTaskStatusResponse = {
|
||||
task_name: string;
|
||||
task_id: string;
|
||||
status: (JobStatus | null);
|
||||
status: JobStatus;
|
||||
queued_at: string;
|
||||
started_at: (string | null);
|
||||
ended_at: (string | null);
|
||||
|
||||
@@ -4,6 +4,6 @@
|
||||
/* eslint-disable */
|
||||
import type { ConversionStats } from './ConversionStats';
|
||||
export type ConversionTaskMeta = {
|
||||
conversion_stats: ConversionStats;
|
||||
conversion_stats: (ConversionStats | null);
|
||||
};
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import type { JobStatus } from './JobStatus';
|
||||
export type ConversionTaskStatusResponse = {
|
||||
task_name: string;
|
||||
task_id: string;
|
||||
status: (JobStatus | null);
|
||||
status: JobStatus;
|
||||
queued_at: string;
|
||||
started_at: (string | null);
|
||||
ended_at: (string | null);
|
||||
|
||||
@@ -7,7 +7,7 @@ import type { JobStatus } from './JobStatus';
|
||||
export type GenericTaskStatusResponse = {
|
||||
task_name: string;
|
||||
task_id: string;
|
||||
status: (JobStatus | null);
|
||||
status: JobStatus;
|
||||
queued_at: string;
|
||||
started_at: (string | null);
|
||||
ended_at: (string | null);
|
||||
|
||||
@@ -4,6 +4,6 @@
|
||||
/* eslint-disable */
|
||||
import type { ScanStats } from './ScanStats';
|
||||
export type ScanTaskMeta = {
|
||||
scan_stats: ScanStats;
|
||||
scan_stats: (ScanStats | null);
|
||||
};
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import type { ScanTaskMeta } from './ScanTaskMeta';
|
||||
export type ScanTaskStatusResponse = {
|
||||
task_name: string;
|
||||
task_id: string;
|
||||
status: (JobStatus | null);
|
||||
status: JobStatus;
|
||||
queued_at: string;
|
||||
started_at: (string | null);
|
||||
ended_at: (string | null);
|
||||
|
||||
@@ -6,7 +6,7 @@ import type { JobStatus } from './JobStatus';
|
||||
export type TaskExecutionResponse = {
|
||||
task_name: string;
|
||||
task_id: string;
|
||||
status: (JobStatus | null);
|
||||
status: JobStatus;
|
||||
queued_at: string;
|
||||
};
|
||||
|
||||
|
||||
@@ -4,6 +4,6 @@
|
||||
/* eslint-disable */
|
||||
import type { UpdateStats } from './UpdateStats';
|
||||
export type UpdateTaskMeta = {
|
||||
update_stats: UpdateStats;
|
||||
update_stats: (UpdateStats | null);
|
||||
};
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import type { UpdateTaskMeta } from './UpdateTaskMeta';
|
||||
export type UpdateTaskStatusResponse = {
|
||||
task_name: string;
|
||||
task_id: string;
|
||||
status: (JobStatus | null);
|
||||
status: JobStatus;
|
||||
queued_at: string;
|
||||
started_at: (string | null);
|
||||
ended_at: (string | null);
|
||||
|
||||
@@ -7,7 +7,7 @@ import type { WatcherTaskMeta } from './WatcherTaskMeta';
|
||||
export type WatcherTaskStatusResponse = {
|
||||
task_name: string;
|
||||
task_id: string;
|
||||
status: (JobStatus | null);
|
||||
status: JobStatus;
|
||||
queued_at: string;
|
||||
started_at: (string | null);
|
||||
ended_at: (string | null);
|
||||
|
||||
@@ -1,59 +1,14 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from "vue";
|
||||
import type {
|
||||
ScanTaskStatusResponse,
|
||||
ConversionTaskStatusResponse,
|
||||
CleanupTaskStatusResponse,
|
||||
UpdateTaskStatusResponse,
|
||||
} from "@/__generated__";
|
||||
import { TaskStatusItem, type TaskStatusResponse } from "@/utils/tasks";
|
||||
import TaskProgressDisplay from "./tasks/TaskProgressDisplay.vue";
|
||||
|
||||
const props = defineProps<{
|
||||
task:
|
||||
| ScanTaskStatusResponse
|
||||
| ConversionTaskStatusResponse
|
||||
| CleanupTaskStatusResponse
|
||||
| UpdateTaskStatusResponse;
|
||||
task: TaskStatusResponse;
|
||||
}>();
|
||||
|
||||
const statusIconColor = computed(() => {
|
||||
switch (props.task.status) {
|
||||
case "queued":
|
||||
return {
|
||||
color: "orange",
|
||||
icon: "mdi-clock-outline",
|
||||
};
|
||||
case "started":
|
||||
return {
|
||||
color: "blue",
|
||||
icon: "mdi-loading",
|
||||
};
|
||||
case "finished":
|
||||
return {
|
||||
color: "green",
|
||||
icon: "mdi-check-circle",
|
||||
};
|
||||
case "failed":
|
||||
return {
|
||||
color: "red",
|
||||
icon: "mdi-alert-circle",
|
||||
};
|
||||
case "stopped":
|
||||
return {
|
||||
color: "grey",
|
||||
icon: "mdi-stop-circle",
|
||||
};
|
||||
case "canceled":
|
||||
return {
|
||||
color: "grey",
|
||||
icon: "mdi-stop-circle",
|
||||
};
|
||||
default:
|
||||
return {
|
||||
color: "grey",
|
||||
icon: "mdi-help-circle-outline",
|
||||
};
|
||||
}
|
||||
return TaskStatusItem[props.task.status];
|
||||
});
|
||||
|
||||
const getTaskDuration = () => {
|
||||
@@ -70,155 +25,81 @@ const getTaskDuration = () => {
|
||||
if (duration < 3600000) return `${Math.round(duration / 60000)}m`;
|
||||
return `${Math.round(duration / 3600000)}h`;
|
||||
};
|
||||
|
||||
const formatRunTime = () => {
|
||||
if (!props.task.started_at) return "Not started";
|
||||
|
||||
const startTime = new Date(props.task.started_at);
|
||||
return startTime.toLocaleTimeString([], {
|
||||
hour: "2-digit",
|
||||
minute: "2-digit",
|
||||
second: "2-digit",
|
||||
});
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<v-card
|
||||
elevation="2"
|
||||
class="task-card"
|
||||
class="rounded border"
|
||||
:class="{
|
||||
'task-card--running': task.status === 'started',
|
||||
'task-card--queued': task.status === 'queued',
|
||||
'task-card--finished': task.status === 'finished',
|
||||
'task-card--failed': task.status === 'failed',
|
||||
'task-card--stopped': task.status === 'stopped',
|
||||
'task-card--canceled': task.status === 'canceled',
|
||||
'border-blue': task.status === 'started',
|
||||
'border-orange': task.status === 'queued',
|
||||
'border-green': task.status === 'finished',
|
||||
'border-red': task.status === 'failed',
|
||||
'border-grey': task.status === 'stopped' || task.status === 'canceled',
|
||||
}"
|
||||
>
|
||||
<!-- Header Section -->
|
||||
<div class="task-header">
|
||||
<div class="task-header__left">
|
||||
<div class="task-icon-wrapper">
|
||||
<v-card-text class="pa-2">
|
||||
<div class="d-flex align-center justify-space-between">
|
||||
<div class="d-flex align-center ga-4 flex-grow-1">
|
||||
<v-icon
|
||||
:color="statusIconColor.color"
|
||||
:icon="statusIconColor.icon"
|
||||
size="24"
|
||||
:class="{ 'task-icon--spinning': task.status === 'started' }"
|
||||
/>
|
||||
</div>
|
||||
<div class="task-info">
|
||||
<h3 class="task-title">{{ task.task_name }}</h3>
|
||||
<div class="task-meta">
|
||||
<span class="task-type">{{ task.task_type }}</span>
|
||||
<span class="task-separator">•</span>
|
||||
<span class="task-duration">{{ getTaskDuration() }}</span>
|
||||
<div class="d-flex flex-row flex-grow-1">
|
||||
<h3 class="text-h6 font-weight-semibold text-white mr-4">
|
||||
{{ task.task_name }}
|
||||
</h3>
|
||||
<div class="d-flex align-center ga-2">
|
||||
<v-chip size="x-small" variant="tonal" class="text-caption">
|
||||
{{ task.task_type }}
|
||||
</v-chip>
|
||||
<v-chip size="x-small" variant="tonal" class="text-caption">
|
||||
{{ getTaskDuration() }}
|
||||
</v-chip>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex align-center ga-2">
|
||||
<v-chip size="small" variant="tonal" class="text-caption">
|
||||
{{ formatRunTime() }}
|
||||
</v-chip>
|
||||
<v-chip
|
||||
:color="statusIconColor.color"
|
||||
size="small"
|
||||
variant="flat"
|
||||
class="font-weight-semibold text-capitalize"
|
||||
>
|
||||
<v-icon
|
||||
:icon="statusIconColor.icon"
|
||||
size="16"
|
||||
class="mr-1"
|
||||
:class="{ 'task-icon--spinning': task.status === 'started' }"
|
||||
/>
|
||||
{{ task.status }}
|
||||
</v-chip>
|
||||
</div>
|
||||
</div>
|
||||
<div class="task-header__right">
|
||||
<v-chip
|
||||
:color="statusIconColor.color"
|
||||
size="small"
|
||||
variant="flat"
|
||||
class="task-status-chip"
|
||||
>
|
||||
<v-icon
|
||||
:icon="statusIconColor.icon"
|
||||
size="16"
|
||||
class="mr-1"
|
||||
:class="{ 'task-icon--spinning': task.status === 'started' }"
|
||||
/>
|
||||
{{ task.status }}
|
||||
</v-chip>
|
||||
</div>
|
||||
</div>
|
||||
</v-card-text>
|
||||
|
||||
<!-- Progress Section -->
|
||||
<TaskProgressDisplay :task="task" />
|
||||
</v-card>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.task-card {
|
||||
border-radius: 12px;
|
||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||
background: linear-gradient(
|
||||
135deg,
|
||||
rgba(255, 255, 255, 0.05) 0%,
|
||||
rgba(255, 255, 255, 0.02) 100%
|
||||
);
|
||||
transition: all 0.3s ease;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.task-card:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
|
||||
border-color: rgba(255, 255, 255, 0.2);
|
||||
}
|
||||
|
||||
.task-card--running {
|
||||
border-left: 4px solid #2196f3;
|
||||
background: linear-gradient(
|
||||
135deg,
|
||||
rgba(33, 150, 243, 0.1) 0%,
|
||||
rgba(33, 150, 243, 0.05) 100%
|
||||
);
|
||||
}
|
||||
|
||||
.task-card--queued {
|
||||
border-left: 4px solid #ff9800;
|
||||
background: linear-gradient(
|
||||
135deg,
|
||||
rgba(255, 152, 0, 0.1) 0%,
|
||||
rgba(255, 152, 0, 0.05) 100%
|
||||
);
|
||||
}
|
||||
|
||||
.task-card--finished {
|
||||
border-left: 4px solid #4caf50;
|
||||
background: linear-gradient(
|
||||
135deg,
|
||||
rgba(76, 175, 80, 0.1) 0%,
|
||||
rgba(76, 175, 80, 0.05) 100%
|
||||
);
|
||||
}
|
||||
|
||||
.task-card--failed {
|
||||
border-left: 4px solid #f44336;
|
||||
background: linear-gradient(
|
||||
135deg,
|
||||
rgba(244, 67, 54, 0.1) 0%,
|
||||
rgba(244, 67, 54, 0.05) 100%
|
||||
);
|
||||
}
|
||||
|
||||
.task-card--stopped,
|
||||
.task-card--canceled {
|
||||
border-left: 4px solid #9e9e9e;
|
||||
background: linear-gradient(
|
||||
135deg,
|
||||
rgba(158, 158, 158, 0.1) 0%,
|
||||
rgba(158, 158, 158, 0.05) 100%
|
||||
);
|
||||
}
|
||||
|
||||
.task-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 20px;
|
||||
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
|
||||
.task-header__left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16px;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.task-icon-wrapper {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
border-radius: 12px;
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
backdrop-filter: blur(10px);
|
||||
}
|
||||
|
||||
.task-icon--spinning {
|
||||
animation: spin 1s linear infinite;
|
||||
}
|
||||
@@ -231,81 +112,4 @@ const getTaskDuration = () => {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
|
||||
.task-info {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.task-title {
|
||||
font-size: 18px;
|
||||
font-weight: 600;
|
||||
color: #ffffff;
|
||||
margin: 0 0 4px 0;
|
||||
line-height: 1.3;
|
||||
}
|
||||
|
||||
.task-meta {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
font-size: 14px;
|
||||
color: rgba(255, 255, 255, 0.7);
|
||||
}
|
||||
|
||||
.task-type {
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
padding: 2px 8px;
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
.task-separator {
|
||||
color: rgba(255, 255, 255, 0.4);
|
||||
}
|
||||
|
||||
.task-duration {
|
||||
font-family: "Monaco", "Menlo", monospace;
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
padding: 2px 8px;
|
||||
border-radius: 6px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.task-header__right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.task-status-chip {
|
||||
font-weight: 600;
|
||||
text-transform: capitalize;
|
||||
border-radius: 20px;
|
||||
padding: 8px 16px;
|
||||
}
|
||||
|
||||
/* Responsive Design */
|
||||
@media (max-width: 768px) {
|
||||
.task-header {
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.task-header__right {
|
||||
align-self: flex-end;
|
||||
}
|
||||
|
||||
.task-details__grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.task-meta {
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.task-separator {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
<script setup lang="ts">
|
||||
import type { CleanupStats } from "@/__generated__";
|
||||
|
||||
defineProps<{
|
||||
cleanupStats: CleanupStats;
|
||||
}>();
|
||||
defineProps<{ cleanupStats: CleanupStats }>();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="d-flex flex-wrap gap-2">
|
||||
<v-chip size="x-small" color="success" variant="outlined">
|
||||
Removed: {{ cleanupStats.removed }} items
|
||||
Removed {{ cleanupStats.removed }} files
|
||||
</v-chip>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -14,7 +14,7 @@ const conversionProgress = computed(() => {
|
||||
|
||||
return {
|
||||
processed: `${processed}/${total}`,
|
||||
processedProgress: Math.round((processed / total) * 100),
|
||||
percentage: Math.round((processed / total) * 100),
|
||||
errors: errors,
|
||||
successRate:
|
||||
total > 0 ? Math.round(((processed - errors) / total) * 100) : 0,
|
||||
@@ -24,16 +24,13 @@ const conversionProgress = computed(() => {
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<!-- Progress Bar -->
|
||||
<div class="mb-3">
|
||||
<div class="d-flex justify-space-between align-center mb-1">
|
||||
<span class="text-caption">Conversion Progress</span>
|
||||
<span class="text-caption"
|
||||
>{{ conversionProgress.processedProgress }}%</span
|
||||
>
|
||||
<span class="text-caption">{{ conversionProgress.percentage }}%</span>
|
||||
</div>
|
||||
<v-progress-linear
|
||||
:model-value="conversionProgress.processedProgress"
|
||||
:model-value="conversionProgress.percentage"
|
||||
color="primary"
|
||||
height="6"
|
||||
rounded
|
||||
|
||||
@@ -15,9 +15,9 @@ const scanProgress = computed(() => {
|
||||
|
||||
return {
|
||||
platforms: `${scannedPlatforms}/${totalPlatforms}`,
|
||||
platformsProgress: Math.round((scannedPlatforms / totalPlatforms) * 100),
|
||||
platformsPercentage: Math.round((scannedPlatforms / totalPlatforms) * 100),
|
||||
roms: `${scannedRoms}/${totalRoms}`,
|
||||
romsProgress: Math.round((scannedRoms / totalRoms) * 100),
|
||||
romsPercentage: Math.round((scannedRoms / totalRoms) * 100),
|
||||
addedRoms: stats.added_roms || 0,
|
||||
metadataRoms: stats.metadata_roms || 0,
|
||||
scannedFirmware: stats.scanned_firmware || 0,
|
||||
@@ -27,279 +27,176 @@ const scanProgress = computed(() => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="scan-progress">
|
||||
<div class="d-flex flex-column ga-6">
|
||||
<!-- Progress Bars -->
|
||||
<div class="progress-bars">
|
||||
<div class="progress-item">
|
||||
<div class="progress-label">
|
||||
<v-icon icon="mdi-console" size="16" class="mr-2" />
|
||||
<span>Platforms</span>
|
||||
<span class="progress-percentage"
|
||||
>{{ scanProgress.platformsProgress }}%</span
|
||||
<div class="d-flex flex-column ga-5">
|
||||
<div class="d-flex flex-column ga-2">
|
||||
<div
|
||||
class="d-flex align-center justify-space-between text-body-2 font-weight-semibold text-white"
|
||||
>
|
||||
<div class="d-flex align-center">
|
||||
<v-icon icon="mdi-console" size="16" class="mr-2" />
|
||||
<span>Platforms</span>
|
||||
</div>
|
||||
<v-chip
|
||||
size="x-small"
|
||||
variant="tonal"
|
||||
class="text-caption font-family-monospace"
|
||||
>
|
||||
{{ scanProgress.platformsPercentage }}%
|
||||
</v-chip>
|
||||
</div>
|
||||
<v-progress-linear
|
||||
:model-value="scanProgress.platformsProgress"
|
||||
:model-value="scanProgress.platformsPercentage"
|
||||
color="primary"
|
||||
height="8"
|
||||
rounded
|
||||
class="progress-bar"
|
||||
/>
|
||||
<div class="progress-details">
|
||||
<div class="text-caption text-grey-lighten-1">
|
||||
{{ scanProgress.platforms }} platforms processed
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="progress-item">
|
||||
<div class="progress-label">
|
||||
<v-icon icon="mdi-gamepad-variant" size="16" class="mr-2" />
|
||||
<span>ROMs</span>
|
||||
<span class="progress-percentage"
|
||||
>{{ scanProgress.romsProgress }}%</span
|
||||
<div class="d-flex flex-column ga-2">
|
||||
<div
|
||||
class="d-flex align-center justify-space-between text-body-2 font-weight-semibold text-white"
|
||||
>
|
||||
<div class="d-flex align-center">
|
||||
<v-icon icon="mdi-gamepad-variant" size="16" class="mr-2" />
|
||||
<span>ROMs</span>
|
||||
</div>
|
||||
<v-chip
|
||||
size="x-small"
|
||||
variant="tonal"
|
||||
class="text-caption font-family-monospace"
|
||||
>
|
||||
{{ scanProgress.romsPercentage }}%
|
||||
</v-chip>
|
||||
</div>
|
||||
<v-progress-linear
|
||||
:model-value="scanProgress.romsProgress"
|
||||
:model-value="scanProgress.romsPercentage"
|
||||
color="secondary"
|
||||
height="8"
|
||||
rounded
|
||||
class="progress-bar"
|
||||
/>
|
||||
<div class="progress-details">
|
||||
<div class="text-caption text-grey-lighten-1">
|
||||
{{ scanProgress.roms }} ROMs processed
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Summary Stats -->
|
||||
<div class="summary-stats">
|
||||
<div class="stats-grid">
|
||||
<div class="stat-item stat-item--primary">
|
||||
<div class="stat-icon">
|
||||
<v-icon icon="mdi-console" size="20" />
|
||||
<div
|
||||
class="d-grid"
|
||||
style="
|
||||
grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
|
||||
gap: 16px;
|
||||
"
|
||||
>
|
||||
<v-card
|
||||
variant="tonal"
|
||||
class="d-flex align-center ga-3 pa-4 border-l-4 border-primary"
|
||||
>
|
||||
<v-avatar size="40" class="bg-primary-lighten-1">
|
||||
<v-icon icon="mdi-console" size="20" />
|
||||
</v-avatar>
|
||||
<div class="d-flex flex-column ga-1 flex-grow-1">
|
||||
<div
|
||||
class="text-h6 font-weight-bold text-white font-family-monospace"
|
||||
>
|
||||
{{ scanProgress.platforms }}
|
||||
</div>
|
||||
<div class="stat-content">
|
||||
<div class="stat-value">{{ scanProgress.platforms }}</div>
|
||||
<div class="stat-label">Platforms</div>
|
||||
<div
|
||||
class="text-caption text-grey-lighten-1 font-weight-medium text-uppercase"
|
||||
>
|
||||
Platforms
|
||||
</div>
|
||||
</div>
|
||||
</v-card>
|
||||
|
||||
<div class="stat-item stat-item--secondary">
|
||||
<div class="stat-icon">
|
||||
<v-icon icon="mdi-gamepad-variant" size="20" />
|
||||
<v-card
|
||||
variant="tonal"
|
||||
class="d-flex align-center ga-3 pa-4 border-l-4 border-secondary"
|
||||
>
|
||||
<v-avatar size="40" class="bg-secondary-lighten-1">
|
||||
<v-icon icon="mdi-gamepad-variant" size="20" />
|
||||
</v-avatar>
|
||||
<div class="d-flex flex-column ga-1 flex-grow-1">
|
||||
<div
|
||||
class="text-h6 font-weight-bold text-white font-family-monospace"
|
||||
>
|
||||
{{ scanProgress.roms }}
|
||||
</div>
|
||||
<div class="stat-content">
|
||||
<div class="stat-value">{{ scanProgress.roms }}</div>
|
||||
<div class="stat-label">ROMs</div>
|
||||
<div
|
||||
class="text-caption text-grey-lighten-1 font-weight-medium text-uppercase"
|
||||
>
|
||||
ROMs
|
||||
</div>
|
||||
</div>
|
||||
</v-card>
|
||||
|
||||
<div class="stat-item stat-item--success">
|
||||
<div class="stat-icon">
|
||||
<v-icon icon="mdi-plus-circle" size="20" />
|
||||
<v-card
|
||||
variant="tonal"
|
||||
class="d-flex align-center ga-3 pa-4 border-l-4 border-success"
|
||||
>
|
||||
<v-avatar size="40" class="bg-success-lighten-1">
|
||||
<v-icon icon="mdi-plus-circle" size="20" />
|
||||
</v-avatar>
|
||||
<div class="d-flex flex-column ga-1 flex-grow-1">
|
||||
<div
|
||||
class="text-h6 font-weight-bold text-white font-family-monospace"
|
||||
>
|
||||
{{ scanProgress.addedRoms }}
|
||||
</div>
|
||||
<div class="stat-content">
|
||||
<div class="stat-value">{{ scanProgress.addedRoms }}</div>
|
||||
<div class="stat-label">Added</div>
|
||||
<div
|
||||
class="text-caption text-grey-lighten-1 font-weight-medium text-uppercase"
|
||||
>
|
||||
Added
|
||||
</div>
|
||||
</div>
|
||||
</v-card>
|
||||
|
||||
<div class="stat-item stat-item--info">
|
||||
<div class="stat-icon">
|
||||
<v-icon icon="mdi-information" size="20" />
|
||||
<v-card
|
||||
variant="tonal"
|
||||
class="d-flex align-center ga-3 pa-4 border-l-4 border-info"
|
||||
>
|
||||
<v-avatar size="40" class="bg-info-lighten-1">
|
||||
<v-icon icon="mdi-information" size="20" />
|
||||
</v-avatar>
|
||||
<div class="d-flex flex-column ga-1 flex-grow-1">
|
||||
<div
|
||||
class="text-h6 font-weight-bold text-white font-family-monospace"
|
||||
>
|
||||
{{ scanProgress.metadataRoms }}
|
||||
</div>
|
||||
<div class="stat-content">
|
||||
<div class="stat-value">{{ scanProgress.metadataRoms }}</div>
|
||||
<div class="stat-label">Metadata</div>
|
||||
<div
|
||||
class="text-caption text-grey-lighten-1 font-weight-medium text-uppercase"
|
||||
>
|
||||
Metadata
|
||||
</div>
|
||||
</div>
|
||||
</v-card>
|
||||
|
||||
<div class="stat-item stat-item--warning">
|
||||
<div class="stat-icon">
|
||||
<v-icon icon="mdi-chip" size="20" />
|
||||
<v-card
|
||||
variant="tonal"
|
||||
class="d-flex align-center ga-3 pa-4 border-l-4 border-warning"
|
||||
>
|
||||
<v-avatar size="40" class="bg-warning-lighten-1">
|
||||
<v-icon icon="mdi-chip" size="20" />
|
||||
</v-avatar>
|
||||
<div class="d-flex flex-column ga-1 flex-grow-1">
|
||||
<div
|
||||
class="text-h6 font-weight-bold text-white font-family-monospace"
|
||||
>
|
||||
{{ scanProgress.scannedFirmware }}
|
||||
</div>
|
||||
<div class="stat-content">
|
||||
<div class="stat-value">{{ scanProgress.scannedFirmware }}</div>
|
||||
<div class="stat-label">Firmware</div>
|
||||
<div
|
||||
class="text-caption text-grey-lighten-1 font-weight-medium text-uppercase"
|
||||
>
|
||||
Firmware
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</v-card>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.scan-progress {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 24px;
|
||||
}
|
||||
|
||||
.progress-bars {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.progress-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.progress-label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.progress-percentage {
|
||||
font-family: "Monaco", "Menlo", monospace;
|
||||
font-size: 12px;
|
||||
color: rgba(255, 255, 255, 0.7);
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
padding: 2px 8px;
|
||||
border-radius: 12px;
|
||||
}
|
||||
|
||||
.progress-bar {
|
||||
border-radius: 4px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.progress-details {
|
||||
font-size: 12px;
|
||||
color: rgba(255, 255, 255, 0.6);
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
.stats-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
|
||||
gap: 16px;
|
||||
}
|
||||
|
||||
.stat-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
padding: 16px;
|
||||
border-radius: 8px;
|
||||
border: 1px solid rgba(255, 255, 255, 0.1);
|
||||
background: rgba(255, 255, 255, 0.02);
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.stat-item:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
||||
border-color: rgba(255, 255, 255, 0.2);
|
||||
}
|
||||
|
||||
.stat-item--primary {
|
||||
border-left: 4px solid #2196f3;
|
||||
background: linear-gradient(
|
||||
135deg,
|
||||
rgba(33, 150, 243, 0.1) 0%,
|
||||
rgba(33, 150, 243, 0.05) 100%
|
||||
);
|
||||
}
|
||||
|
||||
.stat-item--secondary {
|
||||
border-left: 4px solid #9c27b0;
|
||||
background: linear-gradient(
|
||||
135deg,
|
||||
rgba(156, 39, 176, 0.1) 0%,
|
||||
rgba(156, 39, 176, 0.05) 100%
|
||||
);
|
||||
}
|
||||
|
||||
.stat-item--success {
|
||||
border-left: 4px solid #4caf50;
|
||||
background: linear-gradient(
|
||||
135deg,
|
||||
rgba(76, 175, 80, 0.1) 0%,
|
||||
rgba(76, 175, 80, 0.05) 100%
|
||||
);
|
||||
}
|
||||
|
||||
.stat-item--info {
|
||||
border-left: 4px solid #00bcd4;
|
||||
background: linear-gradient(
|
||||
135deg,
|
||||
rgba(0, 188, 212, 0.1) 0%,
|
||||
rgba(0, 188, 212, 0.05) 100%
|
||||
);
|
||||
}
|
||||
|
||||
.stat-item--warning {
|
||||
border-left: 4px solid #ff9800;
|
||||
background: linear-gradient(
|
||||
135deg,
|
||||
rgba(255, 152, 0, 0.1) 0%,
|
||||
rgba(255, 152, 0, 0.05) 100%
|
||||
);
|
||||
}
|
||||
|
||||
.stat-icon {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border-radius: 8px;
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
backdrop-filter: blur(10px);
|
||||
}
|
||||
|
||||
.stat-content {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.stat-value {
|
||||
font-size: 20px;
|
||||
font-weight: 700;
|
||||
color: #ffffff;
|
||||
font-family: "Monaco", "Menlo", monospace;
|
||||
}
|
||||
|
||||
.stat-label {
|
||||
font-size: 12px;
|
||||
color: rgba(255, 255, 255, 0.7);
|
||||
font-weight: 500;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.5px;
|
||||
}
|
||||
|
||||
/* Responsive Design */
|
||||
@media (max-width: 768px) {
|
||||
.stats-grid {
|
||||
grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.stat-item {
|
||||
padding: 12px;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.stat-icon {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
}
|
||||
|
||||
.stat-value {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.stat-label {
|
||||
font-size: 10px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,50 +1,43 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from "vue";
|
||||
import type {
|
||||
ScanTaskStatusResponse,
|
||||
ConversionTaskStatusResponse,
|
||||
CleanupTaskStatusResponse,
|
||||
UpdateTaskStatusResponse,
|
||||
ScanStats,
|
||||
ConversionStats,
|
||||
CleanupStats,
|
||||
UpdateStats,
|
||||
} from "@/__generated__";
|
||||
import {
|
||||
TaskStatusItem,
|
||||
TaskTypeItem,
|
||||
type TaskStatusResponse,
|
||||
} from "@/utils/tasks";
|
||||
import CleanupTaskProgress from "./CleanupTaskProgress.vue";
|
||||
import ConversionTaskProgress from "./ConversionTaskProgress.vue";
|
||||
import ScanTaskProgress from "./ScanTaskProgress.vue";
|
||||
import UpdateTaskProgress from "./UpdateTaskProgress.vue";
|
||||
|
||||
const props = defineProps<{
|
||||
task:
|
||||
| ScanTaskStatusResponse
|
||||
| ConversionTaskStatusResponse
|
||||
| CleanupTaskStatusResponse
|
||||
| UpdateTaskStatusResponse;
|
||||
task: TaskStatusResponse;
|
||||
}>();
|
||||
|
||||
const scanStats = computed((): ScanStats | null => {
|
||||
if (!props.task.meta) return null;
|
||||
if (props.task.task_type !== "scan") return null;
|
||||
return props.task.meta.scan_stats;
|
||||
return props.task.meta?.scan_stats || null;
|
||||
});
|
||||
|
||||
const conversionStats = computed((): ConversionStats | null => {
|
||||
if (!props.task.meta) return null;
|
||||
if (props.task.task_type !== "conversion") return null;
|
||||
return props.task.meta.conversion_stats;
|
||||
return props.task.meta?.conversion_stats || null;
|
||||
});
|
||||
|
||||
const cleanupStats = computed((): CleanupStats | null => {
|
||||
if (!props.task.meta) return null;
|
||||
if (props.task.task_type !== "cleanup") return null;
|
||||
return props.task.meta.cleanup_stats;
|
||||
return props.task.meta?.cleanup_stats || null;
|
||||
});
|
||||
|
||||
const updateStats = computed((): UpdateStats | null => {
|
||||
if (!props.task.meta) return null;
|
||||
if (props.task.task_type !== "update") return null;
|
||||
return props.task.meta.update_stats;
|
||||
return props.task.meta?.update_stats || null;
|
||||
});
|
||||
|
||||
const hasDetailedStats = computed(() => {
|
||||
@@ -56,166 +49,60 @@ const hasDetailedStats = computed(() => {
|
||||
);
|
||||
});
|
||||
|
||||
const progressTitle = computed(() => {
|
||||
switch (props.task.task_type) {
|
||||
case "scan":
|
||||
return "Scan Progress";
|
||||
case "conversion":
|
||||
return "Conversion Progress";
|
||||
case "cleanup":
|
||||
return "Cleanup Progress";
|
||||
case "update":
|
||||
return "Update Progress";
|
||||
default:
|
||||
return "Task Progress";
|
||||
}
|
||||
const taskTypeItem = computed(() => {
|
||||
return TaskTypeItem[props.task.task_type];
|
||||
});
|
||||
|
||||
// Get progress icon based on task type
|
||||
const getProgressIcon = () => {
|
||||
switch (props.task.task_type) {
|
||||
case "scan":
|
||||
return "mdi-magnify-scan";
|
||||
case "conversion":
|
||||
return "mdi-image-multiple";
|
||||
case "cleanup":
|
||||
return "mdi-broom";
|
||||
case "update":
|
||||
return "mdi-update";
|
||||
default:
|
||||
return "mdi-progress-clock";
|
||||
}
|
||||
};
|
||||
|
||||
// Get progress status color
|
||||
const getProgressStatusColor = () => {
|
||||
if (props.task.status === "finished") return "success";
|
||||
if (props.task.status === "started") return "primary";
|
||||
if (props.task.status === "queued") return "warning";
|
||||
if (props.task.status === "failed") return "error";
|
||||
if (props.task.status === "stopped" || props.task.status === "canceled")
|
||||
return "grey";
|
||||
return "grey";
|
||||
};
|
||||
|
||||
// Get progress status text
|
||||
const getProgressStatusText = () => {
|
||||
if (props.task.status === "finished") return "Completed";
|
||||
if (props.task.status === "started") return "Running";
|
||||
if (props.task.status === "queued") return "Queued";
|
||||
if (props.task.status === "failed") return "Failed";
|
||||
if (props.task.status === "stopped") return "Stopped";
|
||||
if (props.task.status === "canceled") return "Canceled";
|
||||
return "Unknown";
|
||||
};
|
||||
const taskStatusItem = computed(() => {
|
||||
return TaskStatusItem[props.task.status];
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div v-if="hasDetailedStats" class="progress-container">
|
||||
<!-- Progress Header -->
|
||||
<div class="progress-header">
|
||||
<div class="progress-title">
|
||||
<v-icon :icon="getProgressIcon()" size="18" class="mr-2" />
|
||||
{{ progressTitle }}
|
||||
</div>
|
||||
<div class="progress-status">
|
||||
<v-card
|
||||
v-if="hasDetailedStats"
|
||||
elevation="0"
|
||||
class="mt-4 rounded border"
|
||||
variant="tonal"
|
||||
>
|
||||
<v-card-text class="pa-0">
|
||||
<div
|
||||
class="d-flex align-center justify-space-between pa-4 bg-grey-lighten-5"
|
||||
>
|
||||
<div
|
||||
class="d-flex align-center text-h6 font-weight-semibold text-grey-darken-2"
|
||||
>
|
||||
<v-icon :icon="taskTypeItem.icon" size="18" class="mr-2" />
|
||||
{{ taskTypeItem.title }}
|
||||
</div>
|
||||
<v-chip
|
||||
:color="getProgressStatusColor()"
|
||||
:color="taskStatusItem.color"
|
||||
size="small"
|
||||
variant="flat"
|
||||
class="progress-status-chip"
|
||||
class="font-weight-semibold text-capitalize"
|
||||
>
|
||||
{{ getProgressStatusText() }}
|
||||
{{ taskStatusItem.text }}
|
||||
</v-chip>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Progress Content -->
|
||||
<div class="progress-content">
|
||||
<!-- Scan Task Progress -->
|
||||
<ScanTaskProgress
|
||||
v-if="task.task_type === 'scan' && scanStats"
|
||||
:scan-stats="scanStats"
|
||||
/>
|
||||
|
||||
<!-- Conversion Task Progress -->
|
||||
<ConversionTaskProgress
|
||||
v-else-if="task.task_type === 'conversion' && conversionStats"
|
||||
:conversion-stats="conversionStats"
|
||||
/>
|
||||
|
||||
<!-- Cleanup Task Progress -->
|
||||
<CleanupTaskProgress
|
||||
v-else-if="task.task_type === 'cleanup' && cleanupStats"
|
||||
:cleanup-stats="cleanupStats"
|
||||
/>
|
||||
|
||||
<!-- Update Task Progress -->
|
||||
<UpdateTaskProgress
|
||||
v-else-if="task.task_type === 'update' && updateStats"
|
||||
:update-stats="updateStats"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="pa-4">
|
||||
<ScanTaskProgress
|
||||
v-if="task.task_type === 'scan' && scanStats"
|
||||
:scan-stats="scanStats"
|
||||
/>
|
||||
<ConversionTaskProgress
|
||||
v-else-if="task.task_type === 'conversion' && conversionStats"
|
||||
:conversion-stats="conversionStats"
|
||||
/>
|
||||
<CleanupTaskProgress
|
||||
v-else-if="task.task_type === 'cleanup' && cleanupStats"
|
||||
:cleanup-stats="cleanupStats"
|
||||
/>
|
||||
<UpdateTaskProgress
|
||||
v-else-if="task.task_type === 'update' && updateStats"
|
||||
:update-stats="updateStats"
|
||||
/>
|
||||
</div>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.progress-container {
|
||||
padding: 0 20px 20px 20px;
|
||||
background: rgba(255, 255, 255, 0.03);
|
||||
border-radius: 12px;
|
||||
border: 1px solid rgba(255, 255, 255, 0.08);
|
||||
overflow: hidden;
|
||||
margin-top: 16px;
|
||||
}
|
||||
|
||||
.progress-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 16px 20px;
|
||||
background: rgba(255, 255, 255, 0.05);
|
||||
border-bottom: 1px solid rgba(255, 255, 255, 0.08);
|
||||
}
|
||||
|
||||
.progress-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.progress-status {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.progress-status-chip {
|
||||
font-weight: 600;
|
||||
text-transform: capitalize;
|
||||
border-radius: 16px;
|
||||
padding: 6px 12px;
|
||||
}
|
||||
|
||||
.progress-content {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
/* Responsive Design */
|
||||
@media (max-width: 768px) {
|
||||
.progress-header {
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.progress-status {
|
||||
align-self: flex-end;
|
||||
}
|
||||
|
||||
.progress-content {
|
||||
padding: 16px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -9,7 +9,7 @@ const props = defineProps<{
|
||||
const updateProgress = computed(() => {
|
||||
return {
|
||||
updated: `${props.updateStats.current}/${props.updateStats.total}`,
|
||||
updatedProgress: Math.round(
|
||||
percentage: Math.round(
|
||||
(props.updateStats.current / props.updateStats.total) * 100,
|
||||
),
|
||||
};
|
||||
@@ -18,21 +18,19 @@ const updateProgress = computed(() => {
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<!-- Progress Bar -->
|
||||
<div class="mb-3">
|
||||
<div class="d-flex justify-space-between align-center mb-1">
|
||||
<span class="text-caption">Download Progress</span>
|
||||
<span class="text-caption">{{ updateProgress.updatedProgress }}%</span>
|
||||
<span class="text-caption">{{ updateProgress.percentage }}%</span>
|
||||
</div>
|
||||
<v-progress-linear
|
||||
:model-value="updateProgress.updatedProgress"
|
||||
:model-value="updateProgress.percentage"
|
||||
color="primary"
|
||||
height="6"
|
||||
rounded
|
||||
/>
|
||||
</div>
|
||||
|
||||
<!-- Summary Chips -->
|
||||
<div class="d-flex flex-wrap gap-2">
|
||||
<v-chip size="x-small" color="primary" variant="outlined">
|
||||
Downloaded: {{ updateProgress.updated }}
|
||||
|
||||
@@ -1,12 +1,6 @@
|
||||
import {
|
||||
type TaskExecutionResponse,
|
||||
type ScanTaskStatusResponse,
|
||||
type ConversionTaskStatusResponse,
|
||||
type CleanupTaskStatusResponse,
|
||||
type UpdateTaskStatusResponse,
|
||||
type TaskInfo,
|
||||
} from "@/__generated__";
|
||||
import { type TaskExecutionResponse, type TaskInfo } from "@/__generated__";
|
||||
import api from "@/services/api";
|
||||
import type { TaskStatusResponse } from "@/utils/tasks";
|
||||
|
||||
async function getTasks(): Promise<{
|
||||
data: Record<string, TaskInfo[]>;
|
||||
@@ -15,11 +9,7 @@ async function getTasks(): Promise<{
|
||||
}
|
||||
|
||||
async function getTaskById(taskId: string): Promise<{
|
||||
data:
|
||||
| ScanTaskStatusResponse
|
||||
| ConversionTaskStatusResponse
|
||||
| CleanupTaskStatusResponse
|
||||
| UpdateTaskStatusResponse;
|
||||
data: TaskStatusResponse;
|
||||
}> {
|
||||
return api.get(`/tasks/${taskId}`);
|
||||
}
|
||||
@@ -35,12 +25,7 @@ async function runTask(
|
||||
}
|
||||
|
||||
async function getTaskStatus(): Promise<{
|
||||
data: (
|
||||
| ScanTaskStatusResponse
|
||||
| ConversionTaskStatusResponse
|
||||
| CleanupTaskStatusResponse
|
||||
| UpdateTaskStatusResponse
|
||||
)[];
|
||||
data: TaskStatusResponse[];
|
||||
}> {
|
||||
return api.get("/tasks/status");
|
||||
}
|
||||
|
||||
@@ -1,24 +1,14 @@
|
||||
import { defineStore } from "pinia";
|
||||
import type {
|
||||
ScanTaskStatusResponse,
|
||||
ConversionTaskStatusResponse,
|
||||
CleanupTaskStatusResponse,
|
||||
UpdateTaskStatusResponse,
|
||||
} from "@/__generated__";
|
||||
import type { TaskInfo } from "@/__generated__/models/TaskInfo";
|
||||
import tasksApi from "@/services/api/task";
|
||||
import type { TaskStatusResponse } from "@/utils/tasks";
|
||||
|
||||
export default defineStore("tasks", {
|
||||
state: () => ({
|
||||
watcherTasks: [] as TaskInfo[],
|
||||
scheduledTasks: [] as TaskInfo[],
|
||||
manualTasks: [] as TaskInfo[],
|
||||
taskStatuses: [] as (
|
||||
| ScanTaskStatusResponse
|
||||
| ConversionTaskStatusResponse
|
||||
| CleanupTaskStatusResponse
|
||||
| UpdateTaskStatusResponse
|
||||
)[],
|
||||
taskStatuses: [] as TaskStatusResponse[],
|
||||
}),
|
||||
|
||||
actions: {
|
||||
@@ -47,14 +37,7 @@ export default defineStore("tasks", {
|
||||
};
|
||||
}
|
||||
},
|
||||
async fetchTaskStatus(): Promise<
|
||||
(
|
||||
| ScanTaskStatusResponse
|
||||
| ConversionTaskStatusResponse
|
||||
| CleanupTaskStatusResponse
|
||||
| UpdateTaskStatusResponse
|
||||
)[]
|
||||
> {
|
||||
async fetchTaskStatus(): Promise<TaskStatusResponse[]> {
|
||||
try {
|
||||
const response = await tasksApi.getTaskStatus();
|
||||
this.taskStatuses = response.data;
|
||||
|
||||
81
frontend/src/utils/tasks.ts
Normal file
81
frontend/src/utils/tasks.ts
Normal file
@@ -0,0 +1,81 @@
|
||||
import type {
|
||||
ScanTaskStatusResponse,
|
||||
ConversionTaskStatusResponse,
|
||||
CleanupTaskStatusResponse,
|
||||
UpdateTaskStatusResponse,
|
||||
GenericTaskStatusResponse,
|
||||
WatcherTaskStatusResponse,
|
||||
JobStatus,
|
||||
TaskType,
|
||||
} from "@/__generated__";
|
||||
|
||||
export type TaskStatusResponse =
|
||||
| ScanTaskStatusResponse
|
||||
| ConversionTaskStatusResponse
|
||||
| CleanupTaskStatusResponse
|
||||
| UpdateTaskStatusResponse
|
||||
| GenericTaskStatusResponse
|
||||
| WatcherTaskStatusResponse;
|
||||
|
||||
export const TaskStatusItem: Record<
|
||||
JobStatus,
|
||||
{ color: string; icon: string; status: string; text: string }
|
||||
> = {
|
||||
queued: {
|
||||
color: "orange",
|
||||
icon: "mdi-clock-outline",
|
||||
status: "queued",
|
||||
text: "Queued",
|
||||
},
|
||||
started: {
|
||||
color: "blue",
|
||||
icon: "mdi-loading",
|
||||
status: "primary",
|
||||
text: "Running",
|
||||
},
|
||||
finished: {
|
||||
color: "green",
|
||||
icon: "mdi-check-circle",
|
||||
status: "success",
|
||||
text: "Completed",
|
||||
},
|
||||
failed: {
|
||||
color: "red",
|
||||
icon: "mdi-alert-circle",
|
||||
status: "error",
|
||||
text: "Failed",
|
||||
},
|
||||
stopped: {
|
||||
color: "grey",
|
||||
icon: "mdi-stop-circle",
|
||||
status: "grey",
|
||||
text: "Stopped",
|
||||
},
|
||||
canceled: {
|
||||
color: "grey",
|
||||
icon: "mdi-stop-circle",
|
||||
status: "grey",
|
||||
text: "Canceled",
|
||||
},
|
||||
deferred: {
|
||||
color: "grey",
|
||||
icon: "mdi-clock-outline",
|
||||
status: "grey",
|
||||
text: "Deferred",
|
||||
},
|
||||
scheduled: {
|
||||
color: "grey",
|
||||
icon: "mdi-clock-outline",
|
||||
status: "grey",
|
||||
text: "Scheduled",
|
||||
},
|
||||
};
|
||||
|
||||
export const TaskTypeItem: Record<TaskType, { title: string; icon: string }> = {
|
||||
scan: { title: "Scan", icon: "mdi-magnify-scan" },
|
||||
conversion: { title: "Conversion", icon: "mdi-image-multiple" },
|
||||
cleanup: { title: "Cleanup", icon: "mdi-broom" },
|
||||
update: { title: "Update", icon: "mdi-update" },
|
||||
watcher: { title: "Watcher", icon: "mdi-eye" },
|
||||
generic: { title: "Task", icon: "mdi-help-circle" },
|
||||
};
|
||||
Reference in New Issue
Block a user