mirror of
https://github.com/chatmail/core.git
synced 2026-04-17 21:46:35 +03:00
fix: cap percentage in connectivity layout to 100%
it may happen that percentages larger than 100% are reported by the provider, eg. for some time a storage usage of 120% may be accepted. while we should report the values "as is" to the user, for the bar, percentages larger 100% will destroy the layout.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
use core::fmt;
|
||||
use std::cmp::min;
|
||||
use std::{iter::once, ops::Deref, sync::Arc};
|
||||
|
||||
use anyhow::{anyhow, Result};
|
||||
@@ -457,7 +458,8 @@ impl Context {
|
||||
} else {
|
||||
"green"
|
||||
};
|
||||
ret += &format!("<div class=\"bar\"><div class=\"progress {color}\" style=\"width: {percent}%\">{percent}%</div></div>");
|
||||
let div_width_percent = min(100, percent);
|
||||
ret += &format!("<div class=\"bar\"><div class=\"progress {color}\" style=\"width: {div_width_percent}%\">{percent}%</div></div>");
|
||||
|
||||
ret += "</li>";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user