From: Dominik Csapak <d.csapak@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [pdm-devel] [PATCH datacenter-manager 1/5] ui: adapt to new node_ref semantic for new pwt
Date: Wed, 10 Sep 2025 13:52:50 +0200 [thread overview]
Message-ID: <20250910115259.3530107-3-d.csapak@proxmox.com> (raw)
In-Reply-To: <20250910115259.3530107-1-d.csapak@proxmox.com>
node_ref is not a std property anymore, but only defined for things that
are vtags, so we have to use into_html_with_ref for those things, or
wrap other elements in a container. There we use 'display: contents' to
make sure layouting/style etc. work as before.
In case of the search box, we can remove the noderef completely because
we didn't use it at all.
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
ui/src/dashboard/top_entities.rs | 8 ++++----
ui/src/widget/search_box.rs | 26 ++++++++++++++------------
2 files changed, 18 insertions(+), 16 deletions(-)
diff --git a/ui/src/dashboard/top_entities.rs b/ui/src/dashboard/top_entities.rs
index 4425fd2..c93ee25 100644
--- a/ui/src/dashboard/top_entities.rs
+++ b/ui/src/dashboard/top_entities.rs
@@ -11,7 +11,7 @@ use pwt::{
css::{AlignItems, Display, FlexFit, JustifyContent},
dom::align::{align_to, AlignOptions},
props::{
- ContainerBuilder, CssLength, CssPaddingBuilder, EventSubscriber, WidgetBuilder,
+ ContainerBuilder, CssLength, CssPaddingBuilder, EventSubscriber, IntoVTag, WidgetBuilder,
WidgetStyleBuilder,
},
tr,
@@ -142,10 +142,10 @@ impl Component for TopEntitiesComp {
tooltip = Some(create_tooltip(remote, resource, info, &props.metrics_title));
Some(
Container::new()
- .node_ref(self.tooltip_anchor.clone())
.style("position", "absolute")
.style("pointer-events", "none")
- .style("left", format!("{}px", info.pos)),
+ .style("left", format!("{}px", info.pos))
+ .into_html_with_ref(self.tooltip_anchor.clone()),
)
} else {
None
@@ -202,13 +202,13 @@ impl Component for TopEntitiesComp {
.with_child(list)
.with_optional_child(tooltip.map(|tooltip| {
Container::new()
- .node_ref(self.tooltip_ref.clone())
.attribute("role", "tooltip")
.attribute("aria-live", "polite")
.attribute("data-show", "")
.class("pwt-tooltip")
.class("pwt-tooltip-rich")
.with_child(tooltip)
+ .into_html_with_ref(self.tooltip_ref.clone())
}))
.into()
}
diff --git a/ui/src/widget/search_box.rs b/ui/src/widget/search_box.rs
index 3a52411..15100a6 100644
--- a/ui/src/widget/search_box.rs
+++ b/ui/src/widget/search_box.rs
@@ -45,7 +45,6 @@ pub enum Msg {
pub struct PdmSearchBox {
search_field_ref: NodeRef,
- search_box_ref: NodeRef,
search_term: String,
focus_tracker: FocusTracker,
focus: bool,
@@ -72,7 +71,6 @@ impl Component for PdmSearchBox {
});
Self {
search_field_ref: Default::default(),
- search_box_ref: Default::default(),
search_term: String::new(),
focus_tracker: FocusTracker::new(ctx.link().callback(Msg::FocusChange)),
focus: false,
@@ -115,7 +113,6 @@ impl Component for PdmSearchBox {
fn view(&self, ctx: &yew::Context<Self>) -> yew::Html {
let search_result = ResourceTree::new()
- .node_ref(self.search_box_ref.clone())
.search_term(self.search_term.clone())
.search_only(true)
.style("position", "absolute")
@@ -147,16 +144,21 @@ impl Component for PdmSearchBox {
.style("flex-basis", "230px") // to avoid changing size with trigger
.min_width(230) // placeholder text
.with_child(
- Field::new()
- .placeholder(tr!("Search (Ctrl+Space / Ctrl+Shift+F)"))
- .node_ref(self.search_field_ref.clone())
- .value(self.force_value.then_some(self.search_term.clone()))
- .with_trigger(
- Trigger::new(clear_trigger_icon)
- .onclick(ctx.link().callback(|_| Msg::ChangeTerm("".into(), true))),
- true,
+ Container::new()
+ .style("display", "contents")
+ .with_child(
+ Field::new()
+ .placeholder(tr!("Search (Ctrl+Space / Ctrl+Shift+F)"))
+ .value(self.force_value.then_some(self.search_term.clone()))
+ .with_trigger(
+ Trigger::new(clear_trigger_icon).onclick(
+ ctx.link().callback(|_| Msg::ChangeTerm("".into(), true)),
+ ),
+ true,
+ )
+ .on_input(ctx.link().callback(|term| Msg::ChangeTerm(term, false))),
)
- .on_input(ctx.link().callback(|term| Msg::ChangeTerm(term, false))),
+ .into_html_with_ref(self.search_field_ref.clone()),
)
.with_child(search_result)
.into()
--
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-09-10 11:53 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-10 11:52 [pdm-devel] [PATCH datacenter-manager/yew-comp 0/6] ui: add remote task panel and filtering Dominik Csapak
2025-09-10 11:52 ` [pdm-devel] [PATCH yew-comp 1/1] tasks: add optional fixed filter Dominik Csapak
2025-09-10 12:23 ` [pdm-devel] applied: " Thomas Lamprecht
2025-09-10 11:52 ` Dominik Csapak [this message]
2025-09-10 13:50 ` [pdm-devel] applied: [PATCH datacenter-manager 1/5] ui: adapt to new node_ref semantic for new pwt Thomas Lamprecht
2025-09-10 11:52 ` [pdm-devel] [PATCH datacenter-manager 2/5] ui: remote: tasks: add remote filter Dominik Csapak
2025-09-10 13:50 ` [pdm-devel] applied: " Thomas Lamprecht
2025-09-10 11:52 ` [pdm-devel] [PATCH datacenter-manager 3/5] ui: remote: tasks: add optional remote property to filter Dominik Csapak
2025-09-10 13:50 ` [pdm-devel] applied: " Thomas Lamprecht
2025-09-10 11:52 ` [pdm-devel] [PATCH datacenter-manager 4/5] ui: pve: tree: use correct key for the root node Dominik Csapak
2025-09-10 13:50 ` [pdm-devel] applied: " Thomas Lamprecht
2025-09-10 11:52 ` [pdm-devel] [PATCH datacenter-manager 5/5] ui: pve: tree: add remote tasks panel Dominik Csapak
2025-09-10 13:50 ` [pdm-devel] applied: " 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=20250910115259.3530107-3-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