mirror of
https://codeberg.org/icewind/logsmash.git
synced 2026-06-03 10:04:12 +02:00
only render 100 rows around selection in grouped logs
This commit is contained in:
parent
589f695497
commit
8cc3180c54
1 changed files with 16 additions and 9 deletions
|
|
@ -68,7 +68,10 @@ impl StatefulWidget for GroupedLogs<'_> {
|
|||
Constraint::Length(27),
|
||||
];
|
||||
let table = ScrollbarTable::new(
|
||||
lines.filter(|line| line.matches(self.filter)).map(log_row),
|
||||
lines
|
||||
.filter(|line| line.matches(self.filter))
|
||||
.enumerate()
|
||||
.map(|(i, line)| log_row(line, i.abs_diff(state.selected()) < 100)),
|
||||
widths,
|
||||
)
|
||||
.header(header);
|
||||
|
|
@ -86,7 +89,8 @@ impl StatefulWidget for GroupedLogs<'_> {
|
|||
}
|
||||
}
|
||||
|
||||
fn log_row<'a>(line: &'a LogLine<'a>) -> Row<'a> {
|
||||
fn log_row<'a>(line: &'a LogLine<'a>, is_in_view: bool) -> Row<'a> {
|
||||
if is_in_view {
|
||||
Row::new([
|
||||
Text::from(line.remote.as_str()),
|
||||
Text::from(line.method.as_str()),
|
||||
|
|
@ -94,4 +98,7 @@ fn log_row<'a>(line: &'a LogLine<'a>) -> Row<'a> {
|
|||
Text::from(line.request_id.as_str()),
|
||||
Text::from(format_time(line.time)).alignment(Alignment::Right),
|
||||
])
|
||||
} else {
|
||||
Row::default()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue