Port queue page to maud

This commit is contained in:
Joscha 2024-05-12 13:17:38 +02:00
parent b3f8c6390c
commit 5d4232ac6b
6 changed files with 131 additions and 159 deletions

View file

@ -70,3 +70,15 @@ pub fn format_value(value: f64) -> String {
format!("{value:.2}")
}
}
pub fn truncate(text: &str, width: usize) -> String {
let truncate = text.chars().take(width + 1).count() > width;
if truncate {
text.chars()
.take(80 - 3)
.chain("...".chars())
.collect::<String>()
} else {
text.to_string()
}
}