Skip to main content

LogPane

Struct LogPane 

Source
pub struct LogPane { /* private fields */ }
Expand description

The component itself. Owns the tab state + ring buffers; reads the bee::http capture from a borrowed handle, same as the legacy CommandLog did.

Implementations§

Source§

impl LogPane

Source

pub fn new( capture: Option<LogCapture>, initial_tab: LogTab, initial_height: u16, ) -> Self

Source

pub fn set_cockpit_capture(&mut self, cap: CockpitCapture)

Attach the cockpit-capture ring buffer so the Cockpit tab can render events bee-tui itself emitted (everything that isn’t bee::http). Wired by [App::new] after crate::logging::init has installed the capture.

Source

pub fn active_tab(&self) -> LogTab

Source

pub fn height(&self) -> u16

Source

pub fn set_spawn_active(&mut self, active: bool)

Tell the pane bee-tui is acting as the supervisor (so the placeholder changes from “configure bee” to “(awaiting first log line)”). Called once at startup; cheap to call repeatedly.

Source

pub fn next_tab(&mut self) -> LogTab

Cycle to the next tab (left → right, wrapping). Returns the new active tab so callers can persist state without re-reading. Resets the scroll offset — the new tab’s content has nothing to do with where we were on the old one.

Source

pub fn prev_tab(&mut self) -> LogTab

Cycle to the previous tab (right → left, wrapping).

Source

pub fn scroll_up(&mut self, lines: usize)

Scroll the active tab up by lines (toward older entries). Clamped at draw-time to the buffer length so the user can’t scroll past the top. lines = 1 is the per-keystroke step; callers can pass a larger value for page-scrolling.

Source

pub fn scroll_down(&mut self, lines: usize)

Scroll the active tab down by lines (toward newer entries / the tail). Saturates at 0, which is the auto-tail state.

Source

pub fn resume_tail(&mut self)

Snap back to auto-tail mode (scroll_offset = 0). The pane resumes following new entries as they arrive. Also resets horizontal pan because operators usually want both axes reset together when “going back to live.”

Source

pub fn scroll_right(&mut self, cols: u16)

Pan the active tab right by cols characters. Bee log lines often run past the pane width; ratatui truncates them at the right edge by default so we add a horizontal scroll to let operators read the tail.

Source

pub fn scroll_left(&mut self, cols: u16)

Pan the active tab left by cols characters. Saturates at 0 (the natural left edge).

Source

pub fn reset_h_scroll(&mut self)

Reset horizontal pan to the left edge without touching the vertical scroll. Used when operators want the line start back without leaving the historical window.

Source

pub fn h_scroll_offset(&self) -> u16

Current horizontal scroll offset. Exposed for tests + the title-strip indicator.

Source

pub fn is_tailing(&self) -> bool

true when the pane is auto-tailing (the default state).

Source

pub fn scroll_offset(&self) -> usize

Lines the pane is currently scrolled back from the tail. Useful for rendering “[paused N]” indicators in the title.

Source

pub fn grow(&mut self) -> u16

Grow the pane by one line. Returns the new height. No-op once the cap is hit.

Source

pub fn shrink(&mut self) -> u16

Shrink the pane by one line. Returns the new height. No-op once the floor is hit.

Source

pub fn push_bee(&mut self, tab: LogTab, line: BeeLogLine)

Push a Bee log line to the appropriate tab. The supervisor’s log tailer calls this for each parsed line. Bounded — when the ring is full the oldest entry is evicted.

Scroll-stability: if this push lands on the active tab AND we’re currently scrolled back (not auto-tailing), bump scroll_offset so the visible window stays anchored on the same content rather than drifting upward as new lines push the old ones up.

Source§

impl LogPane

Source

pub fn active_tab_total_lines(&self) -> usize

Number of payload lines the active tab currently has. Used by draw() to clamp the scroll offset and by tests.

Trait Implementations§

Source§

impl Component for LogPane

Source§

fn update(&mut self, action: Action) -> Result<Option<Action>>

Update the state of the component based on a received action. (REQUIRED) Read more
Source§

