From 507660d835d0beaa8cd021110401ecc58c0613c6 Mon Sep 17 00:00:00 2001 From: Jack Wills <32690432+mrjackwills@users.noreply.github.com> Date: Thu, 2 Mar 2023 16:01:37 +0000 Subject: [PATCH 01/21] feat: only send relevant mouse events to input handler --- src/ui/mod.rs | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/ui/mod.rs b/src/ui/mod.rs index 1e143ae..fb8d00d 100644 --- a/src/ui/mod.rs +++ b/src/ui/mod.rs @@ -128,9 +128,6 @@ impl Ui { } } - // This is a fix for mouse-events being printed to screen - self.nullify_event_read(); - if self .terminal .draw(|f| draw_blocks::error(f, AppError::DockerConnect, Some(seconds))) @@ -159,14 +156,21 @@ impl Ui { if let Ok(event) = event::read() { if let Event::Key(key) = event { self.sender - .send(InputMessages::ButtonPress(key.code)) + .send(InputMessages::ButtonPress((key.code, key.modifiers))) .await .unwrap_or(()); } else if let Event::Mouse(m) = event { - self.sender - .send(InputMessages::MouseEvent(m)) - .await - .unwrap_or(()); + match m.kind { + event::MouseEventKind::Down(_) + | event::MouseEventKind::ScrollDown + | event::MouseEventKind::ScrollUp => { + self.sender + .send(InputMessages::MouseEvent(m)) + .await + .unwrap_or(()); + } + _ => (), + } } else if let Event::Resize(_, _) = event { self.gui_state.lock().clear_area_map(); self.terminal.autoresize().unwrap_or(()); From 598f67c6f6a8713102bcc415f0409911763bb914 Mon Sep 17 00:00:00 2001 From: Jack Wills <32690432+mrjackwills@users.noreply.github.com> Date: Thu, 2 Mar 2023 16:09:57 +0000 Subject: [PATCH 02/21] feat: KeyEvents send modifier, so can quit on ctrl + c --- src/input_handler/message.rs | 4 ++-- src/input_handler/mod.rs | 16 +++++++++++++--- src/main.rs | 21 +++++++++++++-------- 3 files changed, 28 insertions(+), 13 deletions(-) diff --git a/src/input_handler/message.rs b/src/input_handler/message.rs index f87e2e9..ba50101 100644 --- a/src/input_handler/message.rs +++ b/src/input_handler/message.rs @@ -1,7 +1,7 @@ -use crossterm::event::{KeyCode, MouseEvent}; +use crossterm::event::{KeyCode, KeyModifiers, MouseEvent}; #[derive(Debug, Clone, Copy)] pub enum InputMessages { - ButtonPress(KeyCode), + ButtonPress((KeyCode, KeyModifiers)), MouseEvent(MouseEvent), } diff --git a/src/input_handler/mod.rs b/src/input_handler/mod.rs index 1d05087..ef13975 100644 --- a/src/input_handler/mod.rs +++ b/src/input_handler/mod.rs @@ -4,7 +4,7 @@ use std::sync::{ }; use crossterm::{ - event::{DisableMouseCapture, KeyCode, MouseButton, MouseEvent, MouseEventKind}, + event::{DisableMouseCapture, KeyCode, KeyModifiers, MouseButton, MouseEvent, MouseEventKind}, execute, }; use parking_lot::Mutex; @@ -60,7 +60,7 @@ impl InputHandler { async fn start(&mut self) { while let Some(message) = self.rec.recv().await { match message { - InputMessages::ButtonPress(key_code) => self.button_press(key_code).await, + InputMessages::ButtonPress(key) => self.button_press(key.0, key.1).await, InputMessages::MouseEvent(mouse_event) => { let error_or_help = self .gui_state @@ -135,11 +135,17 @@ impl InputHandler { /// Handle any keyboard button events #[allow(clippy::too_many_lines)] - async fn button_press(&mut self, key_code: KeyCode) { + async fn button_press(&mut self, key_code: KeyCode, key_modififer: KeyModifiers) { // TODO - refactor this to a single call, maybe return Error, Help or Normal let contains_error = self.gui_state.lock().status_contains(&[Status::Error]); let contains_help = self.gui_state.lock().status_contains(&[Status::Help]); + // Quit on Ctrl + c/ Ctrl + C + let is_c = || key_code == KeyCode::Char('c') || key_code == KeyCode::Char('C'); + if key_modififer == KeyModifiers::CONTROL && is_c() { + self.quit().await; + } + if contains_error { match key_code { KeyCode::Char('q' | 'Q') => self.quit().await, @@ -157,7 +163,11 @@ impl InputHandler { _ => (), } } else { + // let abc = KeyEvent::new(KeyCode::Char('d'), KeyModifiers::Ctrl); match key_code { + // KeyCode::Ctrl('c') => { + // self.quit().await; + // } KeyCode::Char('0') => self.app_data.lock().reset_sorted(), KeyCode::Char('1') => self.sort(Header::State), KeyCode::Char('2') => self.sort(Header::Status), diff --git a/src/main.rs b/src/main.rs index ec9eef4..6853967 100644 --- a/src/main.rs +++ b/src/main.rs @@ -23,7 +23,10 @@ use docker_data::DockerData; use input_handler::InputMessages; use parking_lot::Mutex; use parse_args::CliArgs; -use std::sync::{atomic::AtomicBool, Arc}; +use std::sync::{ + atomic::{AtomicBool, Ordering}, + Arc, +}; use tokio::sync::mpsc::{Receiver, Sender}; use tracing::{info, Level}; @@ -134,14 +137,16 @@ async fn main() { if args.gui { Ui::create(app_data, docker_sx, gui_state, is_running, input_sx).await; } else { - // Debug mode for testing, mostly pointless, doesn't take terminal info!("in debug mode"); - loop { - docker_sx.send(DockerMessage::Update).await.unwrap_or(()); - tokio::time::sleep(std::time::Duration::from_millis(u64::from( - args.docker_interval, - ))) - .await; + while is_running.load(Ordering::SeqCst) { + // Debug mode for testing, mostly pointless, doesn't take terminal + loop { + docker_sx.send(DockerMessage::Update).await.unwrap_or(()); + tokio::time::sleep(std::time::Duration::from_millis(u64::from( + args.docker_interval, + ))) + .await; + } } } } From 601a73d2c830043a25d64922c4d4aa38f8801912 Mon Sep 17 00:00:00 2001 From: Jack Wills <32690432+mrjackwills@users.noreply.github.com> Date: Tue, 7 Mar 2023 03:23:46 +0000 Subject: [PATCH 03/21] chore: dependencies updated --- Cargo.lock | 60 +++++++++++++++++++++++++++--------------------------- Cargo.toml | 1 - 2 files changed, 30 insertions(+), 31 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 31770af..f0a3038 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -227,9 +227,9 @@ dependencies = [ [[package]] name = "cxx" -version = "1.0.91" +version = "1.0.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86d3488e7665a7a483b57e25bdd90d0aeb2bc7608c8d0346acf2ad3f1caf1d62" +checksum = "9a140f260e6f3f79013b8bfc65e7ce630c9ab4388c6a89c71e07226f49487b72" dependencies = [ "cc", "cxxbridge-flags", @@ -239,9 +239,9 @@ dependencies = [ [[package]] name = "cxx-build" -version = "1.0.91" +version = "1.0.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48fcaf066a053a41a81dfb14d57d99738b767febb8b735c3016e469fac5da690" +checksum = "da6383f459341ea689374bf0a42979739dc421874f112ff26f829b8040b8e613" dependencies = [ "cc", "codespan-reporting", @@ -254,15 +254,15 @@ dependencies = [ [[package]] name = "cxxbridge-flags" -version = "1.0.91" +version = "1.0.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2ef98b8b717a829ca5603af80e1f9e2e48013ab227b68ef37872ef84ee479bf" +checksum = "90201c1a650e95ccff1c8c0bb5a343213bdd317c6e600a93075bca2eff54ec97" [[package]] name = "cxxbridge-macro" -version = "1.0.91" +version = "1.0.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "086c685979a698443656e5cf7856c95c642295a38599f12fb1ff76fb28d19892" +checksum = "0b75aed41bb2e6367cae39e6326ef817a851db13c13e4f3263714ca3cfb8de56" dependencies = [ "proc-macro2", "quote", @@ -538,9 +538,9 @@ dependencies = [ [[package]] name = "io-lifetimes" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1abeb7a0dd0f8181267ff8adc397075586500b81b28a73e8a0208b00fc170fb3" +checksum = "cfa919a82ea574332e2de6e74b4c36e74d41982b335080fa59d4ef31be20fdf3" dependencies = [ "libc", "windows-sys", @@ -560,9 +560,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440" +checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" [[package]] name = "js-sys" @@ -862,9 +862,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.36.8" +version = "0.36.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f43abb88211988493c1abb44a70efa56ff0ce98f233b7b276146f1f3f7ba9644" +checksum = "fd5c6ff11fecd55b40746d1995a02f2eb375bf8c00d192d521ee09f42bef37bc" dependencies = [ "bitflags", "errno", @@ -876,9 +876,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde" +checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" [[package]] name = "scopeguard" @@ -888,9 +888,9 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "scratch" -version = "1.0.3" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddccb15bcce173023b3fedd9436f882a0739b8dfb45e4f6b6002bee5929f61b2" +checksum = "1792db035ce95be60c3f8853017b3999209281c24e2ba5bc8e59bf97a0c590c1" [[package]] name = "serde" @@ -914,9 +914,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.93" +version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cad406b69c91885b5107daf2c29572f6c8cdb3c66826821e286c533490c0bc76" +checksum = "1c533a59c9d8a93a09c6ab31f0fd5e5f4dd1b8fc9434804029839884765d04ea" dependencies = [ "itoa", "ryu", @@ -925,9 +925,9 @@ dependencies = [ [[package]] name = "serde_repr" -version = "0.1.10" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a5ec9fa74a20ebbe5d9ac23dac1fc96ba0ecfe9f50f2843b52e537b10fbcb4e" +checksum = "395627de918015623b32e7669714206363a7fc00382bf477e72c1f7533e8eafc" dependencies = [ "proc-macro2", "quote", @@ -1017,9 +1017,9 @@ checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" [[package]] name = "socket2" -version = "0.4.7" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02e2d2db9033d13a1567121ddd7a095ee144db4e1ca1b1bda3419bc0da294ebd" +checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" dependencies = [ "libc", "winapi", @@ -1053,18 +1053,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.38" +version = "1.0.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0" +checksum = "a5ab016db510546d856297882807df8da66a16fb8c4101cb8b30054b0d5b2d9c" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.38" +version = "1.0.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f" +checksum = "5420d42e90af0c38c3290abcca25b9b3bdf379fc9f55c528f53a269d9c9a267e" dependencies = [ "proc-macro2", "quote", @@ -1268,9 +1268,9 @@ checksum = "d54675592c1dbefd78cbd98db9bacd89886e1ca50692a0692baefffdeb92dd58" [[package]] name = "unicode-ident" -version = "1.0.6" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" +checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" [[package]] name = "unicode-normalization" diff --git a/Cargo.toml b/Cargo.toml index 205a921..17f6210 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -34,4 +34,3 @@ panic = 'abort' strip=true debug = false - From d1497a4451f4de54d3cc26c5a3957cd636c29118 Mon Sep 17 00:00:00 2001 From: Jack Wills <32690432+mrjackwills@users.noreply.github.com> Date: Tue, 7 Mar 2023 03:24:07 +0000 Subject: [PATCH 04/21] revert: temporary devcontainer buildkit fix removed --- .devcontainer/devcontainer.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 0cdbe41..b226482 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -7,8 +7,7 @@ "args": { // Use the VARIANT arg to pick a Debian OS version: buster, bullseye // Use bullseye when on local on arm64/Apple Silicon. - "VARIANT": "bullseye", - "BUILDKIT_INLINE_CACHE": "0" + "VARIANT": "bullseye" } }, "runArgs": [ From 924f14e998f79f731447a2eded038eab51f2e932 Mon Sep 17 00:00:00 2001 From: Jack Wills <32690432+mrjackwills@users.noreply.github.com> Date: Tue, 7 Mar 2023 03:24:42 +0000 Subject: [PATCH 05/21] feat: increase mpsc channel size (16 to 32 messages) --- src/main.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 6853967..f1ebf6f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -127,8 +127,8 @@ async fn main() { let app_data = Arc::new(Mutex::new(AppData::default(args))); let gui_state = Arc::new(Mutex::new(GuiState::default())); let is_running = Arc::new(AtomicBool::new(true)); - let (docker_sx, docker_rx) = tokio::sync::mpsc::channel(16); - let (input_sx, input_rx) = tokio::sync::mpsc::channel(16); + let (docker_sx, docker_rx) = tokio::sync::mpsc::channel(32); + let (input_sx, input_rx) = tokio::sync::mpsc::channel(32); docker_init(&app_data, containerised, docker_rx, &gui_state, &is_running).await; From 0c07d4b40607a0eba003b6dcd0345ec0543c6264 Mon Sep 17 00:00:00 2001 From: Jack Wills <32690432+mrjackwills@users.noreply.github.com> Date: Thu, 9 Mar 2023 15:08:52 +0000 Subject: [PATCH 06/21] chore: dependencies updated --- Cargo.lock | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f0a3038..e8dbef9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -581,9 +581,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.139" +version = "0.2.140" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" +checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" [[package]] name = "link-cplusplus" @@ -894,18 +894,18 @@ checksum = "1792db035ce95be60c3f8853017b3999209281c24e2ba5bc8e59bf97a0c590c1" [[package]] name = "serde" -version = "1.0.152" +version = "1.0.154" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb" +checksum = "8cdd151213925e7f1ab45a9bbfb129316bd00799784b174b7cc7bcd16961c49e" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.152" +version = "1.0.154" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e" +checksum = "4fc80d722935453bcafdc2c9a73cd6fac4dc1938f0346035d84bf99fa9e33217" dependencies = [ "proc-macro2", "quote", @@ -1262,9 +1262,9 @@ dependencies = [ [[package]] name = "unicode-bidi" -version = "0.3.10" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54675592c1dbefd78cbd98db9bacd89886e1ca50692a0692baefffdeb92dd58" +checksum = "524b68aca1d05e03fdf03fcdce2c6c94b6daf6d16861ddaa7e4f2b6638a9052c" [[package]] name = "unicode-ident" From 20b79e9cd5bf75bb253158c0b590284139e0291d Mon Sep 17 00:00:00 2001 From: Jack Wills <32690432+mrjackwills@users.noreply.github.com> Date: Thu, 9 Mar 2023 15:09:43 +0000 Subject: [PATCH 07/21] chore: devcontainer use spare protocol index --- .devcontainer/devcontainer.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index b226482..3834500 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -21,6 +21,9 @@ "mounts": [ "source=/etc/timezone,target=/etc/timezone,type=bind,readonly" ], + "containerEnv": { + "CARGO_REGISTRIES_CRATES_IO_PROTOCOL": "sparse" + }, "customizations": { "vscode": { From 5582c45403413d3355bbcd629cfad559296f5e5b Mon Sep 17 00:00:00 2001 From: Jack Wills <32690432+mrjackwills@users.noreply.github.com> Date: Thu, 9 Mar 2023 15:12:51 +0000 Subject: [PATCH 08/21] chore: Rust 1.68.0 clippy linting --- src/docker_data/mod.rs | 1 - src/ui/draw_blocks.rs | 2 -- 2 files changed, 3 deletions(-) diff --git a/src/docker_data/mod.rs b/src/docker_data/mod.rs index 51b955e..78df076 100644 --- a/src/docker_data/mod.rs +++ b/src/docker_data/mod.rs @@ -402,7 +402,6 @@ impl DockerData { self.spawns .lock() .values() - .into_iter() .for_each(tokio::task::JoinHandle::abort); self.is_running .store(false, std::sync::atomic::Ordering::SeqCst); diff --git a/src/ui/draw_blocks.rs b/src/ui/draw_blocks.rs index f03a68d..d09105b 100644 --- a/src/ui/draw_blocks.rs +++ b/src/ui/draw_blocks.rs @@ -482,7 +482,6 @@ pub fn heading_bar( /// From a given &str, return the maximum number of chars on a single line fn max_line_width(text: &str) -> usize { text.lines() - .into_iter() .map(|i| i.chars().count()) .max() .unwrap_or_default() @@ -530,7 +529,6 @@ impl HelpInfo { fn gen_name() -> Self { let mut spans = NAME_TEXT .lines() - .into_iter() .map(|i| Spans::from(Self::white_span(i))) .collect::>(); spans.insert(0, Self::empty_span()); From 8ba37a165bb89277ab957194da6464bdb35be2e6 Mon Sep 17 00:00:00 2001 From: Jack Wills <32690432+mrjackwills@users.noreply.github.com> Date: Thu, 9 Mar 2023 15:18:00 +0000 Subject: [PATCH 09/21] refactor: reaplace `unwrap_or(())` with `.ok()` --- src/docker_data/mod.rs | 4 ++-- src/input_handler/mod.rs | 30 ++++++++++++------------------ src/main.rs | 7 ++----- src/ui/mod.rs | 14 ++++---------- 4 files changed, 20 insertions(+), 35 deletions(-) diff --git a/src/docker_data/mod.rs b/src/docker_data/mod.rs index 78df076..8104ccc 100644 --- a/src/docker_data/mod.rs +++ b/src/docker_data/mod.rs @@ -109,8 +109,8 @@ impl DockerData { .take(1); while let Some(Ok(stats)) = stream.next().await { - let mem_stat = stats.memory_stats.usage.unwrap_or(0); - let mem_limit = stats.memory_stats.limit.unwrap_or(0); + let mem_stat = stats.memory_stats.usage.unwrap_or_default(); + let mem_limit = stats.memory_stats.limit.unwrap_or_default(); let op_key = stats .networks diff --git a/src/input_handler/mod.rs b/src/input_handler/mod.rs index ef13975..c303309 100644 --- a/src/input_handler/mod.rs +++ b/src/input_handler/mod.rs @@ -251,32 +251,26 @@ impl InputHandler { }; if let Some(id) = option_id { match command { - DockerControls::Pause => self - .docker_sender - .send(DockerMessage::Pause(id)) - .await - .unwrap_or(()), + DockerControls::Pause => { + self.docker_sender.send(DockerMessage::Pause(id)).await.ok() + } DockerControls::Unpause => self .docker_sender .send(DockerMessage::Unpause(id)) .await - .unwrap_or(()), - DockerControls::Start => self - .docker_sender - .send(DockerMessage::Start(id)) - .await - .unwrap_or(()), - DockerControls::Stop => self - .docker_sender - .send(DockerMessage::Stop(id)) - .await - .unwrap_or(()), + .ok(), + DockerControls::Start => { + self.docker_sender.send(DockerMessage::Start(id)).await.ok() + } + DockerControls::Stop => { + self.docker_sender.send(DockerMessage::Stop(id)).await.ok() + } DockerControls::Restart => self .docker_sender .send(DockerMessage::Restart(id)) .await - .unwrap_or(()), - } + .ok(), + }; } } } diff --git a/src/main.rs b/src/main.rs index f1ebf6f..c5d9222 100644 --- a/src/main.rs +++ b/src/main.rs @@ -55,10 +55,7 @@ fn setup_tracing() { /// An ENV is set in the ./containerised/Dockerfile, if this is ENV found, then sleep for 250ms, else the container, for as yet unknown reasons, will close immediately /// returns a bool, so that the `update_all_containers()` won't bother to check the entry point unless running via a container fn check_if_containerised() -> bool { - if std::env::vars() - .into_iter() - .any(|x| x == (ENV_KEY.into(), ENV_VALUE.into())) - { + if std::env::vars().any(|x| x == (ENV_KEY.into(), ENV_VALUE.into())) { std::thread::sleep(std::time::Duration::from_millis(250)); true } else { @@ -141,7 +138,7 @@ async fn main() { while is_running.load(Ordering::SeqCst) { // Debug mode for testing, mostly pointless, doesn't take terminal loop { - docker_sx.send(DockerMessage::Update).await.unwrap_or(()); + docker_sx.send(DockerMessage::Update).await.ok(); tokio::time::sleep(std::time::Duration::from_millis(u64::from( args.docker_interval, ))) diff --git a/src/ui/mod.rs b/src/ui/mod.rs index fb8d00d..232c059 100644 --- a/src/ui/mod.rs +++ b/src/ui/mod.rs @@ -158,31 +158,25 @@ impl Ui { self.sender .send(InputMessages::ButtonPress((key.code, key.modifiers))) .await - .unwrap_or(()); + .ok(); } else if let Event::Mouse(m) = event { match m.kind { event::MouseEventKind::Down(_) | event::MouseEventKind::ScrollDown | event::MouseEventKind::ScrollUp => { - self.sender - .send(InputMessages::MouseEvent(m)) - .await - .unwrap_or(()); + self.sender.send(InputMessages::MouseEvent(m)).await.ok(); } _ => (), } } else if let Event::Resize(_, _) = event { self.gui_state.lock().clear_area_map(); - self.terminal.autoresize().unwrap_or(()); + self.terminal.autoresize().ok(); } } } if self.now.elapsed() >= update_duration { - self.docker_sx - .send(DockerMessage::Update) - .await - .unwrap_or(()); + self.docker_sx.send(DockerMessage::Update).await.ok(); self.now = Instant::now(); } } From 5ff5452773475b330138ca91dbd3aed6a43c1ad1 Mon Sep 17 00:00:00 2001 From: Jack Wills <32690432+mrjackwills@users.noreply.github.com> Date: Thu, 9 Mar 2023 15:22:26 +0000 Subject: [PATCH 10/21] docs: changelog --- CHANGELOG.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e081eed..60fb34f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,19 @@ +### Chores ++ Rust 1.68.0 clippy linting, [5582c45403413d3355bbcd629cfad559296f5e5b] ++ devcontainer use spare protocol index, [20b79e9cd5bf75bb253158c0b590284139e0291d] ++ dependencies updated, [0c07d4b40607a0eba003b6dcd0345ec0543c6264], [601a73d2c830043a25d64922c4d4aa38f8801912] + +### Features ++ increase mpsc channel size (16 to 32 messages), [924f14e998f79f731447a2eded038eab51f2e932] ++ KeyEvents send modifier, so can quit on ctrl + c, [598f67c6f6a8713102bcc415f0409911763bb914] ++ only send relevant mouse events to input handler, [507660d835d0beaa8cd021110401ecc58c0613c6] + +### Refactors ++ replace `unwrap_or(())` with `.ok()`, [8ba37a165bb89277ab957194da6464bdb35be2e6] + +### Reverts ++ temporary devcontainer buildkit fix removed, [d1497a4451f4de54d3cc26c5a3957cd636c29118] + # v0.2.4 ### 2023-03-02 From d9f0bd5566e27218b8c8eaba6ece237907771c1d Mon Sep 17 00:00:00 2001 From: Jack Wills <32690432+mrjackwills@users.noreply.github.com> Date: Sat, 11 Mar 2023 21:04:16 +0000 Subject: [PATCH 11/21] refactor: result return --- src/ui/mod.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/ui/mod.rs b/src/ui/mod.rs index 232c059..5f9ee65 100644 --- a/src/ui/mod.rs +++ b/src/ui/mod.rs @@ -44,15 +44,14 @@ pub struct Ui { impl Ui { /// Enable mouse capture, but don't enable capture of all the mouse movements, doing so will improve performance, and is part of the fix for the weird mouse event output bug pub fn enable_mouse_capture() -> Result<()> { - io::stdout().write_all( + Ok(io::stdout().write_all( concat!( crossterm::csi!("?1000h"), crossterm::csi!("?1015h"), crossterm::csi!("?1006h"), ) .as_bytes(), - )?; - Ok(()) + )?) } /// Create a new Ui struct, and execute the drawing loop @@ -112,8 +111,7 @@ impl Ui { DisableMouseCapture )?; disable_raw_mode()?; - self.terminal.show_cursor()?; - Ok(()) + Ok(self.terminal.show_cursor()?) } /// Draw the the error message ui, for 5 seconds, with a countdown From 79de92c3921702417bb2df1f44939a7b09cb7fa0 Mon Sep 17 00:00:00 2001 From: Jack Wills <32690432+mrjackwills@users.noreply.github.com> Date: Sat, 11 Mar 2023 21:04:44 +0000 Subject: [PATCH 12/21] refactor: use `unwrap_or_default()` --- src/app_data/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app_data/mod.rs b/src/app_data/mod.rs index 3169b1e..93e9aa9 100644 --- a/src/app_data/mod.rs +++ b/src/app_data/mod.rs @@ -561,7 +561,7 @@ impl AppData { let id = ContainerId::from(id); - let created = i.created.map_or(0, |i| u64::try_from(i).unwrap_or(0)); + let created = i.created.map_or(0, |i| u64::try_from(i).unwrap_or_default()); // If container info already in containers Vec, then just update details if let Some(item) = self.get_container_by_id(&id) { if item.name != name { From 7a1563030e48499da7f41033673c70deefe3de8a Mon Sep 17 00:00:00 2001 From: Jack Wills <32690432+mrjackwills@users.noreply.github.com> Date: Sat, 11 Mar 2023 21:09:18 +0000 Subject: [PATCH 13/21] chore: dependencies updated --- Cargo.lock | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e8dbef9..427abc9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -307,24 +307,24 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.26" +version = "0.3.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e5317663a9089767a1ec00a487df42e0ca174b61b4483213ac24448e4664df5" +checksum = "164713a5a0dcc3e7b4b1ed7d3b433cabc18025386f9339346e8daf15963cf7ac" dependencies = [ "futures-core", ] [[package]] name = "futures-core" -version = "0.3.26" +version = "0.3.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec90ff4d0fe1f57d600049061dc6bb68ed03c7d2fbd697274c41805dcb3f8608" +checksum = "86d7a0c1aa76363dac491de0ee99faf6941128376f1cf96f07db7603b7de69dd" [[package]] name = "futures-macro" -version = "0.3.26" +version = "0.3.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95a73af87da33b5acf53acfebdc339fe592ecf5357ac7c0a7734ab9d8c876a70" +checksum = "3eb14ed937631bd8b8b8977f2c198443447a8355b6e3ca599f38c975e5a963b6" dependencies = [ "proc-macro2", "quote", @@ -333,21 +333,21 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.26" +version = "0.3.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f310820bb3e8cfd46c80db4d7fb8353e15dfff853a127158425f31e0be6c8364" +checksum = "ec93083a4aecafb2a80a885c9de1f0ccae9dbd32c2bb54b0c3a65690e0b8d2f2" [[package]] name = "futures-task" -version = "0.3.26" +version = "0.3.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcf79a1bf610b10f42aea489289c5a2c478a786509693b80cd39c44ccd936366" +checksum = "fd65540d33b37b16542a0438c12e6aeead10d4ac5d05bd3f805b8f35ab592879" [[package]] name = "futures-util" -version = "0.3.26" +version = "0.3.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c1d6de3acfef38d2be4b1f543f553131788603495be83da675e180c8d6b7bd1" +checksum = "3ef6b17e481503ec85211fed8f39d1970f128935ca1f814cd32ac4a6842e84ab" dependencies = [ "futures-core", "futures-macro", @@ -456,9 +456,9 @@ checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" [[package]] name = "hyper" -version = "0.14.24" +version = "0.14.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e011372fa0b68db8350aa7a248930ecc7839bf46d8485577d69f117a75f164c" +checksum = "cc5e554ff619822309ffd57d8734d77cd5ce6238bc956f037ea06c58238c9899" dependencies = [ "bytes", "futures-channel", @@ -894,18 +894,18 @@ checksum = "1792db035ce95be60c3f8853017b3999209281c24e2ba5bc8e59bf97a0c590c1" [[package]] name = "serde" -version = "1.0.154" +version = "1.0.155" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cdd151213925e7f1ab45a9bbfb129316bd00799784b174b7cc7bcd16961c49e" +checksum = "71f2b4817415c6d4210bfe1c7bfcf4801b2d904cb4d0e1a8fdb651013c9e86b8" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.154" +version = "1.0.155" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fc80d722935453bcafdc2c9a73cd6fac4dc1938f0346035d84bf99fa9e33217" +checksum = "d071a94a3fac4aff69d023a7f411e33f40f3483f8c5190b1953822b6b76d7630" dependencies = [ "proc-macro2", "quote", @@ -948,9 +948,9 @@ dependencies = [ [[package]] name = "serde_with" -version = "2.2.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30d904179146de381af4c93d3af6ca4984b3152db687dacb9c3c35e86f39809c" +checksum = "85456ffac572dc8826334164f2fb6fb40a7c766aebe195a2a21ee69ee2885ecf" dependencies = [ "base64 0.13.1", "chrono", From 5aaa3c1ab08b0c85df9bfce18a3e60206556fa58 Mon Sep 17 00:00:00 2001 From: Jack Wills <32690432+mrjackwills@users.noreply.github.com> Date: Mon, 13 Mar 2023 00:54:38 +0000 Subject: [PATCH 14/21] chore: dependencies updated --- Cargo.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 427abc9..5b4f382 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -118,9 +118,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.23" +version = "0.4.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16b0a3d9ed01224b22057780a37bb8c5dbfe1be8ba48678e7bf57ec4b385411f" +checksum = "4e3c5919066adf22df73762e50cffcde3a758f2a848b113b586d1f86728b673b" dependencies = [ "iana-time-zone", "num-integer", @@ -805,18 +805,18 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.51" +version = "1.0.52" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6" +checksum = "1d0e1ae9e836cc3beddd63db0df682593d7e2d3d891ae8c9083d2113e1744224" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.23" +version = "1.0.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" +checksum = "5308e8208729c3e1504a6cfad0d5daacc4614c9a2e65d1ea312a34b5cb00fe84" dependencies = [ "proc-macro2", ] From e3d0d64b4d91427c579227760d35e2325a1c176a Mon Sep 17 00:00:00 2001 From: Jack Wills <32690432+mrjackwills@users.noreply.github.com> Date: Mon, 13 Mar 2023 00:56:16 +0000 Subject: [PATCH 15/21] docs: changelog --- CHANGELOG.md | 6 ++++-- src/input_handler/mod.rs | 2 +- src/main.rs | 3 +-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 60fb34f..477a9af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,15 +1,17 @@ ### Chores + Rust 1.68.0 clippy linting, [5582c45403413d3355bbcd629cfad559296f5e5b] + devcontainer use spare protocol index, [20b79e9cd5bf75bb253158c0b590284139e0291d] -+ dependencies updated, [0c07d4b40607a0eba003b6dcd0345ec0543c6264], [601a73d2c830043a25d64922c4d4aa38f8801912] ++ dependencies updated, [0c07d4b40607a0eba003b6dcd0345ec0543c6264], [601a73d2c830043a25d64922c4d4aa38f8801912], [5aaa3c1ab08b0c85df9bfce18a3e60206556fa58], [7a1563030e48499da7f41033673c70deefe3de8a] ### Features -+ increase mpsc channel size (16 to 32 messages), [924f14e998f79f731447a2eded038eab51f2e932] ++ increase mpsc channel size from 16 to 32 messages, [924f14e998f79f731447a2eded038eab51f2e932] + KeyEvents send modifier, so can quit on ctrl + c, [598f67c6f6a8713102bcc415f0409911763bb914] + only send relevant mouse events to input handler, [507660d835d0beaa8cd021110401ecc58c0613c6] ### Refactors + replace `unwrap_or(())` with `.ok()`, [8ba37a165bb89277ab957194da6464bdb35be2e6] ++ use `unwrap_or_default()`, [79de92c3921702417bb2df1f44939a7b09cb7fa0] ++ Result return, [d9f0bd5566e27218b8c8eaba6ece237907771c1d] ### Reverts + temporary devcontainer buildkit fix removed, [d1497a4451f4de54d3cc26c5a3957cd636c29118] diff --git a/src/input_handler/mod.rs b/src/input_handler/mod.rs index c303309..bb60bdd 100644 --- a/src/input_handler/mod.rs +++ b/src/input_handler/mod.rs @@ -140,7 +140,7 @@ impl InputHandler { let contains_error = self.gui_state.lock().status_contains(&[Status::Error]); let contains_help = self.gui_state.lock().status_contains(&[Status::Help]); - // Quit on Ctrl + c/ Ctrl + C + // Quit on Ctrl + c/C let is_c = || key_code == KeyCode::Char('c') || key_code == KeyCode::Char('C'); if key_modififer == KeyModifiers::CONTROL && is_c() { self.quit().await; diff --git a/src/main.rs b/src/main.rs index c5d9222..fd99297 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,13 +1,12 @@ #![forbid(unsafe_code)] #![warn( + clippy::expect_used, clippy::nursery, clippy::pedantic, - clippy::expect_used, clippy::todo, clippy::unused_async, clippy::unwrap_used )] -// Warning - These are indeed pedantic #![allow( clippy::module_name_repetitions, clippy::doc_markdown, From 7401267a844a2e7d0d13d41b3b66127204eae640 Mon Sep 17 00:00:00 2001 From: Jack Wills <32690432+mrjackwills@users.noreply.github.com> Date: Mon, 13 Mar 2023 02:02:12 +0000 Subject: [PATCH 16/21] docs: changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 477a9af..9009abe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ ### Chores + Rust 1.68.0 clippy linting, [5582c45403413d3355bbcd629cfad559296f5e5b] -+ devcontainer use spare protocol index, [20b79e9cd5bf75bb253158c0b590284139e0291d] ++ devcontainer use sparse protocol index, [20b79e9cd5bf75bb253158c0b590284139e0291d] + dependencies updated, [0c07d4b40607a0eba003b6dcd0345ec0543c6264], [601a73d2c830043a25d64922c4d4aa38f8801912], [5aaa3c1ab08b0c85df9bfce18a3e60206556fa58], [7a1563030e48499da7f41033673c70deefe3de8a] ### Features From 457157755baa1f9e9cfef9315a7940c357b0953d Mon Sep 17 00:00:00 2001 From: Jack Wills <32690432+mrjackwills@users.noreply.github.com> Date: Mon, 13 Mar 2023 21:14:36 +0000 Subject: [PATCH 17/21] chore: dependencies updated --- Cargo.lock | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5b4f382..d96deec 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -814,9 +814,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.25" +version = "1.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5308e8208729c3e1504a6cfad0d5daacc4614c9a2e65d1ea312a34b5cb00fe84" +checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" dependencies = [ "proc-macro2", ] @@ -1438,9 +1438,9 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.42.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e2522491fbfcd58cc84d47aeb2958948c4b8982e9a2d8a2a35bbaed431390e7" +checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" dependencies = [ "windows_aarch64_gnullvm", "windows_aarch64_msvc", @@ -1453,42 +1453,42 @@ dependencies = [ [[package]] name = "windows_aarch64_gnullvm" -version = "0.42.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608" +checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" [[package]] name = "windows_aarch64_msvc" -version = "0.42.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7" +checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" [[package]] name = "windows_i686_gnu" -version = "0.42.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640" +checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" [[package]] name = "windows_i686_msvc" -version = "0.42.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605" +checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" [[package]] name = "windows_x86_64_gnu" -version = "0.42.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45" +checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" [[package]] name = "windows_x86_64_gnullvm" -version = "0.42.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463" +checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" [[package]] name = "windows_x86_64_msvc" -version = "0.42.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" +checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" From 37a49bc048cf0ec9636385c57f1328f461c045aa Mon Sep 17 00:00:00 2001 From: Jack Wills <32690432+mrjackwills@users.noreply.github.com> Date: Mon, 13 Mar 2023 21:18:13 +0000 Subject: [PATCH 18/21] docs: changelog --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9009abe..2fdd54c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,11 @@ ### Chores + Rust 1.68.0 clippy linting, [5582c45403413d3355bbcd629cfad559296f5e5b] + devcontainer use sparse protocol index, [20b79e9cd5bf75bb253158c0b590284139e0291d] -+ dependencies updated, [0c07d4b40607a0eba003b6dcd0345ec0543c6264], [601a73d2c830043a25d64922c4d4aa38f8801912], [5aaa3c1ab08b0c85df9bfce18a3e60206556fa58], [7a1563030e48499da7f41033673c70deefe3de8a] ++ dependencies updated, [0c07d4b40607a0eba003b6dcd0345ec0543c6264], [601a73d2c830043a25d64922c4d4aa38f8801912], [5aaa3c1ab08b0c85df9bfce18a3e60206556fa58], [7a1563030e48499da7f41033673c70deefe3de8a], [457157755baa1f9e9cfef9315a7940c357b0953d] ### Features + increase mpsc channel size from 16 to 32 messages, [924f14e998f79f731447a2eded038eab51f2e932] -+ KeyEvents send modifier, so can quit on ctrl + c, [598f67c6f6a8713102bcc415f0409911763bb914] ++ KeyEvents send modifier, so can quit on `ctrl + c`, [598f67c6f6a8713102bcc415f0409911763bb914] + only send relevant mouse events to input handler, [507660d835d0beaa8cd021110401ecc58c0613c6] ### Refactors From 140773865165bf006e74f9d436fc744220f5eae7 Mon Sep 17 00:00:00 2001 From: Jack Wills <32690432+mrjackwills@users.noreply.github.com> Date: Mon, 13 Mar 2023 21:48:53 +0000 Subject: [PATCH 19/21] fix: workflow on tag only --- .github/workflows/create_release_and_build.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/create_release_and_build.yml b/.github/workflows/create_release_and_build.yml index 3becdbc..bd9eb27 100644 --- a/.github/workflows/create_release_and_build.yml +++ b/.github/workflows/create_release_and_build.yml @@ -1,8 +1,6 @@ name: Release CI on: push: - branch: - - 'main' tags: - 'v[0-9]+.[0-9]+.[0-9]+' jobs: From 896ed99d46cba6a76c413f82783bd7d5cf1c63f1 Mon Sep 17 00:00:00 2001 From: Jack Wills <32690432+mrjackwills@users.noreply.github.com> Date: Mon, 13 Mar 2023 21:49:23 +0000 Subject: [PATCH 20/21] docs: changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2fdd54c..ebec7fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,9 @@ + KeyEvents send modifier, so can quit on `ctrl + c`, [598f67c6f6a8713102bcc415f0409911763bb914] + only send relevant mouse events to input handler, [507660d835d0beaa8cd021110401ecc58c0613c6] +### Fixes ++ GitHub workflow on SEMEVR tag only, [140773865165bf006e74f9d436fc744220f5eae7] + ### Refactors + replace `unwrap_or(())` with `.ok()`, [8ba37a165bb89277ab957194da6464bdb35be2e6] + use `unwrap_or_default()`, [79de92c3921702417bb2df1f44939a7b09cb7fa0] From cb9686cfe86baaf4e68f643e83526b8711c3d72b Mon Sep 17 00:00:00 2001 From: Jack Wills <32690432+mrjackwills@users.noreply.github.com> Date: Mon, 13 Mar 2023 22:01:39 +0000 Subject: [PATCH 21/21] chore: release v0.2.5 --- .github/release-body.md | 30 ++++++++++++++---------------- CHANGELOG.md | 25 ++++++++++++++----------- Cargo.lock | 2 +- Cargo.toml | 2 +- src/app_data/mod.rs | 4 +++- 5 files changed, 33 insertions(+), 30 deletions(-) diff --git a/.github/release-body.md b/.github/release-body.md index b482219..28640bb 100644 --- a/.github/release-body.md +++ b/.github/release-body.md @@ -1,27 +1,25 @@ -### 2023-03-02 +### 2023-03-13 ### Chores -+ dependencies updated, [aac3ef2b1def3345d749d813d9b76020d6b5e5ca], [4723be7fb2eb101024bb9d5a514e2c6cc51eb6f6], [c69ab4f7c3b873f25ea46958add37be78d23e9cf], [ba6437862dae0f422660a602aeabd6217d023fac], [2bb4c338903e09856053894d9646307e31d32f1c] -+ dev container install x86 musl toolchain, [e650034d50f01a7598876d4f2887df691700e06a] - -### Docs -+ typos removed, [23ad9a5fb3cacf3fb8cb70c65ca9133ed9949e45], [cebb975cb82f653407ec801fd8c726ca6ed68289], [fdc67c9249a239bac97a78b20c9378472865209c] -+ comments improved, [ec962295a8789ff8010604e974969bf618ea7108] ++ Rust 1.68.0 clippy linting, [5582c45403413d3355bbcd629cfad559296f5e5b] ++ devcontainer use sparse protocol index, [20b79e9cd5bf75bb253158c0b590284139e0291d] ++ dependencies updated, [0c07d4b40607a0eba003b6dcd0345ec0543c6264], [601a73d2c830043a25d64922c4d4aa38f8801912], [5aaa3c1ab08b0c85df9bfce18a3e60206556fa58], [7a1563030e48499da7f41033673c70deefe3de8a], [457157755baa1f9e9cfef9315a7940c357b0953d] ### Features -+ mouse capture is now more specific, should have substantial performance impact, 10x reduction in cpu usage when mouse is moved observed, as well as fixing intermittent mouse events output bug, [0a1b53111627206cc7436589e5b7212e1b72edb8], [93f7c07f708885f8870da5dfb6d57c62f93c9c78], [c74f6c1179b5f62989eb74f395a56b43a8781b03] -+ improve the styling of the help information popup, [28de74b866f07c8543e46be3cab929eff28953fd] -+ use checked_sub & checked_div for bounds checks, [72279e26ae996353c95a75527f704bac1e4bcf4d] ++ increase mpsc channel size from 16 to 32 messages, [924f14e998f79f731447a2eded038eab51f2e932] ++ KeyEvents send modifier, so can quit on `ctrl + c`, [598f67c6f6a8713102bcc415f0409911763bb914] ++ only send relevant mouse events to input handler, [507660d835d0beaa8cd021110401ecc58c0613c6] ### Fixes -+ correctly set gui error, [340893a860e99ec4029d12613f2a6de3cb7b47e2] ++ GitHub workflow on SEMEVR tag only, [140773865165bf006e74f9d436fc744220f5eae7] ### Refactors -+ dead code removed, [b8f5792d1865d3a398cd7f23aa9473a55dc6ea44] -+ improve the get_width function, [04c26fe8fc7c79506921b9cff42825b1ee132737] -+ place ui methods into a Ui struct, [3437df59884f084624031fceb34ea3012a8e2251] -+ get_horizotal/vertical constraints into single method, [e8f5cf9c6f8cd5f807a05fb61e31d7cd1426486f] -+ docker update_everything variables, [074cb957f274675a468f08fecb1c43ff7453217d] ++ replace `unwrap_or(())` with `.ok()`, [8ba37a165bb89277ab957194da6464bdb35be2e6] ++ use `unwrap_or_default()`, [79de92c3921702417bb2df1f44939a7b09cb7fa0] ++ Result return, [d9f0bd5566e27218b8c8eaba6ece237907771c1d] + +### Reverts ++ temporary devcontainer buildkit fix removed, [d1497a4451f4de54d3cc26c5a3957cd636c29118] see CHANGELOG.md for more details diff --git a/CHANGELOG.md b/CHANGELOG.md index ebec7fd..f8ad202 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,23 +1,26 @@ +# v0.2.5 +### 2023-03-13 + ### Chores -+ Rust 1.68.0 clippy linting, [5582c45403413d3355bbcd629cfad559296f5e5b] -+ devcontainer use sparse protocol index, [20b79e9cd5bf75bb253158c0b590284139e0291d] -+ dependencies updated, [0c07d4b40607a0eba003b6dcd0345ec0543c6264], [601a73d2c830043a25d64922c4d4aa38f8801912], [5aaa3c1ab08b0c85df9bfce18a3e60206556fa58], [7a1563030e48499da7f41033673c70deefe3de8a], [457157755baa1f9e9cfef9315a7940c357b0953d] ++ Rust 1.68.0 clippy linting, [5582c454](https://github.com/mrjackwills/oxker/commit/5582c45403413d3355bbcd629cfad559296f5e5b) ++ devcontainer use sparse protocol index, [20b79e9c](https://github.com/mrjackwills/oxker/commit/20b79e9cd5bf75bb253158c0b590284139e0291d) ++ dependencies updated, [0c07d4b4](https://github.com/mrjackwills/oxker/commit/0c07d4b40607a0eba003b6dcd0345ec0543c6264), [601a73d2](https://github.com/mrjackwills/oxker/commit/601a73d2c830043a25d64922c4d4aa38f8801912), [5aaa3c1a](https://github.com/mrjackwills/oxker/commit/5aaa3c1ab08b0c85df9bfce18a3e60206556fa58), [7a156303](https://github.com/mrjackwills/oxker/commit/7a1563030e48499da7f41033673c70deefe3de8a), [45715775](https://github.com/mrjackwills/oxker/commit/457157755baa1f9e9cfef9315a7940c357b0953d) ### Features -+ increase mpsc channel size from 16 to 32 messages, [924f14e998f79f731447a2eded038eab51f2e932] -+ KeyEvents send modifier, so can quit on `ctrl + c`, [598f67c6f6a8713102bcc415f0409911763bb914] -+ only send relevant mouse events to input handler, [507660d835d0beaa8cd021110401ecc58c0613c6] ++ increase mpsc channel size from 16 to 32 messages, [924f14e9](https://github.com/mrjackwills/oxker/commit/924f14e998f79f731447a2eded038eab51f2e932) ++ KeyEvents send modifier, so can quit on `ctrl + c`, [598f67c6](https://github.com/mrjackwills/oxker/commit/598f67c6f6a8713102bcc415f0409911763bb914) ++ only send relevant mouse events to input handler, [507660d8](https://github.com/mrjackwills/oxker/commit/507660d835d0beaa8cd021110401ecc58c0613c6) ### Fixes -+ GitHub workflow on SEMEVR tag only, [140773865165bf006e74f9d436fc744220f5eae7] ++ GitHub workflow on SEMEVR tag only, [14077386](https://github.com/mrjackwills/oxker/commit/140773865165bf006e74f9d436fc744220f5eae7) ### Refactors -+ replace `unwrap_or(())` with `.ok()`, [8ba37a165bb89277ab957194da6464bdb35be2e6] -+ use `unwrap_or_default()`, [79de92c3921702417bb2df1f44939a7b09cb7fa0] -+ Result return, [d9f0bd5566e27218b8c8eaba6ece237907771c1d] ++ replace `unwrap_or(())` with `.ok()`, [8ba37a16](https://github.com/mrjackwills/oxker/commit/8ba37a165bb89277ab957194da6464bdb35be2e6) ++ use `unwrap_or_default()`, [79de92c3](https://github.com/mrjackwills/oxker/commit/79de92c3921702417bb2df1f44939a7b09cb7fa0) ++ Result return, [d9f0bd55](https://github.com/mrjackwills/oxker/commit/d9f0bd5566e27218b8c8eaba6ece237907771c1d) ### Reverts -+ temporary devcontainer buildkit fix removed, [d1497a4451f4de54d3cc26c5a3957cd636c29118] ++ temporary devcontainer buildkit fix removed, [d1497a44](https://github.com/mrjackwills/oxker/commit/d1497a4451f4de54d3cc26c5a3957cd636c29118) # v0.2.4 ### 2023-03-02 diff --git a/Cargo.lock b/Cargo.lock index d96deec..048dded 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -696,7 +696,7 @@ checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" [[package]] name = "oxker" -version = "0.2.4" +version = "0.2.5" dependencies = [ "anyhow", "bollard", diff --git a/Cargo.toml b/Cargo.toml index 17f6210..02a5f28 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "oxker" -version = "0.2.4" +version = "0.2.5" edition = "2021" authors = ["Jack Wills "] description = "A simple tui to view & control docker containers" diff --git a/src/app_data/mod.rs b/src/app_data/mod.rs index 93e9aa9..93d5769 100644 --- a/src/app_data/mod.rs +++ b/src/app_data/mod.rs @@ -561,7 +561,9 @@ impl AppData { let id = ContainerId::from(id); - let created = i.created.map_or(0, |i| u64::try_from(i).unwrap_or_default()); + let created = i + .created + .map_or(0, |i| u64::try_from(i).unwrap_or_default()); // If container info already in containers Vec, then just update details if let Some(item) = self.get_container_by_id(&id) { if item.name != name {