3 use chrono
::{Local, TimeZone}
;
5 pub fn strip_server_file_expenstion(name
: &str) -> String
{
7 if name
.ends_with(".didx") || name
.ends_with(".fidx") || name
.ends_with(".blob") {
8 name
[..name
.len()-5].to_owned()
10 name
.to_owned() // should not happen
14 pub fn render_backup_file_list(files
: &[String
]) -> String
{
15 let mut files
: Vec
<String
> = files
.iter()
16 .map(|v
| strip_server_file_expenstion(&v
))
21 super::join(&files
, ' '
)
24 pub fn render_epoch(value
: &Value
, _record
: &Value
) -> Result
<String
, Error
> {
25 if value
.is_null() { return Ok(String::new()); }
26 let text
= match value
.as_i64() {
28 Local
.timestamp(epoch
, 0).format("%c").to_string()
37 pub fn render_task_status(value
: &Value
, record
: &Value
) -> Result
<String
, Error
> {
38 if record
["endtime"].is_null() {
39 Ok(value
.as_str().unwrap_or("running").to_string())
41 Ok(value
.as_str().unwrap_or("unknown").to_string())