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 0F8DD1FF165 for ; Thu, 23 Oct 2025 10:32:31 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 3E92E368E; Thu, 23 Oct 2025 10:32:58 +0200 (CEST) From: Dominik Csapak To: pdm-devel@lists.proxmox.com Date: Thu, 23 Oct 2025 10:28:09 +0200 Message-ID: <20251023083253.1038119-6-d.csapak@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20251023083253.1038119-1-d.csapak@proxmox.com> References: <20251023083253.1038119-1-d.csapak@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.028 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 SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pdm-devel] [PATCH datacenter-manager v2 05/16] ui: dashboard: refactor sdn panel creation into its own module X-BeenThere: pdm-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Datacenter Manager development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox Datacenter Manager development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pdm-devel-bounces@lists.proxmox.com Sender: "pdm-devel" so we can more easily reuse that outside the dashboard struct. Signed-off-by: Dominik Csapak --- ui/src/dashboard/mod.rs | 17 ++--------------- ui/src/dashboard/sdn_zone_panel.rs | 15 ++++++++++++--- 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/ui/src/dashboard/mod.rs b/ui/src/dashboard/mod.rs index 0441440a..fa0fe2fc 100644 --- a/ui/src/dashboard/mod.rs +++ b/ui/src/dashboard/mod.rs @@ -46,7 +46,7 @@ mod guest_panel; pub use guest_panel::create_guest_panel; mod sdn_zone_panel; -use sdn_zone_panel::SdnZonePanel; +use sdn_zone_panel::create_sdn_panel; mod status_row; use status_row::DashboardStatusRow; @@ -145,19 +145,6 @@ pub struct PdmDashboard { } impl PdmDashboard { - fn create_sdn_panel(&self) -> Panel { - let sdn_zones_status = self.status.as_ref().map(|status| status.sdn_zones.clone()); - - Panel::new() - .flex(1.0) - .width(200) - .title(create_title_with_icon("sdn", tr!("SDN Zones"))) - .border(true) - .with_child(SdnZonePanel::new( - (!self.loading).then_some(sdn_zones_status).flatten(), - )) - } - fn create_task_summary_panel( &self, statistics: &StatisticsOptions, @@ -556,7 +543,7 @@ impl Component for PdmDashboard { .class(FlexWrap::Wrap) .with_child(self.create_task_summary_panel(&self.statistics, None)) .with_child(self.create_task_summary_panel(&self.statistics, Some(5))) - .with_child(self.create_sdn_panel()), + .with_child(create_sdn_panel(self.status.clone()).flex(1.0).width(200)), ); Panel::new() diff --git a/ui/src/dashboard/sdn_zone_panel.rs b/ui/src/dashboard/sdn_zone_panel.rs index 0e26fa9c..611aadd1 100644 --- a/ui/src/dashboard/sdn_zone_panel.rs +++ b/ui/src/dashboard/sdn_zone_panel.rs @@ -1,18 +1,18 @@ use std::rc::Rc; -use pdm_api_types::resource::{ResourceType, SdnStatus, SdnZoneCount}; +use pdm_api_types::resource::{ResourceType, ResourcesStatus, SdnStatus, SdnZoneCount}; use pdm_search::{Search, SearchTerm}; use pwt::{ css::{self, FontColor, TextAlign}, prelude::*, - widget::{Container, Fa, List, ListTile}, + widget::{Container, Fa, List, ListTile, Panel}, }; use yew::{ virtual_dom::{VComp, VNode}, Properties, }; -use crate::search_provider::get_search_provider; +use crate::{dashboard::create_title_with_icon, search_provider::get_search_provider}; use super::loading_column; @@ -155,3 +155,12 @@ fn create_sdn_zone_search_term(status: Option) -> Search { Search::with_terms(terms) } + +pub fn create_sdn_panel(status: Option) -> Panel { + let sdn_zones_status = status.map(|status| status.sdn_zones); + + Panel::new() + .title(create_title_with_icon("sdn", tr!("SDN Zones"))) + .border(true) + .with_child(SdnZonePanel::new(sdn_zones_status)) +} -- 2.47.3 _______________________________________________ pdm-devel mailing list pdm-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel