refactor: add glue to prep for the transition

Write some glue code to transition from the old code to the new one.
This commit is contained in:
ClementTsang 2021-08-23 18:27:50 -04:00
parent 64c6d0c898
commit 88ebcab8f2
8 changed files with 42 additions and 8 deletions

View File

@ -53,4 +53,8 @@ impl Component for BatteryTable {
}
}
impl Widget for BatteryTable {}
impl Widget for BatteryTable {
fn get_pretty_name(&self) -> &'static str {
"Battery"
}
}

View File

@ -124,4 +124,8 @@ impl Component for CpuGraph {
}
}
impl Widget for CpuGraph {}
impl Widget for CpuGraph {
fn get_pretty_name(&self) -> &'static str {
"CPU"
}
}

View File

@ -73,4 +73,8 @@ impl Component for DiskTable {
}
}
impl Widget for DiskTable {}
impl Widget for DiskTable {
fn get_pretty_name(&self) -> &'static str {
"Disk"
}
}

View File

@ -74,4 +74,8 @@ impl Component for MemGraph {
}
}
impl Widget for MemGraph {}
impl Widget for MemGraph {
fn get_pretty_name(&self) -> &'static str {
"Memory"
}
}

View File

@ -92,6 +92,8 @@ pub trait Widget {
fn handle_widget_selection_down(&mut self) -> SelectionAction {
SelectionAction::NotHandled
}
fn get_pretty_name(&self) -> &'static str;
}
/// The "main" widgets that are used by bottom to display information!

View File

@ -145,7 +145,11 @@ impl Component for NetGraph {
}
}
impl Widget for NetGraph {}
impl Widget for NetGraph {
fn get_pretty_name(&self) -> &'static str {
"Network"
}
}
/// A widget denoting network usage via a graph and a separate, single row table. This is built on [`NetGraph`],
/// and the main difference is that it also contains a bounding box for the graph + text.
@ -186,4 +190,8 @@ impl Component for OldNetGraph {
}
}
impl Widget for OldNetGraph {}
impl Widget for OldNetGraph {
fn get_pretty_name(&self) -> &'static str {
"Network"
}
}

View File

@ -811,4 +811,8 @@ impl Component for ProcessManager {
}
}
impl Widget for ProcessManager {}
impl Widget for ProcessManager {
fn get_pretty_name(&self) -> &'static str {
"Processes"
}
}

View File

@ -73,4 +73,8 @@ impl Component for TempTable {
}
}
impl Widget for TempTable {}
impl Widget for TempTable {
fn get_pretty_name(&self) -> &'static str {
"Temperature"
}
}