Upgrading footer
This commit is contained in:
parent
63496cfc93
commit
f4dca93598
5 changed files with 47 additions and 22 deletions
|
|
@ -2,9 +2,8 @@ use crate::api::{UptimeKumaClient, UptimeKumaEndpoints};
|
|||
use crate::core;
|
||||
use crate::data::{heartbeat::HeartbeatResponse, status_page::model::StatusPageResponse};
|
||||
use crate::i18n::{t, t_with_args};
|
||||
use crate::ui::components::render_footer;
|
||||
use crate::ui::{
|
||||
components::{render_header, render_monitor_list},
|
||||
components::{render_footer, render_header, render_monitor_list},
|
||||
dashboard::model::DashboardViewState,
|
||||
};
|
||||
use anyhow::Result;
|
||||
|
|
@ -23,10 +22,10 @@ use ratatui::{
|
|||
};
|
||||
|
||||
use std::{
|
||||
io,
|
||||
thread,
|
||||
sync::mpsc,
|
||||
collections::HashMap,
|
||||
io,
|
||||
sync::mpsc,
|
||||
thread,
|
||||
time::{Duration, Instant},
|
||||
};
|
||||
|
||||
|
|
@ -138,12 +137,21 @@ impl App {
|
|||
} else {
|
||||
render_monitor_list(frame, chunks[1], &self.state);
|
||||
}
|
||||
render_footer(frame, chunks[2]);
|
||||
|
||||
let seconds_until_update = self
|
||||
.update_interval
|
||||
.checked_sub(self.last_update.elapsed())
|
||||
.map(|d| d.as_secs() as u64)
|
||||
.unwrap_or(30);
|
||||
|
||||
render_footer(frame, chunks[2], seconds_until_update);
|
||||
});
|
||||
}
|
||||
|
||||
fn handle_events(&mut self) -> io::Result<()> {
|
||||
if event::poll(Duration::from_millis(50))? {
|
||||
let timeout = Duration::from_secs(1);
|
||||
|
||||
if event::poll(timeout)? {
|
||||
if let Event::Key(key) = event::read()? {
|
||||
if key.kind == KeyEventKind::Release {
|
||||
return Ok(());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue