refactor: docker functions

This commit is contained in:
Jack Wills
2022-04-29 17:03:34 +00:00
parent 679203cf2d
commit 28bf0e603d
4 changed files with 60 additions and 75 deletions
+2 -2
View File
@@ -223,7 +223,7 @@ pub fn draw_logs<B: Backend>(
f: &mut Frame<'_, B>,
gui_state: &Arc<Mutex<GuiState>>,
index: Option<usize>,
loading_icon: String,
loading_icon: String,
selected_panel: &SelectablePanel,
) {
let panel = SelectablePanel::Logs;
@@ -368,7 +368,7 @@ pub fn draw_heading_bar<B: Backend>(
columns: &Columns,
f: &mut Frame<'_, B>,
has_containers: bool,
loading_icon: String,
loading_icon: String,
info_visible: bool,
) {
let block = || Block::default().style(Style::default().bg(Color::Magenta).fg(Color::Black));
+2 -2
View File
@@ -167,8 +167,8 @@ pub struct GuiState {
// If a BMapTree think it would mean have to implement ordering for SelectablePanel
area_map: HashMap<SelectablePanel, Rect>,
loading_icon: Loading,
// Should be a vec, each time loading add a new to the vec, and reset remove from vec
// for for if is_loading just check if vec is empty or not
// Should be a vec, each time loading add a new to the vec, and reset remove from vec
// for for if is_loading just check if vec is empty or not
is_loading: bool,
pub selected_panel: SelectablePanel,
pub show_help: bool,
+4 -5
View File
@@ -14,7 +14,6 @@ use std::{
time::{Duration, Instant},
};
use tokio::sync::mpsc::Sender;
use tracing::error;
use tui::{
backend::{Backend, CrosstermBackend},
layout::{Constraint, Direction, Layout},
@@ -68,7 +67,7 @@ pub async fn create_ui(
terminal.show_cursor().unwrap();
if let Err(err) = res {
error!(%err);
println!("{}", err);
}
Ok(())
}
@@ -157,7 +156,7 @@ fn ui<B: Backend>(
let selected_panel = gui_state.lock().selected_panel;
let show_help = gui_state.lock().show_help;
let info_text = gui_state.lock().info_box_text.clone();
let loading_icon = gui_state.lock().get_loading();
let loading_icon = gui_state.lock().get_loading();
let whole_layout = Layout::default()
.direction(Direction::Vertical)
@@ -219,7 +218,7 @@ fn ui<B: Backend>(
f,
gui_state,
log_index,
loading_icon.to_owned(),
loading_icon.to_owned(),
&selected_panel,
);
@@ -228,7 +227,7 @@ fn ui<B: Backend>(
&column_widths,
f,
has_containers,
loading_icon,
loading_icon,
show_help,
);