From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 13BD39A269 for ; Thu, 12 Oct 2023 15:02:47 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id E4E61138A4 for ; Thu, 12 Oct 2023 15:02:16 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Thu, 12 Oct 2023 15:02:14 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id F0691432A5 for ; Thu, 12 Oct 2023 15:02:13 +0200 (CEST) From: Filip Schauer To: pve-devel@lists.proxmox.com Date: Thu, 12 Oct 2023 15:02:08 +0200 Message-Id: <20231012130208.181749-1-f.schauer@proxmox.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.142 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [setup.rs, proxmox.com, main.rs, runenv.pm] Subject: [pve-devel] [PATCH v2 installer] fix #4869: Make management interface selection more verbose X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Oct 2023 13:02:47 -0000 Display a circle symbol indicating whether a network interface is up or not. Also show the MAC address of each interface in the proxmox-tui-installer, as was already the case in the GUI installer. Signed-off-by: Filip Schauer --- Changes sinve v1: * Use a circle symbol to display the state. GUI: green circle -> UP GUI: hollow circle -> DOWN TUI: green circle -> UP TUI: red circle -> DOWN * Show the MAC address of each network interface in the proxmox-tui-installer Proxmox/Install/RunEnv.pm | 2 ++ debian/control | 1 + proxinstall | 4 +++- proxmox-tui-installer/src/main.rs | 28 ++++++++++++++++++---------- proxmox-tui-installer/src/setup.rs | 2 ++ 5 files changed, 26 insertions(+), 11 deletions(-) diff --git a/Proxmox/Install/RunEnv.pm b/Proxmox/Install/RunEnv.pm index 9878f55..0dabe3c 100644 --- a/Proxmox/Install/RunEnv.pm +++ b/Proxmox/Install/RunEnv.pm @@ -61,6 +61,7 @@ sub query_cpu_hvm_support : prototype() { # mac => , # index => , # name => , +# state => , # addresses => [ # family => , # address => , @@ -99,6 +100,7 @@ my sub query_netdevs : prototype() { $ifs->{$name} = { index => $index, name => $name, + state => $state, mac => $mac, }; $ifs->{$name}->{addresses} = \@valid_addrs if @valid_addrs; diff --git a/debian/control b/debian/control index 3d13019..f863c91 100644 --- a/debian/control +++ b/debian/control @@ -19,6 +19,7 @@ Homepage: https://www.proxmox.com Package: proxmox-installer Architecture: any Depends: chrony, + fonts-noto-color-emoji, geoip-bin, libgtk3-perl, libgtk3-webkit2-perl, diff --git a/proxinstall b/proxinstall index d5b2565..51170cd 100755 --- a/proxinstall +++ b/proxinstall @@ -347,7 +347,9 @@ sub create_ipconf_view { my $get_device_desc = sub { my $iface = shift; - return "$iface->{name} - $iface->{mac} ($iface->{driver})"; + my $iface_state_symbol = "\N{U+25EF}"; + $iface_state_symbol = "\N{U+1F7E2}" if ($iface->{state} eq "UP"); + return "$iface_state_symbol $iface->{name} - $iface->{mac} ($iface->{driver})"; }; my $run_env = Proxmox::Install::RunEnv::get(); diff --git a/proxmox-tui-installer/src/main.rs b/proxmox-tui-installer/src/main.rs index 3f01713..7e46f33 100644 --- a/proxmox-tui-installer/src/main.rs +++ b/proxmox-tui-installer/src/main.rs @@ -548,20 +548,28 @@ fn password_dialog(siv: &mut Cursive) -> InstallerView { fn network_dialog(siv: &mut Cursive) -> InstallerView { let state = siv.user_data::().unwrap(); let options = &state.options.network; - let ifnames = state.runtime_info.network.interfaces.keys(); + + let mut management_interface_select_view = SelectView::new().popup(); + for (key, value) in state.runtime_info.network.interfaces.iter() { + let interface_state_symbol = if value.state == "UP" { + "\x1b[1;92m\u{25CF}" + } else { + "\x1b[1;31m\u{25CF}" + }; + + let interface_label = format!("{0} - {1} {2}", value.name, value.mac, interface_state_symbol); + management_interface_select_view.add_item(interface_label, key.to_string()); + } let inner = FormView::new() .child( "Management interface", - SelectView::new() - .popup() - .with_all_str(ifnames.clone()) - .selected( - ifnames - .clone() - .position(|ifname| ifname == &options.ifname) - .unwrap_or_default(), - ), + management_interface_select_view.selected( + state.runtime_info.network.interfaces.keys() + .clone() + .position(|ifname| ifname == &options.ifname) + .unwrap_or_default(), + ), ) .child( "Hostname (FQDN)", diff --git a/proxmox-tui-installer/src/setup.rs b/proxmox-tui-installer/src/setup.rs index 942e319..dbff3da 100644 --- a/proxmox-tui-installer/src/setup.rs +++ b/proxmox-tui-installer/src/setup.rs @@ -443,6 +443,8 @@ pub struct Interface { pub index: usize, + pub state: String, + pub mac: String, #[serde(default)] -- 2.39.2