mirror of
https://codeberg.org/icewind/logsmash.git
synced 2026-06-04 02:24:11 +02:00
lazy histograms
This commit is contained in:
parent
2f3e2325df
commit
8299a90578
4 changed files with 56 additions and 37 deletions
|
|
@ -65,7 +65,7 @@ fn log_row<'a>(result: &'a LogMatch, app: &'a App, name: &'static str) -> Row<'a
|
|||
Text::from(message),
|
||||
Text::from(paths),
|
||||
Text::from(lines).alignment(Alignment::Right),
|
||||
Text::from(result.sparkline.as_str()),
|
||||
Text::from(result.sparkline(app)),
|
||||
Text::from(result.count().to_string()),
|
||||
])
|
||||
.height(match_result.len() as u16)
|
||||
|
|
@ -74,7 +74,7 @@ fn log_row<'a>(result: &'a LogMatch, app: &'a App, name: &'static str) -> Row<'a
|
|||
Text::from(name),
|
||||
Text::from(""),
|
||||
Text::from(""),
|
||||
Text::from(result.sparkline.as_str()),
|
||||
Text::from(result.sparkline(app)),
|
||||
Text::from(result.count().to_string()),
|
||||
])
|
||||
}
|
||||
|
|
|
|||
|
|
@ -112,12 +112,12 @@ fn ui(frame: &mut Frame, app: &App, state: &mut UiState) {
|
|||
}) => {
|
||||
let selected = table_state.selected();
|
||||
let histogram = if selected == 0 {
|
||||
&app.all.histogram
|
||||
app.all.histogram(app)
|
||||
} else if selected < app.matches.len() + 1 {
|
||||
let log_match = &app.matches[selected - 1];
|
||||
&log_match.histogram
|
||||
log_match.histogram(app)
|
||||
} else {
|
||||
&app.unmatched.histogram
|
||||
app.unmatched.histogram(app)
|
||||
};
|
||||
|
||||
frame.render_widget(UiHistogram::new(histogram), layout[0]);
|
||||
|
|
@ -137,7 +137,7 @@ fn ui(frame: &mut Frame, app: &App, state: &mut UiState) {
|
|||
&result.grouped[selected - 1]
|
||||
};
|
||||
|
||||
frame.render_widget(UiHistogram::new(&selected_group.histogram), layout[0]);
|
||||
frame.render_widget(UiHistogram::new(&selected_group.histogram(app)), layout[0]);
|
||||
frame.render_stateful_widget(
|
||||
grouped_lines(app, result, filter),
|
||||
layout[1],
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ pub fn grouped_lines<'a>(
|
|||
Text::from("All lines"),
|
||||
Text::from(""),
|
||||
Text::from(""),
|
||||
Text::from(log_match.sparkline.as_str()),
|
||||
Text::from(log_match.sparkline(app)),
|
||||
Text::from(log_match.count().to_string()),
|
||||
]))
|
||||
.chain(
|
||||
|
|
@ -58,7 +58,7 @@ fn group_row<'a>(app: &'a App, group: &'a GroupedLines) -> Row<'a> {
|
|||
Text::from(line.level.as_str()),
|
||||
Text::from(line.app.as_ref()),
|
||||
Text::from(line.display()),
|
||||
Text::from(group.sparkline.as_str()),
|
||||
Text::from(group.sparkline(app)),
|
||||
Text::from(group.len().to_string()),
|
||||
])
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue