feat: clear screen & redraw
New keymap key to clear the screen & redraw. Useful if gui shows any glitches
This commit is contained in:
@@ -114,6 +114,7 @@ In application controls, these, amongst many other settings, can be customized w
|
|||||||
| ```( - ) ``` or ```(=)``` | Reduce or increase the height of the logs panel.|
|
| ```( - ) ``` or ```(=)``` | Reduce or increase the height of the logs panel.|
|
||||||
| ```( \ )``` | Toggle the visibility of the logs panel.|
|
| ```( \ )``` | Toggle the visibility of the logs panel.|
|
||||||
| ```( e )``` | Exec into the selected container - not available on Windows.|
|
| ```( e )``` | Exec into the selected container - not available on Windows.|
|
||||||
|
| ```( f )``` | Force clear the screen & redraw the gui.|
|
||||||
| ```( h )``` | Toggle help menu.|
|
| ```( h )``` | Toggle help menu.|
|
||||||
| ```( m )``` | Toggle mouse capture - if disabled, text on screen can be selected.|
|
| ```( m )``` | Toggle mouse capture - if disabled, text on screen can be selected.|
|
||||||
| ```( q )``` | Quit.|
|
| ```( q )``` | Quit.|
|
||||||
|
|||||||
@@ -166,6 +166,10 @@
|
|||||||
// Toggle visibility of the log section
|
// Toggle visibility of the log section
|
||||||
"log_section_toggle": [
|
"log_section_toggle": [
|
||||||
"\\"
|
"\\"
|
||||||
|
],
|
||||||
|
// Force a complete clear & redraw of the screen
|
||||||
|
"force_redraw": [
|
||||||
|
"f"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
////////////////////
|
////////////////////
|
||||||
|
|||||||
@@ -115,6 +115,8 @@ log_section_height_decrease = ["-"]
|
|||||||
log_section_height_increase = ["+"]
|
log_section_height_increase = ["+"]
|
||||||
# Toggle visibility of the log section
|
# Toggle visibility of the log section
|
||||||
log_section_toggle = ["\\"]
|
log_section_toggle = ["\\"]
|
||||||
|
# Force a complete clear & redraw of the screen
|
||||||
|
force_redraw = ["f"]
|
||||||
|
|
||||||
#################
|
#################
|
||||||
# Custom Colors #
|
# Custom Colors #
|
||||||
|
|||||||
+26
-26
@@ -122,7 +122,7 @@ pub struct AppData {
|
|||||||
error: Option<AppError>,
|
error: Option<AppError>,
|
||||||
filter: Filter,
|
filter: Filter,
|
||||||
hidden_containers: Vec<ContainerItem>,
|
hidden_containers: Vec<ContainerItem>,
|
||||||
redraw: Arc<Rerender>,
|
rerender: Arc<Rerender>,
|
||||||
sorted_by: Option<(Header, SortedOrder)>,
|
sorted_by: Option<(Header, SortedOrder)>,
|
||||||
current_sorted_id: Vec<ContainerId>,
|
current_sorted_id: Vec<ContainerId>,
|
||||||
pub config: Config,
|
pub config: Config,
|
||||||
@@ -137,7 +137,7 @@ pub struct AppData {
|
|||||||
pub filter: Filter,
|
pub filter: Filter,
|
||||||
pub hidden_containers: Vec<ContainerItem>,
|
pub hidden_containers: Vec<ContainerItem>,
|
||||||
pub current_sorted_id: Vec<ContainerId>,
|
pub current_sorted_id: Vec<ContainerId>,
|
||||||
pub redraw: Arc<Rerender>,
|
pub rerender: Arc<Rerender>,
|
||||||
pub sorted_by: Option<(Header, SortedOrder)>,
|
pub sorted_by: Option<(Header, SortedOrder)>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -151,7 +151,7 @@ impl AppData {
|
|||||||
error: None,
|
error: None,
|
||||||
filter: Filter::new(),
|
filter: Filter::new(),
|
||||||
hidden_containers: vec![],
|
hidden_containers: vec![],
|
||||||
redraw: Arc::clone(redraw),
|
rerender: Arc::clone(redraw),
|
||||||
sorted_by: None,
|
sorted_by: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -192,7 +192,7 @@ impl AppData {
|
|||||||
/// sets the state to start if any filtering has occurred
|
/// sets the state to start if any filtering has occurred
|
||||||
/// Also search in the "hidden" vec for items and insert back into the main containers vec
|
/// Also search in the "hidden" vec for items and insert back into the main containers vec
|
||||||
fn filter_containers(&mut self) {
|
fn filter_containers(&mut self) {
|
||||||
self.redraw.update();
|
self.rerender.update_draw();
|
||||||
let pre_len = self.get_container_len();
|
let pre_len = self.get_container_len();
|
||||||
|
|
||||||
if !self.hidden_containers.is_empty() {
|
if !self.hidden_containers.is_empty() {
|
||||||
@@ -296,7 +296,7 @@ impl AppData {
|
|||||||
/// Remove the sorted header & order, and sort by default - created datetime
|
/// Remove the sorted header & order, and sort by default - created datetime
|
||||||
pub fn reset_sorted(&mut self) {
|
pub fn reset_sorted(&mut self) {
|
||||||
self.set_sorted(None);
|
self.set_sorted(None);
|
||||||
self.redraw.update();
|
self.rerender.update_draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sort containers based on a given header, if headings match, and already ascending, remove sorting
|
/// Sort containers based on a given header, if headings match, and already ascending, remove sorting
|
||||||
@@ -392,7 +392,7 @@ impl AppData {
|
|||||||
|
|
||||||
self.containers.items.sort_by(sort_closure);
|
self.containers.items.sort_by(sort_closure);
|
||||||
if pre_order != self.get_current_ids() {
|
if pre_order != self.get_current_ids() {
|
||||||
self.redraw.update();
|
self.rerender.update_draw();
|
||||||
}
|
}
|
||||||
} else if self.current_sorted_id != self.get_current_ids() {
|
} else if self.current_sorted_id != self.get_current_ids() {
|
||||||
self.containers.items.sort_by(|a, b| {
|
self.containers.items.sort_by(|a, b| {
|
||||||
@@ -400,7 +400,7 @@ impl AppData {
|
|||||||
.cmp(&b.created)
|
.cmp(&b.created)
|
||||||
.then_with(|| a.name.get().cmp(b.name.get()))
|
.then_with(|| a.name.get().cmp(b.name.get()))
|
||||||
});
|
});
|
||||||
self.redraw.update();
|
self.rerender.update_draw();
|
||||||
self.current_sorted_id = self.get_current_ids();
|
self.current_sorted_id = self.get_current_ids();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -439,25 +439,25 @@ impl AppData {
|
|||||||
/// Select the first container
|
/// Select the first container
|
||||||
pub fn containers_start(&mut self) {
|
pub fn containers_start(&mut self) {
|
||||||
self.containers.start();
|
self.containers.start();
|
||||||
self.redraw.update();
|
self.rerender.update_draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// select the last container
|
/// select the last container
|
||||||
pub fn containers_end(&mut self) {
|
pub fn containers_end(&mut self) {
|
||||||
self.containers.end();
|
self.containers.end();
|
||||||
self.redraw.update();
|
self.rerender.update_draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Select the next container
|
/// Select the next container
|
||||||
pub fn containers_next(&mut self) {
|
pub fn containers_next(&mut self) {
|
||||||
self.containers.next();
|
self.containers.next();
|
||||||
self.redraw.update();
|
self.rerender.update_draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// select the previous container
|
/// select the previous container
|
||||||
pub fn containers_previous(&mut self) {
|
pub fn containers_previous(&mut self) {
|
||||||
self.containers.previous();
|
self.containers.previous();
|
||||||
self.redraw.update();
|
self.rerender.update_draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get ListState of containers
|
/// Get ListState of containers
|
||||||
@@ -579,7 +579,7 @@ impl AppData {
|
|||||||
pub fn docker_controls_next(&mut self) {
|
pub fn docker_controls_next(&mut self) {
|
||||||
if let Some(i) = self.get_mut_selected_container() {
|
if let Some(i) = self.get_mut_selected_container() {
|
||||||
i.docker_controls.next();
|
i.docker_controls.next();
|
||||||
self.redraw.update();
|
self.rerender.update_draw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -587,7 +587,7 @@ impl AppData {
|
|||||||
pub fn docker_controls_previous(&mut self) {
|
pub fn docker_controls_previous(&mut self) {
|
||||||
if let Some(i) = self.get_mut_selected_container() {
|
if let Some(i) = self.get_mut_selected_container() {
|
||||||
i.docker_controls.previous();
|
i.docker_controls.previous();
|
||||||
self.redraw.update();
|
self.rerender.update_draw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -595,7 +595,7 @@ impl AppData {
|
|||||||
pub fn docker_controls_start(&mut self) {
|
pub fn docker_controls_start(&mut self) {
|
||||||
if let Some(i) = self.get_mut_selected_container() {
|
if let Some(i) = self.get_mut_selected_container() {
|
||||||
i.docker_controls.start();
|
i.docker_controls.start();
|
||||||
self.redraw.update();
|
self.rerender.update_draw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -603,7 +603,7 @@ impl AppData {
|
|||||||
pub fn docker_controls_end(&mut self) {
|
pub fn docker_controls_end(&mut self) {
|
||||||
if let Some(i) = self.get_mut_selected_container() {
|
if let Some(i) = self.get_mut_selected_container() {
|
||||||
i.docker_controls.end();
|
i.docker_controls.end();
|
||||||
self.redraw.update();
|
self.rerender.update_draw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -647,7 +647,7 @@ impl AppData {
|
|||||||
pub fn log_back(&mut self) {
|
pub fn log_back(&mut self) {
|
||||||
if let Some(i) = self.get_mut_selected_container() {
|
if let Some(i) = self.get_mut_selected_container() {
|
||||||
i.logs.back();
|
i.logs.back();
|
||||||
self.redraw.update();
|
self.rerender.update_draw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -655,7 +655,7 @@ impl AppData {
|
|||||||
pub fn log_forward(&mut self, width: u16) {
|
pub fn log_forward(&mut self, width: u16) {
|
||||||
if let Some(i) = self.get_mut_selected_container() {
|
if let Some(i) = self.get_mut_selected_container() {
|
||||||
i.logs.forward(width);
|
i.logs.forward(width);
|
||||||
self.redraw.update();
|
self.rerender.update_draw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -663,7 +663,7 @@ impl AppData {
|
|||||||
pub fn log_next(&mut self) {
|
pub fn log_next(&mut self) {
|
||||||
if let Some(i) = self.get_mut_selected_container() {
|
if let Some(i) = self.get_mut_selected_container() {
|
||||||
i.logs.next();
|
i.logs.next();
|
||||||
self.redraw.update();
|
self.rerender.update_draw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -671,7 +671,7 @@ impl AppData {
|
|||||||
pub fn log_previous(&mut self) {
|
pub fn log_previous(&mut self) {
|
||||||
if let Some(i) = self.get_mut_selected_container() {
|
if let Some(i) = self.get_mut_selected_container() {
|
||||||
i.logs.previous();
|
i.logs.previous();
|
||||||
self.redraw.update();
|
self.rerender.update_draw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -679,7 +679,7 @@ impl AppData {
|
|||||||
pub fn log_end(&mut self) {
|
pub fn log_end(&mut self) {
|
||||||
if let Some(i) = self.get_mut_selected_container() {
|
if let Some(i) = self.get_mut_selected_container() {
|
||||||
i.logs.end();
|
i.logs.end();
|
||||||
self.redraw.update();
|
self.rerender.update_draw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -687,7 +687,7 @@ impl AppData {
|
|||||||
pub fn log_start(&mut self) {
|
pub fn log_start(&mut self) {
|
||||||
if let Some(i) = self.get_mut_selected_container() {
|
if let Some(i) = self.get_mut_selected_container() {
|
||||||
i.logs.start();
|
i.logs.start();
|
||||||
self.redraw.update();
|
self.rerender.update_draw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -728,14 +728,14 @@ impl AppData {
|
|||||||
/// Remove single app_state error
|
/// Remove single app_state error
|
||||||
pub fn remove_error(&mut self) {
|
pub fn remove_error(&mut self) {
|
||||||
self.error = None;
|
self.error = None;
|
||||||
self.redraw.update();
|
self.rerender.update_draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Insert single app_state error
|
/// Insert single app_state error
|
||||||
pub fn set_error(&mut self, error: AppError, gui_state: &Arc<Mutex<GuiState>>, status: Status) {
|
pub fn set_error(&mut self, error: AppError, gui_state: &Arc<Mutex<GuiState>>, status: Status) {
|
||||||
gui_state.lock().status_push(status);
|
gui_state.lock().status_push(status);
|
||||||
self.error = Some(error);
|
self.error = Some(error);
|
||||||
self.redraw.update();
|
self.rerender.update_draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Check if the selected container is a dockerised version of oxker
|
/// Check if the selected container is a dockerised version of oxker
|
||||||
@@ -825,7 +825,7 @@ impl AppData {
|
|||||||
container.mem_limit.update(mem_limit);
|
container.mem_limit.update(mem_limit);
|
||||||
}
|
}
|
||||||
if self.is_selected_container(id) {
|
if self.is_selected_container(id) {
|
||||||
self.redraw.update();
|
self.rerender.update_draw();
|
||||||
}
|
}
|
||||||
self.sort_containers();
|
self.sort_containers();
|
||||||
}
|
}
|
||||||
@@ -863,7 +863,7 @@ impl AppData {
|
|||||||
if self.containers.items.get(index).is_some() {
|
if self.containers.items.get(index).is_some() {
|
||||||
self.containers.items.remove(index);
|
self.containers.items.remove(index);
|
||||||
if self.is_selected_container(id) {
|
if self.is_selected_container(id) {
|
||||||
self.redraw.update();
|
self.rerender.update_draw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -992,7 +992,7 @@ impl AppData {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if self.is_selected_container(id) {
|
if self.is_selected_container(id) {
|
||||||
self.redraw.update();
|
self.rerender.update_draw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -114,6 +114,8 @@ log_section_height_decrease = ["-"]
|
|||||||
log_section_height_increase = ["+"]
|
log_section_height_increase = ["+"]
|
||||||
# Toggle visibility of the log section
|
# Toggle visibility of the log section
|
||||||
log_section_toggle = ["\\"]
|
log_section_toggle = ["\\"]
|
||||||
|
# Force a complete clear & redraw of the screen
|
||||||
|
force_redraw = ["f"]
|
||||||
|
|
||||||
#################
|
#################
|
||||||
# Custom Colors #
|
# Custom Colors #
|
||||||
|
|||||||
+17
-10
@@ -35,6 +35,7 @@ macro_rules! config_struct {
|
|||||||
optional_config_struct!(
|
optional_config_struct!(
|
||||||
ConfigKeymap,
|
ConfigKeymap,
|
||||||
clear,
|
clear,
|
||||||
|
force_redraw,
|
||||||
delete_deny,
|
delete_deny,
|
||||||
delete_confirm,
|
delete_confirm,
|
||||||
exec,
|
exec,
|
||||||
@@ -75,6 +76,7 @@ config_struct!(
|
|||||||
delete_confirm,
|
delete_confirm,
|
||||||
exec,
|
exec,
|
||||||
filter_mode,
|
filter_mode,
|
||||||
|
force_redraw,
|
||||||
log_section_height_increase,
|
log_section_height_increase,
|
||||||
log_section_height_decrease,
|
log_section_height_decrease,
|
||||||
log_section_toggle,
|
log_section_toggle,
|
||||||
@@ -112,6 +114,7 @@ impl Keymap {
|
|||||||
delete_deny: (KeyCode::Char('n'), None),
|
delete_deny: (KeyCode::Char('n'), None),
|
||||||
exec: (KeyCode::Char('e'), None),
|
exec: (KeyCode::Char('e'), None),
|
||||||
filter_mode: (KeyCode::Char('/'), Some(KeyCode::F(1))),
|
filter_mode: (KeyCode::Char('/'), Some(KeyCode::F(1))),
|
||||||
|
force_redraw: (KeyCode::Char('f'), None),
|
||||||
log_section_height_decrease: (KeyCode::Char('-'), None),
|
log_section_height_decrease: (KeyCode::Char('-'), None),
|
||||||
log_section_height_increase: (KeyCode::Char('='), None),
|
log_section_height_increase: (KeyCode::Char('='), None),
|
||||||
log_section_toggle: (KeyCode::Char('\\'), None),
|
log_section_toggle: (KeyCode::Char('\\'), None),
|
||||||
@@ -195,6 +198,7 @@ impl From<Option<ConfigKeymap>> for Keymap {
|
|||||||
|
|
||||||
update_keymap(ck.exec, &mut keymap.exec, &mut clash);
|
update_keymap(ck.exec, &mut keymap.exec, &mut clash);
|
||||||
update_keymap(ck.filter_mode, &mut keymap.filter_mode, &mut clash);
|
update_keymap(ck.filter_mode, &mut keymap.filter_mode, &mut clash);
|
||||||
|
update_keymap(ck.force_redraw, &mut keymap.force_redraw, &mut clash);
|
||||||
update_keymap(ck.quit, &mut keymap.quit, &mut clash);
|
update_keymap(ck.quit, &mut keymap.quit, &mut clash);
|
||||||
update_keymap(ck.save_logs, &mut keymap.save_logs, &mut clash);
|
update_keymap(ck.save_logs, &mut keymap.save_logs, &mut clash);
|
||||||
update_keymap(
|
update_keymap(
|
||||||
@@ -376,11 +380,13 @@ mod tests {
|
|||||||
delete_deny: Some(vec!["s".to_owned()]),
|
delete_deny: Some(vec!["s".to_owned()]),
|
||||||
delete_confirm: None,
|
delete_confirm: None,
|
||||||
exec: None,
|
exec: None,
|
||||||
|
filter_mode: None,
|
||||||
|
force_redraw: None,
|
||||||
|
log_scroll_back: None,
|
||||||
|
log_scroll_forward: None,
|
||||||
log_section_height_decrease: None,
|
log_section_height_decrease: None,
|
||||||
log_section_height_increase: None,
|
log_section_height_increase: None,
|
||||||
log_scroll_forward: None,
|
log_section_toggle: None,
|
||||||
log_scroll_back: None,
|
|
||||||
filter_mode: None,
|
|
||||||
quit: None,
|
quit: None,
|
||||||
save_logs: None,
|
save_logs: None,
|
||||||
scroll_down_many: None,
|
scroll_down_many: None,
|
||||||
@@ -390,16 +396,15 @@ mod tests {
|
|||||||
scroll_up_many: None,
|
scroll_up_many: None,
|
||||||
scroll_up_one: None,
|
scroll_up_one: None,
|
||||||
select_next_panel: None,
|
select_next_panel: None,
|
||||||
log_section_toggle: None,
|
|
||||||
select_previous_panel: None,
|
select_previous_panel: None,
|
||||||
sort_by_name: None,
|
|
||||||
sort_by_state: None,
|
|
||||||
sort_by_status: None,
|
|
||||||
sort_by_cpu: None,
|
sort_by_cpu: None,
|
||||||
sort_by_memory: None,
|
|
||||||
sort_by_id: None,
|
sort_by_id: None,
|
||||||
sort_by_image: None,
|
sort_by_image: None,
|
||||||
|
sort_by_memory: None,
|
||||||
|
sort_by_name: None,
|
||||||
sort_by_rx: None,
|
sort_by_rx: None,
|
||||||
|
sort_by_state: None,
|
||||||
|
sort_by_status: None,
|
||||||
sort_by_tx: None,
|
sort_by_tx: None,
|
||||||
sort_reset: None,
|
sort_reset: None,
|
||||||
toggle_help: None,
|
toggle_help: None,
|
||||||
@@ -422,6 +427,7 @@ mod tests {
|
|||||||
delete_deny: gen_v(("c", "d")),
|
delete_deny: gen_v(("c", "d")),
|
||||||
exec: gen_v(("g", "h")),
|
exec: gen_v(("g", "h")),
|
||||||
filter_mode: gen_v(("i", "j")),
|
filter_mode: gen_v(("i", "j")),
|
||||||
|
force_redraw: gen_v(("F1", "F2")),
|
||||||
log_section_height_decrease: gen_v(("-", "Z")),
|
log_section_height_decrease: gen_v(("-", "Z")),
|
||||||
log_section_height_increase: gen_v(("=", "X")),
|
log_section_height_increase: gen_v(("=", "X")),
|
||||||
log_scroll_forward: gen_v(("right", "R")),
|
log_scroll_forward: gen_v(("right", "R")),
|
||||||
@@ -437,7 +443,7 @@ mod tests {
|
|||||||
scroll_up_one: gen_v(("y", "z")),
|
scroll_up_one: gen_v(("y", "z")),
|
||||||
select_next_panel: gen_v(("0", "1")),
|
select_next_panel: gen_v(("0", "1")),
|
||||||
select_previous_panel: gen_v(("2", "3")),
|
select_previous_panel: gen_v(("2", "3")),
|
||||||
sort_by_cpu: gen_v(("F1", "F12")),
|
sort_by_cpu: gen_v(("F11", "F12")),
|
||||||
sort_by_id: gen_v(("[", "]")),
|
sort_by_id: gen_v(("[", "]")),
|
||||||
sort_by_image: gen_v(("A", "B")),
|
sort_by_image: gen_v(("A", "B")),
|
||||||
sort_by_memory: gen_v(("/", "\\")),
|
sort_by_memory: gen_v(("/", "\\")),
|
||||||
@@ -457,6 +463,7 @@ mod tests {
|
|||||||
clear: (KeyCode::Char('a'), Some(KeyCode::Char('b'))),
|
clear: (KeyCode::Char('a'), Some(KeyCode::Char('b'))),
|
||||||
delete_deny: (KeyCode::Char('c'), Some(KeyCode::Char('d'))),
|
delete_deny: (KeyCode::Char('c'), Some(KeyCode::Char('d'))),
|
||||||
delete_confirm: (KeyCode::Char('e'), Some(KeyCode::Char('f'))),
|
delete_confirm: (KeyCode::Char('e'), Some(KeyCode::Char('f'))),
|
||||||
|
force_redraw: (KeyCode::F(1), Some(KeyCode::F(2))),
|
||||||
log_section_height_decrease: (KeyCode::Char('-'), Some(KeyCode::Char('Z'))),
|
log_section_height_decrease: (KeyCode::Char('-'), Some(KeyCode::Char('Z'))),
|
||||||
log_section_height_increase: (KeyCode::Char('='), Some(KeyCode::Char('X'))),
|
log_section_height_increase: (KeyCode::Char('='), Some(KeyCode::Char('X'))),
|
||||||
log_section_toggle: (KeyCode::Char('Y'), Some(KeyCode::Char('W'))),
|
log_section_toggle: (KeyCode::Char('Y'), Some(KeyCode::Char('W'))),
|
||||||
@@ -477,7 +484,7 @@ mod tests {
|
|||||||
sort_by_name: (KeyCode::Char('4'), Some(KeyCode::Char('5'))),
|
sort_by_name: (KeyCode::Char('4'), Some(KeyCode::Char('5'))),
|
||||||
sort_by_state: (KeyCode::Char('6'), Some(KeyCode::Char('7'))),
|
sort_by_state: (KeyCode::Char('6'), Some(KeyCode::Char('7'))),
|
||||||
sort_by_status: (KeyCode::Char('8'), Some(KeyCode::Char('9'))),
|
sort_by_status: (KeyCode::Char('8'), Some(KeyCode::Char('9'))),
|
||||||
sort_by_cpu: (KeyCode::F(1), Some(KeyCode::F(12))),
|
sort_by_cpu: (KeyCode::F(11), Some(KeyCode::F(12))),
|
||||||
sort_by_memory: (KeyCode::Char('/'), Some(KeyCode::Char('\\'))),
|
sort_by_memory: (KeyCode::Char('/'), Some(KeyCode::Char('\\'))),
|
||||||
sort_by_id: (KeyCode::Char('['), Some(KeyCode::Char(']'))),
|
sort_by_id: (KeyCode::Char('['), Some(KeyCode::Char(']'))),
|
||||||
sort_by_image: (KeyCode::Char('A'), Some(KeyCode::Char('B'))),
|
sort_by_image: (KeyCode::Char('A'), Some(KeyCode::Char('B'))),
|
||||||
|
|||||||
@@ -408,6 +408,11 @@ impl InputHandler {
|
|||||||
/// Handle input that refers to the sorting of columns
|
/// Handle input that refers to the sorting of columns
|
||||||
fn handle_sort(&self, key_code: KeyCode) {
|
fn handle_sort(&self, key_code: KeyCode) {
|
||||||
match key_code {
|
match key_code {
|
||||||
|
_ if self.keymap.force_redraw.0 == key_code
|
||||||
|
|| self.keymap.force_redraw.1 == Some(key_code) =>
|
||||||
|
{
|
||||||
|
self.gui_state.lock().set_clear();
|
||||||
|
}
|
||||||
_ if self.keymap.sort_reset.0 == key_code
|
_ if self.keymap.sort_reset.0 == key_code
|
||||||
|| self.keymap.sort_reset.1 == Some(key_code) =>
|
|| self.keymap.sort_reset.1 == Some(key_code) =>
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-1
@@ -210,7 +210,7 @@ mod tests {
|
|||||||
current_sorted_id: vec![],
|
current_sorted_id: vec![],
|
||||||
error: None,
|
error: None,
|
||||||
sorted_by: None,
|
sorted_by: None,
|
||||||
redraw: Arc::new(Rerender::new()),
|
rerender: Arc::new(Rerender::new()),
|
||||||
filter: Filter::new(),
|
filter: Filter::new(),
|
||||||
config: gen_config(),
|
config: gen_config(),
|
||||||
}
|
}
|
||||||
|
|||||||
+84
-79
@@ -84,7 +84,6 @@ impl HelpInfo {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// todo ← → for log moving
|
|
||||||
/// Generate the button information span + metadata
|
/// Generate the button information span + metadata
|
||||||
#[allow(clippy::too_many_lines)]
|
#[allow(clippy::too_many_lines)]
|
||||||
fn gen_keymap_info(colors: AppColors, zone: Option<&TimeZone>, show_timestamp: bool) -> Self {
|
fn gen_keymap_info(colors: AppColors, zone: Option<&TimeZone>, show_timestamp: bool) -> Self {
|
||||||
@@ -129,6 +128,11 @@ impl HelpInfo {
|
|||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
button_desc(" - not available on Windows"),
|
button_desc(" - not available on Windows"),
|
||||||
]),
|
]),
|
||||||
|
Line::from(vec![
|
||||||
|
space(),
|
||||||
|
button_item("f"),
|
||||||
|
button_desc("force clear the screen & redraw the gui"),
|
||||||
|
]),
|
||||||
Line::from(vec![
|
Line::from(vec![
|
||||||
space(),
|
space(),
|
||||||
button_item("h"),
|
button_item("h"),
|
||||||
@@ -285,6 +289,7 @@ impl HelpInfo {
|
|||||||
or_secondary(km.exec, "exec into a container"),
|
or_secondary(km.exec, "exec into a container"),
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
or_secondary(km.exec, "exec into a container - not available on Windows"),
|
or_secondary(km.exec, "exec into a container - not available on Windows"),
|
||||||
|
or_secondary(km.force_redraw, "force clear the screen & redraw the gui"),
|
||||||
or_secondary(
|
or_secondary(
|
||||||
km.toggle_help,
|
km.toggle_help,
|
||||||
"toggle this help information - or click heading",
|
"toggle this help information - or click heading",
|
||||||
@@ -445,9 +450,8 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
/// This will cause issues once the version has more than the current 5 chars (0.5.0)
|
/// This will cause issues once the version has more than the current 5 chars (0.5.0)
|
||||||
/// println!("{} {} {} {} {}", row_index, result_cell_index, result_cell.symbol(), result_cell.bg, result_cell.fg);
|
/// println!("{} {} {} {} {}", row_index, result_cell_index, result_cell.symbol(), result_cell.bg, result_cell.fg);
|
||||||
/// TODO broken wihh the horizonal scrolls!
|
|
||||||
fn test_draw_blocks_help() {
|
fn test_draw_blocks_help() {
|
||||||
let mut setup = test_setup(87, 35, true, true);
|
let mut setup = test_setup(87, 36, true, true);
|
||||||
let tz = setup.app_data.lock().config.timezone.clone();
|
let tz = setup.app_data.lock().config.timezone.clone();
|
||||||
|
|
||||||
setup
|
setup
|
||||||
@@ -469,12 +473,12 @@ mod tests {
|
|||||||
for (result_cell_index, result_cell) in result_row.iter().enumerate() {
|
for (result_cell_index, result_cell) in result_row.iter().enumerate() {
|
||||||
match (row_index, result_cell_index) {
|
match (row_index, result_cell_index) {
|
||||||
// first & last row, and first & last char on each row, is reset/reset, making sure that the help info is centered in the given area
|
// first & last row, and first & last char on each row, is reset/reset, making sure that the help info is centered in the given area
|
||||||
(0 | 34, _) | (0..=33, 0 | 86) => {
|
(0 | 35, _) | (0..=34, 0 | 86) => {
|
||||||
assert_eq!(result_cell.bg, Color::Reset);
|
assert_eq!(result_cell.bg, Color::Reset);
|
||||||
assert_eq!(result_cell.fg, Color::Reset);
|
assert_eq!(result_cell.fg, Color::Reset);
|
||||||
}
|
}
|
||||||
// border is red on black
|
// border is red on black
|
||||||
(1 | 32, _) | (1..=31, 1 | 85) => {
|
(1 | 34, _) | (1..=31, 1 | 85) => {
|
||||||
assert_eq!(result_cell.bg, Color::Magenta);
|
assert_eq!(result_cell.bg, Color::Magenta);
|
||||||
assert_eq!(result_cell.fg, Color::Black);
|
assert_eq!(result_cell.fg, Color::Black);
|
||||||
}
|
}
|
||||||
@@ -483,15 +487,15 @@ mod tests {
|
|||||||
| (12, 19..=66)
|
| (12, 19..=66)
|
||||||
| (14, 2..=10 | 13..=27)
|
| (14, 2..=10 | 13..=27)
|
||||||
| (15, 2..=10 | 13..=21 | 24..=40 | 43..=56)
|
| (15, 2..=10 | 13..=21 | 24..=40 | 43..=56)
|
||||||
| (16 | 25 | 27, 2..=10)
|
| (16 | 26 | 28, 2..=10)
|
||||||
| (17 | 24, 2..=12)
|
| (17 | 25, 2..=12)
|
||||||
| (18 | 19 | 20 | 21 | 23 | 26 | 28, 2..=8)
|
| (18 | 19 | 20 | 21 | 22 | 24 | 27 | 29, 2..=8)
|
||||||
| (22, 2..=9 | 12..=18) => {
|
| (23, 2..=9 | 12..=18) => {
|
||||||
assert_eq!(result_cell.bg, Color::Magenta);
|
assert_eq!(result_cell.bg, Color::Magenta);
|
||||||
assert_eq!(result_cell.fg, Color::White);
|
assert_eq!(result_cell.fg, Color::White);
|
||||||
}
|
}
|
||||||
// The URL is yellow and underlined
|
// The URL is yellow and underlined
|
||||||
(31, 25..=60) => {
|
(32, 25..=60) => {
|
||||||
assert_eq!(result_cell.bg, Color::Magenta);
|
assert_eq!(result_cell.bg, Color::Magenta);
|
||||||
assert_eq!(result_cell.fg, Color::White);
|
assert_eq!(result_cell.fg, Color::White);
|
||||||
assert_eq!(result_cell.modifier, Modifier::UNDERLINED);
|
assert_eq!(result_cell.modifier, Modifier::UNDERLINED);
|
||||||
@@ -508,10 +512,9 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
/// Test that the help panel gets drawn with custom colors
|
/// Test that the help panel gets drawn with custom colors
|
||||||
/// This test is annoying
|
|
||||||
/// println!("{} {} {} {} {}", row_index, result_cell_index, result_cell.symbol(), result_cell.bg, result_cell.fg);
|
/// println!("{} {} {} {} {}", row_index, result_cell_index, result_cell.symbol(), result_cell.bg, result_cell.fg);
|
||||||
fn test_draw_blocks_help_custom_colors() {
|
fn test_draw_blocks_help_custom_colors() {
|
||||||
let mut setup = test_setup(87, 35, true, true);
|
let mut setup = test_setup(87, 36, true, true);
|
||||||
let mut colors = AppColors::new();
|
let mut colors = AppColors::new();
|
||||||
let tz = setup.app_data.lock().config.timezone.clone();
|
let tz = setup.app_data.lock().config.timezone.clone();
|
||||||
|
|
||||||
@@ -533,17 +536,16 @@ mod tests {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
assert_snapshot!(setup.terminal.backend());
|
assert_snapshot!(setup.terminal.backend());
|
||||||
|
|
||||||
for (row_index, result_row) in get_result(&setup) {
|
for (row_index, result_row) in get_result(&setup) {
|
||||||
for (result_cell_index, result_cell) in result_row.iter().enumerate() {
|
for (result_cell_index, result_cell) in result_row.iter().enumerate() {
|
||||||
match (row_index, result_cell_index) {
|
match (row_index, result_cell_index) {
|
||||||
// first & last row, and first & last char on each row, is reset/reset, making sure that the help info is centered in the given area
|
// first & last row, and first & last char on each row, is reset/reset, making sure that the help info is centered in the given area
|
||||||
(0 | 34, _) | (0..=33, 0 | 86) => {
|
(0 | 35, _) | (0..=34, 0 | 86) => {
|
||||||
assert_eq!(result_cell.bg, Color::Reset);
|
assert_eq!(result_cell.bg, Color::Reset);
|
||||||
assert_eq!(result_cell.fg, Color::Reset);
|
assert_eq!(result_cell.fg, Color::Reset);
|
||||||
}
|
}
|
||||||
// border is red on black
|
// border is red on black
|
||||||
(1 | 32, _) | (1..=31, 1 | 85) => {
|
(1 | 34, _) | (1..=31, 1 | 85) => {
|
||||||
assert_eq!(result_cell.bg, Color::Black);
|
assert_eq!(result_cell.bg, Color::Black);
|
||||||
assert_eq!(result_cell.fg, Color::Red);
|
assert_eq!(result_cell.fg, Color::Red);
|
||||||
}
|
}
|
||||||
@@ -552,15 +554,15 @@ mod tests {
|
|||||||
| (12, 19..=66)
|
| (12, 19..=66)
|
||||||
| (14, 2..=10 | 13..=27)
|
| (14, 2..=10 | 13..=27)
|
||||||
| (15, 2..=10 | 13..=21 | 24..=40 | 43..=56)
|
| (15, 2..=10 | 13..=21 | 24..=40 | 43..=56)
|
||||||
| (16 | 25 | 27, 2..=10)
|
| (16 | 26 | 28, 2..=10)
|
||||||
| (17 | 24, 2..=12)
|
| (17 | 25, 2..=12)
|
||||||
| (18 | 19 | 20 | 21 | 23 | 26 | 28, 2..=8)
|
| (18 | 19 | 20 | 21 | 22 | 24 | 27 | 29, 2..=8)
|
||||||
| (22, 2..=9 | 12..=18) => {
|
| (23, 2..=9 | 12..=18) => {
|
||||||
assert_eq!(result_cell.bg, Color::Black);
|
assert_eq!(result_cell.bg, Color::Black);
|
||||||
assert_eq!(result_cell.fg, Color::Yellow);
|
assert_eq!(result_cell.fg, Color::Yellow);
|
||||||
}
|
}
|
||||||
// The URL is yellow and underlined
|
// The URL is yellow and underlined
|
||||||
(31, 25..=60) => {
|
(32, 25..=60) => {
|
||||||
assert_eq!(result_cell.bg, Color::Black);
|
assert_eq!(result_cell.bg, Color::Black);
|
||||||
assert_eq!(result_cell.fg, Color::Yellow);
|
assert_eq!(result_cell.fg, Color::Yellow);
|
||||||
assert_eq!(result_cell.modifier, Modifier::UNDERLINED);
|
assert_eq!(result_cell.modifier, Modifier::UNDERLINED);
|
||||||
@@ -578,7 +580,7 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
/// Help panel will show custom keymap if in use, with one definition for each entry
|
/// Help panel will show custom keymap if in use, with one definition for each entry
|
||||||
fn test_draw_blocks_help_custom_keymap_one_definition() {
|
fn test_draw_blocks_help_custom_keymap_one_definition() {
|
||||||
let mut setup = test_setup(98, 49, true, true);
|
let mut setup = test_setup(98, 50, true, true);
|
||||||
|
|
||||||
let input = Keymap {
|
let input = Keymap {
|
||||||
clear: (KeyCode::Char('a'), None),
|
clear: (KeyCode::Char('a'), None),
|
||||||
@@ -586,33 +588,34 @@ mod tests {
|
|||||||
delete_deny: (KeyCode::Char('c'), None),
|
delete_deny: (KeyCode::Char('c'), None),
|
||||||
exec: (KeyCode::Char('d'), None),
|
exec: (KeyCode::Char('d'), None),
|
||||||
filter_mode: (KeyCode::Char('e'), None),
|
filter_mode: (KeyCode::Char('e'), None),
|
||||||
log_scroll_back: (KeyCode::Char('f'), None),
|
force_redraw: (KeyCode::Char('f'), None),
|
||||||
log_scroll_forward: (KeyCode::Char('g'), None),
|
log_scroll_back: (KeyCode::Char('g'), None),
|
||||||
log_section_height_decrease: (KeyCode::Char('h'), None),
|
log_scroll_forward: (KeyCode::Char('h'), None),
|
||||||
log_section_height_increase: (KeyCode::Char('i'), None),
|
log_section_height_decrease: (KeyCode::Char('i'), None),
|
||||||
log_section_toggle: (KeyCode::Char('j'), None),
|
log_section_height_increase: (KeyCode::Char('j'), None),
|
||||||
quit: (KeyCode::Char('k'), None),
|
log_section_toggle: (KeyCode::Char('k'), None),
|
||||||
save_logs: (KeyCode::Char('l'), None),
|
quit: (KeyCode::Char('l'), None),
|
||||||
scroll_down_many: (KeyCode::Char('m'), None),
|
save_logs: (KeyCode::Char('m'), None),
|
||||||
scroll_down_one: (KeyCode::Char('n'), None),
|
scroll_down_many: (KeyCode::Char('n'), None),
|
||||||
scroll_end: (KeyCode::Char('o'), None),
|
scroll_down_one: (KeyCode::Char('o'), None),
|
||||||
scroll_start: (KeyCode::Char('p'), None),
|
scroll_end: (KeyCode::Char('p'), None),
|
||||||
scroll_up_many: (KeyCode::Char('q'), None),
|
scroll_start: (KeyCode::Char('q'), None),
|
||||||
scroll_up_one: (KeyCode::Char('r'), None),
|
scroll_up_many: (KeyCode::Char('r'), None),
|
||||||
select_next_panel: (KeyCode::Char('s'), None),
|
scroll_up_one: (KeyCode::Char('s'), None),
|
||||||
select_previous_panel: (KeyCode::Char('t'), None),
|
select_next_panel: (KeyCode::Char('t'), None),
|
||||||
sort_by_cpu: (KeyCode::Char('u'), None),
|
select_previous_panel: (KeyCode::Char('u'), None),
|
||||||
sort_by_id: (KeyCode::Char('v'), None),
|
sort_by_cpu: (KeyCode::Char('v'), None),
|
||||||
sort_by_image: (KeyCode::Char('w'), None),
|
sort_by_id: (KeyCode::Char('w'), None),
|
||||||
sort_by_memory: (KeyCode::Char('x'), None),
|
sort_by_image: (KeyCode::Char('x'), None),
|
||||||
sort_by_name: (KeyCode::Char('y'), None),
|
sort_by_memory: (KeyCode::Char('y'), None),
|
||||||
sort_by_rx: (KeyCode::Char('z'), None),
|
sort_by_name: (KeyCode::Char('z'), None),
|
||||||
sort_by_state: (KeyCode::Char('0'), None),
|
sort_by_rx: (KeyCode::Char('0'), None),
|
||||||
sort_by_status: (KeyCode::Char('1'), None),
|
sort_by_state: (KeyCode::Char('1'), None),
|
||||||
sort_by_tx: (KeyCode::Char('2'), None),
|
sort_by_status: (KeyCode::Char('2'), None),
|
||||||
sort_reset: (KeyCode::Char('3'), None),
|
sort_by_tx: (KeyCode::Char('3'), None),
|
||||||
toggle_help: (KeyCode::Char('4'), None),
|
sort_reset: (KeyCode::Char('4'), None),
|
||||||
toggle_mouse_capture: (KeyCode::Char('5'), None),
|
toggle_help: (KeyCode::Char('5'), None),
|
||||||
|
toggle_mouse_capture: (KeyCode::Char('6'), None),
|
||||||
};
|
};
|
||||||
|
|
||||||
setup
|
setup
|
||||||
@@ -628,7 +631,7 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
/// Help panel will show custom keymap if in use, with two definition for each entry
|
/// Help panel will show custom keymap if in use, with two definition for each entry
|
||||||
fn test_draw_blocks_help_custom_keymap_two_definitions() {
|
fn test_draw_blocks_help_custom_keymap_two_definitions() {
|
||||||
let mut setup = test_setup(110, 49, true, true);
|
let mut setup = test_setup(110, 50, true, true);
|
||||||
|
|
||||||
let keymap = Keymap {
|
let keymap = Keymap {
|
||||||
clear: (KeyCode::Char('a'), Some(KeyCode::Char('A'))),
|
clear: (KeyCode::Char('a'), Some(KeyCode::Char('A'))),
|
||||||
@@ -636,6 +639,7 @@ mod tests {
|
|||||||
delete_deny: (KeyCode::Char('c'), Some(KeyCode::Char('C'))),
|
delete_deny: (KeyCode::Char('c'), Some(KeyCode::Char('C'))),
|
||||||
exec: (KeyCode::Char('d'), Some(KeyCode::Char('D'))),
|
exec: (KeyCode::Char('d'), Some(KeyCode::Char('D'))),
|
||||||
filter_mode: (KeyCode::Char('e'), Some(KeyCode::Char('E'))),
|
filter_mode: (KeyCode::Char('e'), Some(KeyCode::Char('E'))),
|
||||||
|
force_redraw: (KeyCode::Char('f'), Some(KeyCode::Char('F'))),
|
||||||
log_scroll_back: (KeyCode::Char('f'), Some(KeyCode::Char('F'))),
|
log_scroll_back: (KeyCode::Char('f'), Some(KeyCode::Char('F'))),
|
||||||
log_scroll_forward: (KeyCode::Char('g'), Some(KeyCode::Char('G'))),
|
log_scroll_forward: (KeyCode::Char('g'), Some(KeyCode::Char('G'))),
|
||||||
log_section_height_decrease: (KeyCode::Char('h'), Some(KeyCode::Char('H'))),
|
log_section_height_decrease: (KeyCode::Char('h'), Some(KeyCode::Char('H'))),
|
||||||
@@ -678,7 +682,7 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
/// Help panel will show custom keymap if in use, with either one or two definition for each entry
|
/// Help panel will show custom keymap if in use, with either one or two definition for each entry
|
||||||
fn test_draw_blocks_help_one_and_two_definitions() {
|
fn test_draw_blocks_help_one_and_two_definitions() {
|
||||||
let mut setup = test_setup(110, 49, true, true);
|
let mut setup = test_setup(110, 50, true, true);
|
||||||
|
|
||||||
let keymap = Keymap {
|
let keymap = Keymap {
|
||||||
clear: (KeyCode::Char('a'), Some(KeyCode::Char('A'))),
|
clear: (KeyCode::Char('a'), Some(KeyCode::Char('A'))),
|
||||||
@@ -686,33 +690,34 @@ mod tests {
|
|||||||
delete_deny: (KeyCode::Char('c'), Some(KeyCode::Char('C'))),
|
delete_deny: (KeyCode::Char('c'), Some(KeyCode::Char('C'))),
|
||||||
exec: (KeyCode::Char('d'), None),
|
exec: (KeyCode::Char('d'), None),
|
||||||
filter_mode: (KeyCode::Char('e'), Some(KeyCode::Char('E'))),
|
filter_mode: (KeyCode::Char('e'), Some(KeyCode::Char('E'))),
|
||||||
log_scroll_back: (KeyCode::Char('f'), None),
|
force_redraw: (KeyCode::Char('f'), None),
|
||||||
log_scroll_forward: (KeyCode::Char('g'), Some(KeyCode::Char('G'))),
|
log_scroll_back: (KeyCode::Char('g'), Some(KeyCode::Char('G'))),
|
||||||
log_section_height_decrease: (KeyCode::Char('h'), None),
|
log_scroll_forward: (KeyCode::Char('h'), None),
|
||||||
log_section_height_increase: (KeyCode::Char('i'), Some(KeyCode::Char('I'))),
|
log_section_height_decrease: (KeyCode::Char('i'), Some(KeyCode::Char('I'))),
|
||||||
log_section_toggle: (KeyCode::Char('j'), None),
|
log_section_height_increase: (KeyCode::Char('j'), None),
|
||||||
quit: (KeyCode::Char('k'), Some(KeyCode::Char('K'))),
|
log_section_toggle: (KeyCode::Char('k'), Some(KeyCode::Char('K'))),
|
||||||
save_logs: (KeyCode::Char('l'), None),
|
quit: (KeyCode::Char('l'), None),
|
||||||
scroll_down_many: (KeyCode::Char('m'), Some(KeyCode::Char('M'))),
|
save_logs: (KeyCode::Char('m'), Some(KeyCode::Char('M'))),
|
||||||
scroll_down_one: (KeyCode::Char('n'), None),
|
scroll_down_many: (KeyCode::Char('n'), None),
|
||||||
scroll_end: (KeyCode::Char('o'), Some(KeyCode::Char('O'))),
|
scroll_down_one: (KeyCode::Char('o'), Some(KeyCode::Char('O'))),
|
||||||
scroll_start: (KeyCode::Char('p'), None),
|
scroll_end: (KeyCode::Char('p'), None),
|
||||||
scroll_up_many: (KeyCode::Char('q'), Some(KeyCode::Char('Q'))),
|
scroll_start: (KeyCode::Char('q'), Some(KeyCode::Char('Q'))),
|
||||||
scroll_up_one: (KeyCode::Char('r'), None),
|
scroll_up_many: (KeyCode::Char('r'), None),
|
||||||
select_next_panel: (KeyCode::Char('s'), Some(KeyCode::Char('S'))),
|
scroll_up_one: (KeyCode::Char('s'), Some(KeyCode::Char('S'))),
|
||||||
select_previous_panel: (KeyCode::Char('t'), None),
|
select_next_panel: (KeyCode::Char('t'), None),
|
||||||
sort_by_cpu: (KeyCode::Char('u'), Some(KeyCode::Char('U'))),
|
select_previous_panel: (KeyCode::Char('u'), Some(KeyCode::Char('U'))),
|
||||||
sort_by_id: (KeyCode::Char('v'), None),
|
sort_by_cpu: (KeyCode::Char('v'), None),
|
||||||
sort_by_image: (KeyCode::Char('w'), Some(KeyCode::Char('W'))),
|
sort_by_id: (KeyCode::Char('w'), Some(KeyCode::Char('W'))),
|
||||||
sort_by_memory: (KeyCode::Char('x'), None),
|
sort_by_image: (KeyCode::Char('x'), None),
|
||||||
sort_by_name: (KeyCode::Char('y'), Some(KeyCode::Char('Y'))),
|
sort_by_memory: (KeyCode::Char('y'), Some(KeyCode::Char('Y'))),
|
||||||
sort_by_rx: (KeyCode::Char('z'), None),
|
sort_by_name: (KeyCode::Char('z'), None),
|
||||||
sort_by_state: (KeyCode::Char('0'), Some(KeyCode::Char('9'))),
|
sort_by_rx: (KeyCode::Char('0'), Some(KeyCode::Char('9'))),
|
||||||
sort_by_status: (KeyCode::Char('1'), None),
|
sort_by_state: (KeyCode::Char('1'), None),
|
||||||
sort_by_tx: (KeyCode::Char('2'), Some(KeyCode::Char('7'))),
|
sort_by_status: (KeyCode::Char('2'), Some(KeyCode::Char('7'))),
|
||||||
sort_reset: (KeyCode::Char('3'), None),
|
sort_by_tx: (KeyCode::Char('3'), None),
|
||||||
toggle_help: (KeyCode::Char('4'), Some(KeyCode::Char('5'))),
|
sort_reset: (KeyCode::Char('4'), Some(KeyCode::Char('5'))),
|
||||||
toggle_mouse_capture: (KeyCode::Char('5'), None),
|
toggle_help: (KeyCode::Char('5'), None),
|
||||||
|
toggle_mouse_capture: (KeyCode::Char('6'), Some(KeyCode::Char('7'))),
|
||||||
};
|
};
|
||||||
|
|
||||||
let tz = setup.app_data.lock().config.timezone.clone();
|
let tz = setup.app_data.lock().config.timezone.clone();
|
||||||
@@ -749,10 +754,10 @@ mod tests {
|
|||||||
for (row_index, result_row) in get_result(&setup) {
|
for (row_index, result_row) in get_result(&setup) {
|
||||||
for (result_cell_index, result_cell) in result_row.iter().enumerate() {
|
for (result_cell_index, result_cell) in result_row.iter().enumerate() {
|
||||||
match (row_index, result_cell_index) {
|
match (row_index, result_cell_index) {
|
||||||
(14, 31..=45) => {
|
(13, 31..=45) => {
|
||||||
assert_eq!(result_cell.fg, AppColors::new().popup_help.text);
|
assert_eq!(result_cell.fg, AppColors::new().popup_help.text);
|
||||||
}
|
}
|
||||||
(14, 46..=55) => {
|
(13, 46..=55) => {
|
||||||
assert_eq!(result_cell.fg, AppColors::new().popup_help.text_highlight);
|
assert_eq!(result_cell.fg, AppColors::new().popup_help.text_highlight);
|
||||||
}
|
}
|
||||||
_ => (),
|
_ => (),
|
||||||
|
|||||||
+1
@@ -21,6 +21,7 @@ expression: setup.terminal.backend()
|
|||||||
" │ ( ← → ) horizontal scroll across logs │ "
|
" │ ( ← → ) horizontal scroll across logs │ "
|
||||||
" │ ( enter ) send docker container command │ "
|
" │ ( enter ) send docker container command │ "
|
||||||
" │ ( e ) exec into a container │ "
|
" │ ( e ) exec into a container │ "
|
||||||
|
" │ ( f ) force clear the screen & redraw the gui │ "
|
||||||
" │ ( h ) toggle this help information - or click heading │ "
|
" │ ( h ) toggle this help information - or click heading │ "
|
||||||
" │ ( s ) save logs to file │ "
|
" │ ( s ) save logs to file │ "
|
||||||
" │ ( m ) toggle mouse capture - if disabled, text on screen can be selected & copied │ "
|
" │ ( m ) toggle mouse capture - if disabled, text on screen can be selected & copied │ "
|
||||||
|
|||||||
+1
@@ -21,6 +21,7 @@ expression: setup.terminal.backend()
|
|||||||
" │ ( ← → ) horizontal scroll across logs │ "
|
" │ ( ← → ) horizontal scroll across logs │ "
|
||||||
" │ ( enter ) send docker container command │ "
|
" │ ( enter ) send docker container command │ "
|
||||||
" │ ( e ) exec into a container │ "
|
" │ ( e ) exec into a container │ "
|
||||||
|
" │ ( f ) force clear the screen & redraw the gui │ "
|
||||||
" │ ( h ) toggle this help information - or click heading │ "
|
" │ ( h ) toggle this help information - or click heading │ "
|
||||||
" │ ( s ) save logs to file │ "
|
" │ ( s ) save logs to file │ "
|
||||||
" │ ( m ) toggle mouse capture - if disabled, text on screen can be selected & copied │ "
|
" │ ( m ) toggle mouse capture - if disabled, text on screen can be selected & copied │ "
|
||||||
|
|||||||
+28
-27
@@ -15,37 +15,38 @@ expression: setup.terminal.backend()
|
|||||||
" │ │ "
|
" │ │ "
|
||||||
" │ A simple tui to view & control docker containers │ "
|
" │ A simple tui to view & control docker containers │ "
|
||||||
" │ │ "
|
" │ │ "
|
||||||
" │ ( s ) select next panel │ "
|
" │ ( t ) select next panel │ "
|
||||||
" │ ( t ) select previous panel │ "
|
" │ ( u ) select previous panel │ "
|
||||||
" │ ( n ) scroll list down by one │ "
|
" │ ( o ) scroll list down by one │ "
|
||||||
" │ ( r ) scroll list up by one │ "
|
" │ ( s ) scroll list up by one │ "
|
||||||
" │ ( m ) scroll list down by many │ "
|
" │ ( n ) scroll list down by many │ "
|
||||||
" │ ( q ) scroll list by up many │ "
|
" │ ( r ) scroll list by up many │ "
|
||||||
" │ ( o ) scroll list to end │ "
|
" │ ( p ) scroll list to end │ "
|
||||||
" │ ( p ) scroll list to start │ "
|
" │ ( q ) scroll list to start │ "
|
||||||
" │ ( g ) horizontal scroll logs right │ "
|
" │ ( h ) horizontal scroll logs right │ "
|
||||||
" │ ( f ) horizontal scroll logs left │ "
|
" │ ( g ) horizontal scroll logs left │ "
|
||||||
" │ ( enter ) send docker container command │ "
|
" │ ( enter ) send docker container command │ "
|
||||||
" │ ( d ) exec into a container │ "
|
" │ ( d ) exec into a container │ "
|
||||||
" │ ( 4 ) toggle this help information - or click heading │ "
|
" │ ( f ) force clear the screen & redraw the gui │ "
|
||||||
" │ ( l ) save logs to file │ "
|
" │ ( 5 ) toggle this help information - or click heading │ "
|
||||||
" │ ( 5 ) toggle mouse capture - if disabled, text on screen can be selected & copied │ "
|
" │ ( m ) save logs to file │ "
|
||||||
|
" │ ( 6 ) toggle mouse capture - if disabled, text on screen can be selected & copied │ "
|
||||||
" │ ( e ) enter filter mode │ "
|
" │ ( e ) enter filter mode │ "
|
||||||
" │ ( 3 ) reset container sorting │ "
|
" │ ( 4 ) reset container sorting │ "
|
||||||
" │ ( y ) sort containers by name │ "
|
" │ ( z ) sort containers by name │ "
|
||||||
" │ ( 0 ) sort containers by state │ "
|
" │ ( 1 ) sort containers by state │ "
|
||||||
" │ ( 1 ) sort containers by status │ "
|
" │ ( 2 ) sort containers by status │ "
|
||||||
" │ ( u ) sort containers by cpu │ "
|
" │ ( v ) sort containers by cpu │ "
|
||||||
" │ ( x ) sort containers by memory │ "
|
" │ ( y ) sort containers by memory │ "
|
||||||
" │ ( v ) sort containers by id │ "
|
" │ ( w ) sort containers by id │ "
|
||||||
" │ ( w ) sort containers by image │ "
|
" │ ( x ) sort containers by image │ "
|
||||||
" │ ( z ) sort containers by rx │ "
|
" │ ( 0 ) sort containers by rx │ "
|
||||||
" │ ( 2 ) sort containers by tx │ "
|
" │ ( 3 ) sort containers by tx │ "
|
||||||
" │ ( h ) decrease log section height │ "
|
" │ ( i ) decrease log section height │ "
|
||||||
" │ ( i ) increase log section height │ "
|
" │ ( j ) increase log section height │ "
|
||||||
" │ ( j ) toggle log section visibility │ "
|
" │ ( k ) toggle log section visibility │ "
|
||||||
" │ ( a ) close dialog │ "
|
" │ ( a ) close dialog │ "
|
||||||
" │ ( k ) quit at any time │ "
|
" │ ( l ) quit at any time │ "
|
||||||
" │ │ "
|
" │ │ "
|
||||||
" │ currently an early work in progress, all and any input appreciated │ "
|
" │ currently an early work in progress, all and any input appreciated │ "
|
||||||
" │ https://github.com/mrjackwills/oxker │ "
|
" │ https://github.com/mrjackwills/oxker │ "
|
||||||
|
|||||||
+1
@@ -27,6 +27,7 @@ expression: setup.terminal.backend()
|
|||||||
" │ ( f ) or ( F ) horizontal scroll logs left │ "
|
" │ ( f ) or ( F ) horizontal scroll logs left │ "
|
||||||
" │ ( enter ) send docker container command │ "
|
" │ ( enter ) send docker container command │ "
|
||||||
" │ ( d ) or ( D ) exec into a container │ "
|
" │ ( d ) or ( D ) exec into a container │ "
|
||||||
|
" │ ( f ) or ( F ) force clear the screen & redraw the gui │ "
|
||||||
" │ ( 4 ) or ( 5 ) toggle this help information - or click heading │ "
|
" │ ( 4 ) or ( 5 ) toggle this help information - or click heading │ "
|
||||||
" │ ( l ) or ( L ) save logs to file │ "
|
" │ ( l ) or ( L ) save logs to file │ "
|
||||||
" │ ( 5 ) or ( Page Down ) toggle mouse capture - if disabled, text on screen can be selected & copied │ "
|
" │ ( 5 ) or ( Page Down ) toggle mouse capture - if disabled, text on screen can be selected & copied │ "
|
||||||
|
|||||||
+50
-49
@@ -2,52 +2,53 @@
|
|||||||
source: src/ui/draw_blocks/help.rs
|
source: src/ui/draw_blocks/help.rs
|
||||||
expression: setup.terminal.backend()
|
expression: setup.terminal.backend()
|
||||||
---
|
---
|
||||||
" ╭ 0.00.000 ──────────────────────────────────────────────────────────────────────────╮ "
|
" ╭ 0.00.000 ──────────────────────────────────────────────────────────────────────────────────╮ "
|
||||||
" │ │ "
|
" │ │ "
|
||||||
" │ 88 │ "
|
" │ 88 │ "
|
||||||
" │ 88 │ "
|
" │ 88 │ "
|
||||||
" │ 88 │ "
|
" │ 88 │ "
|
||||||
" │ ,adPPYba, 8b, ,d8 88 ,d8 ,adPPYba, 8b,dPPYba, │ "
|
" │ ,adPPYba, 8b, ,d8 88 ,d8 ,adPPYba, 8b,dPPYba, │ "
|
||||||
" │ a8" "8a `Y8, ,8P' 88 ,a8" a8P_____88 88P' "Y8 │ "
|
" │ a8" "8a `Y8, ,8P' 88 ,a8" a8P_____88 88P' "Y8 │ "
|
||||||
" │ 8b d8 )888( 8888[ 8PP""""""" 88 │ "
|
" │ 8b d8 )888( 8888[ 8PP""""""" 88 │ "
|
||||||
" │ "8a, ,a8" ,d8" "8b, 88`"Yba, "8b, ,aa 88 │ "
|
" │ "8a, ,a8" ,d8" "8b, 88`"Yba, "8b, ,aa 88 │ "
|
||||||
" │ `"YbbdP"' 8P' `Y8 88 `Y8a `"Ybbd8"' 88 │ "
|
" │ `"YbbdP"' 8P' `Y8 88 `Y8a `"Ybbd8"' 88 │ "
|
||||||
" │ │ "
|
" │ │ "
|
||||||
" │ A simple tui to view & control docker containers │ "
|
" │ A simple tui to view & control docker containers │ "
|
||||||
" │ │ "
|
" │ │ "
|
||||||
" │ ( s ) or ( S ) select next panel │ "
|
" │ ( t ) select next panel │ "
|
||||||
" │ ( t ) select previous panel │ "
|
" │ ( u ) or ( U ) select previous panel │ "
|
||||||
" │ ( n ) scroll list down by one │ "
|
" │ ( o ) or ( O ) scroll list down by one │ "
|
||||||
" │ ( r ) scroll list up by one │ "
|
" │ ( s ) or ( S ) scroll list up by one │ "
|
||||||
" │ ( m ) or ( M ) scroll list down by many │ "
|
" │ ( n ) scroll list down by many │ "
|
||||||
" │ ( q ) or ( Q ) scroll list by up many │ "
|
" │ ( r ) scroll list by up many │ "
|
||||||
" │ ( o ) or ( O ) scroll list to end │ "
|
" │ ( p ) scroll list to end │ "
|
||||||
" │ ( p ) scroll list to start │ "
|
" │ ( q ) or ( Q ) scroll list to start │ "
|
||||||
" │ ( g ) or ( G ) horizontal scroll logs right │ "
|
" │ ( h ) horizontal scroll logs right │ "
|
||||||
" │ ( f ) horizontal scroll logs left │ "
|
" │ ( g ) or ( G ) horizontal scroll logs left │ "
|
||||||
" │ ( enter ) send docker container command │ "
|
" │ ( enter ) send docker container command │ "
|
||||||
" │ ( d ) exec into a container │ "
|
" │ ( d ) exec into a container │ "
|
||||||
" │ ( 4 ) or ( 5 ) toggle this help information - or click heading │ "
|
" │ ( f ) force clear the screen & redraw the gui │ "
|
||||||
" │ ( l ) save logs to file │ "
|
" │ ( 5 ) toggle this help information - or click heading │ "
|
||||||
" │ ( 5 ) toggle mouse capture - if disabled, text on screen can be selected & copied │ "
|
" │ ( m ) or ( M ) save logs to file │ "
|
||||||
" │ ( e ) or ( E ) enter filter mode │ "
|
" │ ( 6 ) or ( 7 ) toggle mouse capture - if disabled, text on screen can be selected & copied │ "
|
||||||
" │ ( 3 ) reset container sorting │ "
|
" │ ( e ) or ( E ) enter filter mode │ "
|
||||||
" │ ( y ) or ( Y ) sort containers by name │ "
|
" │ ( 4 ) or ( 5 ) reset container sorting │ "
|
||||||
" │ ( 0 ) or ( 9 ) sort containers by state │ "
|
" │ ( z ) sort containers by name │ "
|
||||||
" │ ( 1 ) sort containers by status │ "
|
" │ ( 1 ) sort containers by state │ "
|
||||||
" │ ( u ) or ( U ) sort containers by cpu │ "
|
" │ ( 2 ) or ( 7 ) sort containers by status │ "
|
||||||
" │ ( x ) sort containers by memory │ "
|
" │ ( v ) sort containers by cpu │ "
|
||||||
" │ ( v ) sort containers by id │ "
|
" │ ( y ) or ( Y ) sort containers by memory │ "
|
||||||
" │ ( w ) or ( W ) sort containers by image │ "
|
" │ ( w ) or ( W ) sort containers by id │ "
|
||||||
" │ ( z ) sort containers by rx │ "
|
" │ ( x ) sort containers by image │ "
|
||||||
" │ ( 2 ) or ( 7 ) sort containers by tx │ "
|
" │ ( 0 ) or ( 9 ) sort containers by rx │ "
|
||||||
" │ ( h ) decrease log section height │ "
|
" │ ( 3 ) sort containers by tx │ "
|
||||||
" │ ( i ) or ( I ) increase log section height │ "
|
" │ ( i ) or ( I ) decrease log section height │ "
|
||||||
" │ ( j ) toggle log section visibility │ "
|
" │ ( j ) increase log section height │ "
|
||||||
" │ ( a ) or ( A ) close dialog │ "
|
" │ ( k ) or ( K ) toggle log section visibility │ "
|
||||||
" │ ( k ) or ( K ) quit at any time │ "
|
" │ ( a ) or ( A ) close dialog │ "
|
||||||
" │ │ "
|
" │ ( l ) quit at any time │ "
|
||||||
" │ currently an early work in progress, all and any input appreciated │ "
|
" │ │ "
|
||||||
" │ https://github.com/mrjackwills/oxker │ "
|
" │ currently an early work in progress, all and any input appreciated │ "
|
||||||
" │ │ "
|
" │ https://github.com/mrjackwills/oxker │ "
|
||||||
" ╰────────────────────────────────────────────────────────────────────────────────────╯ "
|
" │ │ "
|
||||||
|
" ╰────────────────────────────────────────────────────────────────────────────────────────────╯ "
|
||||||
|
|||||||
+2
-2
@@ -2,7 +2,6 @@
|
|||||||
source: src/ui/draw_blocks/help.rs
|
source: src/ui/draw_blocks/help.rs
|
||||||
expression: setup.terminal.backend()
|
expression: setup.terminal.backend()
|
||||||
---
|
---
|
||||||
" "
|
|
||||||
" ╭ 0.00.000 ─────────────────────────────────────────────────────────────────────────╮ "
|
" ╭ 0.00.000 ─────────────────────────────────────────────────────────────────────────╮ "
|
||||||
" │ │ "
|
" │ │ "
|
||||||
" │ 88 │ "
|
" │ 88 │ "
|
||||||
@@ -23,6 +22,7 @@ expression: setup.terminal.backend()
|
|||||||
" │ ( ← → ) horizontal scroll across logs │ "
|
" │ ( ← → ) horizontal scroll across logs │ "
|
||||||
" │ ( enter ) send docker container command │ "
|
" │ ( enter ) send docker container command │ "
|
||||||
" │ ( e ) exec into a container │ "
|
" │ ( e ) exec into a container │ "
|
||||||
|
" │ ( f ) force clear the screen & redraw the gui │ "
|
||||||
" │ ( h ) toggle this help information - or click heading │ "
|
" │ ( h ) toggle this help information - or click heading │ "
|
||||||
" │ ( s ) save logs to file │ "
|
" │ ( s ) save logs to file │ "
|
||||||
" │ ( m ) toggle mouse capture - if disabled, text on screen can be selected & copied │ "
|
" │ ( m ) toggle mouse capture - if disabled, text on screen can be selected & copied │ "
|
||||||
@@ -37,5 +37,5 @@ expression: setup.terminal.backend()
|
|||||||
" │ currently an early work in progress, all and any input appreciated │ "
|
" │ currently an early work in progress, all and any input appreciated │ "
|
||||||
" │ https://github.com/mrjackwills/oxker │ "
|
" │ https://github.com/mrjackwills/oxker │ "
|
||||||
" │ │ "
|
" │ │ "
|
||||||
|
" │ │ "
|
||||||
" ╰───────────────────────────────────────────────────────────────────────────────────╯ "
|
" ╰───────────────────────────────────────────────────────────────────────────────────╯ "
|
||||||
" "
|
|
||||||
|
|||||||
+7
-7
@@ -23,6 +23,7 @@ expression: setup.terminal.backend()
|
|||||||
"│ │ ( ← → ) horizontal scroll across logs │ │"
|
"│ │ ( ← → ) horizontal scroll across logs │ │"
|
||||||
"│ │ ( enter ) send docker container command │ │"
|
"│ │ ( enter ) send docker container command │ │"
|
||||||
"│ │ ( e ) exec into a container │ │"
|
"│ │ ( e ) exec into a container │ │"
|
||||||
|
"│ │ ( f ) force clear the screen & redraw the gui │ │"
|
||||||
"│ │ ( h ) toggle this help information - or click heading │ │"
|
"│ │ ( h ) toggle this help information - or click heading │ │"
|
||||||
"│ │ ( s ) save logs to file │ │"
|
"│ │ ( s ) save logs to file │ │"
|
||||||
"│ │ ( m ) toggle mouse capture - if disabled, text on screen can be selected & copied │ │"
|
"│ │ ( m ) toggle mouse capture - if disabled, text on screen can be selected & copied │ │"
|
||||||
@@ -30,13 +31,12 @@ expression: setup.terminal.backend()
|
|||||||
"│ │ ( 0 ) stop sort │ │"
|
"│ │ ( 0 ) stop sort │ │"
|
||||||
"│ │ ( 1 - 9 ) sort by header - or click header │ │"
|
"│ │ ( 1 - 9 ) sort by header - or click header │ │"
|
||||||
"│ │ ( - = ) change log section height │ │"
|
"│ │ ( - = ) change log section height │ │"
|
||||||
"│ │ ( \ ) toggle log section visibility │ │"
|
"╰────────────────────────────────────│ ( \ ) toggle log section visibility │────────────────────────────────────╯"
|
||||||
"╰────────────────────────────────────│ ( esc ) close dialog │────────────────────────────────────╯"
|
"╭───────────────────────── cpu 03.00%│ ( esc ) close dialog │──────╮╭────────── ports ───────────╮"
|
||||||
"╭───────────────────────── cpu 03.00%│ ( q ) quit at any time │──────╮╭────────── ports ───────────╮"
|
"│10.00%│ •• │ ( q ) quit at any time │ ││ ip private public│"
|
||||||
"│10.00%│ •• │ │ ││ ip private public│"
|
"│ │ • • │ │ ││ 8001 │"
|
||||||
"│ │ • • │ currently an early work in progress, all and any input appreciated │ ││ 8001 │"
|
"│ │ •• • │ currently an early work in progress, all and any input appreciated │ ││127.0.0.1 8003 8003│"
|
||||||
"│ │ •• • │ https://github.com/mrjackwills/oxker │ ││127.0.0.1 8003 8003│"
|
"│ │ • • │ https://github.com/mrjackwills/oxker │ ││ │"
|
||||||
"│ │ • • │ │ ││ │"
|
|
||||||
"│ │ •• • • │ │ ││ │"
|
"│ │ •• • • │ │ ││ │"
|
||||||
"│ │• •• ╰────────────────────────────────────────────────────────────────────────────────────╯ ││ │"
|
"│ │• •• ╰────────────────────────────────────────────────────────────────────────────────────╯ ││ │"
|
||||||
"│ │• • ││ │• • ││ │"
|
"│ │• • ││ │• • ││ │"
|
||||||
|
|||||||
+19
-14
@@ -217,7 +217,7 @@ impl GuiState {
|
|||||||
pub fn log_height_increase(&mut self) {
|
pub fn log_height_increase(&mut self) {
|
||||||
if self.show_logs && self.log_height <= 75 {
|
if self.show_logs && self.log_height <= 75 {
|
||||||
self.log_height = self.log_height.saturating_add(5);
|
self.log_height = self.log_height.saturating_add(5);
|
||||||
self.rerender.update();
|
self.rerender.update_draw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -230,7 +230,7 @@ impl GuiState {
|
|||||||
self.show_logs = false;
|
self.show_logs = false;
|
||||||
self.selected_panel = SelectablePanel::Containers;
|
self.selected_panel = SelectablePanel::Containers;
|
||||||
}
|
}
|
||||||
self.rerender.update();
|
self.rerender.update_draw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -253,7 +253,7 @@ impl GuiState {
|
|||||||
if !self.show_logs && self.selected_panel == SelectablePanel::Logs {
|
if !self.show_logs && self.selected_panel == SelectablePanel::Logs {
|
||||||
self.selected_panel = SelectablePanel::Containers;
|
self.selected_panel = SelectablePanel::Containers;
|
||||||
}
|
}
|
||||||
self.rerender.update();
|
self.rerender.update_draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Set the log_height to zero, for now only used by tests
|
/// Set the log_height to zero, for now only used by tests
|
||||||
@@ -272,6 +272,11 @@ impl GuiState {
|
|||||||
self.intersect_panel.clear();
|
self.intersect_panel.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Set the rerender clear to true, to flush the screen and redraw
|
||||||
|
pub fn set_clear(&self) {
|
||||||
|
self.rerender.set_clear();
|
||||||
|
}
|
||||||
|
|
||||||
/// Get the currently selected panel
|
/// Get the currently selected panel
|
||||||
pub const fn get_selected_panel(&self) -> SelectablePanel {
|
pub const fn get_selected_panel(&self) -> SelectablePanel {
|
||||||
self.selected_panel
|
self.selected_panel
|
||||||
@@ -287,7 +292,7 @@ impl GuiState {
|
|||||||
.first()
|
.first()
|
||||||
{
|
{
|
||||||
self.selected_panel = *data.0;
|
self.selected_panel = *data.0;
|
||||||
self.rerender.update();
|
self.rerender.update_draw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -360,7 +365,7 @@ impl GuiState {
|
|||||||
self.status_del(Status::DeleteConfirm);
|
self.status_del(Status::DeleteConfirm);
|
||||||
}
|
}
|
||||||
self.delete_container_id = id;
|
self.delete_container_id = id;
|
||||||
self.rerender.update();
|
self.rerender.update_draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return a copy of the Status HashSet
|
/// Return a copy of the Status HashSet
|
||||||
@@ -381,7 +386,7 @@ impl GuiState {
|
|||||||
}
|
}
|
||||||
_ => (),
|
_ => (),
|
||||||
}
|
}
|
||||||
self.rerender.update();
|
self.rerender.update_draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Inset the ExecMode into self, and set the Status as exec
|
/// Inset the ExecMode into self, and set the Status as exec
|
||||||
@@ -390,7 +395,7 @@ impl GuiState {
|
|||||||
pub fn set_exec_mode(&mut self, mode: ExecMode) {
|
pub fn set_exec_mode(&mut self, mode: ExecMode) {
|
||||||
self.exec_mode = Some(mode);
|
self.exec_mode = Some(mode);
|
||||||
self.status.insert(Status::Exec);
|
self.status.insert(Status::Exec);
|
||||||
self.rerender.update();
|
self.rerender.update_draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_exec_mode(&self) -> Option<ExecMode> {
|
pub fn get_exec_mode(&self) -> Option<ExecMode> {
|
||||||
@@ -402,7 +407,7 @@ impl GuiState {
|
|||||||
pub fn status_push(&mut self, status: Status) {
|
pub fn status_push(&mut self, status: Status) {
|
||||||
if status != Status::Exec {
|
if status != Status::Exec {
|
||||||
self.status.insert(status);
|
self.status.insert(status);
|
||||||
self.rerender.update();
|
self.rerender.update_draw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -415,7 +420,7 @@ impl GuiState {
|
|||||||
{
|
{
|
||||||
self.selected_panel = self.selected_panel.next();
|
self.selected_panel = self.selected_panel.next();
|
||||||
}
|
}
|
||||||
self.rerender.update();
|
self.rerender.update_draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Change to previous selectable panel
|
/// Change to previous selectable panel
|
||||||
@@ -427,7 +432,7 @@ impl GuiState {
|
|||||||
{
|
{
|
||||||
self.selected_panel = self.selected_panel.prev();
|
self.selected_panel = self.selected_panel.prev();
|
||||||
}
|
}
|
||||||
self.rerender.update();
|
self.rerender.update_draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Insert a new loading_uuid into HashSet, and advance the loading_index by one frame, or reset to 0 if at end of array
|
/// Insert a new loading_uuid into HashSet, and advance the loading_index by one frame, or reset to 0 if at end of array
|
||||||
@@ -438,7 +443,7 @@ impl GuiState {
|
|||||||
self.loading_index += 1;
|
self.loading_index += 1;
|
||||||
}
|
}
|
||||||
self.loading_set.insert(uuid);
|
self.loading_set.insert(uuid);
|
||||||
self.rerender.update();
|
self.rerender.update_draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_loading(&self) -> bool {
|
pub fn is_loading(&self) -> bool {
|
||||||
@@ -471,7 +476,7 @@ impl GuiState {
|
|||||||
/// Stop the loading_spin function, and reset gui loading status
|
/// Stop the loading_spin function, and reset gui loading status
|
||||||
pub fn stop_loading_animation(&mut self, loading_uuid: Uuid) {
|
pub fn stop_loading_animation(&mut self, loading_uuid: Uuid) {
|
||||||
self.loading_set.remove(&loading_uuid);
|
self.loading_set.remove(&loading_uuid);
|
||||||
self.rerender.update();
|
self.rerender.update_draw();
|
||||||
if self.loading_set.is_empty() {
|
if self.loading_set.is_empty() {
|
||||||
self.loading_index = 0;
|
self.loading_index = 0;
|
||||||
if let Some(h) = &self.loading_handle {
|
if let Some(h) = &self.loading_handle {
|
||||||
@@ -484,12 +489,12 @@ impl GuiState {
|
|||||||
/// Set info box content
|
/// Set info box content
|
||||||
pub fn set_info_box(&mut self, text: &str) {
|
pub fn set_info_box(&mut self, text: &str) {
|
||||||
self.info_box_text = Some((text.to_owned(), std::time::Instant::now()));
|
self.info_box_text = Some((text.to_owned(), std::time::Instant::now()));
|
||||||
self.rerender.update();
|
self.rerender.update_draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Remove info box content
|
/// Remove info box content
|
||||||
pub fn reset_info_box(&mut self) {
|
pub fn reset_info_box(&mut self) {
|
||||||
self.info_box_text = None;
|
self.info_box_text = None;
|
||||||
self.rerender.update();
|
self.rerender.update_draw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+17
-8
@@ -50,7 +50,7 @@ pub struct Ui {
|
|||||||
input_tx: Sender<InputMessages>,
|
input_tx: Sender<InputMessages>,
|
||||||
is_running: Arc<AtomicBool>,
|
is_running: Arc<AtomicBool>,
|
||||||
now: Instant,
|
now: Instant,
|
||||||
redraw: Arc<Rerender>,
|
rerender: Arc<Rerender>,
|
||||||
terminal: Terminal<CrosstermBackend<Stdout>>,
|
terminal: Terminal<CrosstermBackend<Stdout>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,7 +73,7 @@ impl Ui {
|
|||||||
gui_state: Arc<Mutex<GuiState>>,
|
gui_state: Arc<Mutex<GuiState>>,
|
||||||
input_tx: Sender<InputMessages>,
|
input_tx: Sender<InputMessages>,
|
||||||
is_running: Arc<AtomicBool>,
|
is_running: Arc<AtomicBool>,
|
||||||
redraw: Arc<Rerender>,
|
rerender: Arc<Rerender>,
|
||||||
) {
|
) {
|
||||||
match Self::setup_terminal() {
|
match Self::setup_terminal() {
|
||||||
Ok(mut terminal) => {
|
Ok(mut terminal) => {
|
||||||
@@ -85,7 +85,7 @@ impl Ui {
|
|||||||
input_tx,
|
input_tx,
|
||||||
is_running,
|
is_running,
|
||||||
now: Instant::now(),
|
now: Instant::now(),
|
||||||
redraw,
|
rerender,
|
||||||
terminal,
|
terminal,
|
||||||
};
|
};
|
||||||
if let Err(e) = ui.draw_ui().await {
|
if let Err(e) = ui.draw_ui().await {
|
||||||
@@ -169,6 +169,13 @@ impl Ui {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Check if the user has attempt to clear the screen, and if so clear and redraw
|
||||||
|
fn check_clear(&mut self) {
|
||||||
|
if self.rerender.get_clear() {
|
||||||
|
self.terminal.clear().ok();
|
||||||
|
self.rerender.update_draw();
|
||||||
|
}
|
||||||
|
}
|
||||||
/// Use external docker cli to exec into a container
|
/// Use external docker cli to exec into a container
|
||||||
async fn exec(&mut self) {
|
async fn exec(&mut self) {
|
||||||
let exec_mode = self.gui_state.lock().get_exec_mode();
|
let exec_mode = self.gui_state.lock().get_exec_mode();
|
||||||
@@ -191,7 +198,8 @@ impl Ui {
|
|||||||
/// Use the previously redrawn time, the current time, the docker_interval, and the redraw struct, to calculate
|
/// Use the previously redrawn time, the current time, the docker_interval, and the redraw struct, to calculate
|
||||||
/// if the screen should be redrawn or not
|
/// if the screen should be redrawn or not
|
||||||
fn should_redraw(&self, previous: &mut Instant, docker_interval_ms: u128) -> bool {
|
fn should_redraw(&self, previous: &mut Instant, docker_interval_ms: u128) -> bool {
|
||||||
let result = self.redraw.swap() || previous.elapsed().as_millis() >= docker_interval_ms;
|
let result =
|
||||||
|
self.rerender.swap_draw() || previous.elapsed().as_millis() >= docker_interval_ms;
|
||||||
if result {
|
if result {
|
||||||
*previous = std::time::Instant::now();
|
*previous = std::time::Instant::now();
|
||||||
}
|
}
|
||||||
@@ -210,6 +218,10 @@ impl Ui {
|
|||||||
}
|
}
|
||||||
|
|
||||||
while self.is_running.load(Ordering::SeqCst) {
|
while self.is_running.load(Ordering::SeqCst) {
|
||||||
|
// if self.redraw.get_clear() {
|
||||||
|
// self.terminal.clear().ok();
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
if self.should_redraw(&mut drawn_at, docker_interval_ms) {
|
if self.should_redraw(&mut drawn_at, docker_interval_ms) {
|
||||||
let fd = FrameData::from(&*self);
|
let fd = FrameData::from(&*self);
|
||||||
|
|
||||||
@@ -249,15 +261,12 @@ impl Ui {
|
|||||||
}
|
}
|
||||||
} else if let Event::Resize(width, _) = event {
|
} else if let Event::Resize(width, _) = event {
|
||||||
self.gui_state.lock().clear_area_map();
|
self.gui_state.lock().clear_area_map();
|
||||||
|
|
||||||
// self.gui_state.lock().set_window_height(row);
|
|
||||||
|
|
||||||
self.terminal.autoresize().ok();
|
self.terminal.autoresize().ok();
|
||||||
// todo set screen width
|
|
||||||
self.gui_state.lock().set_screen_width(width);
|
self.gui_state.lock().set_screen_width(width);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
self.check_clear();
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
+26
-7
@@ -1,21 +1,40 @@
|
|||||||
use std::sync::atomic::{AtomicBool, Ordering};
|
use std::sync::atomic::{AtomicBool, Ordering};
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct Rerender(AtomicBool);
|
pub struct Rerender {
|
||||||
|
draw: AtomicBool,
|
||||||
|
clear: AtomicBool,
|
||||||
|
}
|
||||||
|
|
||||||
impl Rerender {
|
impl Rerender {
|
||||||
pub const fn new() -> Self {
|
pub const fn new() -> Self {
|
||||||
Self(AtomicBool::new(true))
|
Self {
|
||||||
|
draw: AtomicBool::new(true),
|
||||||
|
clear: AtomicBool::new(false),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn update(&self) {
|
pub fn update_draw(&self) {
|
||||||
self.0.store(true, Ordering::SeqCst);
|
self.draw.store(true, Ordering::SeqCst);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return the value of the self, and set to false
|
pub fn get_clear(&self) -> bool {
|
||||||
pub fn swap(&self) -> bool {
|
if self.clear.load(Ordering::SeqCst) {
|
||||||
|
self.clear.store(false, Ordering::SeqCst);
|
||||||
|
true
|
||||||
|
} else {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn set_clear(&self) {
|
||||||
|
self.clear.store(true, Ordering::SeqCst);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Return the value of the draw, and set to false
|
||||||
|
pub fn swap_draw(&self) -> bool {
|
||||||
match self
|
match self
|
||||||
.0
|
.draw
|
||||||
.compare_exchange(true, false, Ordering::SeqCst, Ordering::SeqCst)
|
.compare_exchange(true, false, Ordering::SeqCst, Ordering::SeqCst)
|
||||||
{
|
{
|
||||||
Ok(previous_value) => previous_value,
|
Ok(previous_value) => previous_value,
|
||||||
|
|||||||
Reference in New Issue
Block a user