diff --git a/Cargo.lock b/Cargo.lock index 91e475f..b512da4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -279,7 +279,7 @@ checksum = "a1d728cc89cf3aee9ff92b05e62b19ee65a02b5702cff7d5a377e32c6ae29d8d" [[package]] name = "cm-dashboard" -version = "0.1.170" +version = "0.1.171" dependencies = [ "anyhow", "chrono", @@ -301,7 +301,7 @@ dependencies = [ [[package]] name = "cm-dashboard-agent" -version = "0.1.170" +version = "0.1.171" dependencies = [ "anyhow", "async-trait", @@ -324,7 +324,7 @@ dependencies = [ [[package]] name = "cm-dashboard-shared" -version = "0.1.170" +version = "0.1.171" dependencies = [ "chrono", "serde", diff --git a/agent/Cargo.toml b/agent/Cargo.toml index f37f266..02934d4 100644 --- a/agent/Cargo.toml +++ b/agent/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cm-dashboard-agent" -version = "0.1.170" +version = "0.1.171" edition = "2021" [dependencies] diff --git a/dashboard/Cargo.toml b/dashboard/Cargo.toml index cda1f6d..b82d8d1 100644 --- a/dashboard/Cargo.toml +++ b/dashboard/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cm-dashboard" -version = "0.1.170" +version = "0.1.171" edition = "2021" [dependencies] diff --git a/dashboard/src/ui/widgets/system.rs b/dashboard/src/ui/widgets/system.rs index 2009219..f2bc783 100644 --- a/dashboard/src/ui/widgets/system.rs +++ b/dashboard/src/ui/widgets/system.rs @@ -629,10 +629,20 @@ impl SystemWidget { let virtual_interfaces: Vec<_> = self.network_interfaces.iter().filter(|i| !i.is_physical).collect(); // Find standalone virtual interfaces (those without a parent) - let standalone_virtual: Vec<_> = virtual_interfaces.iter() + let mut standalone_virtual: Vec<_> = virtual_interfaces.iter() .filter(|i| i.parent_interface.is_none()) .collect(); + // Sort standalone virtual: VLANs first (by VLAN ID), then others alphabetically + standalone_virtual.sort_by(|a, b| { + match (a.vlan_id, b.vlan_id) { + (Some(vlan_a), Some(vlan_b)) => vlan_a.cmp(&vlan_b), + (Some(_), None) => std::cmp::Ordering::Less, + (None, Some(_)) => std::cmp::Ordering::Greater, + (None, None) => a.name.cmp(&b.name), + } + }); + // Render physical interfaces with their children for (phy_idx, interface) in physical.iter().enumerate() { let is_last_physical = phy_idx == physical.len() - 1 && standalone_virtual.is_empty(); @@ -646,7 +656,7 @@ impl SystemWidget { lines.push(Line::from(header_spans)); // Find child interfaces for this physical interface - let children: Vec<_> = virtual_interfaces.iter() + let mut children: Vec<_> = virtual_interfaces.iter() .filter(|vi| { if let Some(parent) = &vi.parent_interface { parent == &interface.name @@ -656,6 +666,16 @@ impl SystemWidget { }) .collect(); + // Sort children: VLANs first (by VLAN ID), then others alphabetically + children.sort_by(|a, b| { + match (a.vlan_id, b.vlan_id) { + (Some(vlan_a), Some(vlan_b)) => vlan_a.cmp(&vlan_b), + (Some(_), None) => std::cmp::Ordering::Less, + (None, Some(_)) => std::cmp::Ordering::Greater, + (None, None) => a.name.cmp(&b.name), + } + }); + // Count total items under this physical interface (IPs + children) let ip_count = interface.ipv4_addresses.len() + interface.ipv6_addresses.len(); let total_children = ip_count + children.len(); diff --git a/shared/Cargo.toml b/shared/Cargo.toml index 8404be2..29ac1ae 100644 --- a/shared/Cargo.toml +++ b/shared/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cm-dashboard-shared" -version = "0.1.170" +version = "0.1.171" edition = "2021" [dependencies]