public inbox for pdm-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: "Lukas Wagner" <l.wagner@proxmox.com>
To: "Proxmox Datacenter Manager development discussion"
	<pdm-devel@lists.proxmox.com>
Subject: Re: [pdm-devel] [PATCH proxmox-datacenter-manager v2 4/4] ui: add firewall status tree
Date: Fri, 07 Nov 2025 13:27:28 +0100	[thread overview]
Message-ID: <DE2GN9DSJVJQ.2MYYHEK5JS4QF@proxmox.com> (raw)
In-Reply-To: <20251105163546.450094-13-h.laimer@proxmox.com>

Looks good from what I can tell (not a super deep review though), some
notes inline.

There is some small bug that I've found, when you use the << button to
collapse the tree and then expand it again, it is slightly smaller than
before, noticable from the "x out of y rules enabled" text not fitting
the view any more.

Also we need to find some way to handle unavailable remotes more
gracefully. Right now, a single unavailable remote can block the entire
loading progress until that one eventually times out; this is definitely
not great UX-wise. But I think this can also be improved in a future
patch series, IMO no need to block this until then.

On Wed Nov 5, 2025 at 5:35 PM CET, Hannes Laimer wrote:
> +    let mut remote_handle = root.append(remote_entry);
> +    remote_handle.set_expanded(cluster_is_enabled);
> +
> +    for node_status in remote_status.nodes {
> +        let node_name = node_status.node.clone();
> +        let node_firewall_status = node_status.status;
> +
> +        let node_entry = TreeEntry::Node(NodeEntry {
> +            remote: remote_name.clone(),
> +            name: node_name.clone(),
> +            status: node_firewall_status,
> +            masked: !cluster_is_enabled,
> +        });
> +
> +        let mut node_handle = remote_handle.append(node_entry);
> +        node_handle.set_expanded(!node_status.guests.is_empty());
> +
> +        for guest in node_status.guests {
> +            let guest_entry = GuestEntry::new(
> +                guest.clone(),
> +                node_name.clone(),
> +                remote_name.clone(),
> +                !cluster_is_enabled,
> +            );
> +
> +            let tree_entry = match guest.kind {
> +                GuestKind::Lxc => TreeEntry::Guest(guest_entry, GuestKind::Lxc),
> +                GuestKind::Qemu => TreeEntry::Guest(guest_entry, GuestKind::Qemu),
> +            };

This can just be:

            let tree_entry = TreeEntry::Guest(guest_entry, guest.kind);

> +
> +            node_handle.append(tree_entry);
> +        }
> +    }
> +}
> +
> +fn sort_entries(a: &TreeEntry, b: &TreeEntry) -> Ordering {
> +    let rank_a = a.sort_rank();
> +    let rank_b = b.sort_rank();
> +    match rank_a.cmp(&rank_b) {
> +        Ordering::Equal => a.name().cmp(&b.name()),
> +        other => other,
> +    }
> +}
> +
> +pub enum Msg {
> +    DataLoaded {
> +        generation: usize,
> +        data: Vec<pdm_api_types::firewall::RemoteFirewallStatus>,
> +    },
> +    RemoteListChanged,
> +    Reload,
> +    FilterChanged(String),
> +    ScopeChanged(Scope),
> +    RemotesLoaded(Vec<String>),
> +    NodesLoaded {
> +        generation: usize,
> +        nodes: Vec<String>,
> +    },
> +    SelectionChanged(Option<yew::virtual_dom::Key>),
> +    ToggleTreePanel,
> +    Error(FirewallError),
> +    NoOp,
> +}
> +

 [...]

