public inbox for pdm-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Stefan Hanreich <s.hanreich@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [pdm-devel] [PATCH pve-yew-mobile-gui 1/1] tree-wide: handle fallback enum values
Date: Wed, 12 Nov 2025 10:22:10 +0100	[thread overview]
Message-ID: <20251112092225.17890-7-s.hanreich@proxmox.com> (raw)
In-Reply-To: <20251112092225.17890-1-s.hanreich@proxmox.com>

pve-api-types introduced a new fallback variant when encountering
unknown enum variants in the Proxmox VE API response.

For the resources overview, simply ignore any unknown resource type
and do nothing, as is alreadu the case with known resource types that
are not yet implemented.

Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
---
 src/pages/page_resources.rs   | 4 +++-
 src/pages/page_task_status.rs | 7 +++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/pages/page_resources.rs b/src/pages/page_resources.rs
index f0c1e2d..50b2545 100644
--- a/src/pages/page_resources.rs
+++ b/src/pages/page_resources.rs
@@ -231,7 +231,8 @@ impl PvePageResources {
                     ClusterResourceType::Node => Some(self.create_node_list_item(ctx, item)),
                     ClusterResourceType::Pool
                     | ClusterResourceType::Openvz
-                    | ClusterResourceType::Sdn => {
+                    | ClusterResourceType::Sdn
+                    | ClusterResourceType::UnknownEnumValue(_) => {
                         /* ignore for now  */
                         None
                     }
@@ -343,6 +344,7 @@ fn type_ordering(ty: ClusterResourceType) -> usize {
         ClusterResourceType::Node => 4,
         ClusterResourceType::Pool => 5,
         ClusterResourceType::Sdn => 6,
+        ClusterResourceType::UnknownEnumValue(_) => 1000,
     }
 }
 
diff --git a/src/pages/page_task_status.rs b/src/pages/page_task_status.rs
index 4424eed..dda34a5 100644
--- a/src/pages/page_task_status.rs
+++ b/src/pages/page_task_status.rs
@@ -125,6 +125,13 @@ impl PvePageTaskStatus {
                         (IsRunning::Stopped, None) => {
                             format!("{} ({})", tr!("stopped"), tr!("unknown"))
                         }
+                        (IsRunning::UnknownEnumValue(value), msg) => {
+                            format!(
+                                "{} ({})",
+                                tr!("unknown status '{0}'", value),
+                                msg.as_ref().unwrap_or(&tr!("unknown"))
+                            )
+                        }
                     },
                 ));
 
-- 
2.47.3


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


      parent reply	other threads:[~2025-11-12  9:21 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-12  9:22 [pdm-devel] [RFC proxmox{, -yew-comp, -datacenter-manager}/yew-mobile-gui 0/6] Add fallback variant to enum properties in Proxmox VE Rust API types Stefan Hanreich
2025-11-12  9:22 ` [pdm-devel] [PATCH proxmox 1/3] pve-api-types: add FixedString type Stefan Hanreich
2025-11-12 10:50   ` Wolfgang Bumiller
2025-11-12 16:39     ` Stefan Hanreich
2025-11-12  9:22 ` [pdm-devel] [PATCH proxmox 2/3] pve-api-types: generate fallback variant for enums Stefan Hanreich
2025-11-12  9:22 ` [pdm-devel] [PATCH proxmox 3/3] pve-api-types: regenerate Stefan Hanreich
2025-11-12  9:22 ` [pdm-devel] [PATCH proxmox-yew-comp 1/1] pve: qemu: handle fallback enum variants Stefan Hanreich
2025-11-12  9:22 ` [pdm-devel] [PATCH proxmox-datacenter-manager 1/1] tree-wide: handle new unknown " Stefan Hanreich
2025-11-12 12:25   ` Lukas Wagner
2025-11-12  9:22 ` Stefan Hanreich [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=20251112092225.17890-7-s.hanreich@proxmox.com \
    --to=s.hanreich@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