refactor: filter mode displayed updated
This commit is contained in:
@@ -101,7 +101,7 @@ In application controls
|
|||||||
| ```( enter )```| Run selected docker command.|
|
| ```( enter )```| Run selected docker command.|
|
||||||
| ```( 1-9 )``` | Sort containers by heading, clicking on headings also sorts the selected column. |
|
| ```( 1-9 )``` | Sort containers by heading, clicking on headings also sorts the selected column. |
|
||||||
| ```( 0 )``` | Stop sorting.|
|
| ```( 0 )``` | Stop sorting.|
|
||||||
| ```( F1 )``` or ```( / )``` | Toggle filter mode. |
|
| ```( F1 )``` or ```( / )``` | Enter filter mode. |
|
||||||
| ```( e )``` | Exec into the selected container - not available on Windows.|
|
| ```( e )``` | Exec into the selected container - not available on Windows.|
|
||||||
| ```( 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.|
|
||||||
|
|||||||
@@ -388,11 +388,11 @@ impl InputHandler {
|
|||||||
/// Actions to take when Filter status active
|
/// Actions to take when Filter status active
|
||||||
fn handle_filter(&mut self, key_code: KeyCode) {
|
fn handle_filter(&mut self, key_code: KeyCode) {
|
||||||
match key_code {
|
match key_code {
|
||||||
KeyCode::F(1) | KeyCode::Char('/') | KeyCode::Esc => {
|
KeyCode::Esc => {
|
||||||
self.app_data.lock().filter_term_clear();
|
self.app_data.lock().filter_term_clear();
|
||||||
self.gui_state.lock().status_del(Status::Filter);
|
self.gui_state.lock().status_del(Status::Filter);
|
||||||
}
|
}
|
||||||
KeyCode::Enter => {
|
KeyCode::Enter | KeyCode::F(1) | KeyCode::Char('/') => {
|
||||||
self.gui_state.lock().status_del(Status::Filter);
|
self.gui_state.lock().status_del(Status::Filter);
|
||||||
}
|
}
|
||||||
KeyCode::Backspace => {
|
KeyCode::Backspace => {
|
||||||
|
|||||||
+15
-14
@@ -427,8 +427,8 @@ pub fn filter_bar(area: Rect, frame: &mut Frame, app_data: &Arc<Mutex<AppData>>)
|
|||||||
let style_but = Style::default().fg(Color::Black).bg(Color::Magenta);
|
let style_but = Style::default().fg(Color::Black).bg(Color::Magenta);
|
||||||
let style_desc = Style::default().fg(Color::Gray).bg(Color::Reset);
|
let style_desc = Style::default().fg(Color::Gray).bg(Color::Reset);
|
||||||
let line = Line::from(vec![
|
let line = Line::from(vec![
|
||||||
Span::styled(" Enter ", style_but),
|
// Span::styled(" Enter ", style_but),
|
||||||
Span::styled(" done ", style_desc),
|
// Span::styled(" done ", style_desc),
|
||||||
Span::styled(" Esc ", style_but),
|
Span::styled(" Esc ", style_but),
|
||||||
Span::styled(" clear ", style_desc),
|
Span::styled(" clear ", style_desc),
|
||||||
Span::styled(
|
Span::styled(
|
||||||
@@ -745,7 +745,7 @@ impl HelpInfo {
|
|||||||
button_item("F1"),
|
button_item("F1"),
|
||||||
or(),
|
or(),
|
||||||
button_item("/"),
|
button_item("/"),
|
||||||
button_desc("toggle filter mode"),
|
button_desc("enter filter mode"),
|
||||||
]),
|
]),
|
||||||
Line::from(vec![space(), button_item("0"), button_desc("stop sort")]),
|
Line::from(vec![space(), button_item("0"), button_desc("stop sort")]),
|
||||||
Line::from(vec![
|
Line::from(vec![
|
||||||
@@ -2549,7 +2549,7 @@ mod tests {
|
|||||||
" │ ( h ) toggle this help information │ ",
|
" │ ( h ) toggle this help information │ ",
|
||||||
" │ ( 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 │ ",
|
||||||
" │ ( F1 ) or ( / ) toggle filter mode │ ",
|
" │ ( F1 ) or ( / ) enter filter mode │ ",
|
||||||
" │ ( 0 ) stop sort │ ",
|
" │ ( 0 ) stop sort │ ",
|
||||||
" │ ( 1 - 9 ) sort by header - or click header │ ",
|
" │ ( 1 - 9 ) sort by header - or click header │ ",
|
||||||
" │ ( esc ) close dialog │ ",
|
" │ ( esc ) close dialog │ ",
|
||||||
@@ -2779,22 +2779,23 @@ mod tests {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let expected = [
|
let expected = [
|
||||||
" Enter done Esc clear filter: "
|
" Esc clear filter: "
|
||||||
];
|
];
|
||||||
|
|
||||||
for (row_index, result_row) in get_result(&setup, w) {
|
for (row_index, result_row) in get_result(&setup, w) {
|
||||||
let expected_row = expected_to_vec(&expected, row_index);
|
let expected_row = expected_to_vec(&expected, row_index);
|
||||||
for (result_cell_index, result_cell) in result_row.iter().enumerate() {
|
for (result_cell_index, result_cell) in result_row.iter().enumerate() {
|
||||||
|
assert_eq!(result_cell.symbol(), expected_row[result_cell_index]);
|
||||||
match result_cell_index {
|
match result_cell_index {
|
||||||
0..=6 | 13..=17 => {
|
0..=4 => {
|
||||||
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);
|
||||||
}
|
}
|
||||||
7..=12 | 18..=24 => {
|
5..=11 => {
|
||||||
assert_eq!(result_cell.bg, Color::Reset);
|
assert_eq!(result_cell.bg, Color::Reset);
|
||||||
assert_eq!(result_cell.fg, Color::Gray);
|
assert_eq!(result_cell.fg, Color::Gray);
|
||||||
}
|
}
|
||||||
25..=32 => {
|
12..=19 => {
|
||||||
assert_eq!(result_cell.bg, Color::Reset);
|
assert_eq!(result_cell.bg, Color::Reset);
|
||||||
assert_eq!(result_cell.fg, Color::Magenta);
|
assert_eq!(result_cell.fg, Color::Magenta);
|
||||||
}
|
}
|
||||||
@@ -2803,7 +2804,6 @@ mod tests {
|
|||||||
assert_eq!(result_cell.fg, Color::Reset);
|
assert_eq!(result_cell.fg, Color::Reset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert_eq!(result_cell.symbol(), expected_row[result_cell_index]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2817,23 +2817,24 @@ mod tests {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let expected = [
|
let expected = [
|
||||||
" Enter done Esc clear filter: c "
|
" Esc clear filter: c "
|
||||||
];
|
];
|
||||||
|
|
||||||
for (row_index, result_row) in get_result(&setup, w) {
|
for (row_index, result_row) in get_result(&setup, w) {
|
||||||
let expected_row = expected_to_vec(&expected, row_index);
|
let expected_row = expected_to_vec(&expected, row_index);
|
||||||
for (result_cell_index, result_cell) in result_row.iter().enumerate() {
|
for (result_cell_index, result_cell) in result_row.iter().enumerate() {
|
||||||
assert_eq!(result_cell.symbol(), expected_row[result_cell_index]);
|
assert_eq!(result_cell.symbol(), expected_row[result_cell_index]);
|
||||||
|
|
||||||
match result_cell_index {
|
match result_cell_index {
|
||||||
0..=6 | 13..=17 => {
|
0..=4 => {
|
||||||
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);
|
||||||
}
|
}
|
||||||
7..=12 | 18..=24 | 33 => {
|
5..=11 | 20 => {
|
||||||
assert_eq!(result_cell.bg, Color::Reset);
|
assert_eq!(result_cell.bg, Color::Reset);
|
||||||
assert_eq!(result_cell.fg, Color::Gray);
|
assert_eq!(result_cell.fg, Color::Gray);
|
||||||
}
|
}
|
||||||
25..=32 => {
|
12..=19 => {
|
||||||
assert_eq!(result_cell.bg, Color::Reset);
|
assert_eq!(result_cell.bg, Color::Reset);
|
||||||
assert_eq!(result_cell.fg, Color::Magenta);
|
assert_eq!(result_cell.fg, Color::Magenta);
|
||||||
}
|
}
|
||||||
@@ -3341,7 +3342,7 @@ mod tests {
|
|||||||
"│ │• •• ││ │• •• ││ │",
|
"│ │• •• ││ │• •• ││ │",
|
||||||
"│ │ ││ │ ││ │",
|
"│ │ ││ │ ││ │",
|
||||||
"╰───────────────────────────────────────────────────────────────╯╰───────────────────────────────────────────────────────────────╯╰────────────────────────────╯",
|
"╰───────────────────────────────────────────────────────────────╯╰───────────────────────────────────────────────────────────────╯╰────────────────────────────╯",
|
||||||
" Enter done Esc clear filter: r_1 "
|
" Esc clear filter: r_1 "
|
||||||
];
|
];
|
||||||
setup
|
setup
|
||||||
.terminal
|
.terminal
|
||||||
|
|||||||
Reference in New Issue
Block a user