diff --git a/Cargo.lock b/Cargo.lock index 3fc86c3..5d1f45f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -218,9 +218,12 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.85" +version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b918671670962b48bc23753aef0c51d072dca6f52f01f800854ada6ddb7f7d3" +checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +dependencies = [ + "libc", +] [[package]] name = "cfg-if" @@ -503,9 +506,9 @@ checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "hermit-abi" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0c62115964e08cb8039170eb33c1d0e2388a256930279edca206fff675f82c3" +checksum = "bd5256b483761cd23699d0da46cc6fd2ee3be420bbe6d020ae4a091e70b7e9fd" [[package]] name = "hex" diff --git a/src/ui/draw_blocks.rs b/src/ui/draw_blocks.rs index 0b7f5b6..795d52f 100644 --- a/src/ui/draw_blocks.rs +++ b/src/ui/draw_blocks.rs @@ -46,7 +46,6 @@ const CIRCLE: &str = "⚪ "; const CONSTRAINT_50_50: [Constraint; 2] = [Constraint::Percentage(50), Constraint::Percentage(50)]; const CONSTRAINT_100: [Constraint; 1] = [Constraint::Percentage(100)]; -// TODO FIX THIS const CONSTRAINT_POPUP: [Constraint; 5] = [ Constraint::Min(2), Constraint::Max(1), @@ -764,8 +763,6 @@ pub fn help_box(f: &mut Frame) { BoxLocation::MiddleCentre, ); - // This is wrong! - // TODO let split_popup = Layout::default() .direction(Direction::Vertical) .constraints([ @@ -928,7 +925,7 @@ pub fn error(f: &mut Frame, error: AppError, seconds: Option) { .block(block) .alignment(Alignment::Center); - let area = popup(lines, max_line_width, f.size(), BoxLocation::MiddleCentre); + let area = popup(lines, max_line_width, f.size(), BoxLocation::TopLeft); // let (paragraph, area) = gen_error(f, error, seconds); f.render_widget(Clear, area); @@ -936,6 +933,7 @@ pub fn error(f: &mut Frame, error: AppError, seconds: Option) { } /// Draw info box in one of the 9 BoxLocations +// TODO is this broken? pub fn info(f: &mut Frame, text: &str, instant: Instant, gui_state: &Arc>) { let block = Block::default() .title("") @@ -2580,16 +2578,16 @@ mod tests { setup.app_data.lock().containers.items[0].name = name.clone(); let expected = [ - " ", - " ╭──────────────────────────────────── Confirm Delete ────────────────────────────────────╮ ", - " │ │ ", - " │ Are you sure you want to delete container: container_1_container_1_container_1 │ ", - " │ │ ", - " │ ╭──────────────────────────────╮ ╭─────────────────────────────╮ │ ", - " │ │ (N)o │ │ (Y)es │ │ ", - " │ ╰──────────────────────────────╯ ╰─────────────────────────────╯ │ ", - " ╰────────────────────────────────────────────────────────────────────────────────────────╯ ", - " ", + " ", + " ╭──────────────────────────────────── Confirm Delete ────────────────────────────────────╮ ", + " │ │ ", + " │ Are you sure you want to delete container: container_1_container_1_container_1 │ ", + " │ │ ", + " │ ╭──────────────────────────────╮ ╭─────────────────────────────╮ │ ", + " │ │ (N)o │ │ (Y)es │ │ ", + " │ ╰──────────────────────────────╯ ╰─────────────────────────────╯ │ ", + " ╰────────────────────────────────────────────────────────────────────────────────────────╯ ", + " ", ]; setup @@ -2931,12 +2929,9 @@ mod tests { if row_index == 1 && result_cell_as_char { assert_eq!(result_cell.fg, Color::Yellow); } - if row_index == 2 && result_cell_as_char { + if (2..=3).contains(&row_index) && result_cell_as_char { assert_eq!(result_cell.fg, Color::White); } - if row_index == 3 && result_cell_as_char { - assert_eq!(result_cell.fg, Color::Magenta); - } if row_index == 4 && result_cell_as_char { assert_eq!(result_cell.fg, Color::White); } @@ -3124,10 +3119,10 @@ mod tests { ContainerImage::from("a_long_image_name_for_the_purposes_of_this_test"); let expected = [ - " name state status cpu memory/limit id image ↓ rx ↑ tx ( h ) show help ", + " name state status cpu memory/limit id image ↓ rx ↑ tx ( h ) show help ", "╭ Containers 1/3 ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮╭─────────────────╮", "│⚪ a_long_container_name_for_the… ✓ running Up 1 hour 03.00% 30.00 kB / 30.00 kB 1 a_long_image_name_for_the_pur… 0.00 kB 0.00 kB ││▶ pause │", - "│ container_2 ✓ running Up 2 hour 00.00% 0.00 kB / 0.00 kB 2 image_2 0.00 kB 0.00 kB ││ restart │", + "│ container_2 ✓ running Up 2 hour 00.00% 0.00 kB / 0.00 kB 2 image_2 0.00 kB 0.00 kB ││ restart │", "│ container_3 ✓ running Up 3 hour 00.00% 0.00 kB / 0.00 kB 3 image_3 0.00 kB 0.00 kB ││ stop │", "│ ││ delete │", "│ ││ │",