Skip to content

Commit

Permalink
fix: fix network interface not visible
Browse files Browse the repository at this point in the history
  • Loading branch information
pacholoamit committed May 13, 2024
1 parent 69a31b8 commit 0385c9b
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src-tauri/src/metrics.rs
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
use crate::models::*;
use crate::utils::{current_time, get_percentage, round};
use std::str::{self, FromStr};
use sysinfo::{CpuExt, DiskExt, NetworkExt, Pid, ProcessExt, System, SystemExt};
use sysinfo::{CpuExt, DiskExt, NetworkExt, NetworksExt, Pid, ProcessExt, System, SystemExt};

pub struct Metrics {
sys: System,
}

impl Default for Metrics {
fn default() -> Self {
Metrics { sys: System::new() }
let mut sys = System::new_all();
sys.refresh_all();
Metrics {
sys: System::new_all(),
}
}
}

impl SystemInformationTrait for Metrics {
fn get_system_information(&mut self) -> SysInfo {
self.sys.refresh_all();

let kernel_version = self.sys.kernel_version().unwrap_or("Unknown".to_string());
let os_version = self.sys.long_os_version().unwrap_or("Unknown".to_string());
let hostname = self.sys.host_name().unwrap_or("Unknown".to_string());
Expand Down Expand Up @@ -242,7 +244,7 @@ impl NetworkTrait for Metrics {
let networks: Vec<Network> = self
.sys
.networks()
.into_iter()
.iter()
.map(|(name, network)| {
let name = name.to_owned();

Expand Down

0 comments on commit 0385c9b

Please sign in to comment.