chore: cargo fmt
This commit is contained in:
@@ -51,7 +51,9 @@ fn generate_block<'a>(
|
||||
gui_state: &Arc<Mutex<GuiState>>,
|
||||
panel: SelectablePanel,
|
||||
) -> Block<'a> {
|
||||
gui_state.lock().update_map(Region::Panel(panel), area);
|
||||
gui_state
|
||||
.lock()
|
||||
.update_heading_map(Region::Panel(panel), area);
|
||||
let current_selected_panel = gui_state.lock().selected_panel;
|
||||
let title = match panel {
|
||||
SelectablePanel::Containers => {
|
||||
@@ -466,7 +468,9 @@ pub fn heading_bar<B: Backend>(
|
||||
// draw the actual header blocks
|
||||
for (index, (paragraph, header, _)) in header_data.into_iter().enumerate() {
|
||||
let rect = headers_section[index];
|
||||
gui_state.lock().update_map(Region::Header(header), rect);
|
||||
gui_state
|
||||
.lock()
|
||||
.update_heading_map(Region::Header(header), rect);
|
||||
f.render_widget(paragraph, rect);
|
||||
}
|
||||
}
|
||||
@@ -501,7 +505,7 @@ fn max_line_width(text: &str) -> usize {
|
||||
}
|
||||
|
||||
/// Draw the help box in the centre of the screen
|
||||
/// TODO this is message, should make every line it's own renderable span
|
||||
/// TODO should make every line it's own renderable span
|
||||
pub fn help_box<B: Backend>(f: &mut Frame<'_, B>) {
|
||||
let title = format!(" {} ", VERSION);
|
||||
|
||||
|
||||
+9
-7
@@ -173,7 +173,7 @@ impl fmt::Display for Loading {
|
||||
}
|
||||
}
|
||||
|
||||
/// The application can be in these four states
|
||||
/// The application gui state can be in multiple of these four states at the same time
|
||||
/// Various functions (e.g input handler), operate differently depending upon current Status
|
||||
#[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)]
|
||||
pub enum Status {
|
||||
@@ -237,7 +237,7 @@ impl GuiState {
|
||||
}
|
||||
|
||||
/// Insert, or updates header area panel into heading_map
|
||||
pub fn update_map(&mut self, region: Region, area: Rect) {
|
||||
pub fn update_heading_map(&mut self, region: Region, area: Rect) {
|
||||
match region {
|
||||
Region::Header(header) => self
|
||||
.heading_map
|
||||
@@ -252,16 +252,19 @@ impl GuiState {
|
||||
};
|
||||
}
|
||||
|
||||
pub fn status_push(&mut self, status: Status) {
|
||||
self.status.insert(status);
|
||||
/// Check if the current gui_status contains any of the given status'
|
||||
pub fn status_contains(&self, status: &[Status]) -> bool {
|
||||
status.iter().any(|i| self.status.contains(i))
|
||||
}
|
||||
|
||||
/// Remove a gui_status into the current gui_status hashset
|
||||
pub fn status_del(&mut self, status: Status) {
|
||||
self.status.remove(&status);
|
||||
}
|
||||
|
||||
pub fn status_contains(&self, status: &[Status]) -> bool {
|
||||
status.iter().any(|i| self.status.contains(i))
|
||||
/// Insert a gui_status into the current gui_status hashset
|
||||
pub fn status_push(&mut self, status: Status) {
|
||||
self.status.insert(status);
|
||||
}
|
||||
|
||||
/// Change to next selectable panel
|
||||
@@ -281,7 +284,6 @@ impl GuiState {
|
||||
}
|
||||
|
||||
/// If is_loading has any entries, return the current loading_icon, else an emtpy string
|
||||
// Option<String>?
|
||||
pub fn get_loading(&mut self) -> String {
|
||||
if self.is_loading.is_empty() {
|
||||
String::from(" ")
|
||||
|
||||
@@ -83,10 +83,7 @@ async fn run_app<B: Backend + Send>(
|
||||
update_duration: Duration,
|
||||
) -> Result<(), AppError> {
|
||||
let input_poll_rate = std::time::Duration::from_millis(75);
|
||||
|
||||
// Check for docker connect errors before attempting to draw the gui
|
||||
let status_dockerconnect = gui_state.lock().status_contains(&[Status::DockerConnect]);
|
||||
|
||||
if status_dockerconnect {
|
||||
let mut seconds = 5;
|
||||
loop {
|
||||
@@ -139,7 +136,6 @@ async fn run_app<B: Backend + Send>(
|
||||
break;
|
||||
}
|
||||
}
|
||||
// }
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user