fn draw(&mut self, frame: &mut Frame<'_>, area: Rect) -> Result<()>

Render the component on the screen. (REQUIRED) Read more
Source§

fn register_action_handler(&mut self, tx: UnboundedSender<Action>) -> Result<()>

Register an action handler that can send actions for processing if necessary. Read more
Source§

fn register_config_handler(&mut self, config: Config) -> Result<()>

Register a configuration handler that provides configuration settings if necessary. Read more
Source§

fn init(&mut self, area: Size) -> Result<()>

Initialize the component with a specified area if necessary. Read more
Source§

fn handle_events(&mut self, event: Option<Event>) -> Result<Option<Action>>

Handle incoming events and produce actions if necessary. Read more
Source§

fn handle_key_event(&mut self, key: KeyEvent) -> Result<Option<Action>>

Handle key events and produce actions if necessary. Read more
Source§

fn handle_mouse_event(&mut self, mouse: MouseEvent) -> Result<Option<Action>>

Handle mouse events and produce actions if necessary. Read more
Source§

fn as_any_mut(&mut self) -> Option<&mut dyn Any>

Downcast hook so the App can reach a concrete screen type (e.g. to call Manifest::load(reference) from the command bar). Default returns None so screens that don’t need it can ignore this method.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<D> OwoColorize for D

Source§

fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>
where C: Color,

Set the foreground color generically Read more
Source§

fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>
where C: Color,

Set the background color generically. Read more
Source§

fn black(&self) -> FgColorDisplay<'_, Black, Self>

Change the foreground color to black
Source§

fn on_black(&self) -> BgColorDisplay<'_, Black, Self>

Change the background color to black
Source§

fn red(&self) -> FgColorDisplay<'_, Red, Self>

Change the foreground color to red
Source§

fn on_red(&self) -> BgColorDisplay<'_, Red, Self>

Change the background color to red
Source§

fn green(&self) -> FgColorDisplay<'_, Green, Self>

Change the foreground color to green
Source§

fn on_green(&self) -> BgColorDisplay<'_, Green, Self>

Change the background color to green
Source§

fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>

Change the foreground color to yellow
Source§

fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>

Change the background color to yellow
Source§

fn blue(&self) -> FgColorDisplay<'_, Blue, Self>

Change the foreground color to blue
Source§

fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>

Change the background color to blue
Source§

fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>

Change the foreground color to magenta
Source§

fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>

Change the background color to magenta
Source§

fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>

Change the foreground color to purple
Source§

fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>

Change the background color to purple
Source§

fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>

Change the foreground color to cyan
Source§

fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>

Change the background color to cyan
Source§

fn white(&self) -> FgColorDisplay<'_, White, Self>

Change the foreground color to white
Source§

fn on_white(&self) -> BgColorDisplay<'_, White, Self>

Change the background color to white
Source§

fn default_color(&self) -> FgColorDisplay<'_, Default, Self>

Change the foreground color to the terminal default
Source§

fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>

Change the background color to the terminal default
Source§

fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>

Change the foreground color to bright black
Source§

fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>

Change the background color to bright black
Source§

fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>

Change the foreground color to bright red
Source§

fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>

Change the background color to bright red
Source§

fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>

Change the foreground color to bright green
Source§

fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>

Change the background color to bright green
Source§

fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>

Change the foreground color to bright yellow
Source§

fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>

Change the background color to bright yellow
Source§

fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>

Change the foreground color to bright blue
Source§

fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>

Change the background color to bright blue
Source§

fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>

Change the foreground color to bright magenta
Source§

fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>

Change the background color to bright magenta
Source§

fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>

Change the foreground color to bright purple
Source§

fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>

Change the background color to bright purple
Source§

fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>

Change the foreground color to bright cyan
Source§

fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>

Change the background color to bright cyan
Source§

fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>

Change the foreground color to bright white
Source§

fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>

Change the background color to bright white
Source§

fn bold(&self) -> BoldDisplay<'_, Self>

Make the text bold
Source§

fn dimmed(&self) -> DimDisplay<'_, Self>

Make the text dim
Source§

fn italic(&self) -> ItalicDisplay<'_, Self>

Make the text italicized
Source§

fn underline(&self) -> UnderlineDisplay<'_, Self>

Make the text underlined
Make the text blink
Make the text blink (but fast!)
Source§

fn reversed(&self) -> ReversedDisplay<'_, Self>

Swap the foreground and background colors
Source§

fn hidden(&self) -> HiddenDisplay<'_, Self>

Hide the text
Source§

fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>

Cross out the text
Source§

fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>
where Color: DynColor,

Set the foreground color at runtime. Only use if you do not know which color will be used at compile-time. If the color is constant, use either OwoColorize::fg or a color-specific method, such as OwoColorize::green, Read more
Source§

fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>
where Color: DynColor,

Set the background color at runtime. Only use if you do not know what color to use at compile-time. If the color is constant, use either OwoColorize::bg or a color-specific method, such as OwoColorize::on_yellow, Read more
Source§

fn fg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>

Set the foreground color to a specific RGB value.
Source§

fn bg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>

Set the background color to a specific RGB value.
Source§

fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>

Sets the foreground color to an RGB value.
Source§

fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>

Sets the background color to an RGB value.
Source§

fn style(&self, style: Style) -> Styled<&Self>

Apply a runtime-determined style
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more