From: Dominik Csapak <d.csapak@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [pdm-devel] [PATCH datacenter-manager v5 24/26] api-types/ui: add ResourceTree variant for WidgetType
Date: Wed, 26 Nov 2025 16:18:17 +0100 [thread overview]
Message-ID: <20251126151833.3637080-25-d.csapak@proxmox.com> (raw)
In-Reply-To: <20251126151833.3637080-1-d.csapak@proxmox.com>
this is the resource tree from the search, but contained within a panel
and with search field in a toolbar, for use in the custom views.
This can come in handy, since it gives an overview of the filtered
resources.
It does not refresh together with the other panels in the view
currently, only once at the beginning and when the search term changes.
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
lib/pdm-api-types/src/views.rs | 1 +
ui/src/dashboard/mod.rs | 3 ++
ui/src/dashboard/resource_tree.rs | 46 +++++++++++++++++++++++++++++++
ui/src/dashboard/view.rs | 6 +++-
ui/src/dashboard/view/row_view.rs | 4 +++
5 files changed, 59 insertions(+), 1 deletion(-)
create mode 100644 ui/src/dashboard/resource_tree.rs
diff --git a/lib/pdm-api-types/src/views.rs b/lib/pdm-api-types/src/views.rs
index c9864718..1bcde477 100644
--- a/lib/pdm-api-types/src/views.rs
+++ b/lib/pdm-api-types/src/views.rs
@@ -291,6 +291,7 @@ pub enum WidgetType {
TaskSummary {
grouping: TaskSummaryGrouping,
},
+ ResourceTree,
}
#[derive(Serialize, Deserialize, PartialEq, Clone, Copy)]
diff --git a/ui/src/dashboard/mod.rs b/ui/src/dashboard/mod.rs
index 8800102f..17e5ccd3 100644
--- a/ui/src/dashboard/mod.rs
+++ b/ui/src/dashboard/mod.rs
@@ -39,6 +39,9 @@ pub mod view;
mod refresh_config_edit;
pub use refresh_config_edit::create_refresh_config_edit_window;
+mod resource_tree;
+pub use resource_tree::create_resource_tree;
+
fn loading_column() -> Column {
Column::new()
.padding(4)
diff --git a/ui/src/dashboard/resource_tree.rs b/ui/src/dashboard/resource_tree.rs
new file mode 100644
index 00000000..cd7a1702
--- /dev/null
+++ b/ui/src/dashboard/resource_tree.rs
@@ -0,0 +1,46 @@
+use pwt::css;
+use pwt::prelude::*;
+use pwt::props::{ContainerBuilder, WidgetBuilder, WidgetStyleBuilder};
+use pwt::widget::form::Field;
+use pwt::widget::Column;
+use pwt::widget::Panel;
+use pwt::widget::Row;
+use pwt::widget::Toolbar;
+
+use crate::widget::ResourceTree;
+
+#[function_component]
+fn ResourceTreeWithSearch() -> Html {
+ let search = use_state(String::new);
+
+ Column::new()
+ .class(css::FlexFit)
+ .with_child(
+ Toolbar::new()
+ .with_child(tr!("Search"))
+ .with_child(Field::new().on_change({
+ let search = search.clone();
+ move |value| search.set(value)
+ })),
+ )
+ .with_child(
+ // use another flex layout with base width to work around the data tables dynamic
+ // column size that does not decrease
+ Row::new().class(css::FlexFit).with_child(
+ ResourceTree::new()
+ .search_term(search.to_string())
+ .flex(1.0)
+ .width(250)
+ .height(500)
+ .class(css::FlexFit),
+ ),
+ )
+ .into()
+}
+
+pub fn create_resource_tree() -> Panel {
+ Panel::new()
+ .class(css::FlexFit)
+ .title(tr!("Resources"))
+ .with_child(html! {<ResourceTreeWithSearch />})
+}
diff --git a/ui/src/dashboard/view.rs b/ui/src/dashboard/view.rs
index ff287db8..e6a86bc9 100644
--- a/ui/src/dashboard/view.rs
+++ b/ui/src/dashboard/view.rs
@@ -24,7 +24,7 @@ use crate::dashboard::subscription_info::create_subscriptions_dialog;
use crate::dashboard::tasks::get_task_options;
use crate::dashboard::{
create_guest_panel, create_node_panel, create_pbs_datastores_panel,
- create_refresh_config_edit_window, create_remote_panel, create_sdn_panel,
+ create_refresh_config_edit_window, create_remote_panel, create_resource_tree, create_sdn_panel,
create_subscription_panel, create_task_summary_panel, create_top_entities_panel,
DashboardStatusRow,
};
@@ -161,6 +161,7 @@ fn render_widget(
let (hours, since) = get_task_options(refresh_config.task_last_hours);
create_task_summary_panel(statistics, remotes, hours, since)
}
+ WidgetType::ResourceTree => create_resource_tree(),
};
if let Some(title) = &item.title {
@@ -269,6 +270,9 @@ fn required_api_calls(layout: &ViewLayout) -> (bool, bool, bool) {
}
WidgetType::Leaderboard { .. } => top_entities = true,
WidgetType::TaskSummary { .. } => task_statistics = true,
+ WidgetType::ResourceTree => {
+ // each list must do it itself
+ }
}
}
}
diff --git a/ui/src/dashboard/view/row_view.rs b/ui/src/dashboard/view/row_view.rs
index 7ecac200..df5552c3 100644
--- a/ui/src/dashboard/view/row_view.rs
+++ b/ui/src/dashboard/view/row_view.rs
@@ -625,4 +625,8 @@ fn create_menu(ctx: &yew::Context<RowViewComp>, new_coords: Position) -> Menu {
),
)
.with_item(MenuItem::new(tr!("SDN Panel")).on_select(create_callback(WidgetType::Sdn)))
+ .with_item(
+ MenuItem::new(tr!("Resource Tree"))
+ .on_select(create_callback(WidgetType::ResourceTree)),
+ )
}
--
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-11-26 15:19 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-26 15:17 [pdm-devel] [PATCH datacenter-manager v5 00/26] enable custom views on the UI Dominik Csapak
2025-11-26 15:17 ` [pdm-devel] [PATCH datacenter-manager v5 01/26] lib: pdm-config: views: add locking/saving methods Dominik Csapak
2025-11-26 15:17 ` [pdm-devel] [PATCH datacenter-manager v5 02/26] lib: api-types: add 'layout' property to ViewConfig Dominik Csapak
2025-11-26 15:17 ` [pdm-devel] [PATCH datacenter-manager v5 03/26] server: api: implement CRUD api for views Dominik Csapak
2025-11-26 15:17 ` [pdm-devel] [PATCH datacenter-manager v5 04/26] server: api: resources: add 'view' category to search syntax Dominik Csapak
2025-11-26 15:17 ` [pdm-devel] [PATCH datacenter-manager v5 05/26] ui: remote selector: allow forcing of value Dominik Csapak
2025-11-26 15:17 ` [pdm-devel] [PATCH datacenter-manager v5 06/26] ui: dashboard types: add missing 'default's to de-serialization Dominik Csapak
2025-11-26 15:18 ` [pdm-devel] [PATCH datacenter-manager v5 07/26] ui: dashboard: status row: add optional 'editing state' Dominik Csapak
2025-11-26 15:18 ` [pdm-devel] [PATCH datacenter-manager v5 08/26] ui: dashboard: prepare view for editing custom views Dominik Csapak
2025-11-26 15:18 ` [pdm-devel] [PATCH datacenter-manager v5 09/26] ui: views: implement view loading from api Dominik Csapak
2025-11-26 15:18 ` [pdm-devel] [PATCH datacenter-manager v5 10/26] ui: views: make 'view' name property optional Dominik Csapak
2025-11-26 15:18 ` [pdm-devel] [PATCH datacenter-manager v5 11/26] ui: views: add 'view' parameter to api calls Dominik Csapak
2025-11-26 15:18 ` [pdm-devel] [PATCH datacenter-manager v5 12/26] ui: views: save updated layout to backend Dominik Csapak
2025-11-26 15:18 ` [pdm-devel] [PATCH datacenter-manager v5 13/26] ui: add view list context Dominik Csapak
2025-11-26 15:18 ` [pdm-devel] [PATCH datacenter-manager v5 14/26] ui: configuration: add view CRUD panels Dominik Csapak
2025-11-26 15:18 ` [pdm-devel] [PATCH datacenter-manager v5 15/26] ui: main menu: add optional view_list property Dominik Csapak
2025-11-26 15:18 ` [pdm-devel] [PATCH datacenter-manager v5 16/26] ui: load view list on page init Dominik Csapak
2025-11-26 15:18 ` [pdm-devel] [PATCH datacenter-manager v5 17/26] lib/ui: move views types to pdm-api-types Dominik Csapak
2025-11-26 15:18 ` [pdm-devel] [PATCH datacenter-manager v5 18/26] server: api: views: check layout string for validity Dominik Csapak
2025-11-26 15:18 ` [pdm-devel] [PATCH datacenter-manager v5 19/26] ui: dashboard: add current view to search terms Dominik Csapak
2025-11-26 15:18 ` [pdm-devel] [PATCH datacenter-manager v5 20/26] ui: resource tree: fix loading logic Dominik Csapak
2025-11-26 15:18 ` [pdm-devel] [PATCH datacenter-manager v5 21/26] ui: resource tree: move error message into first column Dominik Csapak
2025-11-26 15:18 ` [pdm-devel] [PATCH datacenter-manager v5 22/26] ui: resource tree: use `ViewContext` to limit the api calls to a view Dominik Csapak
2025-11-26 15:18 ` [pdm-devel] [PATCH datacenter-manager v5 23/26] ui: resource tree: show guest tags Dominik Csapak
2025-11-26 15:18 ` Dominik Csapak [this message]
2025-11-26 15:18 ` [pdm-devel] [PATCH datacenter-manager v5 25/26] ui: dashboard view: refactor widget rendering arguments into struct Dominik Csapak
2025-11-26 15:18 ` [pdm-devel] [PATCH datacenter-manager v5 26/26] ui: resource tree/view: reload tree in a view on refresh Dominik Csapak
2025-11-26 21:15 ` [pdm-devel] applied: [PATCH datacenter-manager v5 00/26] enable custom views on the UI Thomas Lamprecht
2025-11-26 21:17 ` [pdm-devel] " Thomas Lamprecht
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=20251126151833.3637080-25-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 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.