pretty printing
This commit is contained in:
parent
52a80cfb0e
commit
c867ad379e
30 changed files with 1533 additions and 387 deletions
|
|
@ -15,7 +15,7 @@ use tui_widget_list::{ListBuilder, ListState, ListView};
|
|||
use crate::tui::{
|
||||
block_around,
|
||||
log_viewer::LogViewer,
|
||||
model::{SpanDescriptor, LogEntry, LogFields},
|
||||
model::{LogEntry, LogFields, SpanDescriptor},
|
||||
widgets::{line_text::style_span, styled::Styled},
|
||||
};
|
||||
|
||||
|
|
@ -91,7 +91,10 @@ impl<'a> FieldTree<'a> {
|
|||
self.lv.selected().map(|(s, _)| s)
|
||||
}
|
||||
|
||||
fn current_span_fields(&mut self, spans: &[(SpanDescriptor, &LogFields)]) -> Vec<(String, String)> {
|
||||
fn current_span_fields(
|
||||
&mut self,
|
||||
spans: &[(SpanDescriptor, &LogFields)],
|
||||
) -> Vec<(String, String)> {
|
||||
let mut selected = self.state().current_span.selected.unwrap_or(0);
|
||||
if selected > spans.len() {
|
||||
selected = spans.len().saturating_sub(1);
|
||||
|
|
@ -120,7 +123,12 @@ impl<'a> FieldTree<'a> {
|
|||
}
|
||||
|
||||
impl Styled<'_, &mut FieldTree<'_>> {
|
||||
fn areas(&self, area: Rect, buf: &mut Buffer, name: Option<&SpanDescriptor>) -> (Rect, Rect, Rect) {
|
||||
fn areas(
|
||||
&self,
|
||||
area: Rect,
|
||||
buf: &mut Buffer,
|
||||
name: Option<&SpanDescriptor>,
|
||||
) -> (Rect, Rect, Rect) {
|
||||
let [spans_area, fields_area] = Layout::horizontal([
|
||||
Constraint::Length(if self.spans_focussed() || !self.focussed {
|
||||
25
|
||||
|
|
@ -220,6 +228,7 @@ impl Widget for Styled<'_, &mut FieldTree<'_>> {
|
|||
i,
|
||||
Config {
|
||||
collapse_space: true,
|
||||
..Default::default()
|
||||
},
|
||||
)
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue