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.
36 lines
1.0 KiB
Rust
36 lines
1.0 KiB
Rust
use std::time::Duration;
|
|
use ratatui::Frame;
|
|
use crate::tui::ratatui_app::RatatuiApp;
|
|
use color_eyre::Result;
|
|
use crossterm::event;
|
|
use crossterm::event::{Event, KeyCode, KeyEventKind};
|
|
use ratatui::widgets::{Block, Paragraph};
|
|
use crate::tui::ratatui_screens::RatatuiScreens::Monitoring;
|
|
|
|
pub struct RatatuiAddingMode {}
|
|
|
|
impl RatatuiAddingMode {
|
|
pub fn render(frame: &mut Frame, state: &mut RatatuiApp) {
|
|
frame.render_widget(
|
|
Paragraph::new("Not Yet Written.")
|
|
.block(Block::bordered())
|
|
.centered(),
|
|
frame.area()
|
|
);
|
|
|
|
}
|
|
|
|
pub fn handle_crossterm_events(app: &mut RatatuiApp) -> Result<()> {
|
|
if event::poll(Duration::from_millis(100))? {
|
|
match event::read()? {
|
|
Event::Key(key) if key.kind == KeyEventKind::Press => match key.code {
|
|
KeyCode::Esc => app.set_screen(Monitoring),
|
|
_ => {}
|
|
}
|
|
_ => {}
|
|
}
|
|
|
|
}
|
|
Ok(())
|
|
}
|
|
} |