Chugging along making UI adjustments.

This commit is contained in:
Herbert Wolverson 2024-07-02 13:00:02 -05:00
parent cb7a1fd640
commit 95ac0fa825
7 changed files with 15 additions and 16 deletions

View File

@ -23,7 +23,7 @@ export class ThroughputBpsDash extends BaseDashlet{
onMessage(msg) { onMessage(msg) {
if (msg.event === "Throughput") { if (msg.event === "Throughput") {
this.graph.update(msg.data.bps[0], msg.data.bps[1], msg.data.max[0], msg.data.max[1]); this.graph.update(msg.data.bps.down, msg.data.bps.up, msg.data.max.down, msg.data.max.up);
} }
} }
} }

View File

@ -23,7 +23,7 @@ export class ThroughputPpsDash extends BaseDashlet{
onMessage(msg) { onMessage(msg) {
if (msg.event === "Throughput") { if (msg.event === "Throughput") {
this.graph.update(msg.data.pps[0], msg.data.pps[1]); this.graph.update(msg.data.pps.down, msg.data.pps.up);
} }
} }
} }

View File

@ -27,8 +27,6 @@ export class ThroughputRingDash extends BaseDashlet{
onMessage(msg) { onMessage(msg) {
if (msg.event === "Throughput") { if (msg.event === "Throughput") {
let shaped = msg.data.shaped_bps[0] + msg.data.shaped_bps[1];
let unshaped = msg.data.bps[0] + msg.data.bps[1];
this.graph.update(msg.data.shaped_bps, msg.data.bps); this.graph.update(msg.data.shaped_bps, msg.data.bps);
} }
} }

View File

@ -132,14 +132,14 @@ export class BitsPerSecondGauge extends DashboardGraph {
this.option && this.chart.setOption(this.option); this.option && this.chart.setOption(this.option);
} }
update(value1, value2, max1, max2) { update(download, upload, max_down, max_up) {
this.chart.hideLoading(); this.chart.hideLoading();
this.option.series[0].data[0].value = value1; this.option.series[0].data[0].value = download;
this.option.series[1].data[0].value = value2; this.option.series[1].data[0].value = upload;
this.option.series[0].min = 0; this.option.series[0].min = 0;
this.option.series[0].max = max1 * 1000000; // Convert to bits this.option.series[0].max = max_down * 1000000; // Convert to bits
this.option.series[1].min = 0; this.option.series[1].min = 0;
this.option.series[1].max = max2 * 1000000; // Convert to bits this.option.series[1].max = max_up * 1000000; // Convert to bits
this.chart.setOption(this.option); this.chart.setOption(this.option);
} }
} }

View File

@ -25,7 +25,7 @@ export class PacketsPerSecondBar extends DashboardGraph {
this.option && this.chart.setOption(this.option); this.option && this.chart.setOption(this.option);
} }
update(up, down) { update(down, up) {
this.chart.hideLoading(); this.chart.hideLoading();
this.option.series[0].data = [up, down]; this.option.series[0].data = [up, down];
this.chart.setOption(this.option); this.chart.setOption(this.option);

View File

@ -100,10 +100,10 @@ class RingBuffer {
} }
push(shaped, unshaped) { push(shaped, unshaped) {
this.data[this.head][0] = 0.0 - shaped[0]; this.data[this.head][0] = shaped.down;
this.data[this.head][1] = shaped[1]; this.data[this.head][1] = 0.0 - shaped.up;
this.data[this.head][2] = 0.0 - unshaped[0]; this.data[this.head][2] = unshaped.down;
this.data[this.head][3] = unshaped[1]; this.data[this.head][3] = 0.0 - unshaped.up;
this.head += 1; this.head += 1;
this.head %= this.size; this.head %= this.size;
} }

View File

@ -1,6 +1,7 @@
use std::sync::Arc; use std::sync::Arc;
use serde_json::json; use serde_json::json;
use lqos_config::load_config; use lqos_config::load_config;
use lqos_utils::units::DownUpOrder;
use crate::node_manager::ws::publish_subscribe::PubSub; use crate::node_manager::ws::publish_subscribe::PubSub;
use crate::node_manager::ws::published_channels::PublishedChannels; use crate::node_manager::ws::published_channels::PublishedChannels;
use crate::throughput_tracker::THROUGHPUT_TRACKER; use crate::throughput_tracker::THROUGHPUT_TRACKER;
@ -18,12 +19,12 @@ pub async fn throughput(channels: Arc<PubSub>) {
) )
}; };
let max = if let Ok(config) = load_config() { let max = if let Ok(config) = load_config() {
( DownUpOrder::new(
config.queues.uplink_bandwidth_mbps, config.queues.uplink_bandwidth_mbps,
config.queues.downlink_bandwidth_mbps, config.queues.downlink_bandwidth_mbps,
) )
} else { } else {
(0,0) DownUpOrder::zeroed()
}; };
let bps = json!( let bps = json!(
{ {