** RatatuiUi **
displays a preset list of hosts and their response state Updates format of input file to CSV with <host ip>,<host name> as the format. UI now has red/green for down/up hosts duration_to_string now in lib improves display of how long ago change happened log events are now displayed on the monitoring page to show when a host comes up/goes down Modularize ui better Adds ability to return to monitoring or quit from editing page table in place for displaying hosts WIP: start of being able to go up/down through the list of hosts to eventually edit them.
This commit is contained in:
+4
-8
@@ -17,6 +17,8 @@ use std::{env, error::Error, ffi::OsString, process};
|
||||
use color_eyre::owo_colors::OwoColorize;
|
||||
use crossterm::style::Stylize;
|
||||
use log::debug;
|
||||
use pp::app_settings::AppSettings;
|
||||
|
||||
const SECONDS_IN_MINUTE: u32 = 60;
|
||||
const SECONDS_IN_HOUR: u32 = SECONDS_IN_MINUTE * 60;
|
||||
const SECONDS_IN_DAY: u32 = SECONDS_IN_HOUR * 24;
|
||||
@@ -117,7 +119,7 @@ impl PPState {
|
||||
}
|
||||
|
||||
pub fn build_targets_from_file(filename: Option<PathBuf>) -> BTreeMap<String, TargetState> {
|
||||
PPState::get_default_targets();
|
||||
// PPState::get_default_targets();
|
||||
if let Some(file) = filename {
|
||||
let mut working = BTreeMap::new();
|
||||
if !&file.exists() {
|
||||
@@ -155,13 +157,7 @@ impl PPState {
|
||||
}
|
||||
|
||||
/// Simple program to greet a person
|
||||
#[derive(Parser, Debug)]
|
||||
#[command(version, about, long_about = None)]
|
||||
pub struct AppSettings {
|
||||
/// File of list of hosts
|
||||
#[arg(short, long)]
|
||||
ping_host_file: Option<PathBuf>,
|
||||
}
|
||||
|
||||
|
||||
fn main() {
|
||||
// Get App Settings
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
use clap::Parser;
|
||||
use ratatui::widgets::TableState;
|
||||
use pp::app_settings::AppSettings;
|
||||
use pp::tui::ratatui_app::RatatuiApp;
|
||||
fn main() -> color_eyre::Result<()> {
|
||||
// find out what file we are using to get our hosts
|
||||
let settings = AppSettings::parse();
|
||||
|
||||
color_eyre::install()?;
|
||||
let terminal = ratatui::init();
|
||||
let result = RatatuiApp::new(settings.ping_host_file).run(terminal);
|
||||
ratatui::restore();
|
||||
result
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user