Skip to content

Commit

Permalink
add constant ReportCol::FILTER_COLUMNS_WIDTH
Browse files Browse the repository at this point in the history
  • Loading branch information
GyulyVGC committed Jan 23, 2025
1 parent 957e300 commit fcfd865
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 1 addition & 4 deletions src/gui/pages/inspect_page.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions src/report/types/report_col.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down

0 comments on commit fcfd865

Please sign in to comment.