From: Dominik Csapak <d.csapak@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [pdm-devel] [PATCH datacenter-manager v3 13/21] ui: dashboard: pbs datastores panel: refactor creation into own module
Date: Fri, 31 Oct 2025 13:43:56 +0100 [thread overview]
Message-ID: <20251031124822.2739685-14-d.csapak@proxmox.com> (raw)
In-Reply-To: <20251031124822.2739685-1-d.csapak@proxmox.com>
so we can use it more easily outside the `Dashboard` struct.
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
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<Self>) {
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<ResourcesStatus>) -> 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
next prev parent reply other threads:[~2025-10-31 12:47 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-31 12:43 [pdm-devel] [PATCH datacenter-manager v3 00/21] prepare ui for customizable views Dominik Csapak
2025-10-31 12:43 ` [pdm-devel] [PATCH datacenter-manager v3 01/21] ui: dashboard: refactor guest panel creation to its own module Dominik Csapak
2025-10-31 12:43 ` [pdm-devel] [PATCH datacenter-manager v3 02/21] ui: dashboard: refactor creating the node panel into " Dominik Csapak
2025-10-31 12:43 ` [pdm-devel] [PATCH datacenter-manager v3 03/21] ui: dashboard: node panel: make remote type optional Dominik Csapak
2025-10-31 12:43 ` [pdm-devel] [PATCH datacenter-manager v3 04/21] ui: dashboard: refactor remote panel creation into its own module Dominik Csapak
2025-10-31 12:43 ` [pdm-devel] [PATCH datacenter-manager v3 05/21] ui: dashboard: remote panel: make wizard menu optional Dominik Csapak
2025-10-31 12:43 ` [pdm-devel] [PATCH datacenter-manager v3 06/21] ui: dashboard: refactor sdn panel creation into its own module Dominik Csapak
2025-10-31 12:43 ` [pdm-devel] [PATCH datacenter-manager v3 07/21] ui: dashboard: refactor task summary panel creation to " Dominik Csapak
2025-10-31 12:43 ` [pdm-devel] [PATCH datacenter-manager v3 08/21] ui: dashboard: task summary: disable virtual scrolling Dominik Csapak
2025-10-31 12:43 ` [pdm-devel] [PATCH datacenter-manager v3 09/21] ui: dashboard: refactor subscription panel creation to its own module Dominik Csapak
2025-10-31 12:43 ` [pdm-devel] [PATCH datacenter-manager v3 10/21] ui: dashboard: refactor top entities " Dominik Csapak
2025-10-31 12:43 ` [pdm-devel] [PATCH datacenter-manager v3 11/21] ui: dashboard: refactor DashboardConfig editing/constants to their module Dominik Csapak
2025-10-31 12:43 ` [pdm-devel] [PATCH datacenter-manager v3 12/21] ui: dashboard: factor out task parameter calculation Dominik Csapak
2025-10-31 12:43 ` Dominik Csapak [this message]
2025-10-31 12:43 ` [pdm-devel] [PATCH datacenter-manager v3 14/21] ui: dashboard: remove unused remote list Dominik Csapak
2025-10-31 12:43 ` [pdm-devel] [PATCH datacenter-manager v3 15/21] ui: dashboard: status row: make loading less jarring Dominik Csapak
2025-10-31 12:43 ` [pdm-devel] [PATCH datacenter-manager v3 16/21] ui: introduce `LoadResult` helper type Dominik Csapak
2025-10-31 12:44 ` [pdm-devel] [PATCH datacenter-manager v3 17/21] ui: dashboard: implement 'View' Dominik Csapak
2025-10-31 12:44 ` [pdm-devel] [PATCH datacenter-manager v3 18/21] ui: dashboard: use 'View' instead of the Dashboard Dominik Csapak
2025-10-31 12:44 ` [pdm-devel] [PATCH datacenter-manager v3 19/21] ui: dashboard: subscription info: move subscription loading to view Dominik Csapak
2025-10-31 12:44 ` [pdm-devel] [PATCH datacenter-manager v3 20/21] ui: dashboard: use SharedState for create_*_panel Dominik Csapak
2025-10-31 12:44 ` [pdm-devel] [PATCH datacenter-manager v3 21/21] ui: dashboard: enable editing view Dominik Csapak
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=20251031124822.2739685-14-d.csapak@proxmox.com \
--to=d.csapak@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox