Update ratatui to 0.26 (#2269)
* Update ratatui to 0.26 * more build infos * fix introspection
This commit is contained in:
parent
2a82e9c40f
commit
1556cba426
@ -163,7 +163,7 @@ nix = { version = "0.29", optional = true }
|
|||||||
regex = { version = "1", optional = true }
|
regex = { version = "1", optional = true }
|
||||||
uuid = { version = "1.4", optional = true, features = ["serde", "v4"] }
|
uuid = { version = "1.4", optional = true, features = ["serde", "v4"] }
|
||||||
libm = "0.2.2"
|
libm = "0.2.2"
|
||||||
ratatui = { version = "0.23.0", default-features = false, features = ['crossterm'], optional = true } # Commandline rendering, for TUI Monitor
|
ratatui = { version = "0.26.3", default-features = false, features = ['crossterm'], optional = true } # Commandline rendering, for TUI Monitor
|
||||||
crossterm = { version = "0.27.0", optional = true }
|
crossterm = { version = "0.27.0", optional = true }
|
||||||
|
|
||||||
prometheus-client = { version = "0.22", optional = true } # For the prometheus monitor
|
prometheus-client = { version = "0.22", optional = true } # For the prometheus monitor
|
||||||
|
@ -5,7 +5,6 @@ use std::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
use ratatui::{
|
use ratatui::{
|
||||||
backend::Backend,
|
|
||||||
layout::{Alignment, Constraint, Direction, Layout, Rect},
|
layout::{Alignment, Constraint, Direction, Layout, Rect},
|
||||||
style::{Color, Modifier, Style},
|
style::{Color, Modifier, Style},
|
||||||
symbols,
|
symbols,
|
||||||
@ -94,10 +93,7 @@ impl TuiUI {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn draw<B>(&mut self, f: &mut Frame<B>, app: &Arc<RwLock<TuiContext>>)
|
pub fn draw(&mut self, f: &mut Frame, app: &Arc<RwLock<TuiContext>>) {
|
||||||
where
|
|
||||||
B: Backend,
|
|
||||||
{
|
|
||||||
self.clients = app.read().unwrap().clients_num;
|
self.clients = app.read().unwrap().clients_num;
|
||||||
|
|
||||||
let body = Layout::default()
|
let body = Layout::default()
|
||||||
@ -134,10 +130,7 @@ impl TuiUI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::too_many_lines)]
|
#[allow(clippy::too_many_lines)]
|
||||||
fn draw_overall_ui<B>(&mut self, f: &mut Frame<B>, app: &Arc<RwLock<TuiContext>>, area: Rect)
|
fn draw_overall_ui(&mut self, f: &mut Frame, app: &Arc<RwLock<TuiContext>>, area: Rect) {
|
||||||
where
|
|
||||||
B: Backend,
|
|
||||||
{
|
|
||||||
let top_layout = Layout::default()
|
let top_layout = Layout::default()
|
||||||
.direction(Direction::Vertical)
|
.direction(Direction::Vertical)
|
||||||
.constraints([Constraint::Length(16), Constraint::Min(0)].as_ref())
|
.constraints([Constraint::Length(16), Constraint::Min(0)].as_ref())
|
||||||
@ -252,10 +245,7 @@ impl TuiUI {
|
|||||||
self.draw_overall_generic_text(f, app, bottom_layout);
|
self.draw_overall_generic_text(f, app, bottom_layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn draw_client_ui<B>(&mut self, f: &mut Frame<B>, app: &Arc<RwLock<TuiContext>>, area: Rect)
|
fn draw_client_ui(&mut self, f: &mut Frame, app: &Arc<RwLock<TuiContext>>, area: Rect) {
|
||||||
where
|
|
||||||
B: Backend,
|
|
||||||
{
|
|
||||||
let client_block = Block::default()
|
let client_block = Block::default()
|
||||||
.title(Span::styled(
|
.title(Span::styled(
|
||||||
format!("client #{} (l/r arrows to switch)", self.clients_idx),
|
format!("client #{} (l/r arrows to switch)", self.clients_idx),
|
||||||
@ -304,16 +294,14 @@ impl TuiUI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::too_many_lines, clippy::cast_precision_loss)]
|
#[allow(clippy::too_many_lines, clippy::cast_precision_loss)]
|
||||||
fn draw_time_chart<B>(
|
fn draw_time_chart(
|
||||||
&mut self,
|
&mut self,
|
||||||
title: &str,
|
title: &str,
|
||||||
y_name: &str,
|
y_name: &str,
|
||||||
f: &mut Frame<B>,
|
f: &mut Frame,
|
||||||
area: Rect,
|
area: Rect,
|
||||||
stats: &TimedStats,
|
stats: &TimedStats,
|
||||||
) where
|
) {
|
||||||
B: Backend,
|
|
||||||
{
|
|
||||||
if stats.series.is_empty() {
|
if stats.series.is_empty() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -430,15 +418,13 @@ impl TuiUI {
|
|||||||
f.render_widget(chart, area);
|
f.render_widget(chart, area);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn draw_item_geometry_text<B>(
|
fn draw_item_geometry_text(
|
||||||
&mut self,
|
&mut self,
|
||||||
f: &mut Frame<B>,
|
f: &mut Frame,
|
||||||
app: &Arc<RwLock<TuiContext>>,
|
app: &Arc<RwLock<TuiContext>>,
|
||||||
area: Rect,
|
area: Rect,
|
||||||
is_overall: bool,
|
is_overall: bool,
|
||||||
) where
|
) {
|
||||||
B: Backend,
|
|
||||||
{
|
|
||||||
let item_geometry: ItemGeometry = if is_overall {
|
let item_geometry: ItemGeometry = if is_overall {
|
||||||
app.read().unwrap().total_item_geometry.clone()
|
app.read().unwrap().total_item_geometry.clone()
|
||||||
} else if self.clients < 2 {
|
} else if self.clients < 2 {
|
||||||
@ -486,7 +472,8 @@ impl TuiUI {
|
|||||||
)
|
)
|
||||||
.split(area);
|
.split(area);
|
||||||
|
|
||||||
let table = Table::new(items)
|
let table = Table::default()
|
||||||
|
.rows(items)
|
||||||
.block(
|
.block(
|
||||||
Block::default()
|
Block::default()
|
||||||
.title(Span::styled(
|
.title(Span::styled(
|
||||||
@ -497,19 +484,17 @@ impl TuiUI {
|
|||||||
))
|
))
|
||||||
.borders(Borders::ALL),
|
.borders(Borders::ALL),
|
||||||
)
|
)
|
||||||
.widths(&[Constraint::Ratio(1, 2), Constraint::Ratio(1, 2)]);
|
.widths([Constraint::Ratio(1, 2), Constraint::Ratio(1, 2)]);
|
||||||
f.render_widget(table, chunks[0]);
|
f.render_widget(table, chunks[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn draw_process_timing_text<B>(
|
fn draw_process_timing_text(
|
||||||
&mut self,
|
&mut self,
|
||||||
f: &mut Frame<B>,
|
f: &mut Frame,
|
||||||
app: &Arc<RwLock<TuiContext>>,
|
app: &Arc<RwLock<TuiContext>>,
|
||||||
area: Rect,
|
area: Rect,
|
||||||
is_overall: bool,
|
is_overall: bool,
|
||||||
) where
|
) {
|
||||||
B: Backend,
|
|
||||||
{
|
|
||||||
let tup: (Duration, ProcessTiming) = if is_overall {
|
let tup: (Duration, ProcessTiming) = if is_overall {
|
||||||
let tui_context = app.read().unwrap();
|
let tui_context = app.read().unwrap();
|
||||||
(
|
(
|
||||||
@ -560,7 +545,8 @@ impl TuiUI {
|
|||||||
)
|
)
|
||||||
.split(area);
|
.split(area);
|
||||||
|
|
||||||
let table = Table::new(items)
|
let table = Table::default()
|
||||||
|
.rows(items)
|
||||||
.block(
|
.block(
|
||||||
Block::default()
|
Block::default()
|
||||||
.title(Span::styled(
|
.title(Span::styled(
|
||||||
@ -571,18 +557,16 @@ impl TuiUI {
|
|||||||
))
|
))
|
||||||
.borders(Borders::ALL),
|
.borders(Borders::ALL),
|
||||||
)
|
)
|
||||||
.widths(&[Constraint::Ratio(1, 2), Constraint::Ratio(1, 2)]);
|
.widths([Constraint::Ratio(1, 2), Constraint::Ratio(1, 2)]);
|
||||||
f.render_widget(table, chunks[0]);
|
f.render_widget(table, chunks[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn draw_overall_generic_text<B>(
|
fn draw_overall_generic_text(
|
||||||
&mut self,
|
&mut self,
|
||||||
f: &mut Frame<B>,
|
f: &mut Frame,
|
||||||
app: &Arc<RwLock<TuiContext>>,
|
app: &Arc<RwLock<TuiContext>>,
|
||||||
area: Rect,
|
area: Rect,
|
||||||
) where
|
) {
|
||||||
B: Backend,
|
|
||||||
{
|
|
||||||
let items = {
|
let items = {
|
||||||
let app = app.read().unwrap();
|
let app = app.read().unwrap();
|
||||||
vec![
|
vec![
|
||||||
@ -609,7 +593,8 @@ impl TuiUI {
|
|||||||
.constraints([Constraint::Percentage(100)].as_ref())
|
.constraints([Constraint::Percentage(100)].as_ref())
|
||||||
.split(area);
|
.split(area);
|
||||||
|
|
||||||
let table = Table::new(items)
|
let table = Table::default()
|
||||||
|
.rows(items)
|
||||||
.block(
|
.block(
|
||||||
Block::default()
|
Block::default()
|
||||||
.title(Span::styled(
|
.title(Span::styled(
|
||||||
@ -620,7 +605,7 @@ impl TuiUI {
|
|||||||
))
|
))
|
||||||
.borders(Borders::ALL),
|
.borders(Borders::ALL),
|
||||||
)
|
)
|
||||||
.widths(&[
|
.widths([
|
||||||
Constraint::Percentage(15),
|
Constraint::Percentage(15),
|
||||||
Constraint::Percentage(16),
|
Constraint::Percentage(16),
|
||||||
Constraint::Percentage(15),
|
Constraint::Percentage(15),
|
||||||
@ -631,14 +616,12 @@ impl TuiUI {
|
|||||||
f.render_widget(table, chunks[0]);
|
f.render_widget(table, chunks[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn draw_client_results_text<B>(
|
fn draw_client_results_text(
|
||||||
&mut self,
|
&mut self,
|
||||||
f: &mut Frame<B>,
|
f: &mut Frame,
|
||||||
app: &Arc<RwLock<TuiContext>>,
|
app: &Arc<RwLock<TuiContext>>,
|
||||||
area: Rect,
|
area: Rect,
|
||||||
) where
|
) {
|
||||||
B: Backend,
|
|
||||||
{
|
|
||||||
let items = {
|
let items = {
|
||||||
let app = app.read().unwrap();
|
let app = app.read().unwrap();
|
||||||
vec![
|
vec![
|
||||||
@ -667,7 +650,8 @@ impl TuiUI {
|
|||||||
.constraints([Constraint::Percentage(100)].as_ref())
|
.constraints([Constraint::Percentage(100)].as_ref())
|
||||||
.split(area);
|
.split(area);
|
||||||
|
|
||||||
let table = Table::new(items)
|
let table = Table::default()
|
||||||
|
.rows(items)
|
||||||
.block(
|
.block(
|
||||||
Block::default()
|
Block::default()
|
||||||
.title(Span::styled(
|
.title(Span::styled(
|
||||||
@ -678,18 +662,16 @@ impl TuiUI {
|
|||||||
))
|
))
|
||||||
.borders(Borders::ALL),
|
.borders(Borders::ALL),
|
||||||
)
|
)
|
||||||
.widths(&[Constraint::Ratio(1, 2), Constraint::Ratio(1, 2)]);
|
.widths([Constraint::Ratio(1, 2), Constraint::Ratio(1, 2)]);
|
||||||
f.render_widget(table, chunks[0]);
|
f.render_widget(table, chunks[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn draw_client_generic_text<B>(
|
fn draw_client_generic_text(
|
||||||
&mut self,
|
&mut self,
|
||||||
f: &mut Frame<B>,
|
f: &mut Frame,
|
||||||
app: &Arc<RwLock<TuiContext>>,
|
app: &Arc<RwLock<TuiContext>>,
|
||||||
area: Rect,
|
area: Rect,
|
||||||
) where
|
) {
|
||||||
B: Backend,
|
|
||||||
{
|
|
||||||
let items = {
|
let items = {
|
||||||
let app = app.read().unwrap();
|
let app = app.read().unwrap();
|
||||||
vec![
|
vec![
|
||||||
@ -724,7 +706,8 @@ impl TuiUI {
|
|||||||
.constraints([Constraint::Percentage(100)].as_ref())
|
.constraints([Constraint::Percentage(100)].as_ref())
|
||||||
.split(area);
|
.split(area);
|
||||||
|
|
||||||
let table = Table::new(items)
|
let table = Table::default()
|
||||||
|
.rows(items)
|
||||||
.block(
|
.block(
|
||||||
Block::default()
|
Block::default()
|
||||||
.title(Span::styled(
|
.title(Span::styled(
|
||||||
@ -735,19 +718,17 @@ impl TuiUI {
|
|||||||
))
|
))
|
||||||
.borders(Borders::ALL),
|
.borders(Borders::ALL),
|
||||||
)
|
)
|
||||||
.widths(&[Constraint::Ratio(1, 2), Constraint::Ratio(1, 2)]);
|
.widths([Constraint::Ratio(1, 2), Constraint::Ratio(1, 2)]);
|
||||||
f.render_widget(table, chunks[0]);
|
f.render_widget(table, chunks[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "introspection")]
|
#[cfg(feature = "introspection")]
|
||||||
fn draw_introspection_text<B>(
|
fn draw_introspection_text(
|
||||||
&mut self,
|
&mut self,
|
||||||
f: &mut Frame<B>,
|
f: &mut Frame,
|
||||||
app: &Arc<RwLock<TuiContext>>,
|
app: &Arc<RwLock<TuiContext>>,
|
||||||
area: Rect,
|
area: Rect,
|
||||||
) where
|
) {
|
||||||
B: Backend,
|
|
||||||
{
|
|
||||||
let mut items = vec![];
|
let mut items = vec![];
|
||||||
{
|
{
|
||||||
let ctx = app.read().unwrap();
|
let ctx = app.read().unwrap();
|
||||||
@ -786,7 +767,8 @@ impl TuiUI {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
let table = Table::new(items)
|
let table = Table::default()
|
||||||
|
.rows(items)
|
||||||
.block(
|
.block(
|
||||||
Block::default()
|
Block::default()
|
||||||
.title(Span::styled(
|
.title(Span::styled(
|
||||||
@ -797,14 +779,11 @@ impl TuiUI {
|
|||||||
))
|
))
|
||||||
.borders(Borders::ALL),
|
.borders(Borders::ALL),
|
||||||
)
|
)
|
||||||
.widths(&[Constraint::Ratio(1, 2), Constraint::Ratio(1, 2)]);
|
.widths([Constraint::Ratio(1, 2), Constraint::Ratio(1, 2)]);
|
||||||
f.render_widget(table, area);
|
f.render_widget(table, area);
|
||||||
}
|
}
|
||||||
#[allow(clippy::unused_self)]
|
#[allow(clippy::unused_self)]
|
||||||
fn draw_logs<B>(&mut self, f: &mut Frame<B>, app: &Arc<RwLock<TuiContext>>, area: Rect)
|
fn draw_logs(&mut self, f: &mut Frame, app: &Arc<RwLock<TuiContext>>, area: Rect) {
|
||||||
where
|
|
||||||
B: Backend,
|
|
||||||
{
|
|
||||||
let app = app.read().unwrap();
|
let app = app.read().unwrap();
|
||||||
let logs: Vec<ListItem> = app
|
let logs: Vec<ListItem> = app
|
||||||
.client_logs
|
.client_logs
|
||||||
|
@ -203,22 +203,22 @@ fn build_pass(
|
|||||||
Ok(s) => {
|
Ok(s) => {
|
||||||
if !s.success() {
|
if !s.success() {
|
||||||
if optional {
|
if optional {
|
||||||
println!("cargo:warning=Skipping src/{src_file}");
|
println!("cargo:warning=Skipping src/{src_file} - Exit status: {s}");
|
||||||
} else {
|
} else {
|
||||||
panic!("Failed to compile {src_file}");
|
panic!("Failed to compile {src_file} - Exit status: {s}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(_) => {
|
Err(err) => {
|
||||||
if optional {
|
if optional {
|
||||||
println!("cargo:warning=Skipping src/{src_file}");
|
println!("cargo:warning=Skipping src/{src_file} - {err}");
|
||||||
} else {
|
} else {
|
||||||
panic!("Failed to compile {src_file}");
|
panic!("Failed to compile {src_file} - {err}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
None => {
|
None => {
|
||||||
println!("cargo:warning=Skipping src/{src_file}");
|
println!("cargo:warning=Skipping src/{src_file} - Only supported on Windows or *nix.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user