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>
|
||||
### 2022-07-06
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
</p>
|
||||
|
||||
|
||||
## Download & install
|
||||
## Download & install
|
||||
|
||||
See <a href="https://github.com/mrjackwills/oxker/releases" target='_blank' rel='noopener noreferrer'>releases</a>
|
||||
|
||||
@@ -54,7 +54,7 @@ In application controls
|
||||
available command line arguments
|
||||
| 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) |
|
||||
|```-c```| Attempt to color the logs (conflicts with -r) |
|
||||
|```-t```| Remove timestamps from each log entry |
|
||||
|
||||
@@ -10,7 +10,6 @@ use super::Header;
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct StatefulList<T> {
|
||||
pub state: ListState,
|
||||
// todo BTreeMap
|
||||
pub items: Vec<T>,
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ use crate::{
|
||||
app_error::AppError,
|
||||
};
|
||||
|
||||
use super::gui_state::BoxLocation;
|
||||
use super::gui_state::{BoxLocation, Region};
|
||||
use super::{GuiState, SelectablePanel};
|
||||
|
||||
const NAME_TEXT: &str = r#"
|
||||
@@ -48,7 +48,7 @@ fn generate_block<'a>(
|
||||
gui_state: &Arc<Mutex<GuiState>>,
|
||||
panel: SelectablePanel,
|
||||
) -> 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()
|
||||
.borders(Borders::ALL)
|
||||
.border_type(BorderType::Rounded);
|
||||
@@ -473,10 +473,11 @@ pub fn draw_heading_bar<B: Backend>(
|
||||
|
||||
// draw the actual header blocks
|
||||
for (index, (paragraph, header, _)) in header_data.into_iter().enumerate() {
|
||||
let rect = headers_section[index];
|
||||
gui_state
|
||||
.lock()
|
||||
.insert_into_header_map(header, headers_section[index]);
|
||||
f.render_widget(paragraph, headers_section[index]);
|
||||
.update_map(Region::Header(header), rect);
|
||||
f.render_widget(paragraph, rect);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+14
-14
@@ -10,6 +10,12 @@ pub enum SelectablePanel {
|
||||
Logs,
|
||||
}
|
||||
|
||||
|
||||
pub enum Region {
|
||||
Panel(SelectablePanel),
|
||||
Header(Header)
|
||||
}
|
||||
|
||||
#[allow(unused)]
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
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(
|
||||
&self,
|
||||
blank_vertical: u16,
|
||||
@@ -177,7 +183,6 @@ pub struct GuiState {
|
||||
pub show_help: bool,
|
||||
pub info_box_text: Option<String>,
|
||||
}
|
||||
|
||||
impl GuiState {
|
||||
/// Generate a default gui_state
|
||||
pub fn default() -> Self {
|
||||
@@ -220,18 +225,13 @@ impl GuiState {
|
||||
.map(|data| data.0.to_owned())
|
||||
}
|
||||
|
||||
/// Insert selectable gui panel into area map
|
||||
/// Remove each time, as terminal may have been resized!
|
||||
pub fn insert_into_panel_map(&mut self, panel: SelectablePanel, area: Rect) {
|
||||
self.panel_map.remove(&panel);
|
||||
self.panel_map.insert(panel, 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);
|
||||
/// Insert, or updatem header area panel into heading_map
|
||||
pub fn update_map(&mut self, region: Region, area: Rect) {
|
||||
match region {
|
||||
Region::Header(header) =>
|
||||
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),
|
||||
};
|
||||
}
|
||||
|
||||
/// Change to next selectable panel
|
||||
|
||||
Reference in New Issue
Block a user