wip: gui_status, should use a hashset?
This commit is contained in:
+7
-6
@@ -25,7 +25,7 @@ mod draw_blocks;
|
||||
mod gui_state;
|
||||
|
||||
pub use self::color_match::*;
|
||||
pub use self::gui_state::{GuiState, SelectablePanel};
|
||||
pub use self::gui_state::{GuiState, SelectablePanel, Status};
|
||||
use crate::{
|
||||
app_data::AppData, app_error::AppError, docker_data::DockerMessage,
|
||||
input_handler::InputMessages,
|
||||
@@ -56,7 +56,7 @@ pub async fn create_ui(
|
||||
update_duration,
|
||||
)
|
||||
.await;
|
||||
terminal.clear()?;
|
||||
terminal.clear()?;
|
||||
|
||||
disable_raw_mode()?;
|
||||
execute!(
|
||||
@@ -85,8 +85,9 @@ async fn run_app<B: Backend + Send>(
|
||||
let input_poll_rate = std::time::Duration::from_millis(75);
|
||||
|
||||
// Check for docker connect errors before attempting to draw the gui
|
||||
let e = app_data.lock().get_error();
|
||||
if let Some(AppError::DockerConnect) = e {
|
||||
let status = gui_state.lock().get_status();
|
||||
|
||||
if status == Status::DockerConnect {
|
||||
let mut seconds = 5;
|
||||
loop {
|
||||
if seconds < 1 {
|
||||
@@ -138,6 +139,7 @@ async fn run_app<B: Backend + Send>(
|
||||
break;
|
||||
}
|
||||
}
|
||||
// }
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
@@ -157,7 +159,7 @@ fn ui<B: Backend>(
|
||||
let log_index = app_data.lock().get_selected_log_index();
|
||||
let sorted_by = app_data.lock().get_sorted();
|
||||
|
||||
let show_help = gui_state.lock().show_help;
|
||||
let show_help = gui_state.lock().get_status() == Status::Help;
|
||||
let info_text = gui_state.lock().info_box_text.clone();
|
||||
let loading_icon = gui_state.lock().get_loading();
|
||||
|
||||
@@ -241,7 +243,6 @@ fn ui<B: Backend>(
|
||||
}
|
||||
|
||||
if let Some(error) = has_error {
|
||||
app_data.lock().show_error = true;
|
||||
draw_blocks::error(f, error, None);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user