[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: allow_failures:
- rust: nightly - rust: nightly
# From https://levans.fr/rust_travis_cache.html #From https://levans.fr/rust_travis_cache.html
# cache: cache:
# directories: directories:
# - /home/travis/.cargo - /home/travis/.cargo
# before_cache: before_cache:
# - rm -rf /home/travis/.cargo/registry - rm -rf /home/travis/.cargo/registry
notifications: notifications:
email: email:

View File

@ -37,6 +37,8 @@ lazy_static! {
pub struct CanvasData { pub struct CanvasData {
pub rx_display: String, pub rx_display: String,
pub tx_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_rx: Vec<(f64, f64)>,
pub network_data_tx: Vec<(f64, f64)>, pub network_data_tx: Vec<(f64, f64)>,
pub disk_data: Vec<Vec<String>>, 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 }) .marker(if app_state.use_dot { Marker::Dot } else { Marker::Braille })
.style(Style::default().fg(COLOUR_LIST[1])) .style(Style::default().fg(COLOUR_LIST[1]))
.data(&canvas_data.network_data_tx), .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]); .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.network_data_tx = network_data.tx;
canvas_data.rx_display = network_data.rx_display; canvas_data.rx_display = network_data.rx_display;
canvas_data.tx_display = network_data.tx_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.disk_data = update_disk_row(&app.data);
canvas_data.temp_sensor_data = update_temp_row(&app.data, &app.temperature_type); canvas_data.temp_sensor_data = update_temp_row(&app.data, &app.temperature_type);
canvas_data.process_data = update_process_row(&app.data); canvas_data.process_data = update_process_row(&app.data);