From: Stefan Hanreich <s.hanreich@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-datacenter-manager 1/1] tree-wide: add enum fallback variants for pbs api types
Date: Thu, 20 Nov 2025 15:50:14 +0100 [thread overview]
Message-ID: <20251120145031.550340-7-s.hanreich@proxmox.com> (raw)
In-Reply-To: <20251120145031.550340-1-s.hanreich@proxmox.com>
pbs-api-types added fallback variants to all enums that are part of
the REST API. Fix all occurences of the enums that got new fallback
variants in PDM by handling them properly. In the backend, unknown
values are logged, while in the frontend they're simply rendered with
a special icon / font color.
Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
---
Cargo.toml | 2 +-
server/src/metric_collection/rrd_task.rs | 4 ++++
ui/Cargo.toml | 2 +-
ui/src/pbs/snapshot_list.rs | 7 +++++++
4 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/Cargo.toml b/Cargo.toml
index 6ae8f69..c44b181 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -83,7 +83,7 @@ proxmox-node-status = "1"
# API types for PVE (and later PMG?)
pve-api-types = "8.1.0"
# API types for PBS
-pbs-api-types = "1.0.5"
+pbs-api-types = { version = "1.0.5", features = [ "enum-fallback" ] }
# PDM workspace
server = { path = "server" }
diff --git a/server/src/metric_collection/rrd_task.rs b/server/src/metric_collection/rrd_task.rs
index f48968b..48b6de9 100644
--- a/server/src/metric_collection/rrd_task.rs
+++ b/server/src/metric_collection/rrd_task.rs
@@ -165,6 +165,10 @@ fn store_metric_pbs(cache: &RrdCache, remote_name: &str, data_point: &MetricData
MetricDataType::Gauge => DataSourceType::Gauge,
MetricDataType::Counter => DataSourceType::Counter,
MetricDataType::Derive => DataSourceType::Derive,
+ MetricDataType::UnknownEnumValue(s) => {
+ log::warn!("unknown metric data type: {s}");
+ return;
+ }
};
cache.update_value(
diff --git a/ui/Cargo.toml b/ui/Cargo.toml
index d9acbe9..ef032ea 100644
--- a/ui/Cargo.toml
+++ b/ui/Cargo.toml
@@ -40,7 +40,7 @@ proxmox-login = "1"
proxmox-schema = "5"
proxmox-rrd-api-types = "1"
proxmox-node-status = "1"
-pbs-api-types = "1.0.3"
+pbs-api-types = { version = "1.0.3", features = [ "enum-fallback" ] }
pdm-api-types = { version = "0.9", path = "../lib/pdm-api-types" }
pdm-client = { version = "0.9", path = "../lib/pdm-client" }
diff --git a/ui/src/pbs/snapshot_list.rs b/ui/src/pbs/snapshot_list.rs
index b82ffd5..564288b 100644
--- a/ui/src/pbs/snapshot_list.rs
+++ b/ui/src/pbs/snapshot_list.rs
@@ -114,6 +114,7 @@ impl SnapshotListComp {
BackupType::Vm => "desktop",
BackupType::Ct => "cube",
BackupType::Host => "building",
+ BackupType::UnknownEnumValue(_) => "question-circle-o",
},
group.to_string(),
),
@@ -234,6 +235,7 @@ impl Component for SnapshotListComp {
match state.state {
VerifyState::Ok => verify_state.ok += 1,
VerifyState::Failed => verify_state.failed += 1,
+ VerifyState::UnknownEnumValue(_) => {}
}
let age_days = (now - state.upid.starttime) / (30 * 24 * 60 * 60);
@@ -436,6 +438,11 @@ fn render_verification(entry: &SnapshotTreeEntry) -> Html {
let (text, icon_class, class) = match state.state {
VerifyState::Ok => (tr!("Ok"), "check", FontColor::Success),
VerifyState::Failed => (tr!("Failed"), "times", FontColor::Warning),
+ VerifyState::UnknownEnumValue(s) => (
+ tr!("Unknown ({0})", s),
+ "question-circle-o",
+ FontColor::Error,
+ ),
};
let icon = Fa::new(icon_class).class(class).padding_end(2);
Tooltip::new(html! {<>{icon}<span>{text}</span></>})
--
2.47.3
_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
prev parent reply other threads:[~2025-11-20 14:51 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-20 14:50 [pbs-devel] [RFC proxmox{, -datacenter-manager} 0/6] Add fallback variants to PBS API types Stefan Hanreich
2025-11-20 14:50 ` [pbs-devel] [PATCH proxmox 1/5] proxmox-upgrade-checks: fix meta package version check Stefan Hanreich
2025-11-20 15:04 ` Shannon Sterz
2025-11-20 15:08 ` Stefan Hanreich
2025-11-20 14:50 ` [pbs-devel] [PATCH proxmox 2/5] proxmox-fixed-string: extract FixedString into own crate Stefan Hanreich
2025-11-20 14:50 ` [pbs-devel] [PATCH proxmox 3/5] proxmox-fixed-string: implement hash trait Stefan Hanreich
2025-11-20 14:50 ` [pbs-devel] [PATCH proxmox 4/5] pve-api-types: add proxmox-fixed-string Stefan Hanreich
2025-11-20 14:50 ` [pbs-devel] [PATCH proxmox 5/5] pbs-api-types: add fallback variants to enums in public API Stefan Hanreich
2025-11-20 14:50 ` 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=20251120145031.550340-7-s.hanreich@proxmox.com \
--to=s.hanreich@proxmox.com \
--cc=pbs-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