docs: readme updated
This commit is contained in:
@@ -38,6 +38,19 @@ rm oxker_linux_x86_64.tar.gz oxker
|
|||||||
|
|
||||||
```oxker```
|
```oxker```
|
||||||
|
|
||||||
|
In application controls
|
||||||
|
| button| result|
|
||||||
|
|--|--|
|
||||||
|
| ```( tab )``` or ```( shift+tab )``` | Change panel (containers > controls > logs). Clicking panels also changed the selected panel|
|
||||||
|
| ```( ↑ ↓ )``` or ```( j k )``` or ```(PgUp PgDown)``` or ```(Home End)```| Change selected line in selected panel, mouse scroll also changes selected line |
|
||||||
|
| ```( enter )```| execute selected docker commands|
|
||||||
|
| ```( 1-9 )``` | sort containers by heading. Clicking on headings also sorts selected column |
|
||||||
|
| ```( 0 )``` | stop sorting |
|
||||||
|
| ```( h )``` | Show help menu - displays these options|
|
||||||
|
| ```( m )``` | toggle mouse capture - if disabled, text on screen can be selected, to be copied etc|
|
||||||
|
| ```( q )``` | to quit at any time |
|
||||||
|
|
||||||
|
|
||||||
available command line arguments
|
available command line arguments
|
||||||
| argument|result|
|
| argument|result|
|
||||||
|--|--|
|
|--|--|
|
||||||
|
|||||||
+1
-12
@@ -1,10 +1,9 @@
|
|||||||
use bollard::models::ContainerSummary;
|
use bollard::models::ContainerSummary;
|
||||||
use core::fmt;
|
use core::fmt;
|
||||||
use std::{
|
use std::{
|
||||||
collections::HashMap,
|
|
||||||
time::{SystemTime, UNIX_EPOCH},
|
time::{SystemTime, UNIX_EPOCH},
|
||||||
};
|
};
|
||||||
use tui::{layout::Rect, widgets::ListItem};
|
use tui::widgets::ListItem;
|
||||||
|
|
||||||
mod container_state;
|
mod container_state;
|
||||||
|
|
||||||
@@ -216,16 +215,6 @@ impl AppData {
|
|||||||
.items
|
.items
|
||||||
.sort_by(|a, b| b.status.cmp(&a.status)),
|
.sort_by(|a, b| b.status.cmp(&a.status)),
|
||||||
},
|
},
|
||||||
Header::Status => match so {
|
|
||||||
SortedOrder::Asc => self
|
|
||||||
.containers
|
|
||||||
.items
|
|
||||||
.sort_by(|a, b| a.status.cmp(&b.status)),
|
|
||||||
SortedOrder::Desc => self
|
|
||||||
.containers
|
|
||||||
.items
|
|
||||||
.sort_by(|a, b| b.status.cmp(&a.status)),
|
|
||||||
},
|
|
||||||
Header::Cpu => match so {
|
Header::Cpu => match so {
|
||||||
SortedOrder::Desc => self
|
SortedOrder::Desc => self
|
||||||
.containers
|
.containers
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
use bollard::{
|
use bollard::{
|
||||||
container::{ListContainersOptions, LogsOptions, StartContainerOptions, Stats, StatsOptions},
|
container::{ListContainersOptions, LogsOptions, StartContainerOptions, Stats, StatsOptions},
|
||||||
models::ContainerSummary,
|
|
||||||
Docker,
|
Docker,
|
||||||
};
|
};
|
||||||
use futures_util::{future::join_all, StreamExt};
|
use futures_util::{future::join_all, StreamExt};
|
||||||
@@ -9,7 +8,7 @@ use std::sync::Arc;
|
|||||||
use tokio::{sync::mpsc::Receiver, task::JoinHandle};
|
use tokio::{sync::mpsc::Receiver, task::JoinHandle};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
app_data::{AppData, DockerControls, Header, SortedOrder},
|
app_data::{AppData, DockerControls},
|
||||||
app_error::AppError,
|
app_error::AppError,
|
||||||
parse_args::CliArgs,
|
parse_args::CliArgs,
|
||||||
ui::GuiState,
|
ui::GuiState,
|
||||||
@@ -215,6 +214,11 @@ impl DockerData {
|
|||||||
output
|
output
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// async fn stop(&self) {
|
||||||
|
// self.docker.
|
||||||
|
|
||||||
|
// }
|
||||||
|
|
||||||
/// Update all logs, spawn each container into own tokio::spawn thread
|
/// Update all logs, spawn each container into own tokio::spawn thread
|
||||||
async fn init_all_logs(&mut self, all_ids: &[(bool, String)]) {
|
async fn init_all_logs(&mut self, all_ids: &[(bool, String)]) {
|
||||||
let mut handles = vec![];
|
let mut handles = vec![];
|
||||||
|
|||||||
@@ -259,7 +259,7 @@ impl InputHandler {
|
|||||||
1,
|
1,
|
||||||
));
|
));
|
||||||
|
|
||||||
/// Don't like this
|
// Don't like this
|
||||||
let order = if let Some((_, or)) = self.app_data.lock().get_sorted() {
|
let order = if let Some((_, or)) = self.app_data.lock().get_sorted() {
|
||||||
match or {
|
match or {
|
||||||
SortedOrder::Asc => SortedOrder::Desc,
|
SortedOrder::Asc => SortedOrder::Desc,
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
#![allow(unused)]
|
|
||||||
use app_data::AppData;
|
use app_data::AppData;
|
||||||
use app_error::AppError;
|
use app_error::AppError;
|
||||||
use bollard::Docker;
|
use bollard::Docker;
|
||||||
|
|||||||
+10
-99
@@ -125,27 +125,6 @@ pub fn draw_containers<B: Backend>(
|
|||||||
) {
|
) {
|
||||||
let block = generate_block(app_data, area, gui_state, SelectablePanel::Containers);
|
let block = generate_block(app_data, area, gui_state, SelectablePanel::Containers);
|
||||||
|
|
||||||
let sorted = app_data.lock().get_sorted();
|
|
||||||
|
|
||||||
// if containers sorted, increase width to match headers
|
|
||||||
// let sorted_width = if app_data.lock().get_sorted().is_some() {
|
|
||||||
// 2
|
|
||||||
// }else {
|
|
||||||
// 0
|
|
||||||
// };
|
|
||||||
|
|
||||||
// Check if need to alter column width to watch the heading widths
|
|
||||||
let sorted_width = |(x, s): &(Header, usize)| {
|
|
||||||
let mut output = 0;
|
|
||||||
if let Some((h, _)) = &sorted {
|
|
||||||
if h == x {
|
|
||||||
output = 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// s + output
|
|
||||||
s.to_owned()
|
|
||||||
};
|
|
||||||
|
|
||||||
let items = app_data
|
let items = app_data
|
||||||
.lock()
|
.lock()
|
||||||
.containers
|
.containers
|
||||||
@@ -166,7 +145,7 @@ pub fn draw_containers<B: Backend>(
|
|||||||
format!(
|
format!(
|
||||||
"{:<width$}",
|
"{:<width$}",
|
||||||
i.state.to_string(),
|
i.state.to_string(),
|
||||||
width = sorted_width(&widths.state)
|
width = widths.state.1
|
||||||
),
|
),
|
||||||
state_style,
|
state_style,
|
||||||
),
|
),
|
||||||
@@ -175,7 +154,7 @@ pub fn draw_containers<B: Backend>(
|
|||||||
"{}{:>width$}",
|
"{}{:>width$}",
|
||||||
MARGIN,
|
MARGIN,
|
||||||
i.status,
|
i.status,
|
||||||
width = sorted_width(&widths.status)
|
width =&widths.status.1
|
||||||
),
|
),
|
||||||
state_style,
|
state_style,
|
||||||
),
|
),
|
||||||
@@ -184,7 +163,7 @@ pub fn draw_containers<B: Backend>(
|
|||||||
"{}{:>width$}",
|
"{}{:>width$}",
|
||||||
MARGIN,
|
MARGIN,
|
||||||
i.cpu_stats.back().unwrap_or(&CpuStats::new(0.0)),
|
i.cpu_stats.back().unwrap_or(&CpuStats::new(0.0)),
|
||||||
width = sorted_width(&widths.cpu)
|
width = &widths.cpu.1
|
||||||
),
|
),
|
||||||
state_style,
|
state_style,
|
||||||
),
|
),
|
||||||
@@ -193,7 +172,7 @@ pub fn draw_containers<B: Backend>(
|
|||||||
"{}{:>width$}",
|
"{}{:>width$}",
|
||||||
MARGIN,
|
MARGIN,
|
||||||
mems,
|
mems,
|
||||||
width = sorted_width(&widths.mem)
|
width = &widths.mem.1
|
||||||
),
|
),
|
||||||
state_style,
|
state_style,
|
||||||
),
|
),
|
||||||
@@ -202,7 +181,7 @@ pub fn draw_containers<B: Backend>(
|
|||||||
"{}{:>width$}",
|
"{}{:>width$}",
|
||||||
MARGIN,
|
MARGIN,
|
||||||
i.id.chars().take(8).collect::<String>(),
|
i.id.chars().take(8).collect::<String>(),
|
||||||
width = sorted_width(&widths.id),
|
width = &widths.id.1
|
||||||
),
|
),
|
||||||
blue,
|
blue,
|
||||||
),
|
),
|
||||||
@@ -211,7 +190,7 @@ pub fn draw_containers<B: Backend>(
|
|||||||
"{}{:>width$}",
|
"{}{:>width$}",
|
||||||
MARGIN,
|
MARGIN,
|
||||||
i.name,
|
i.name,
|
||||||
width = sorted_width(&widths.name)
|
width = widths.name.1
|
||||||
),
|
),
|
||||||
blue,
|
blue,
|
||||||
),
|
),
|
||||||
@@ -220,7 +199,7 @@ pub fn draw_containers<B: Backend>(
|
|||||||
"{}{:>width$}",
|
"{}{:>width$}",
|
||||||
MARGIN,
|
MARGIN,
|
||||||
i.image,
|
i.image,
|
||||||
width = sorted_width(&widths.image)
|
width = widths.image.1
|
||||||
),
|
),
|
||||||
blue,
|
blue,
|
||||||
),
|
),
|
||||||
@@ -229,7 +208,7 @@ pub fn draw_containers<B: Backend>(
|
|||||||
"{}{:>width$}",
|
"{}{:>width$}",
|
||||||
MARGIN,
|
MARGIN,
|
||||||
i.net_rx,
|
i.net_rx,
|
||||||
width = sorted_width(&widths.net_rx)
|
width = widths.net_rx.1
|
||||||
),
|
),
|
||||||
Style::default().fg(Color::Rgb(255, 233, 193)),
|
Style::default().fg(Color::Rgb(255, 233, 193)),
|
||||||
),
|
),
|
||||||
@@ -238,7 +217,7 @@ pub fn draw_containers<B: Backend>(
|
|||||||
"{}{:>width$}",
|
"{}{:>width$}",
|
||||||
MARGIN,
|
MARGIN,
|
||||||
i.net_tx,
|
i.net_tx,
|
||||||
width = sorted_width(&widths.net_tx)
|
width = widths.net_tx.1
|
||||||
),
|
),
|
||||||
Style::default().fg(Color::Rgb(205, 140, 140)),
|
Style::default().fg(Color::Rgb(205, 140, 140)),
|
||||||
),
|
),
|
||||||
@@ -246,74 +225,6 @@ pub fn draw_containers<B: Backend>(
|
|||||||
ListItem::new(lines)
|
ListItem::new(lines)
|
||||||
})
|
})
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
// let items = app_data
|
|
||||||
// .lock()
|
|
||||||
// .containers
|
|
||||||
// .items
|
|
||||||
// .iter()
|
|
||||||
// .map(|i| {
|
|
||||||
// let state_style = Style::default().fg(i.state.get_color());
|
|
||||||
// let blue = Style::default().fg(Color::Blue);
|
|
||||||
|
|
||||||
// let mems = format!(
|
|
||||||
// "{:>1} / {:>1}",
|
|
||||||
// i.mem_stats.back().unwrap_or(&ByteStats::new(0)),
|
|
||||||
// i.mem_limit
|
|
||||||
// );
|
|
||||||
|
|
||||||
// let lines = Spans::from(vec![
|
|
||||||
// Span::styled(
|
|
||||||
// format!("{:<width$}", i.state.to_string(), width = widths.state.1),
|
|
||||||
// state_style,
|
|
||||||
// ),
|
|
||||||
// Span::styled(
|
|
||||||
// format!("{}{:>width$}", MARGIN, i.status, width = widths.status.1),
|
|
||||||
// state_style,
|
|
||||||
// ),
|
|
||||||
// Span::styled(
|
|
||||||
// format!(
|
|
||||||
// "{}{:>width$}",
|
|
||||||
// MARGIN,
|
|
||||||
// i.cpu_stats.back().unwrap_or(&CpuStats::new(0.0)),
|
|
||||||
// width = widths.cpu.1
|
|
||||||
// ),
|
|
||||||
// state_style,
|
|
||||||
// ),
|
|
||||||
// Span::styled(
|
|
||||||
// format!("{}{:>width$}", MARGIN, mems, width = widths.mem.1),
|
|
||||||
// state_style,
|
|
||||||
// ),
|
|
||||||
// Span::styled(
|
|
||||||
// format!(
|
|
||||||
// "{}{:>width$}",
|
|
||||||
// MARGIN,
|
|
||||||
// i.id.chars().take(8).collect::<String>(),
|
|
||||||
// width = widths.id.1
|
|
||||||
// ),
|
|
||||||
// blue,
|
|
||||||
// ),
|
|
||||||
// Span::styled(
|
|
||||||
// format!("{}{:>width$}", MARGIN, i.name, width = widths.name.1),
|
|
||||||
// blue,
|
|
||||||
// ),
|
|
||||||
// Span::styled(
|
|
||||||
// format!("{}{:>width$}", MARGIN, i.image, width = widths.image.1),
|
|
||||||
// blue,
|
|
||||||
// ),
|
|
||||||
// Span::styled(
|
|
||||||
// format!("{}{:>width$}", MARGIN, i.net_rx, width = widths.net_rx.1),
|
|
||||||
// Style::default().fg(Color::Rgb(255, 233, 193)),
|
|
||||||
// ),
|
|
||||||
// Span::styled(
|
|
||||||
// format!("{}{:>width$}", MARGIN, i.net_tx, width = widths.net_tx.1),
|
|
||||||
// Style::default().fg(Color::Rgb(205, 140, 140)),
|
|
||||||
// ),
|
|
||||||
// ]);
|
|
||||||
// ListItem::new(lines)
|
|
||||||
// })
|
|
||||||
// .collect::<Vec<_>>();
|
|
||||||
|
|
||||||
if items.is_empty() {
|
if items.is_empty() {
|
||||||
let debug_text = String::from("no containers running");
|
let debug_text = String::from("no containers running");
|
||||||
let paragraph = Paragraph::new(debug_text)
|
let paragraph = Paragraph::new(debug_text)
|
||||||
@@ -488,7 +399,7 @@ pub fn draw_heading_bar<B: Backend>(
|
|||||||
|
|
||||||
f.render_widget(block(), area);
|
f.render_widget(block(), area);
|
||||||
|
|
||||||
/// Generate a bloack for the header, if the header is currently being used to sort a column, then highlight it white
|
// Generate a bloack for the header, if the header is currently being used to sort a column, then highlight it white
|
||||||
let header_block = |x: &Header| {
|
let header_block = |x: &Header| {
|
||||||
let mut color = Color::Black;
|
let mut color = Color::Black;
|
||||||
let mut suffix = "";
|
let mut suffix = "";
|
||||||
|
|||||||
Reference in New Issue
Block a user