mirror of
https://codeberg.org/icewind/logsmash.git
synced 2026-06-03 10:04:12 +02:00
fix count/sparkline for all/unmatched
This commit is contained in:
parent
52091f55e2
commit
a00565cf65
1 changed files with 12 additions and 7 deletions
|
|
@ -2,6 +2,7 @@ use crate::app::Filter;
|
|||
use crate::grouping::{GroupingResult, GroupingUi, LogGrouping};
|
||||
use crate::ui::style::TABLE_HEADER_STYLE;
|
||||
use crate::ui::table::{ScrollbarTable, ScrollbarTableState};
|
||||
use itertools::repeat_n;
|
||||
use ratatui::prelude::*;
|
||||
use ratatui::widgets::{Cell, Row};
|
||||
use std::borrow::Cow;
|
||||
|
|
@ -60,6 +61,7 @@ impl StatefulWidget for GroupingList<'_, '_> {
|
|||
result,
|
||||
self.time_range.clone(),
|
||||
i.abs_diff(state.selected()) < 100,
|
||||
self.ui.widths.len(),
|
||||
)
|
||||
})
|
||||
.collect();
|
||||
|
|
@ -82,6 +84,7 @@ fn grouped_row<'a>(
|
|||
grouping: &LogGrouping<'a>,
|
||||
time_range: RangeInclusive<OffsetDateTime>,
|
||||
is_in_view: bool,
|
||||
column_count: usize,
|
||||
) -> Row<'a> {
|
||||
if is_in_view {
|
||||
if let Some(match_result) = &grouping.result {
|
||||
|
|
@ -92,13 +95,15 @@ fn grouped_row<'a>(
|
|||
]);
|
||||
Row::new(columns).height(match_result.height() as u16)
|
||||
} else {
|
||||
Row::new([
|
||||
Text::from(grouping.name.unwrap_or_default()),
|
||||
Text::from(""),
|
||||
Text::from(""),
|
||||
Text::from(grouping.sparkline(time_range).to_string()),
|
||||
Text::from(grouping.count().to_string()),
|
||||
])
|
||||
Row::new(
|
||||
[Text::from(grouping.name.unwrap_or_default())]
|
||||
.into_iter()
|
||||
.chain(repeat_n(Text::default(), column_count - 1))
|
||||
.chain([
|
||||
Text::from(grouping.sparkline(time_range).to_string()),
|
||||
Text::from(grouping.count().to_string()),
|
||||
]),
|
||||
)
|
||||
}
|
||||
} else {
|
||||
Row::default()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue