public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Christoph Heiss <c.heiss@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH installer] tui: network: toggle form labels too in advanced options dialog
Date: Fri,  6 Nov 2026 13:02:59 +0100	[thread overview]
Message-ID: <20261106120419.392497-1-c.heiss@proxmox.com> (raw)
In-Reply-To: <20261102124539.1008075-1-c.heiss@proxmox.com>

This follows the GUI more closely by also changing the style of the
labels to make them the same coloring as disabled interactive form
elements.

Suggested-by: Lukas Sichert <l.sichert@proxmox.com>
Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
---
Just a small follow-up patch for the series, w/o the need to re-spin it
all.

Can also rebase & resend to whole series with this patch properly
integrated, if wanted so.

 proxmox-tui-installer/src/views/mod.rs     | 45 +++++++++++++++++++++-
 proxmox-tui-installer/src/views/network.rs | 20 +++++++---
 2 files changed, 58 insertions(+), 7 deletions(-)

diff --git a/proxmox-tui-installer/src/views/mod.rs b/proxmox-tui-installer/src/views/mod.rs
index 9349a9c..760b467 100644
--- a/proxmox-tui-installer/src/views/mod.rs
+++ b/proxmox-tui-installer/src/views/mod.rs
@@ -3,7 +3,7 @@ use std::{collections::HashMap, net::IpAddr, str::FromStr, sync::Arc};
 use cursive::{
     Printer, Rect, Vec2, View,
     event::{Event, EventResult},
-    theme::BaseColor,
+    theme::{BaseColor, StyleType},
     view::{Resizable, ViewWrapper},
     views::{
         Checkbox, DummyView, EditView, LinearLayout, NamedView, ResizedView, SelectView, TextView,
@@ -543,6 +543,33 @@ impl<UDT> FormView<UDT> {
         }
     }
 
+    pub fn set_labels_enabled(&mut self, enabled: bool) {
+        let style = if enabled {
+            StyleType::primary()
+        } else {
+            StyleType::secondary()
+        };
+
+        let len = self.len();
+        let view = self
+            .view
+            .get_child_mut(0)
+            .and_then(|v| v.downcast_mut::<ResizedView<LinearLayout>>())
+            .map(|v| v.get_inner_mut());
+
+        if let Some(view) = view {
+            for i in 0..len {
+                let label = view
+                    .get_child_mut(i)
+                    .and_then(|v| v.downcast_mut::<TextView>());
+
+                if let Some(label) = label {
+                    label.set_style(style);
+                }
+            }
+        }
+    }
+
     pub fn len(&self) -> usize {
         self.view
             .get_child(1)
@@ -685,7 +712,23 @@ impl<UDT> CheckboxGroup<UDT> {
     }
 
     pub fn set_enabled(&mut self, enabled: bool) {
+        let label_style = if enabled {
+            StyleType::primary()
+        } else {
+            StyleType::secondary()
+        };
+
         for i in 0..self.view.len() {
+            if let Some(label) = self
+                .view
+                .get_child_mut(i)
+                .and_then(|v| v.downcast_mut::<LinearLayout>())
+                .and_then(|v| v.get_child_mut(2))
+                .and_then(|v| v.downcast_mut::<TextView>())
+            {
+                label.set_style(label_style);
+            }
+
             if let Some(checkbox) = self
                 .view
                 .get_child_mut(i)
diff --git a/proxmox-tui-installer/src/views/network.rs b/proxmox-tui-installer/src/views/network.rs
index 15b078f..877d343 100644
--- a/proxmox-tui-installer/src/views/network.rs
+++ b/proxmox-tui-installer/src/views/network.rs
@@ -1,6 +1,7 @@
 use anyhow::{Result, anyhow, bail};
 use cursive::{
     Cursive, View,
+    theme::StyleType,
     view::{Nameable, Resizable, ViewWrapper},
     views::{
         Button, Checkbox, Dialog, DummyView, EditView, LinearLayout, NamedView, PaddedView,
@@ -497,6 +498,7 @@ impl InterfacePinningOptionsView {
 
     fn toggle_all(siv: &mut Cursive, enabled: bool) {
         siv.call_on_name(Self::FORM_NAME, |v: &mut FormView<MacAddress>| {
+            v.set_labels_enabled(enabled);
             v.call_on_childs(&|v: &mut LinearLayout| {
                 if let Some(v) = v
                     .get_child_mut(1)
@@ -675,6 +677,8 @@ impl BondOptionsView {
 
     fn toggle_all(siv: &mut Cursive, enabled: bool) {
         siv.call_on_name(Self::FORM_NAME, |form: &mut FormView| {
+            form.set_labels_enabled(enabled);
+
             if let Some(v) = form.get_child_mut::<SelectView<LinuxBondMode>>(0) {
                 v.set_enabled(enabled);
             }
@@ -839,12 +843,7 @@ impl VlanOptionsView {
                                 move |siv, enabled| {
                                     options_ref.lock().expect("unpoisoned lock").vlan_enabled =
                                         enabled;
-
-                                    siv.call_on_name(Self::FORM_NAME, |form: &mut FormView| {
-                                        if let Some(v) = form.get_child_mut::<IntegerEditView>(0) {
-                                            v.set_enabled(enabled);
-                                        }
-                                    });
+                                    Self::toggle_all(siv, enabled);
                                 }
                             }),
                     )
@@ -867,6 +866,15 @@ impl VlanOptionsView {
         Self { view }
     }
 
+    fn toggle_all(siv: &mut Cursive, enabled: bool) {
+        siv.call_on_name(Self::FORM_NAME, |form: &mut FormView| {
+            form.set_labels_enabled(enabled);
+            if let Some(v) = form.get_child_mut::<IntegerEditView>(0) {
+                v.set_enabled(enabled);
+            }
+        });
+    }
+
     fn get_values(&mut self) -> Result<NetworkVlanOptions> {
         let form = self
             .view
-- 
2.56.0





  parent reply	other threads:[~2026-11-06 12:04 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-02 12:45 [PATCH installer/proxmox v4 00/30] fix #2164: add bond setup across all installers Christoph Heiss
2026-11-02 12:45 ` [PATCH proxmox v4 01/30] installer-types: clippy: use .is_multiple_of() instead of manual modulo Christoph Heiss
2026-11-02 12:45 ` [PATCH proxmox v4 02/30] installer-types: use `MacAddress` type where applicable Christoph Heiss
2026-11-02 12:45 ` [PATCH proxmox v4 03/30] installer-types: derive Display for RebootMode and FilterMatch Christoph Heiss
2026-11-02 12:45 ` [PATCH proxmox v4 04/30] installer-types: answer: add options for configuring management bond Christoph Heiss
2026-11-02 12:45 ` [PATCH proxmox v4 05/30] installer-types: answer: add options for configuring management vlan Christoph Heiss
2026-11-02 12:45 ` [PATCH proxmox v4 06/30] installer-types: bump fetch schema for bond and VLAN answer options Christoph Heiss
2026-11-02 12:45 ` [PATCH proxmox v4 07/30] installer-types: bump version to 0.3.0-1 Christoph Heiss
2026-11-02 12:45 ` [PATCH proxmox v4 08/30] network-api: derive Display and FromStr for network bond types Christoph Heiss
2026-11-02 12:45 ` [PATCH installer v4 09/30] install: run make tidy Christoph Heiss
2026-11-02 12:45 ` [PATCH installer v4 10/30] tree-wide: use `MacAddress` type instead of string for MAC addresses Christoph Heiss
2026-11-02 12:45 ` [PATCH installer v4 11/30] install: factor out ifupdown2 config generation into own subroutine Christoph Heiss
2026-11-02 12:45 ` [PATCH installer v4 12/30] install: do not rely on interface name map to be fully populated Christoph Heiss
2026-11-02 12:45 ` [PATCH installer v4 13/30] install: config: add option for setting up bond on management interface Christoph Heiss
2026-11-02 12:45 ` [PATCH installer v4 14/30] install: config: add option for setting up vlan " Christoph Heiss
2026-11-02 12:45 ` [PATCH installer v4 15/30] install: network: set up management bond if requested Christoph Heiss
2026-11-02 12:45 ` [PATCH installer v4 16/30] install: network: set up vlan on management interface " Christoph Heiss
2026-11-02 12:45 ` [PATCH installer v4 17/30] gui: network: factor out name pinning into advanced options dialog Christoph Heiss
2026-11-02 12:45 ` [PATCH installer v4 18/30] gui: network: add bond setup options to " Christoph Heiss
2026-11-02 12:45 ` [PATCH installer v4 19/30] gui: network: add vlan setup options to advanced network dialog Christoph Heiss
2026-11-02 12:45 ` [PATCH installer v4 20/30] auto: pass through management network bond options to low-level installer Christoph Heiss
2026-11-02 12:45 ` [PATCH installer v4 21/30] auto: pass through management network vlan " Christoph Heiss
2026-11-02 12:45 ` [PATCH installer v4 22/30] tui: drop long obsolete comment about logo formatting Christoph Heiss
2026-11-02 12:45 ` [PATCH installer v4 23/30] tui: views: add widget for displaying a group of checkboxes Christoph Heiss
2026-11-02 12:45 ` [PATCH installer v4 24/30] tui: network: factor out name pinning into advanced options dialog Christoph Heiss
2026-11-02 12:45 ` [PATCH installer v4 25/30] tui: network: add bond setup options to advanced network dialog Christoph Heiss
2026-11-02 14:55   ` Lukas Sichert
2026-11-02 12:45 ` [PATCH installer v4 26/30] tui: network: add vlan " Christoph Heiss
2026-11-02 12:45 ` [PATCH installer v4 27/30] gui: network: split advanced options dialog into tabs Christoph Heiss
2026-11-02 12:45 ` [PATCH installer v4 28/30] tui: " Christoph Heiss
2026-11-02 12:45 ` [PATCH installer v4 29/30] gui: network: list bond member candidates sharing a MAC address once Christoph Heiss
2026-11-02 12:45 ` [PATCH installer v4 30/30] tui: " Christoph Heiss
2026-11-06 12:02 ` Christoph Heiss [this message]
2026-11-06 13:12 ` [PATCH installer/proxmox v4 00/30] fix #2164: add bond setup across all installers Christoph Heiss

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261106120419.392497-1-c.heiss@proxmox.com \
    --to=c.heiss@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal