mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:47:45 +00:00
Userland: Add network adapter link status to SystemMonitor and applet
Add a column named 'Link status' to the Network tab in SystemMonitor showing the speed and duplex if the link is up. Add the link speed behind the existing text in the applet or show 'down' if the link is down.
This commit is contained in:
parent
32c8d35ef0
commit
3a40287776
2 changed files with 15 additions and 1 deletions
|
@ -48,6 +48,14 @@ NetworkStatisticsWidget::NetworkStatisticsWidget()
|
|||
net_adapters_fields.empend("name", "Name", Gfx::TextAlignment::CenterLeft);
|
||||
net_adapters_fields.empend("class_name", "Class", Gfx::TextAlignment::CenterLeft);
|
||||
net_adapters_fields.empend("mac_address", "MAC", Gfx::TextAlignment::CenterLeft);
|
||||
net_adapters_fields.empend("Link status", Gfx::TextAlignment::CenterLeft,
|
||||
[this](JsonObject const& object) -> String {
|
||||
if (!object.get("link_up").as_bool())
|
||||
return "Down";
|
||||
|
||||
return String::formatted("{} Mb/s {}-duplex", object.get("link_speed").to_i32(),
|
||||
object.get("link_full_duplex").as_bool() ? "full" : "half");
|
||||
});
|
||||
net_adapters_fields.empend("ipv4_address", "IPv4", Gfx::TextAlignment::CenterLeft);
|
||||
net_adapters_fields.empend("packets_in", "Pkt In", Gfx::TextAlignment::CenterRight);
|
||||
net_adapters_fields.empend("packets_out", "Pkt Out", Gfx::TextAlignment::CenterRight);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue