Skip to content
This repository has been archived by the owner on Nov 1, 2023. It is now read-only.

Commit

Permalink
switch tui to ratatui (#3155)
Browse files Browse the repository at this point in the history
  • Loading branch information
chkeita authored Jun 5, 2023
1 parent bada352 commit c76cb9b
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 41 deletions.
50 changes: 17 additions & 33 deletions src/agent/Cargo.lock

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

2 changes: 1 addition & 1 deletion src/agent/onefuzz-task/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ thiserror = "1.0"
tokio = { version = "1.28", features = ["full"] }
tokio-util = { version = "0.7", features = ["full"] }
tokio-stream = "0.1"
tui = { version = "0.19", default-features = false, features = ['crossterm'] }
tui = { package = "ratatui", version = "0.21.0", default-features = false, features = ['crossterm']}
url = { version = "2.3", features = ["serde"] }
uuid = { version = "1.3", features = ["serde", "v4"] }
chrono = { version = "0.4", default-features = false, features = [
Expand Down
5 changes: 2 additions & 3 deletions src/agent/onefuzz-task/src/local/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ use crate::tasks::config::CommonConfig;
use crate::tasks::utils::parse_key_value;

pub const SETUP_DIR: &str = "setup_dir";
pub const EXTRA_DIR: &str = "extra_dir";
pub const INPUTS_DIR: &str = "inputs_dir";
pub const CRASHES_DIR: &str = "crashes_dir";
pub const TARGET_WORKERS: &str = "target_workers";
Expand Down Expand Up @@ -238,7 +237,7 @@ pub async fn build_local_context(
});
let instance_id = get_uuid("instance_id", args).unwrap_or_default();

let extra_dir = args.get_one::<PathBuf>(EXTRA_DIR).cloned();
// let extra_dir = args.get_one::<PathBuf>(EXTRA_DIR).cloned();
let setup_dir = if let Some(setup_dir) = args.get_one::<PathBuf>(SETUP_DIR) {
setup_dir.clone()
} else if let Some(target_exe) = args.get_one::<String>(TARGET_EXE) {
Expand All @@ -255,7 +254,7 @@ pub async fn build_local_context(
task_id,
instance_id,
setup_dir,
extra_dir,
extra_dir: None,
machine_identity: MachineIdentity {
machine_id: Uuid::nil(),
machine_name: "local".to_string(),
Expand Down
8 changes: 4 additions & 4 deletions src/agent/onefuzz-task/src/local/tui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ use tui::{
backend::CrosstermBackend,
layout::{Alignment, Constraint, Corner, Direction, Layout},
style::{Color, Modifier, Style},
text::{Span, Spans},
text::{Line, Span},
widgets::{Block, Borders},
widgets::{Gauge, List, ListItem, ListState, Paragraph, Wrap},
Terminal,
Expand Down Expand Up @@ -354,7 +354,7 @@ impl TerminalUi {
stats_spans.pop();
}

Paragraph::new(Spans::from(stats_spans))
Paragraph::new(Line::from(stats_spans))
.style(Style::default())
.alignment(Alignment::Left)
.wrap(Wrap { trim: true })
Expand Down Expand Up @@ -390,7 +390,7 @@ impl TerminalUi {
files_spans.pop();
} // removing the last ","

Paragraph::new(Spans::from(files_spans))
Paragraph::new(Line::from(files_spans))
.style(Style::default())
.alignment(Alignment::Left)
.wrap(Wrap { trim: true })
Expand All @@ -408,7 +408,7 @@ impl TerminalUi {
Level::Trace => Style::default(),
};

ListItem::new(Spans::from(vec![
ListItem::new(Line::from(vec![
Span::styled(format!("{level:<9}"), style),
Span::raw(" "),
Span::raw(log),
Expand Down

0 comments on commit c76cb9b

Please sign in to comment.