Merge branch 'dev'

This commit is contained in:
Jack Wills
2022-04-25 12:40:57 +00:00
9 changed files with 25 additions and 23 deletions
+5
View File
@@ -1,3 +1,8 @@
### Fixes
+ readme.md typo, [589501f9a4a0bfabdb0654e68cc0c752c529d97a]
+ column heading mem > memory, [5e8e6b590b06f01a542fdd10bae8f14d303ab08a]
+ cargo fmt added to create_release.sh, [bb29c0ebfafd6a9a036eb317a240954d1405966e]
# <a href='https://github.com/mrjackwills/oxker/releases/tag/v0.0.1'>v0.0.1</a> # <a href='https://github.com/mrjackwills/oxker/releases/tag/v0.0.1'>v0.0.1</a>
### 2022-04-25 ### 2022-04-25
+1 -1
View File
@@ -7,7 +7,7 @@
</p> </p>
<p align="center"> <p align="center">
A simple tui to view and control docker containers" A simple tui to view and control docker containers
</p> </p>
<p align="center"> <p align="center">
+1
View File
@@ -193,6 +193,7 @@ release_flow() {
ask_changelog_update ask_changelog_update
git checkout -b "$RELEASE_BRANCH" git checkout -b "$RELEASE_BRANCH"
update_cargo_toml update_cargo_toml
cargo fmt
git add . git add .
git commit -m "chore: release $NEW_TAG_VERSION" git commit -m "chore: release $NEW_TAG_VERSION"
git checkout main git checkout main
+3 -3
View File
@@ -232,7 +232,7 @@ impl Stats for CpuStats {
impl fmt::Display for CpuStats { impl fmt::Display for CpuStats {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let disp = format!("{:05.2}%", self.value); let disp = format!("{:05.2}%", self.value);
write!(f, "{:>x$}", disp, x = f.width().unwrap_or(1)) write!(f, "{:>x$}", disp, x = f.width().unwrap_or(1))
} }
} }
@@ -411,13 +411,13 @@ pub struct Columns {
impl Columns { impl Columns {
pub fn new() -> Self { pub fn new() -> Self {
Self { Self {
// 7 to allow for 100.00% // 7 to allow for 100.00%
cpu: (String::from("cpu"), 7), cpu: (String::from("cpu"), 7),
image: (String::from("image"), 5), image: (String::from("image"), 5),
name: (String::from("name"), 4), name: (String::from("name"), 4),
state: (String::from("state"), 11), state: (String::from("state"), 11),
status: (String::from("status"), 16), status: (String::from("status"), 16),
mem: (String::from("mem/limit"), 9), mem: (String::from("memory/limit"), 12),
net_rx: (String::from("↓ rx"), 5), net_rx: (String::from("↓ rx"), 5),
net_tx: (String::from("↑ tx"), 5), net_tx: (String::from("↑ tx"), 5),
} }
+4 -7
View File
@@ -31,8 +31,7 @@ impl AppData {
} }
} }
// Current time as unix timestamp
// Current time as unix timestamp
fn get_systemtime(&self) -> u64 { fn get_systemtime(&self) -> u64 {
SystemTime::now() SystemTime::now()
.duration_since(UNIX_EPOCH) .duration_since(UNIX_EPOCH)
@@ -40,7 +39,6 @@ impl AppData {
.as_secs() .as_secs()
} }
/// Get the current select docker command /// Get the current select docker command
/// So know which command to execute /// So know which command to execute
pub fn get_docker_command(&self) -> Option<DockerControls> { pub fn get_docker_command(&self) -> Option<DockerControls> {
@@ -363,8 +361,8 @@ impl AppData {
} }
} }
/// update logs of a given container, based on index not id /// update logs of a given container, based on index not id
pub fn update_log_by_index(&mut self, output: Vec<String>, index: usize) { pub fn update_log_by_index(&mut self, output: Vec<String>, index: usize) {
let tz = self.get_systemtime(); let tz = self.get_systemtime();
if let Some(container) = self.containers.items.get_mut(index) { if let Some(container) = self.containers.items.get_mut(index) {
container.last_updated = tz; container.last_updated = tz;
@@ -388,8 +386,7 @@ impl AppData {
self.logs_parsed = true; self.logs_parsed = true;
} }
pub fn update_all_logs(&mut self, all_logs: Vec<Vec<String>>) {
pub fn update_all_logs(&mut self, all_logs: Vec<Vec<String>>) {
for (index, output) in all_logs.into_iter().enumerate() { for (index, output) in all_logs.into_iter().enumerate() {
self.update_log_by_index(output, index); self.update_log_by_index(output, index);
} }
+2 -2
View File
@@ -43,7 +43,7 @@ impl InputHandler {
is_running, is_running,
rec, rec,
}; };
inner.start().await; inner.start().await;
} }
/// check for incoming messages /// check for incoming messages
@@ -129,7 +129,7 @@ impl InputHandler {
} }
} }
KeyCode::Enter => { KeyCode::Enter => {
// Does is matter though? // Does is matter though?
// This isn't great, just means you can't send docker commands before full initialization of the program // This isn't great, just means you can't send docker commands before full initialization of the program
// could change to to if loading = true, although at the moment don't have a loading bool // could change to to if loading = true, although at the moment don't have a loading bool
let panel = self.gui_state.lock().selected_panel; let panel = self.gui_state.lock().selected_panel;
+5 -6
View File
@@ -222,16 +222,15 @@ pub fn draw_logs<B: Backend>(
let block = generate_block(Some(panel), app_data, selected_panel); let block = generate_block(Some(panel), app_data, selected_panel);
let init = app_data.lock().init; let init = app_data.lock().init;
if !init { if !init {
let icon = gui_state.lock().get_loading(); let icon = gui_state.lock().get_loading();
let parsing_logs = format!("parsing logs {}", icon); let parsing_logs = format!("parsing logs {}", icon);
let paragraph = Paragraph::new(parsing_logs) let paragraph = Paragraph::new(parsing_logs)
.style(Style::default()) .style(Style::default())
.block(block) .block(block)
.alignment(Alignment::Center); .alignment(Alignment::Center);
f.render_widget(paragraph, area) f.render_widget(paragraph, area)
} else if let Some(index) = index { } else if let Some(index) = index {
let items = app_data.lock().containers.items[index] let items = app_data.lock().containers.items[index]
.logs .logs
@@ -349,8 +348,8 @@ fn make_chart<T: Stats + Display>(
.fg(label_color), .fg(label_color),
), ),
]) ])
// add 0.01, for cases when the value is 0 // add 0.01, for cases when the value is 0
.bounds([0.0, max.get_value() +0.01]), .bounds([0.0, max.get_value() + 0.01]),
) )
} }
+3 -3
View File
@@ -94,9 +94,9 @@ impl SelectablePanel {
/// Global gui_state, stored in an Arc<Mutex> /// Global gui_state, stored in an Arc<Mutex>
#[derive(Debug)] #[derive(Debug)]
pub struct GuiState { pub struct GuiState {
// Think this should be a BMapTree, so can define order when iterating over potential intersects // Think this should be a BMapTree, so can define order when iterating over potential intersects
// Is an issue if two panels are in the same space, sush as a smaller panel embedded, yet infront of, a larger panel // Is an issue if two panels are in the same space, sush as a smaller panel embedded, yet infront of, a larger panel
// If a BMapTree think it would mean have to implement ordering for SelectablePanel // If a BMapTree think it would mean have to implement ordering for SelectablePanel
area_map: HashMap<SelectablePanel, Rect>, area_map: HashMap<SelectablePanel, Rect>,
loading: Loading, loading: Loading,
pub selected_panel: SelectablePanel, pub selected_panel: SelectablePanel,
+1 -1
View File
@@ -85,7 +85,7 @@ async fn run_app<B: Backend>(
} else { } else {
loop { loop {
terminal.draw(|f| ui(f, &app_data, &gui_state)).unwrap(); terminal.draw(|f| ui(f, &app_data, &gui_state)).unwrap();
if crossterm::event::poll(input_poll_rate).unwrap() { if crossterm::event::poll(input_poll_rate).unwrap() {
let event = event::read().unwrap(); let event = event::read().unwrap();
if let Event::Key(key) = event { if let Event::Key(key) = event {
sender sender