add constant ReportCol::FILTER_COLUMNS_WIDTH

This commit is contained in:
GyulyVGC 2025-01-24 00:20:25 +01:00
parent 957e30012b
commit fcfd865624
2 changed files with 3 additions and 4 deletions

View file

@ -559,10 +559,7 @@ fn get_agglomerates_row<'a>(
tot_out_bytes: u128,
) -> Row<'a, Message, StyleType> {
let tot_bytes = tot_in_bytes + tot_out_bytes;
let width = ReportCol::ALL
.iter()
.filter(|x| *x != &ReportCol::Bytes && *x != &ReportCol::Packets)
.fold(0.0, |acc, x| acc + x.get_width());
let width = ReportCol::FILTER_COLUMNS_WIDTH;
#[allow(clippy::cast_precision_loss)]
let in_length = width * (tot_in_bytes as f32 / tot_bytes as f32);
let out_length = width - in_length;

View file

@ -41,6 +41,8 @@ impl ReportCol {
ReportCol::Packets,
];
pub(crate) const FILTER_COLUMNS_WIDTH: f32 = 4.0 * SMALL_COL_WIDTH + 2.0 * LARGE_COL_WIDTH;
pub(crate) fn get_title(&self, language: Language) -> String {
match self {
ReportCol::SrcIp | ReportCol::DstIp => address_translation(language).to_string(),