> +
> +fn create_remote_combobox(
> +    ctx: &LoadableComponentContext<FirewallTreeComponent>,
> +    available_remotes: &[String],
> +    options_loading: bool,
> +    current_scope: &Scope,
> +) -> Html {
> +    if options_loading {
> +        return Combobox::new()
> +            .items(Rc::new(vec![]))
> +            .placeholder(tr!("Loading..."))
> +            .disabled(true)
> +            .key("remote-combobox-loading")
> +            .on_change(ctx.link().callback(|_: String| Msg::NoOp))
> +            .into();
> +    }
> +
> +    let items: Vec<yew::AttrValue> = available_remotes
> +        .iter()
> +        .map(|remote| yew::AttrValue::from(remote.clone()))
> +        .collect();
> +
> +    let current_value = current_scope
> +        .remote_name()
> +        .map(|s| yew::AttrValue::from(s.to_string()));
> +
> +    Combobox::new()
> +        .items(Rc::new(items))
> +        .default(current_value)
> +        .placeholder(tr!("All remotes"))

This combobox also shows PBS remotes, I guess they need to be filtered
out somewhere along the way.

> +        .disabled(false)
> +        .key("remote-combobox")
> +        .on_change(ctx.link().callback(move |value: String| {
> +            if value.is_empty() {
> +                Msg::ScopeChanged(Scope::All)
> +            } else {
> +                Msg::ScopeChanged(Scope::Remote { name: value })
> +            }
> +        }))
> +        .into()
> +}
> +



_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel


      reply	other threads:[~2025-11-07 12:27 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-05 16:35 [pdm-devel] [PATCH proxmox{, -yew-comp, -datacenter-manager} v2 00/12] add basic integration of PVE firewall Hannes Laimer
2025-11-05 16:35 ` [pdm-devel] [PATCH proxmox v2 1/4] pve-api-types: update pve-api.json Hannes Laimer
2025-11-05 16:35 ` [pdm-devel] [PATCH proxmox v2 2/4] pve-api-types: add get/update firewall options endpoints Hannes Laimer
2025-11-05 16:35 ` [pdm-devel] [PATCH proxmox v2 3/4] pve-api-types: add list firewall rules endpoints Hannes Laimer
2025-11-05 16:35 ` [pdm-devel] [PATCH proxmox v2 4/4] pve-api-types: regenerate Hannes Laimer
2025-11-05 16:35 ` [pdm-devel] [PATCH proxmox-yew-comp v2 1/4] form: add helpers for extractig data out of schemas Hannes Laimer
2025-11-05 16:35 ` [pdm-devel] [PATCH proxmox-yew-comp v2 2/4] firewall: add FirewallContext Hannes Laimer
2025-11-05 16:35 ` [pdm-devel] [PATCH proxmox-yew-comp v2 3/4] firewall: add options edit form Hannes Laimer
2025-11-07 12:26   ` Lukas Wagner
2025-11-05 16:35 ` [pdm-devel] [PATCH proxmox-yew-comp v2 4/4] firewall: add rules table Hannes Laimer
2025-11-07 12:26   ` Lukas Wagner
2025-11-05 16:35 ` [pdm-devel] [PATCH proxmox-datacenter-manager v2 1/4] pdm-api-types: add firewall status types Hannes Laimer
2025-11-07 12:27   ` Lukas Wagner
2025-11-05 16:35 ` [pdm-devel] [PATCH proxmox-datacenter-manager v2 2/4] api: firewall: add option, rules and status endpoints Hannes Laimer
2025-11-06 16:58   ` Michael Köppl
2025-11-07  6:43     ` Hannes Laimer
2025-11-07 12:27   ` Lukas Wagner
2025-11-05 16:35 ` [pdm-devel] [PATCH proxmox-datacenter-manager v2 3/4] pdm-client: add api methods for firewall options, " Hannes Laimer
2025-11-05 16:35 ` [pdm-devel] [PATCH proxmox-datacenter-manager v2 4/4] ui: add firewall status tree Hannes Laimer
2025-11-07 12:27   ` Lukas Wagner [this message]

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=DE2GN9DSJVJQ.2MYYHEK5JS4QF@proxmox.com \
    --to=l.wagner@proxmox.com \
    --cc=pdm-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