Files
romm/frontend/src/utils/tasks.ts
renovate[bot] 3224220a1f chore(deps): update dependency rq to v3 (#5493)
* chore(deps): update dependency rq to v3

* fix: adapt the RQ worker and job types to rq 3

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

* fix: update worker tests and task status map for rq 3

The worker tests pass the Execution to perform_job and patch the
module-level execute_failure_callback. TaskStatusItem covers the new
rate_limited and ready_to_enqueue statuses, shown as queued.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Sam Dornan <sam.dornan@athleticgreens.com>
Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-authored-by: Georges-Antoine Assi <contact@me.gantoine.com>
2026-11-05 10:39:35 -05:00

93 lines
1.9 KiB
TypeScript

import type {
ScanTaskStatusResponse,
ConversionTaskStatusResponse,
CleanupTaskStatusResponse,
UpdateTaskStatusResponse,
GenericTaskStatusResponse,
WatcherTaskStatusResponse,
JobStatus,
} from "@/__generated__";
import i18n from "@/locales";
const { t } = i18n.global;
export type TaskStatusResponse =
| ScanTaskStatusResponse
| ConversionTaskStatusResponse
| CleanupTaskStatusResponse
| UpdateTaskStatusResponse
| GenericTaskStatusResponse
| WatcherTaskStatusResponse;
export const TaskStatusItem: Record<
JobStatus,
{ color: string; icon: string; status: string; text: string }
> = {
created: {
color: "orange",
icon: "mdi-clock-outline",
status: "queued",
text: t("settings.queued"),
},
queued: {
color: "orange",
icon: "mdi-clock-outline",
status: "queued",
text: t("settings.queued"),
},
rate_limited: {
color: "orange",
icon: "mdi-clock-outline",
status: "queued",
text: t("settings.queued"),
},
ready_to_enqueue: {
color: "orange",
icon: "mdi-clock-outline",
status: "queued",
text: t("settings.queued"),
},
started: {
color: "blue",
icon: "mdi-loading",
status: "primary",
text: t("settings.running"),
},
finished: {
color: "green",
icon: "mdi-check-circle",
status: "success",
text: t("settings.completed"),
},
failed: {
color: "red",
icon: "mdi-alert-circle",
status: "error",
text: t("settings.failed"),
},
stopped: {
color: "grey",
icon: "mdi-stop-circle",
status: "grey",
text: t("settings.stopped"),
},
canceled: {
color: "grey",
icon: "mdi-stop-circle",
status: "grey",
text: t("settings.canceled"),
},
deferred: {
color: "grey",
icon: "mdi-clock-outline",
status: "grey",
text: t("settings.deferred"),
},
scheduled: {
color: "grey",
icon: "mdi-clock-outline",
status: "grey",
text: t("settings.scheduled"),
},
};