From: Stefan Hanreich <s.hanreich@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [pdm-devel] [PATCH proxmox-datacenter-manager 1/1] sdn: add pending as status
Date: Tue, 28 Oct 2025 10:50:24 +0100 [thread overview]
Message-ID: <20251028095026.84493-1-s.hanreich@proxmox.com> (raw)
Currently SDN zones with pending changes were shown as unknown in the
UI. Add the pending status to the status enum and display it in the
frontend accordingly.
Signed-off-by: Stefan Hanreich <s.hanreich@proxmox.com>
---
lib/pdm-api-types/src/resource.rs | 5 +++++
server/src/api/resources.rs | 3 +++
ui/src/dashboard/sdn_zone_panel.rs | 4 +++-
ui/src/sdn/zone_tree.rs | 3 +++
4 files changed, 14 insertions(+), 1 deletion(-)
diff --git a/lib/pdm-api-types/src/resource.rs b/lib/pdm-api-types/src/resource.rs
index e09678d..671ba05 100644
--- a/lib/pdm-api-types/src/resource.rs
+++ b/lib/pdm-api-types/src/resource.rs
@@ -372,6 +372,7 @@ pub struct SdnZoneResource {
pub enum SdnStatus {
Available,
Error,
+ Pending,
#[serde(other)]
#[default]
Unknown,
@@ -383,6 +384,7 @@ impl std::str::FromStr for SdnStatus {
fn from_str(value: &str) -> Result<Self, Infallible> {
Ok(match value {
"ok" | "available" => Self::Available,
+ "pending" => Self::Pending,
"error" => Self::Error,
_ => Self::Unknown,
})
@@ -397,6 +399,7 @@ impl SdnStatus {
match self {
Self::Available => "available",
Self::Error => "error",
+ Self::Pending => "pending",
Self::Unknown => "unknown",
}
}
@@ -602,6 +605,8 @@ pub struct PbsDatastoreStatusCount {
pub struct SdnZoneCount {
/// Amount of available / ok zones
pub available: u64,
+ /// Amount of sdn zones with pending changes
+ pub pending: u64,
/// Amount of erroneous sdn zones
pub error: u64,
/// Amount of sdn zones with an unknown status
diff --git a/server/src/api/resources.rs b/server/src/api/resources.rs
index 3502c3b..0a50539 100644
--- a/server/src/api/resources.rs
+++ b/server/src/api/resources.rs
@@ -451,6 +451,9 @@ pub async fn get_status(
SdnStatus::Error => {
counts.sdn_zones.error += 1;
}
+ SdnStatus::Pending => {
+ counts.sdn_zones.pending += 1;
+ }
SdnStatus::Unknown => {
counts.sdn_zones.unknown += 1;
}
diff --git a/ui/src/dashboard/sdn_zone_panel.rs b/ui/src/dashboard/sdn_zone_panel.rs
index 0e26fa9..f08c4a8 100644
--- a/ui/src/dashboard/sdn_zone_panel.rs
+++ b/ui/src/dashboard/sdn_zone_panel.rs
@@ -46,6 +46,7 @@ impl StatusRow {
Self::All(_) => ("th", None),
Self::State(SdnStatus::Available, _) => ("check", Some(FontColor::Success)),
Self::State(SdnStatus::Error, _) => ("times-circle", Some(FontColor::Error)),
+ Self::State(SdnStatus::Pending, _) => ("refresh", Some(FontColor::Warning)),
Self::State(SdnStatus::Unknown, _) => ("question", None),
};
@@ -87,8 +88,9 @@ impl yew::Component for SdnZonePanelComponent {
let data = vec![
StatusRow::State(SdnStatus::Available, status.available),
StatusRow::State(SdnStatus::Error, status.error),
+ StatusRow::State(SdnStatus::Pending, status.pending),
StatusRow::State(SdnStatus::Unknown, status.unknown),
- StatusRow::All(status.available + status.error + status.unknown),
+ StatusRow::All(status.available + status.pending + status.error + status.unknown),
];
let tiles: Vec<_> = data
diff --git a/ui/src/sdn/zone_tree.rs b/ui/src/sdn/zone_tree.rs
index 2f90764..c6a85e9 100644
--- a/ui/src/sdn/zone_tree.rs
+++ b/ui/src/sdn/zone_tree.rs
@@ -143,6 +143,9 @@ impl ZoneTreeComponent {
SdnStatus::Available => {
row.with_child(Fa::new("check").class(FontColor::Success))
}
+ SdnStatus::Pending => {
+ row.with_child(Fa::new("refresh").class(FontColor::Warning))
+ }
SdnStatus::Error => {
row.with_child(Fa::new("times-circle").class(FontColor::Error))
}
--
2.47.3
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
reply other threads:[~2025-10-28 9:50 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20251028095026.84493-1-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.