[pdm-devel] [PATCH datacenter-manager 08/21] ui: remotes: node url list: handle changing default
Dominik Csapak
d.csapak at proxmox.com
Fri May 16 15:35:58 CEST 2025
in the wizard, the default can change if a user goes back and
starts querying a different host. To show that, we have to manually
update the internal state when the default changes.
Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
ui/src/remotes/node_url_list.rs | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/ui/src/remotes/node_url_list.rs b/ui/src/remotes/node_url_list.rs
index d546a94..af77f1b 100644
--- a/ui/src/remotes/node_url_list.rs
+++ b/ui/src/remotes/node_url_list.rs
@@ -136,6 +136,20 @@ impl ManagedField for PdmNodeUrlField {
this
}
+ fn changed(&mut self, ctx: &ManagedFieldContext<Self>, old_props: &Self::Properties) -> bool {
+ let props = ctx.props();
+ if old_props.default != props.default {
+ let default: Value = props
+ .default
+ .iter()
+ .filter_map(|n| serde_json::to_value(n).ok())
+ .collect();
+ ctx.link().update_default(default.clone());
+ self.sync_from_value(default);
+ }
+ true
+ }
+
fn value_changed(&mut self, ctx: &ManagedFieldContext<Self>) {
match ctx.state().value {
Value::Null => self.sync_from_value(ctx.state().default.clone()),
--
2.39.5
More information about the pdm-devel
mailing list