all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [pdm-devel] [PATCH proxmox-datacenter-manager 1/1] sdn: add pending as status
@ 2025-10-28  9:50 Stefan Hanreich
  2025-12-02  0:03 ` [pdm-devel] applied: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Hanreich @ 2025-10-28  9:50 UTC (permalink / raw)
  To: pdm-devel

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-12-02  0:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-10-28  9:50 [pdm-devel] [PATCH proxmox-datacenter-manager 1/1] sdn: add pending as status Stefan Hanreich
2025-12-02  0:03 ` [pdm-devel] applied: " Thomas Lamprecht

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.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal