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 957BF1FF15C for ; Fri, 31 Oct 2025 13:47:58 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 98927115D3; Fri, 31 Oct 2025 13:48:32 +0100 (CET) From: Dominik Csapak To: pdm-devel@lists.proxmox.com Date: Fri, 31 Oct 2025 13:43:56 +0100 Message-ID: <20251031124822.2739685-14-d.csapak@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20251031124822.2739685-1-d.csapak@proxmox.com> References: <20251031124822.2739685-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 v3 13/21] ui: dashboard: pbs datastores panel: refactor creation into 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 use it more easily outside the `Dashboard` struct. Signed-off-by: Dominik Csapak --- ui/src/dashboard/mod.rs | 26 +++++---------------- ui/src/dashboard/pbs_datastores_panel.rs | 29 ++++++++++++++++-------- 2 files changed, 25 insertions(+), 30 deletions(-) diff --git a/ui/src/dashboard/mod.rs b/ui/src/dashboard/mod.rs index 51341737..ee40405b 100644 --- a/ui/src/dashboard/mod.rs +++ b/ui/src/dashboard/mod.rs @@ -47,14 +47,13 @@ use status_row::DashboardStatusRow; mod filtered_tasks; mod pbs_datastores_panel; -use pbs_datastores_panel::PbsDatastoresPanel; +pub use pbs_datastores_panel::create_pbs_datastores_panel; mod tasks; use tasks::{create_task_summary_panel, get_task_options}; pub mod types; - mod refresh_config_edit; pub use refresh_config_edit::{ create_refresh_config_edit_window, refresh_config_id, RefreshConfig, @@ -118,23 +117,6 @@ pub struct PdmDashboard { } impl PdmDashboard { - fn create_pbs_datastores_panel(&self) -> Panel { - let pbs_datastores = self - .status - .as_ref() - .map(|status| status.pbs_datastores.clone()); - - Panel::new() - .flex(1.0) - .width(300) - .title(create_title_with_icon( - "database", - tr!("Backup Server Datastores"), - )) - .border(true) - .with_child(PbsDatastoresPanel::new(pbs_datastores)) - } - fn reload(&mut self, ctx: &yew::Context) { let max_age = if self.loaded_once { self.config.max_age.unwrap_or(DEFAULT_MAX_AGE_S) @@ -364,7 +346,11 @@ impl Component for PdmDashboard { .flex(1.0) .width(300), ) - .with_child(self.create_pbs_datastores_panel()) + .with_child( + create_pbs_datastores_panel(self.status.clone()) + .flex(1.0) + .width(300), + ) .with_child( create_subscription_panel() .flex(1.0) diff --git a/ui/src/dashboard/pbs_datastores_panel.rs b/ui/src/dashboard/pbs_datastores_panel.rs index a06acf7f..6542ac00 100644 --- a/ui/src/dashboard/pbs_datastores_panel.rs +++ b/ui/src/dashboard/pbs_datastores_panel.rs @@ -1,18 +1,15 @@ use std::rc::Rc; -use pdm_api_types::resource::{PbsDatastoreStatusCount, ResourceType}; +use yew::virtual_dom::{VComp, VNode}; + +use pdm_api_types::resource::{PbsDatastoreStatusCount, ResourceType, ResourcesStatus}; use pdm_search::{Search, SearchTerm}; use proxmox_yew_comp::Status; -use pwt::{ - css::{self, TextAlign}, - prelude::*, - widget::{Container, Fa, List, ListTile}, -}; -use yew::{ - virtual_dom::{VComp, VNode}, - Properties, -}; +use pwt::css::{self, TextAlign}; +use pwt::prelude::*; +use pwt::widget::{Container, Fa, List, ListTile, Panel}; +use crate::dashboard::create_title_with_icon; use crate::search_provider::get_search_provider; use super::loading_column; @@ -157,3 +154,15 @@ fn create_pbs_datastores_status_search_term(search_term: Option<(&str, &str)>) - } Search::with_terms(terms) } + +pub fn create_pbs_datastores_panel(status: Option) -> Panel { + let pbs_datastores = status.map(|status| status.pbs_datastores.clone()); + + Panel::new() + .title(create_title_with_icon( + "database", + tr!("Backup Server Datastores"), + )) + .border(true) + .with_child(PbsDatastoresPanel::new(pbs_datastores)) +} -- 2.47.3 _______________________________________________ pdm-devel mailing list pdm-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel