[skip travis] Add field for total rx and tx display in the canvas; note this will get changed when we rewrite legend into a separate tab due to tui-rs limitations

This commit is contained in:
ClementTsang 2019-12-27 18:30:35 -05:00
parent 9b11e7ea9c
commit e5845d5719
3 changed files with 12 additions and 6 deletions

View File

@ -13,13 +13,13 @@ jobs:
allow_failures:
- rust: nightly
# From https://levans.fr/rust_travis_cache.html
# cache:
# directories:
# - /home/travis/.cargo
#From https://levans.fr/rust_travis_cache.html
cache:
directories:
- /home/travis/.cargo
# before_cache:
# - rm -rf /home/travis/.cargo/registry
before_cache:
- rm -rf /home/travis/.cargo/registry
notifications:
email:

View File

@ -37,6 +37,8 @@ lazy_static! {
pub struct CanvasData {
pub rx_display: String,
pub tx_display: String,
pub total_rx_display: String,
pub total_tx_display: String,
pub network_data_rx: Vec<(f64, f64)>,
pub network_data_tx: Vec<(f64, f64)>,
pub disk_data: Vec<Vec<String>>,
@ -414,6 +416,8 @@ pub fn draw_data<B: backend::Backend>(terminal: &mut Terminal<B>, app_state: &mu
.marker(if app_state.use_dot { Marker::Dot } else { Marker::Braille })
.style(Style::default().fg(COLOUR_LIST[1]))
.data(&canvas_data.network_data_tx),
Dataset::default().name(&(canvas_data.total_rx_display)),
Dataset::default().name(&(canvas_data.total_tx_display)),
])
.render(&mut f, bottom_chunks[0]);
}

View File

@ -272,6 +272,8 @@ fn main() -> error::Result<()> {
canvas_data.network_data_tx = network_data.tx;
canvas_data.rx_display = network_data.rx_display;
canvas_data.tx_display = network_data.tx_display;
canvas_data.total_rx_display = network_data.total_rx_display;
canvas_data.total_tx_display = network_data.total_tx_display;
canvas_data.disk_data = update_disk_row(&app.data);
canvas_data.temp_sensor_data = update_temp_row(&app.data, &app.temperature_type);
canvas_data.process_data = update_process_row(&app.data);