refactor: dead code removed
This commit is contained in:
@@ -1,3 +1,10 @@
|
|||||||
|
### Chores
|
||||||
|
+ dependencies updated, [cf7e02dde94f69832a2e485b99785afc66a5bc15]
|
||||||
|
|
||||||
|
### Features
|
||||||
|
+ Enable sorting of containers by every heading, via keyboard or mouse, closes [#3], [a6c296f2cde56cf241bcd696cab8bd477270e5f4]
|
||||||
|
+ Spawn & track docker information update requests, multiple identical requests cannot be executed, [740c059b276f35acd1cb03f1030134646bf8a07d]
|
||||||
|
|
||||||
# <a href='https://github.com/mrjackwills/oxker/releases/tag/v0.0.6'>v0.0.6</a>
|
# <a href='https://github.com/mrjackwills/oxker/releases/tag/v0.0.6'>v0.0.6</a>
|
||||||
### 2022-07-06
|
### 2022-07-06
|
||||||
|
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ In application controls
|
|||||||
available command line arguments
|
available command line arguments
|
||||||
| argument|result|
|
| argument|result|
|
||||||
|--|--|
|
|--|--|
|
||||||
|```-d [number > 0]```| set the update interval for docker information, in ms, defaults to 1000 (1 second) |
|
|```-d [number > 0]```| set the minimum update interval for docker information, in ms, defaults to 1000 (1 second) |
|
||||||
|```-r```| Show raw logs, by default oxker will remove ANSI formatting (conflicts with -c) |
|
|```-r```| Show raw logs, by default oxker will remove ANSI formatting (conflicts with -c) |
|
||||||
|```-c```| Attempt to color the logs (conflicts with -r) |
|
|```-c```| Attempt to color the logs (conflicts with -r) |
|
||||||
|```-t```| Remove timestamps from each log entry |
|
|```-t```| Remove timestamps from each log entry |
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ use super::Header;
|
|||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct StatefulList<T> {
|
pub struct StatefulList<T> {
|
||||||
pub state: ListState,
|
pub state: ListState,
|
||||||
// todo BTreeMap
|
|
||||||
pub items: Vec<T>,
|
pub items: Vec<T>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ use crate::{
|
|||||||
app_error::AppError,
|
app_error::AppError,
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::gui_state::BoxLocation;
|
use super::gui_state::{BoxLocation, Region};
|
||||||
use super::{GuiState, SelectablePanel};
|
use super::{GuiState, SelectablePanel};
|
||||||
|
|
||||||
const NAME_TEXT: &str = r#"
|
const NAME_TEXT: &str = r#"
|
||||||
@@ -48,7 +48,7 @@ fn generate_block<'a>(
|
|||||||
gui_state: &Arc<Mutex<GuiState>>,
|
gui_state: &Arc<Mutex<GuiState>>,
|
||||||
panel: SelectablePanel,
|
panel: SelectablePanel,
|
||||||
) -> Block<'a> {
|
) -> Block<'a> {
|
||||||
gui_state.lock().insert_into_panel_map(panel, area);
|
gui_state.lock().update_map(Region::Panel(panel), area);
|
||||||
let mut block = Block::default()
|
let mut block = Block::default()
|
||||||
.borders(Borders::ALL)
|
.borders(Borders::ALL)
|
||||||
.border_type(BorderType::Rounded);
|
.border_type(BorderType::Rounded);
|
||||||
@@ -473,10 +473,11 @@ pub fn draw_heading_bar<B: Backend>(
|
|||||||
|
|
||||||
// draw the actual header blocks
|
// draw the actual header blocks
|
||||||
for (index, (paragraph, header, _)) in header_data.into_iter().enumerate() {
|
for (index, (paragraph, header, _)) in header_data.into_iter().enumerate() {
|
||||||
|
let rect = headers_section[index];
|
||||||
gui_state
|
gui_state
|
||||||
.lock()
|
.lock()
|
||||||
.insert_into_header_map(header, headers_section[index]);
|
.update_map(Region::Header(header), rect);
|
||||||
f.render_widget(paragraph, headers_section[index]);
|
f.render_widget(paragraph, rect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+14
-14
@@ -10,6 +10,12 @@ pub enum SelectablePanel {
|
|||||||
Logs,
|
Logs,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
pub enum Region {
|
||||||
|
Panel(SelectablePanel),
|
||||||
|
Header(Header)
|
||||||
|
}
|
||||||
|
|
||||||
#[allow(unused)]
|
#[allow(unused)]
|
||||||
#[derive(Debug, Clone, Copy)]
|
#[derive(Debug, Clone, Copy)]
|
||||||
pub enum BoxLocation {
|
pub enum BoxLocation {
|
||||||
@@ -39,7 +45,7 @@ impl BoxLocation {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Should combine and just return a tupple?
|
// Should combine and just return a tuple?
|
||||||
pub fn get_horizontal_constraints(
|
pub fn get_horizontal_constraints(
|
||||||
&self,
|
&self,
|
||||||
blank_vertical: u16,
|
blank_vertical: u16,
|
||||||
@@ -177,7 +183,6 @@ pub struct GuiState {
|
|||||||
pub show_help: bool,
|
pub show_help: bool,
|
||||||
pub info_box_text: Option<String>,
|
pub info_box_text: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl GuiState {
|
impl GuiState {
|
||||||
/// Generate a default gui_state
|
/// Generate a default gui_state
|
||||||
pub fn default() -> Self {
|
pub fn default() -> Self {
|
||||||
@@ -220,18 +225,13 @@ impl GuiState {
|
|||||||
.map(|data| data.0.to_owned())
|
.map(|data| data.0.to_owned())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Insert selectable gui panel into area map
|
/// Insert, or updatem header area panel into heading_map
|
||||||
/// Remove each time, as terminal may have been resized!
|
pub fn update_map(&mut self, region: Region, area: Rect) {
|
||||||
pub fn insert_into_panel_map(&mut self, panel: SelectablePanel, area: Rect) {
|
match region {
|
||||||
self.panel_map.remove(&panel);
|
Region::Header(header) =>
|
||||||
self.panel_map.insert(panel, area);
|
self.heading_map.entry(header).and_modify(|w|*w =area).or_insert(area),
|
||||||
}
|
Region::Panel(panel) => self.panel_map.entry(panel).and_modify(|w|*w =area).or_insert(area),
|
||||||
|
};
|
||||||
/// Insert selectable gui panel into area map
|
|
||||||
/// Remove each time, as terminal may have been resized!
|
|
||||||
pub fn insert_into_header_map(&mut self, header: Header, area: Rect) {
|
|
||||||
self.heading_map.remove(&header);
|
|
||||||
self.heading_map.insert(header, area);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Change to next selectable panel
|
/// Change to next selectable panel
|
||||||
|
|||||||
Reference in New Issue
Block a user