Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 744x 744x 1x 309x 309x 1x 29x 29x 1x 26x 26x 1x 57x 57x 1x 5x 5x | import type { RobotStatus, TaskStatus } from "../api/types";
export type Tone = "neutral" | "info" | "warning" | "success" | "danger";
const TASK_LABELS: Record<TaskStatus, string> = {
pending: "В очереди",
assigned: "Назначена",
running: "Выполняется",
retrying: "Повтор",
succeeded: "Успешно",
failed: "Провалена",
cancelled: "Отменена",
};
const TASK_TONES: Record<TaskStatus, Tone> = {
pending: "neutral",
assigned: "info",
running: "info",
retrying: "warning",
succeeded: "success",
failed: "danger",
cancelled: "neutral",
};
const ROBOT_LABELS: Record<RobotStatus, string> = {
idle: "Свободен",
busy: "Занят",
offline: "Не в сети",
};
const ROBOT_TONES: Record<RobotStatus, Tone> = {
idle: "success",
busy: "info",
offline: "danger",
};
export const TERMINAL_STATUSES: readonly TaskStatus[] = ["succeeded", "failed", "cancelled"];
export function taskStatusLabel(status: string): string {
return TASK_LABELS[status as TaskStatus] ?? status;
}
export function taskStatusTone(status: string): Tone {
return TASK_TONES[status as TaskStatus] ?? "neutral";
}
export function robotStatusLabel(status: string): string {
return ROBOT_LABELS[status as RobotStatus] ?? status;
}
export function robotStatusTone(status: string): Tone {
return ROBOT_TONES[status as RobotStatus] ?? "neutral";
}
export function isTerminalStatus(status: string): boolean {
return TERMINAL_STATUSES.includes(status as TaskStatus);
}
export function isActiveStatus(status: string): boolean {
return ["assigned", "running", "retrying"].includes(status);
}
|