diff --git a/src/server/worker_task.rs b/src/server/worker_task.rs index ff853058..24b4e3d6 100644 --- a/src/server/worker_task.rs +++ b/src/server/worker_task.rs @@ -22,7 +22,7 @@ use crate::buildcfg; use crate::server; use crate::tools::logrotate::{LogRotate, LogRotateFiles}; use crate::tools::{FileLogger, FileLogOptions}; -use crate::api2::types::Authid; +use crate::api2::types::{Authid, TaskStateType}; macro_rules! taskdir { ($subdir:expr) => (concat!(PROXMOX_BACKUP_LOG_DIR_M!(), "/tasks", $subdir)) @@ -242,6 +242,15 @@ impl TaskState { } } + pub fn tasktype(&self) -> TaskStateType { + match self { + TaskState::OK { .. } => TaskStateType::OK, + TaskState::Unknown { .. } => TaskStateType::Unknown, + TaskState::Error { .. } => TaskStateType::Error, + TaskState::Warning { .. } => TaskStateType::Warning, + } + } + fn result_text(&self) -> String { match self { TaskState::Error { message, .. } => format!("TASK ERROR: {}", message),