mirror of
https://github.com/LibreQoE/LibreQoS.git
synced 2024-11-22 00:07:21 -06:00
Change country selection from flag to name matching, to ensure that America/Foo matches only that region - and not everything with the stars and stripes.
This commit is contained in:
parent
ec8707ac6f
commit
1a3c8df787
@ -101,7 +101,7 @@ function countryDropdown() {
|
||||
li.innerHTML = "<img alt='" + row.iso_code + "' src='flags/" + row.iso_code.toLowerCase() + ".svg' height=12 width=12 />" + row.name + " (" + row.count + ")";
|
||||
li.classList.add("dropdown-item");
|
||||
li.onclick = () => {
|
||||
selectCountry(row.iso_code);
|
||||
selectCountry(row.name);
|
||||
renderMode = "country";
|
||||
};
|
||||
dropdownList.appendChild(li);
|
||||
|
@ -84,12 +84,12 @@ fn all_flows_to_transport(boot_time: u64, all_flows_for_asn: Vec<(FlowbeeKey, Fl
|
||||
.collect::<Vec<_>>()
|
||||
}
|
||||
|
||||
pub async fn country_timeline(Path(iso_code): Path<String>) -> Json<Vec<FlowTimeline>> {
|
||||
pub async fn country_timeline(Path(country_name): Path<String>) -> Json<Vec<FlowTimeline>> {
|
||||
let time_since_boot = time_since_boot().unwrap();
|
||||
let since_boot = Duration::from(time_since_boot);
|
||||
let boot_time = unix_now().unwrap() - since_boot.as_secs();
|
||||
|
||||
let all_flows_for_asn = RECENT_FLOWS.all_flows_for_country(&iso_code);
|
||||
let all_flows_for_asn = RECENT_FLOWS.all_flows_for_country(&country_name);
|
||||
|
||||
let flows = all_flows_to_transport(boot_time, all_flows_for_asn);
|
||||
|
||||
|
@ -286,13 +286,13 @@ impl TimeBuffer {
|
||||
.collect()
|
||||
}
|
||||
|
||||
pub fn all_flows_for_country(&self, iso_code: &str) -> Vec<(FlowbeeKey, FlowbeeLocalData, FlowAnalysis)> {
|
||||
pub fn all_flows_for_country(&self, country_name: &str) -> Vec<(FlowbeeKey, FlowbeeLocalData, FlowAnalysis)> {
|
||||
let buffer = self.buffer.lock().unwrap();
|
||||
buffer
|
||||
.iter()
|
||||
.filter(|flow| {
|
||||
let country = get_asn_name_and_country(flow.data.0.remote_ip.as_ip());
|
||||
country.flag == iso_code
|
||||
country.name == country_name
|
||||
})
|
||||
.map(|flow| flow.data.clone())
|
||||
.collect()
|
||||
|
Loading…
Reference in New Issue
Block a user