From 8838faff9e29dab975580200c571b18b970696c6 Mon Sep 17 00:00:00 2001 From: Jesse Szwedko Date: Fri, 11 Aug 2023 16:43:34 -0700 Subject: [PATCH] chore(deps): Swap tui crate for ratatui (#18225) * chore(deps): Swap tui crate for ratatui The `tui` crate is unmaintained and points to `ratatui` as the mantained fork. Signed-off-by: Jesse Szwedko * Spelling Signed-off-by: Jesse Szwedko * Regenerate license file Signed-off-by: Jesse Szwedko --------- Signed-off-by: Jesse Szwedko --- .github/actions/spelling/expect.txt | 1 + Cargo.lock | 48 ++++++++++------------------- Cargo.toml | 4 +-- LICENSE-3rdparty.csv | 2 +- src/top/dashboard.rs | 14 ++++----- src/top/state.rs | 4 +-- 6 files changed, 30 insertions(+), 43 deletions(-) diff --git a/.github/actions/spelling/expect.txt b/.github/actions/spelling/expect.txt index 3d472b5be00bb..eeae2da48b292 100644 --- a/.github/actions/spelling/expect.txt +++ b/.github/actions/spelling/expect.txt @@ -869,6 +869,7 @@ qwe raboof rande RANDFILE +ratatui rawconfig rawstring rdkafka diff --git a/Cargo.lock b/Cargo.lock index c855252a12a34..0f4e6ea5ad074 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2471,22 +2471,6 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "crossterm" -version = "0.25.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e64e6c0fbe2c17357405f7c758c1ef960fce08bdfb2c03d88d2a18d7e09c4b67" -dependencies = [ - "bitflags 1.3.2", - "crossterm_winapi", - "libc", - "mio", - "parking_lot", - "signal-hook", - "signal-hook-mio", - "winapi", -] - [[package]] name = "crossterm" version = "0.26.1" @@ -6821,6 +6805,21 @@ dependencies = [ "rand_core 0.6.4", ] +[[package]] +name = "ratatui" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8285baa38bdc9f879d92c0e37cb562ef38aa3aeefca22b3200186bc39242d3d5" +dependencies = [ + "bitflags 2.3.2", + "cassowary", + "crossterm", + "indoc", + "paste", + "unicode-segmentation", + "unicode-width", +] + [[package]] name = "raw-cpuid" version = "10.6.0" @@ -9065,19 +9064,6 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" -[[package]] -name = "tui" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccdd26cbd674007e649a272da4475fb666d3aa0ad0531da7136db6fab0e5bad1" -dependencies = [ - "bitflags 1.3.2", - "cassowary", - "crossterm 0.25.0", - "unicode-segmentation", - "unicode-width", -] - [[package]] name = "tungstenite" version = "0.18.0" @@ -9449,7 +9435,7 @@ dependencies = [ "colored", "console-subscriber", "criterion", - "crossterm 0.26.1", + "crossterm", "csv", "derivative", "dirs-next", @@ -9528,6 +9514,7 @@ dependencies = [ "quickcheck", "rand 0.8.5", "rand_distr", + "ratatui", "rdkafka", "redis", "regex", @@ -9576,7 +9563,6 @@ dependencies = [ "tracing-subscriber", "tracing-tower", "trust-dns-proto 0.22.0", - "tui", "typetag", "url", "uuid", diff --git a/Cargo.toml b/Cargo.toml index e477eca441a11..1d76162b9090e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -229,7 +229,7 @@ itertools = { version = "0.11.0", default-features = false, optional = true } crossterm = { version = "0.26.1", default-features = false, features = ["event-stream"], optional = true } num-format = { version = "0.4.4", default-features = false, features = ["with-num-bigint"], optional = true } number_prefix = { version = "0.4.0", default-features = false, features = ["std"], optional = true } -tui = { version = "0.19.0", optional = true, default-features = false, features = ["crossterm"] } +ratatui = { version = "0.22.0", optional = true, default-features = false, features = ["crossterm"] } # Datadog Pipelines @@ -443,7 +443,7 @@ api-client = [ "dep:crossterm", "dep:num-format", "dep:number_prefix", - "dep:tui", + "dep:ratatui", "vector-core/api", "dep:vector-api-client", ] diff --git a/LICENSE-3rdparty.csv b/LICENSE-3rdparty.csv index c99a0ece7a912..65cfddb9563e3 100644 --- a/LICENSE-3rdparty.csv +++ b/LICENSE-3rdparty.csv @@ -422,6 +422,7 @@ rand_chacha,https://github.com/rust-random/rand,MIT OR Apache-2.0,"The Rand Proj rand_distr,https://github.com/rust-random/rand,MIT OR Apache-2.0,The Rand Project Developers rand_hc,https://github.com/rust-random/rand,MIT OR Apache-2.0,The Rand Project Developers rand_xorshift,https://github.com/rust-random/rngs,MIT OR Apache-2.0,"The Rand Project Developers, The Rust Project Developers" +ratatui,https://github.com/tui-rs-revival/ratatui,MIT,"Florian Dehau , The Ratatui Developers" raw-cpuid,https://github.com/gz/rust-cpuid,MIT,Gerd Zellweger raw-window-handle,https://github.com/rust-windowing/raw-window-handle,MIT OR Apache-2.0 OR Zlib,Osspial rdkafka,https://github.com/fede1024/rust-rdkafka,MIT,Federico Giraud @@ -568,7 +569,6 @@ treediff,https://github.com/Byron/treediff-rs,MIT OR Apache-2.0,Sebastian Thiel trust-dns-proto,https://github.com/bluejekyll/trust-dns,MIT OR Apache-2.0,Benjamin Fry trust-dns-resolver,https://github.com/bluejekyll/trust-dns,MIT OR Apache-2.0,Benjamin Fry try-lock,https://github.com/seanmonstar/try-lock,MIT,Sean McArthur -tui,https://github.com/fdehau/tui-rs,MIT,Florian Dehau tungstenite,https://github.com/snapview/tungstenite-rs,MIT OR Apache-2.0,"Alexey Galakhov, Daniel Abramov" twox-hash,https://github.com/shepmaster/twox-hash,MIT,Jake Goulding typed-builder,https://github.com/idanarye/rust-typed-builder,MIT OR Apache-2.0,"IdanArye , Chris Morgan " diff --git a/src/top/dashboard.rs b/src/top/dashboard.rs index e38505555dce0..7ccaeeb10e2dd 100644 --- a/src/top/dashboard.rs +++ b/src/top/dashboard.rs @@ -9,16 +9,16 @@ use crossterm::{ }; use num_format::{Locale, ToFormattedString}; use number_prefix::NumberPrefix; -use std::io::stdout; -use tokio::sync::oneshot; -use tui::{ +use ratatui::{ backend::{Backend, CrosstermBackend}, layout::{Alignment, Constraint, Layout, Rect}, style::{Color, Modifier, Style}, - text::{Span, Spans}, + text::{Line, Span}, widgets::{Block, Borders, Cell, Paragraph, Row, Table, Wrap}, Frame, Terminal, }; +use std::io::stdout; +use tokio::sync::oneshot; use super::{ events::capture_key_press, @@ -180,7 +180,7 @@ impl<'a> Widgets<'a> { ]; text.extend(connection_status.as_ui_spans()); - let text = vec![Spans::from(text)]; + let text = vec![Line::from(text)]; let block = Block::default().borders(Borders::ALL).title(Span::styled( self.title, @@ -260,7 +260,7 @@ impl<'a> Widgets<'a> { .into_iter() .map(Cell::from) .collect::>(); - data[1] = Cell::from(id.as_ref()); + data[1] = Cell::from(id.as_str()); data[5] = Cell::from(sent_events_metric); items.push(Row::new(data).style(Style::default())); } @@ -312,7 +312,7 @@ impl<'a> Widgets<'a> { /// Renders a box showing instructions on how to exit from `vector top`. fn quit_box(&self, f: &mut Frame, area: Rect) { - let text = vec![Spans::from("To quit, press ESC or 'q'")]; + let text = vec![Line::from("To quit, press ESC or 'q'")]; let block = Block::default() .borders(Borders::ALL) diff --git a/src/top/state.rs b/src/top/state.rs index 8e8d4e51fe770..bf478e43dea8c 100644 --- a/src/top/state.rs +++ b/src/top/state.rs @@ -1,11 +1,11 @@ use std::collections::{BTreeMap, HashMap}; use chrono::{DateTime, Local}; -use tokio::sync::mpsc; -use tui::{ +use ratatui::{ style::{Color, Style}, text::Span, }; +use tokio::sync::mpsc; use vector_core::internal_event::DEFAULT_OUTPUT; use crate::config::ComponentKey;