Skip to content

Commit

Permalink
chore(deps): update ratatui to 0.26.0
Browse files Browse the repository at this point in the history
This necessitated 3 changes to the codebase:
- `Spans` was renamed to the more ergonomic `Line` type.
- `Frame` no longer requires a backend type parameter.
- `Table::new` requires a widths parameter, so we use
  `Table::default().rows(rows)` instead of `Table::new(rows)`.
  • Loading branch information
joshka committed Feb 3, 2024
1 parent 1656c79 commit 20562c1
Show file tree
Hide file tree
Showing 14 changed files with 237 additions and 89 deletions.
169 changes: 160 additions & 9 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions tokio-console/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ clap_complete = "~4.1.6"
tokio = { version = "1", features = ["full", "rt-multi-thread"] }
tonic = { version = "0.10", features = ["transport"] }
futures = "0.3"
ratatui = { version = "0.20.1", default-features = false, features = ["crossterm"] }
ratatui = { version = "0.26.0", default-features = false, features = ["crossterm"] }
tower = "0.4.12"
tracing = "0.1"
tracing-subscriber = { version = "0.3" }
tracing-journald = { version = "0.2", optional = true }
prost-types = "0.12"
crossterm = { version = "0.26.1", features = ["event-stream"] }
crossterm = { version = "0.27.0", features = ["event-stream"] }
color-eyre = { version = "0.6", features = ["issue-url"] }
hdrhistogram = { version = "7.3.0", default-features = false, features = ["serialization"] }
# Keep this in sync with the version from `tonic`.
Expand Down
6 changes: 3 additions & 3 deletions tokio-console/src/conn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,10 @@ impl Connection {
}
}

pub fn render(&self, styles: &crate::view::Styles) -> ratatui::text::Spans {
pub fn render(&self, styles: &crate::view::Styles) -> ratatui::text::Line {
use ratatui::{
style::{Color, Modifier},
text::{Span, Spans},
text::{Line, Span},
};
let state = match self.state {
State::Connected { .. } => Span::styled(
Expand All @@ -202,7 +202,7 @@ impl Connection {
styles.fg(Color::Yellow).add_modifier(Modifier::BOLD),
),
};
Spans::from(vec![
Line::from(vec![
Span::raw("connection: "),
Span::raw(self.target.to_string()),
Span::raw(" "),
Expand Down
8 changes: 4 additions & 4 deletions tokio-console/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use futures::{
use ratatui::{
layout::{Constraint, Direction, Layout},
style::Color,
text::{Span, Spans},
text::{Line, Span},
widgets::{Paragraph, Wrap},
};
use tokio::sync::{mpsc, watch};
Expand Down Expand Up @@ -147,7 +147,7 @@ async fn main() -> color_eyre::Result<()> {
let mut header_text = conn.render(&view.styles);
if state.is_paused() {
header_text
.0
.spans
.push(Span::styled(" PAUSED", view.styles.fg(Color::Red)));
}
let dropped_async_ops_state = state.async_ops_state().dropped_events();
Expand All @@ -164,13 +164,13 @@ async fn main() -> color_eyre::Result<()> {
if dropped_resources_state > 0 {
dropped_texts.push(format!("{} resources", dropped_resources_state))
}
header_text.0.push(Span::styled(
header_text.spans.push(Span::styled(
format!(" dropped: {}", dropped_texts.join(", ")),
view.styles.fg(Color::Red),
));
}
let header = Paragraph::new(header_text).wrap(Wrap { trim: true });
let view_controls = Paragraph::new(Spans::from(vec![
let view_controls = Paragraph::new(Line::from(vec![
Span::raw("views: "),
bold("t"),
Span::raw(" = tasks, "),
Expand Down
Loading

0 comments on commit 20562c1

Please sign in to comment.