mirror of
https://github.com/LibreQoE/LibreQoS.git
synced 2025-02-25 18:55:32 -06:00
GREATLY improved ShapedDevices writer system. It now catches the changes you make, and the formatting seems to work.
This commit is contained in:
parent
648d20183d
commit
9bfce3ecec
@ -113,6 +113,7 @@ impl ConfigShapedDevices {
|
||||
/// Replace the current shaped devices list with a new one
|
||||
pub fn replace_with_new_data(&mut self, devices: Vec<ShapedDevice>) {
|
||||
self.devices = devices;
|
||||
log::info!("{:?}", self.devices);
|
||||
self.trie = ConfigShapedDevices::make_trie(&self.devices);
|
||||
}
|
||||
|
||||
@ -162,6 +163,7 @@ impl ConfigShapedDevices {
|
||||
error!("Unable to write ShapedDevices.csv. Permissions?");
|
||||
return Err(ShapedDevicesError::WriteFail);
|
||||
}
|
||||
//println!("Would write to file: {}", csv);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
@ -84,6 +84,7 @@ pub async fn update_network_and_devices(
|
||||
}
|
||||
let mut lock = SHAPED_DEVICES.write().unwrap();
|
||||
lock.replace_with_new_data(data.shaped_devices.clone());
|
||||
println!("{:?}", lock.devices);
|
||||
lock.write_csv(&format!("{}/ShapedDevices.csv", config.lqos_directory)).unwrap();
|
||||
|
||||
"Ok".to_string()
|
||||
|
@ -1664,6 +1664,17 @@
|
||||
};
|
||||
}
|
||||
|
||||
function ipAddressesToTuple(ip) {
|
||||
if (ip.length === 0) return [];
|
||||
let ips = ip.replace(' ', '').split(',');
|
||||
for (let i=0; i<ips.length; i++) {
|
||||
let this_ip = ips[i].trim();
|
||||
let parts = this_ip.split('/');
|
||||
ips[i] = [ parts[0], parseInt(parts[1]) ];
|
||||
}
|
||||
return ips;
|
||||
}
|
||||
|
||||
function saveNetAndDevices() {
|
||||
let isValid = validateSd().valid;
|
||||
if (!isValid) {
|
||||
@ -1671,7 +1682,26 @@
|
||||
return;
|
||||
}
|
||||
|
||||
// Update the Shaped Devices to match the onscreen list
|
||||
for (let i=0; i<shaped_devices.length; i++) {
|
||||
let row = shaped_devices[i];
|
||||
row.circuit_id = $("#" + rowPrefix(i, "circuit_id")).val();
|
||||
row.circuit_name = $("#" + rowPrefix(i, "circuit_name")).val();
|
||||
row.device_id = $("#" + rowPrefix(i, "device_id")).val();
|
||||
row.device_name = $("#" + rowPrefix(i, "device_name")).val();
|
||||
row.parent_node = $("#" + rowPrefix(i, "parent_node")).val();
|
||||
row.mac = $("#" + rowPrefix(i, "mac")).val();
|
||||
row.ipv4 = ipAddressesToTuple($("#" + rowPrefix(i, "ipv4")).val());
|
||||
row.ipv6 = ipAddressesToTuple($("#" + rowPrefix(i, "ipv6")).val());
|
||||
row.download_min_mbps = parseInt($("#" + rowPrefix(i, "download_min_mbps")).val());
|
||||
row.upload_min_mbps = parseInt($("#" + rowPrefix(i, "upload_min_mbps")).val());
|
||||
row.download_max_mbps = parseInt($("#" + rowPrefix(i, "download_max_mbps")).val());
|
||||
row.upload_max_mbps = parseInt($("#" + rowPrefix(i, "upload_max_mbps")).val());
|
||||
row.comment = $("#" + rowPrefix(i, "comment")).val();
|
||||
}
|
||||
|
||||
// Submit both for saving
|
||||
console.log(network_json);
|
||||
let submission = {
|
||||
shaped_devices: shaped_devices,
|
||||
network_json: network_json,
|
||||
|
Loading…
Reference in New Issue
Block a user