From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id E6A7A1FF184 for ; Thu, 20 Nov 2025 15:51:24 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 8064DBA79; Thu, 20 Nov 2025 15:51:31 +0100 (CET) From: Stefan Hanreich To: pbs-devel@lists.proxmox.com Date: Thu, 20 Nov 2025 15:50:14 +0100 Message-ID: <20251120145031.550340-7-s.hanreich@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20251120145031.550340-1-s.hanreich@proxmox.com> References: <20251120145031.550340-1-s.hanreich@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.172 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 KAM_LAZY_DOMAIN_SECURITY 1 Sending domain does not have any anti-forgery methods RDNS_NONE 0.793 Delivered to internal network by a host with no rDNS SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_NONE 0.001 SPF: sender does not publish an SPF Record Subject: [pbs-devel] [PATCH proxmox-datacenter-manager 1/1] tree-wide: add enum fallback variants for pbs api types X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox Backup Server development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pbs-devel-bounces@lists.proxmox.com Sender: "pbs-devel" 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 --- 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}{text}}) -- 2.47.3 _______________________________________________ pbs-devel mailing list pbs-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel