1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 15:48:12 +00:00

Userland: Make representation of 'null' IPv4-address friendlier

Show an empty column rather than 'null' in SystemMonitor and show
'no IP' in the network applet if the adapter has no IPv4-address
configured.
This commit is contained in:
Thomas Wagenveld 2021-07-30 19:58:17 +02:00 committed by Gunnar Beutner
parent 3a40287776
commit df6db8b8cc
2 changed files with 5 additions and 2 deletions

View file

@ -56,7 +56,10 @@ NetworkStatisticsWidget::NetworkStatisticsWidget()
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("IPv4", Gfx::TextAlignment::CenterLeft,
[this](JsonObject const& object) -> String {
return object.get("ipv4_address").as_string_or("");
});
net_adapters_fields.empend("packets_in", "Pkt In", Gfx::TextAlignment::CenterRight);
net_adapters_fields.empend("packets_out", "Pkt Out", Gfx::TextAlignment::CenterRight);
net_adapters_fields.empend("bytes_in", "Bytes In", Gfx::TextAlignment::CenterRight);