mirror of
https://codeberg.org/icewind/logsmash.git
synced 2026-06-03 18:14:11 +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::grouping::{GroupingResult, GroupingUi, LogGrouping};
|
||||||
use crate::ui::style::TABLE_HEADER_STYLE;
|
use crate::ui::style::TABLE_HEADER_STYLE;
|
||||||
use crate::ui::table::{ScrollbarTable, ScrollbarTableState};
|
use crate::ui::table::{ScrollbarTable, ScrollbarTableState};
|
||||||
|
use itertools::repeat_n;
|
||||||
use ratatui::prelude::*;
|
use ratatui::prelude::*;
|
||||||
use ratatui::widgets::{Cell, Row};
|
use ratatui::widgets::{Cell, Row};
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
|
|
@ -60,6 +61,7 @@ impl StatefulWidget for GroupingList<'_, '_> {
|
||||||
result,
|
result,
|
||||||
self.time_range.clone(),
|
self.time_range.clone(),
|
||||||
i.abs_diff(state.selected()) < 100,
|
i.abs_diff(state.selected()) < 100,
|
||||||
|
self.ui.widths.len(),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
|
@ -82,6 +84,7 @@ fn grouped_row<'a>(
|
||||||
grouping: &LogGrouping<'a>,
|
grouping: &LogGrouping<'a>,
|
||||||
time_range: RangeInclusive<OffsetDateTime>,
|
time_range: RangeInclusive<OffsetDateTime>,
|
||||||
is_in_view: bool,
|
is_in_view: bool,
|
||||||
|
column_count: usize,
|
||||||
) -> Row<'a> {
|
) -> Row<'a> {
|
||||||
if is_in_view {
|
if is_in_view {
|
||||||
if let Some(match_result) = &grouping.result {
|
if let Some(match_result) = &grouping.result {
|
||||||
|
|
@ -92,13 +95,15 @@ fn grouped_row<'a>(
|
||||||
]);
|
]);
|
||||||
Row::new(columns).height(match_result.height() as u16)
|
Row::new(columns).height(match_result.height() as u16)
|
||||||
} else {
|
} else {
|
||||||
Row::new([
|
Row::new(
|
||||||
Text::from(grouping.name.unwrap_or_default()),
|
[Text::from(grouping.name.unwrap_or_default())]
|
||||||
Text::from(""),
|
.into_iter()
|
||||||
Text::from(""),
|
.chain(repeat_n(Text::default(), column_count - 1))
|
||||||
Text::from(grouping.sparkline(time_range).to_string()),
|
.chain([
|
||||||
Text::from(grouping.count().to_string()),
|
Text::from(grouping.sparkline(time_range).to_string()),
|
||||||
])
|
Text::from(grouping.count().to_string()),
|
||||||
|
]),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Row::default()
|
Row::default()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue