use crate::{
app::{self, data_harvester::processes::ProcessHarvest},
constants::*,
data_conversion::{ConvertedCpuData, ConvertedProcessData},
utils::error,
};
use std::cmp::max;
use std::collections::HashMap;
use tui::{
backend,
layout::{Alignment, Constraint, Direction, Layout, Rect},
style::{Color, Style},
terminal::Frame,
widgets::{Axis, Block, Borders, Chart, Dataset, Marker, Paragraph, Row, Table, Text, Widget},
Terminal,
};
mod canvas_colours;
use canvas_colours::*;
// Headers
const CPU_LEGEND_HEADER: [&str; 2] = ["CPU", "Use%"];
const DISK_HEADERS: [&str; 7] = ["Disk", "Mount", "Used", "Free", "Total", "R/s", "W/s"];
const TEMP_HEADERS: [&str; 2] = ["Sensor", "Temp"];
const MEM_HEADERS: [&str; 3] = ["Mem", "Usage", "Usage%"];
const NON_WINDOWS_NETWORK_HEADERS: [&str; 4] = ["RX", "TX", "Total RX", "Total TX"];
const WINDOWS_NETWORK_HEADERS: [&str; 4] = ["RX", "TX", "", ""];
const FORCE_MIN_THRESHOLD: usize = 5;
lazy_static! {
static ref DEFAULT_TEXT_STYLE: Style = Style::default().fg(Color::Gray);
static ref DEFAULT_HEADER_STYLE: Style = Style::default().fg(Color::LightBlue);
static ref GENERAL_HELP_TEXT: [Text<'static>; 14] = [
Text::styled("General Keybindings\n\n", *DEFAULT_HEADER_STYLE),
Text::styled("Esc Close dialog box\n", *DEFAULT_TEXT_STYLE),
Text::styled("q, Ctrl-c Quit bottom\n", *DEFAULT_TEXT_STYLE),
Text::styled("Ctrl-r Reset all data\n", *DEFAULT_TEXT_STYLE),
Text::styled("f Freeze display\n", *DEFAULT_TEXT_STYLE),
Text::styled("Ctrl-Arrow Move currently selected widget\n", *DEFAULT_TEXT_STYLE),
Text::styled("Shift-Arrow Move currently selected widget\n", *DEFAULT_TEXT_STYLE),
Text::styled("Up, k Move cursor up\n", *DEFAULT_TEXT_STYLE),
Text::styled("Down, j Move cursor down\n", *DEFAULT_TEXT_STYLE),
Text::styled("Left, h Move cursor left\n"<