refactor: Multiple UI improvements;
Use FrameData struct to store commonly accessed data, in order to reduce mutex locks. rename unpause to resume use get_selected_panel() function instead of directly gui_state.selected_panel debug mode now shows some usefull information
This commit is contained in:
@@ -28,6 +28,11 @@ impl ContainerId {
|
||||
pub fn get(&self) -> &str {
|
||||
self.0.as_str()
|
||||
}
|
||||
|
||||
/// Only return first 8 chars of id, is usually more than enough for uniqueness
|
||||
pub fn get_short(&self) -> String {
|
||||
self.0.chars().take(8).collect::<String>()
|
||||
}
|
||||
}
|
||||
|
||||
impl Ord for ContainerId {
|
||||
@@ -443,6 +448,20 @@ pub struct ContainerItem {
|
||||
pub is_oxker: bool,
|
||||
}
|
||||
|
||||
/// Basic display information, for when running in debug mode
|
||||
impl fmt::Display for ContainerItem {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(
|
||||
f,
|
||||
"{}, {}, {}, {}",
|
||||
self.id.get_short(),
|
||||
self.name,
|
||||
self.cpu_stats.back().unwrap_or(&CpuStats::new(0.0)),
|
||||
self.mem_stats.back().unwrap_or(&ByteStats::new(0))
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
impl ContainerItem {
|
||||
/// Create a new container item
|
||||
pub fn new(
|
||||
|
||||
Reference in New Issue
Block a user