diff --git a/.github/release-body.md b/.github/release-body.md index 31b0f6c..895c033 100644 --- a/.github/release-body.md +++ b/.github/release-body.md @@ -1,14 +1,22 @@ -### 2022-08-04 +### 2022-09-07 ### Chores -+ dependencies updated, [d9801cdf372521fe5624a8d68fac83ed39ef81f4] -+ linting: nursery, pedantic, unused_unwraps, [1bd61d4ce8b369d6d078201add3eea0f59fe0dea], [1263662bd9412afacddbc10721bf216ae3a843f1], [ca3315a69f593ad705eb637f227f195edd7781b2] ++ dependencies updated, [a3168daa3f769a6747dfbe61103073a7e80a1485], [78e59160bb6a978ee80e3a99eb72f051fb64e737] ### Features -+ build all production targets on release, [44f8140eaec330abe5a94f3ddae9e8b223688aa8] ++ containerize self, github action to build and push to [Docker Hub](https://hub.docker.com/r/mrjackwills/oxker), [07f972022a69f22bac57925e6ad84234381f7890] ++ gui_state is_loading use a HashSet to enable multiple things be loading at the same time, [66583e1b037b7e2f3e47948d70d8a4c6f6a2f2d5] ++ github action publish to crates.io, [90b2e3f6db0d5f63840cd80888a30da6ecc22f20] ++ derive Eq where appropriate, [d7c2601f959bc12a64cd25cef59c837e1e8c2b2a] ++ ignore containers 'oxker' containers, [1be9f52ad4a68f93142784e9df630c59cdec0a79] ++ update container info if container is either running OR restarting, [5f12362db7cb61ca68f75b99ecfc9725380d87d2] ### Fixes -+ toml keywords, [dd2d82d114537e09dbeb12f360157f0e68e7846e] ++ devcontainer updated, [3bde4f5629539cab3dbb57556663ab81685f9d7a] ++ Use Binate enum to enable two cycles of cpu/mem update to be executed (for each container) at the same time, refactor hashmap spawn insertions, [7ec58e79a1316ad1f7e50a2781dea0fe8422c588] + +### Refactors ++ improved way to remove leading '/' of container name, [832e9782d7765872cbb84df6b3703fc08cb353c9] see CHANGELOG.md for more details diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b8c6ff..9dfa2ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,20 +1,23 @@ +# v0.1.4 +### 2022-09-07 + ### Chores -+ dependencies updated, [a3168daa3f769a6747dfbe61103073a7e80a1485], [78e59160bb6a978ee80e3a99eb72f051fb64e737] ++ dependencies updated, [a3168daa](https://github.com/mrjackwills/oxker/commit/a3168daa3f769a6747dfbe61103073a7e80a1485),, [78e59160](https://github.com/mrjackwills/oxker/commit/78e59160bb6a978ee80e3a99eb72f051fb64e737), ### Features -+ containerize self, github action to build and push to [Docker Hub](https://hub.docker.com/r/mrjackwills/oxker), [07f972022a69f22bac57925e6ad84234381f7890] -+ gui_state is_loading use a HashSet to enable multiple things be loading at the same time, [66583e1b037b7e2f3e47948d70d8a4c6f6a2f2d5] -+ github action publish to crates.io, [90b2e3f6db0d5f63840cd80888a30da6ecc22f20] -+ derive Eq where appropriate, [d7c2601f959bc12a64cd25cef59c837e1e8c2b2a] -+ ignore containers 'oxker' containers, [1be9f52ad4a68f93142784e9df630c59cdec0a79] -+ update container info if container is either running OR restarting, [5f12362db7cb61ca68f75b99ecfc9725380d87d2] ++ containerize self, github action to build and push to [Docker Hub](https://hub.docker.com/r/mrjackwills/oxker), [07f97202](https://github.com/mrjackwills/oxker/commit/07f972022a69f22bac57925e6ad84234381f7890), ++ gui_state is_loading use a HashSet to enable multiple things be loading at the same time, [66583e1b](https://github.com/mrjackwills/oxker/commit/66583e1b037b7e2f3e47948d70d8a4c6f6a2f2d5), ++ github action publish to crates.io, [90b2e3f6](https://github.com/mrjackwills/oxker/commit/90b2e3f6db0d5f63840cd80888a30da6ecc22f20), ++ derive Eq where appropriate, [d7c2601f](https://github.com/mrjackwills/oxker/commit/d7c2601f959bc12a64cd25cef59c837e1e8c2b2a), ++ ignore containers 'oxker' containers, [1be9f52a](https://github.com/mrjackwills/oxker/commit/1be9f52ad4a68f93142784e9df630c59cdec0a79), ++ update container info if container is either running OR restarting, [5f12362d](https://github.com/mrjackwills/oxker/commit/5f12362db7cb61ca68f75b99ecfc9725380d87d2), ### Fixes -+ devcontainer updated, [3bde4f5629539cab3dbb57556663ab81685f9d7a] -+ Use Binate enum to enable two cycles of cpu/mem update to be executed (for each container) at the same time, refactor hashmap spawn insertions, [7ec58e79a1316ad1f7e50a2781dea0fe8422c588] ++ devcontainer updated, [3bde4f56](https://github.com/mrjackwills/oxker/commit/3bde4f5629539cab3dbb57556663ab81685f9d7a), ++ Use Binate enum to enable two cycles of cpu/mem update to be executed (for each container) at the same time, refactor hashmap spawn insertions, [7ec58e79](https://github.com/mrjackwills/oxker/commit/7ec58e79a1316ad1f7e50a2781dea0fe8422c588), ### Refactors -+ improved way to remove leading '/' of container name, [832e9782d7765872cbb84df6b3703fc08cb353c9] ++ improved way to remove leading '/' of container name, [832e9782](https://github.com/mrjackwills/oxker/commit/832e9782d7765872cbb84df6b3703fc08cb353c9), # v0.1.3 ### 2022-08-04 diff --git a/Cargo.toml b/Cargo.toml index dd11a33..12c456f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "oxker" -version = "0.1.3" +version = "0.1.4" edition = "2021" authors = ["Jack Wills "] description = "a simple tui to view & control docker containers" diff --git a/src/docker_data/mod.rs b/src/docker_data/mod.rs index d639d10..feb6314 100644 --- a/src/docker_data/mod.rs +++ b/src/docker_data/mod.rs @@ -5,7 +5,6 @@ use bollard::{ }; use futures_util::StreamExt; use parking_lot::Mutex; -use uuid::Uuid; use std::{ collections::HashMap, sync::{ @@ -14,6 +13,7 @@ use std::{ }, }; use tokio::{sync::mpsc::Receiver, task::JoinHandle}; +use uuid::Uuid; use crate::{ app_data::{AppData, DockerControls}, @@ -24,7 +24,6 @@ use crate::{ mod message; pub use message::DockerMessage; - #[derive(Debug, Hash, Clone, PartialEq, Eq)] enum SpawnId { Stats((String, Binate)), @@ -37,7 +36,7 @@ enum SpawnId { #[derive(Debug, Hash, Clone, PartialEq, Eq, Copy)] enum Binate { One, - Two + Two, } impl Binate { @@ -58,7 +57,7 @@ pub struct DockerData { receiver: Receiver, spawns: Arc>>>, timestamps: bool, - binate: Binate + binate: Binate, } impl DockerData { @@ -168,7 +167,7 @@ impl DockerData { app_data, *is_running, spawns, - spawn_key + spawn_key, )) }); } @@ -265,9 +264,12 @@ impl DockerData { let app_data = Arc::clone(&self.app_data); let spawns = Arc::clone(&self.spawns); let key = SpawnId::Log(id.clone()); - self.spawns.lock().insert(key, tokio::spawn(Self::update_log( - docker, id, timestamps, 0, app_data, spawns, - ))); + self.spawns.lock().insert( + key, + tokio::spawn(Self::update_log( + docker, id, timestamps, 0, app_data, spawns, + )), + ); } } @@ -292,7 +294,6 @@ impl DockerData { }); }; self.update_all_container_stats(&all_ids).await; - } /// Animate the loading icon @@ -314,7 +315,7 @@ impl DockerData { // Initialize docker container data, before any messages are received async fn initialise_container_data(&mut self) { - let loading_uuid = Uuid::new_v4(); + let loading_uuid = Uuid::new_v4(); let loading_spin = self.loading_spin(loading_uuid).await; let all_ids = self.update_all_containers().await; @@ -341,7 +342,7 @@ impl DockerData { while let Some(message) = self.receiver.recv().await { let docker = Arc::clone(&self.docker); let app_data = Arc::clone(&self.app_data); - let loading_uuid = Uuid::new_v4(); + let loading_uuid = Uuid::new_v4(); match message { DockerMessage::Pause(id) => { let loading_spin = self.loading_spin(loading_uuid).await; @@ -390,8 +391,8 @@ impl DockerData { .lock() .set_error(AppError::DockerCommand(DockerControls::Unpause)); }; - // loading sping take uuid to remove - // stop_loading_sping(uuid) + // loading sping take uuid to remove + // stop_loading_sping(uuid) self.stop_loading_spin(&loading_spin, loading_uuid); self.update_everything().await; } @@ -427,7 +428,7 @@ impl DockerData { spawns: Arc::new(Mutex::new(HashMap::new())), timestamps: args.timestamp, is_running, - binate: Binate::One + binate: Binate::One, }; inner.initialise_container_data().await; diff --git a/src/ui/gui_state.rs b/src/ui/gui_state.rs index f0e3639..ec17be3 100644 --- a/src/ui/gui_state.rs +++ b/src/ui/gui_state.rs @@ -1,4 +1,7 @@ -use std::{collections::{HashMap, HashSet}, fmt}; +use std::{ + collections::{HashMap, HashSet}, + fmt, +}; use tui::layout::{Constraint, Rect}; use uuid::Uuid; @@ -168,14 +171,13 @@ impl fmt::Display for Loading { } } - /// Global gui_state, stored in an Arc #[derive(Debug, Clone)] pub struct GuiState { panel_map: HashMap, heading_map: HashMap, loading_icon: Loading, - is_loading: HashSet, + is_loading: HashSet, pub selected_panel: SelectablePanel, pub show_help: bool, pub info_box_text: Option, @@ -245,14 +247,14 @@ impl GuiState { /// Change to previous selectable panel pub fn previous_panel(&mut self) { - self.selected_panel = self.selected_panel.prev(); + self.selected_panel = self.selected_panel.prev(); } /// Advance loading animation pub fn next_loading(&mut self, uuid: Uuid) { self.loading_icon = self.loading_icon.next(); self.is_loading.insert(uuid); - } + } /// if is_loading, return loading animation frame, else single space pub fn get_loading(&mut self) -> String {