all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [PATCH datacenter-manager/proxmox-yew-comp/yew-widget-toolkit v3 0/8] ui: make the default dashboard configurable and add "My Settings" dialog
@ 2026-11-30 12:52 Dominik Csapak
  2026-11-30 12:52 ` [PATCH yew-widget-toolkit v3 1/8] state: event: add helper to dispatch custom DOM events Dominik Csapak
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Dominik Csapak @ 2026-11-30 12:52 UTC (permalink / raw)
  To: pdm-devel

This adds a 'My Settings' dialog like the one in PVE to the user menu of
PDM. It contains the settings of the xterm.js and noVNC consoles, and
lets users select one of their views as the dashboard. All of them are
saved in the local storage of the browser, so they are per browser, not
per user.

For that, a `PersistentState` in pwt can now listen for updates of its
storage location (so the dashboard changes without reloading the page),
and `XTermJs` in proxmox-yew-comp gets a 'resize' property for the
scaling mode of noVNC.

The xterm.js settings are written as plain local storage entries instead
of a `PersistentState`, since the xterm.js console uses their text as
is.

Note that for the pdm patches, pwt and proxmox-yew-comp must be bumped and the
new versions must be recorded in Cargo.toml.

Even if we don't want to have the default dashboard configurable, the
'my settings' patches could be applied individually.

changes from v2:
* rebase on master
* drop the fix for dismissing the remove confirmation, that is already
  fixed on master
* pwt: only add a helper to dispatch custom events, and use it for the
  theme changed event too
* pwt: improve the doc comments of the persistent state patch
* pass the noVNC scaling mode from the settings to the noVNC console
  (new proxmox-yew-comp patch)
* treat empty xterm.js settings as unset and add a step for the line
  height
* use a new component for the dashboard when another view is selected
  (new patch)
* show the notice for a missing dashboard view when loading it fails
  with 'not found', instead of looking it up in the list of views
* use a shared helper for the persistent state of the dashboard
* document the my settings window (new patch)
* improve commit messages and comments

changes from v1:
* add my settings window and move the default dashboard selection there
* use '#' for the default dashboard instead of '__dashboard__'
* show a notice if the selected dashboard is not in the view_list

v2: https://lore.proxmox.com/pdm-devel/20261127170941.4183880-1-d.csapak@proxmox.com/


proxmox-yew-widget-toolkit:

Dominik Csapak (2):
  state: event: add helper to dispatch custom DOM events
  state: persistent state: allow listening for updates

 src/state/event.rs            | 21 +++++++++++++++++++
 src/state/mod.rs              | 33 +++++++++++++++++++++++++-----
 src/state/persistent_state.rs | 38 ++++++++++++++++++++++++++++++++++-
 src/state/theme.rs            |  7 ++-----
 4 files changed, 88 insertions(+), 11 deletions(-)
 create mode 100644 src/state/event.rs


proxmox-yew-comp:

Dominik Csapak (1):
  xtermjs: allow setting the noVNC scaling mode

 src/xtermjs.rs | 33 +++++++++++++++++++++++++--------
 1 file changed, 25 insertions(+), 8 deletions(-)


proxmox-datacenter-manager:

Dominik Csapak (5):
  ui: view selector: use a placeholder that can't conflict with a view
  ui: add 'My Settings' dialog with xterm.js and noVNC settings
  ui: views: use the view name as key of the component
  ui: make the default dashboard page configurable
  docs: web ui: describe the 'My Settings' dialog

 docs/views.rst                      |   2 +
 docs/web-ui.rst                     |  19 +-
 ui/Cargo.toml                       |   2 +-
 ui/src/configuration/views.rs       |   4 +-
 ui/src/dashboard/mod.rs             |   7 +
 ui/src/dashboard/view.rs            |  53 +++---
 ui/src/main.rs                      |   1 +
 ui/src/main_menu.rs                 |  21 ++-
 ui/src/pve/utils.rs                 |  13 +-
 ui/src/top_nav_bar.rs               |  22 ++-
 ui/src/widget/mod.rs                |   5 +-
 ui/src/widget/my_settings_dialog.rs | 273 ++++++++++++++++++++++++++++
 ui/src/widget/view_selector.rs      |  10 +-
 13 files changed, 388 insertions(+), 44 deletions(-)
 create mode 100644 ui/src/widget/my_settings_dialog.rs


Summary over all repositories:
  18 files changed, 501 insertions(+), 63 deletions(-)

-- 
Generated by murpp 0.11.0




^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH yew-widget-toolkit v3 1/8] state: event: add helper to dispatch custom DOM events
  2026-11-30 12:52 [PATCH datacenter-manager/proxmox-yew-comp/yew-widget-toolkit v3 0/8] ui: make the default dashboard configurable and add "My Settings" dialog Dominik Csapak
@ 2026-11-30 12:52 ` Dominik Csapak
  2026-11-30 12:52 ` [PATCH yew-widget-toolkit v3 2/8] state: persistent state: allow listening for updates Dominik Csapak
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Dominik Csapak @ 2026-11-30 12:52 UTC (permalink / raw)
  To: pdm-devel

Dispatching a custom event is currently open coded for the
`pwt-theme-changed` event. Provide a small wrapper, so that further
users do not have to repeat the window/document lookup and the JS error
conversion, and use it for the theme event too.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 src/state/event.rs | 21 +++++++++++++++++++++
 src/state/mod.rs   |  3 +++
 src/state/theme.rs |  7 ++-----
 3 files changed, 26 insertions(+), 5 deletions(-)
 create mode 100644 src/state/event.rs

diff --git a/src/state/event.rs b/src/state/event.rs
new file mode 100644
index 0000000..39f4444
--- /dev/null
+++ b/src/state/event.rs
@@ -0,0 +1,21 @@
+//! Helper to dispatch custom DOM events.
+
+use anyhow::{Error, format_err};
+use web_sys::Event;
+
+/// Dispatch a custom event with the given name on the document.
+///
+/// The event is only delivered to listeners in the current document, so listeners in other
+/// browser tabs or windows are not notified.
+pub fn dispatch_custom_event(name: &str) -> Result<(), Error> {
+    let document = web_sys::window()
+        .and_then(|window| window.document())
+        .ok_or_else(|| format_err!("no document available"))?;
+
+    let event = Event::new(name).map_err(crate::convert_js_error)?;
+
+    document
+        .dispatch_event(&event)
+        .map(|_| ())
+        .map_err(crate::convert_js_error)
+}
diff --git a/src/state/mod.rs b/src/state/mod.rs
index d98d4db..335d7de 100644
--- a/src/state/mod.rs
+++ b/src/state/mod.rs
@@ -7,6 +7,9 @@ use serde::{Serialize, de::DeserializeOwned};
 mod data_store;
 pub use data_store::{DataNode, DataNodeDerefGuard, DataStore};
 
+mod event;
+pub use event::dispatch_custom_event;
+
 mod loader;
 pub use loader::{Loader, LoaderState};
 
diff --git a/src/state/theme.rs b/src/state/theme.rs
index 485c88e..a87679f 100644
--- a/src/state/theme.rs
+++ b/src/state/theme.rs
@@ -155,11 +155,8 @@ impl Default for Theme {
 }
 
 fn emit_theme_changed_event() {
-    if let Some(window) = web_sys::window() {
-        if let Some(document) = window.document() {
-            let event = web_sys::Event::new("pwt-theme-changed").unwrap();
-            let _ = document.dispatch_event(&event);
-        }
+    if let Err(err) = super::dispatch_custom_event("pwt-theme-changed") {
+        log::error!("failed to send theme changed event: {err}");
     }
 }
 
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH yew-widget-toolkit v3 2/8] state: persistent state: allow listening for updates
  2026-11-30 12:52 [PATCH datacenter-manager/proxmox-yew-comp/yew-widget-toolkit v3 0/8] ui: make the default dashboard configurable and add "My Settings" dialog Dominik Csapak
  2026-11-30 12:52 ` [PATCH yew-widget-toolkit v3 1/8] state: event: add helper to dispatch custom DOM events Dominik Csapak
@ 2026-11-30 12:52 ` Dominik Csapak
  2026-11-30 12:52 ` [PATCH proxmox-yew-comp v3 3/8] xtermjs: allow setting the noVNC scaling mode Dominik Csapak
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Dominik Csapak @ 2026-11-30 12:52 UTC (permalink / raw)
  To: pdm-devel

A `PersistentState` only reads its storage location on construction, so
instances held by unrelated components go stale as soon as another one
writes. Components deep in different subtrees often share nothing but the
storage key, so they cannot be handed a common instance either.

Dispatch a per-location event whenever `store_state` succeeds and let
`PersistentState` subscribe to it. The event carries no payload, and the
callback has no mutable access to the `PersistentState` it was
registered on, so it cannot update the data itself. Make `load` public,
so that the owner can reload the value when it handles the callback.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 src/state/mod.rs              | 30 ++++++++++++++++++++++-----
 src/state/persistent_state.rs | 38 ++++++++++++++++++++++++++++++++++-
 2 files changed, 62 insertions(+), 6 deletions(-)

diff --git a/src/state/mod.rs b/src/state/mod.rs
index 335d7de..1010372 100644
--- a/src/state/mod.rs
+++ b/src/state/mod.rs
@@ -125,6 +125,19 @@ pub fn load_state<T: 'static + DeserializeOwned>(storage: &StorageLocation) -> O
     None
 }
 
+fn create_storage_event_name(location: &StorageLocation) -> String {
+    let (prefix, name) = match location {
+        StorageLocation::Local(name) => ("local", name),
+        StorageLocation::Session(name) => ("session", name),
+    };
+
+    format!("pwt-storage-{prefix}-{name}")
+}
+
+/// Stores the (JSON encoded) data at the given storage location.
+///
+/// On success, this dispatches an event for that location on the document, which notifies the
+/// update callbacks of all [PersistentState] instances for it.
 pub fn store_state<T: 'static + Serialize>(data: &T, storage: &StorageLocation) {
     let (store, state_id) = match storage {
         StorageLocation::Local(state_id) => (local_storage(), state_id),
@@ -132,11 +145,18 @@ pub fn store_state<T: 'static + Serialize>(data: &T, storage: &StorageLocation)
     };
     if let Some(store) = store {
         let item_str = serde_json::to_string(data).unwrap();
-        if let Err(err) = store.set_item(state_id, &item_str) {
-            log::error!(
-                "store persistent state {state_id} failed: {}",
-                crate::convert_js_error(err)
-            )
+        match store.set_item(state_id, &item_str) {
+            Ok(()) => {
+                if let Err(err) = dispatch_custom_event(&create_storage_event_name(storage)) {
+                    log::error!("failed to send storage event: {err}")
+                }
+            }
+            Err(err) => {
+                log::error!(
+                    "store persistent state {state_id} failed: {}",
+                    crate::convert_js_error(err)
+                )
+            }
         }
     }
 }
diff --git a/src/state/persistent_state.rs b/src/state/persistent_state.rs
index 90a54b7..91760d0 100644
--- a/src/state/persistent_state.rs
+++ b/src/state/persistent_state.rs
@@ -1,7 +1,10 @@
+use gloo_events::EventListener;
 use serde::{Serialize, de::DeserializeOwned};
 use std::ops::Deref;
+use yew::Callback;
 
 use crate::props::StorageLocation;
+use crate::state::create_storage_event_name;
 
 /// Helper to store data persistently using window local [Storage](web_sys::Storage)
 ///
@@ -35,6 +38,7 @@ use crate::props::StorageLocation;
 pub struct PersistentState<T> {
     storage: StorageLocation,
     data: T,
+    listener: Option<EventListener>,
 }
 
 impl<T> Deref for PersistentState<T> {
@@ -51,12 +55,14 @@ impl<T: 'static + Default + Serialize + DeserializeOwned> PersistentState<T> {
         let mut me = Self {
             data: T::default(),
             storage: storage.into(),
+            listener: None,
         };
         me.load();
         me
     }
 
-    fn load(&mut self) {
+    /// Loads the (potentially updated) data again from the storage location of this state.
+    pub fn load(&mut self) {
         if let Some(data) = super::load_state(&self.storage) {
             self.data = data;
         }
@@ -80,4 +86,34 @@ impl<T: 'static + Default + Serialize + DeserializeOwned> PersistentState<T> {
     pub fn into_inner(self) -> T {
         self.data
     }
+
+    /// Calls the callback whenever data is stored to this location.
+    ///
+    /// CAUTION: this does not update the data, [Self::load] must be called after this event to get
+    /// the current value.
+    ///
+    /// The callback also fires for updates done through this instance, so it must not write back
+    /// unconditionally, otherwise it triggers itself in an endless loop. Only updates from the
+    /// current document are reported, changes made in other browser tabs are not.
+    pub fn set_on_update(&mut self, on_update: impl Into<Callback<()>>) {
+        let on_update = on_update.into();
+        let Some(document) = web_sys::window().and_then(|window| window.document()) else {
+            return;
+        };
+
+        self.listener = Some(EventListener::new(
+            &document,
+            create_storage_event_name(&self.storage),
+            move |_| on_update.emit(()),
+        ));
+    }
+
+    /// Builder style method to set an update callback [Self::set_on_update].
+    ///
+    /// CAUTION: this does not update the data, [Self::load] must be called after this event to
+    /// get the current value.
+    pub fn on_update(mut self, on_update: impl Into<Callback<()>>) -> Self {
+        self.set_on_update(on_update);
+        self
+    }
 }
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH proxmox-yew-comp v3 3/8] xtermjs: allow setting the noVNC scaling mode
  2026-11-30 12:52 [PATCH datacenter-manager/proxmox-yew-comp/yew-widget-toolkit v3 0/8] ui: make the default dashboard configurable and add "My Settings" dialog Dominik Csapak
  2026-11-30 12:52 ` [PATCH yew-widget-toolkit v3 1/8] state: event: add helper to dispatch custom DOM events Dominik Csapak
  2026-11-30 12:52 ` [PATCH yew-widget-toolkit v3 2/8] state: persistent state: allow listening for updates Dominik Csapak
@ 2026-11-30 12:52 ` Dominik Csapak
  2026-11-30 12:52 ` [PATCH datacenter-manager v3 4/8] ui: view selector: use a placeholder that can't conflict with a view Dominik Csapak
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Dominik Csapak @ 2026-11-30 12:52 UTC (permalink / raw)
  To: pdm-devel

by adding a 'resize' property that is passed on to noVNC, like the web
interface of PVE does. If it is not set, noVNC uses its default.

To also use it when opening the console in its own window, add an
`open_viewer` method that does so for an existing `XTermJs`.
`open_xterm_js_viewer` keeps its parameters, so that its users do not
have to change.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 src/xtermjs.rs | 33 +++++++++++++++++++++++++--------
 1 file changed, 25 insertions(+), 8 deletions(-)

diff --git a/src/xtermjs.rs b/src/xtermjs.rs
index fb91ded..d1329e1 100644
--- a/src/xtermjs.rs
+++ b/src/xtermjs.rs
@@ -30,6 +30,13 @@ pub struct XTermJs {
     #[prop_or_default]
     #[builder]
     pub vnc: bool,
+
+    /// The scaling mode of noVNC ('scale', 'remote' or 'off'), if not set, noVNC uses its default.
+    ///
+    /// It is passed to noVNC as 'resize' parameter and has no effect for xterm.js.
+    #[prop_or_default]
+    #[builder(IntoPropValue, into_prop_value)]
+    pub resize: Option<AttrValue>,
 }
 
 impl Default for XTermJs {
@@ -47,7 +54,16 @@ impl XTermJs {
     // FIXME: separate noVNC and xterm.js, this is not a nice interface!
     /// Open a new terminal window.
     pub fn open_xterm_js_viewer(console_type: ConsoleType, node_name: &str, vnc: bool) {
-        let url = xtermjs_url(&console_type, node_name, vnc);
+        Self::new()
+            .console_type(console_type)
+            .node_name(node_name.to_string())
+            .vnc(vnc)
+            .open_viewer();
+    }
+
+    /// Open this terminal in a new window, instead of using it as panel.
+    pub fn open_viewer(&self) {
+        let url = xtermjs_url(self);
         let target = "_blank";
         let features =
             "toolbar=no,location=no,status=no,menubar=no,resizable=yes,width=800,height=420";
@@ -78,19 +94,21 @@ pub enum ConsoleType {
     RemotePveKVM(String, u64),
 }
 
-fn xtermjs_url(console_type: &ConsoleType, node_name: &str, vnc: bool) -> String {
+fn xtermjs_url(props: &XTermJs) -> String {
     let mut param = json!({
-        "node": node_name,
+        "node": props.node_name.as_str(),
     });
 
-    if vnc {
+    if props.vnc {
         param["novnc"] = 1.into();
-        //param["resize"] = "scale".into();
+        if let Some(resize) = &props.resize {
+            param["resize"] = resize.as_str().into();
+        }
     } else {
         param["xtermjs"] = 1.into();
     }
 
-    match console_type {
+    match &props.console_type {
         ConsoleType::KVM(vmid) => {
             param["console"] = "kvm".into();
             param["vmid"] = (*vmid).into();
@@ -146,8 +164,7 @@ impl Component for ProxmoxXTermJs {
     }
 
     fn view(&self, ctx: &Context<Self>) -> Html {
-        let props = ctx.props();
-        let url = xtermjs_url(&props.console_type, &props.node_name, props.vnc);
+        let url = xtermjs_url(ctx.props());
         html! {<iframe class="pwt-flex-fit" src={format!("/{url}")}/>}
     }
 }
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH datacenter-manager v3 4/8] ui: view selector: use a placeholder that can't conflict with a view
  2026-11-30 12:52 [PATCH datacenter-manager/proxmox-yew-comp/yew-widget-toolkit v3 0/8] ui: make the default dashboard configurable and add "My Settings" dialog Dominik Csapak
                   ` (2 preceding siblings ...)
  2026-11-30 12:52 ` [PATCH proxmox-yew-comp v3 3/8] xtermjs: allow setting the noVNC scaling mode Dominik Csapak
@ 2026-11-30 12:52 ` Dominik Csapak
  2026-11-30 12:52 ` [PATCH datacenter-manager v3 5/8] ui: add 'My Settings' dialog with xterm.js and noVNC settings Dominik Csapak
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Dominik Csapak @ 2026-11-30 12:52 UTC (permalink / raw)
  To: pdm-devel

since a view could be named '__dashboard__' too. Use '#' instead,
which is not a valid view ID, and expose it as a constant, so that the
code creating the view can use it too.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 ui/src/configuration/views.rs  |  4 ++--
 ui/src/widget/mod.rs           |  2 +-
 ui/src/widget/view_selector.rs | 10 ++++++++--
 3 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/ui/src/configuration/views.rs b/ui/src/configuration/views.rs
index fca40490..26e4852b 100644
--- a/ui/src/configuration/views.rs
+++ b/ui/src/configuration/views.rs
@@ -26,7 +26,7 @@ use pwt::widget::{Button, ConfirmDialog, InputPanel, Toolbar, Tooltip};
 use pdm_api_types::views::{ViewConfig, ViewLayout, ViewTemplate};
 
 use crate::ViewListContext;
-use crate::widget::{ViewFilterSelector, ViewSelector};
+use crate::widget::{DEFAULT_DASHBOARD_VALUE, ViewFilterSelector, ViewSelector};
 
 async fn create_view(
     base_url: AttrValue,
@@ -40,7 +40,7 @@ async fn create_view(
             description: String::new(),
             layout: ViewLayout::Rows { rows: Vec::new() },
         })?),
-        "__dashboard__" => None,
+        DEFAULT_DASHBOARD_VALUE => None,
         layout => {
             let store = store.read();
             if let Some(config) = store.lookup_record(&Key::from(layout)) {
diff --git a/ui/src/widget/mod.rs b/ui/src/widget/mod.rs
index 24f5b9e8..353be148 100644
--- a/ui/src/widget/mod.rs
+++ b/ui/src/widget/mod.rs
@@ -37,7 +37,7 @@ pub use remote_selector::RemoteSelector;
 mod remote_endpoint_selector;
 
 mod view_selector;
-pub use view_selector::ViewSelector;
+pub use view_selector::{DEFAULT_DASHBOARD_VALUE, ViewSelector};
 
 mod view_filter_selector;
 pub use view_filter_selector::ViewFilterSelector;
diff --git a/ui/src/widget/view_selector.rs b/ui/src/widget/view_selector.rs
index b48ef4f7..c95fbba1 100644
--- a/ui/src/widget/view_selector.rs
+++ b/ui/src/widget/view_selector.rs
@@ -7,6 +7,12 @@ use pwt_macros::{builder, widget};
 
 use pdm_api_types::views::ViewConfig;
 
+/// A placeholder value to represent the default dashboard.
+///
+/// To not conflict with a real view, this is not a valid view ID: '#' is shorter than the minimum
+/// length of two and not an allowed character in it.
+pub const DEFAULT_DASHBOARD_VALUE: &str = "#";
+
 #[widget(comp=ViewSelectorComp, @input)]
 #[derive(Clone, Properties, PartialEq)]
 #[builder]
@@ -32,7 +38,7 @@ impl Component for ViewSelectorComp {
     }
 
     fn view(&self, ctx: &Context<Self>) -> Html {
-        let mut list = vec!["__dashboard__".into()];
+        let mut list = vec![DEFAULT_DASHBOARD_VALUE.into()];
         let store = &ctx.props().store;
         for item in store.read().data().iter() {
             list.push(item.id.clone().into());
@@ -43,7 +49,7 @@ impl Component for ViewSelectorComp {
             .on_change(|_| {})
             .render_value({
                 move |value: &AttrValue| {
-                    if value == "__dashboard__" {
+                    if value == DEFAULT_DASHBOARD_VALUE {
                         html! {{tr!("Dashboard")}}
                     } else {
                         html! {{value}}
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH datacenter-manager v3 5/8] ui: add 'My Settings' dialog with xterm.js and noVNC settings
  2026-11-30 12:52 [PATCH datacenter-manager/proxmox-yew-comp/yew-widget-toolkit v3 0/8] ui: make the default dashboard configurable and add "My Settings" dialog Dominik Csapak
                   ` (3 preceding siblings ...)
  2026-11-30 12:52 ` [PATCH datacenter-manager v3 4/8] ui: view selector: use a placeholder that can't conflict with a view Dominik Csapak
@ 2026-11-30 12:52 ` Dominik Csapak
  2026-11-30 12:52 ` [PATCH datacenter-manager v3 6/8] ui: views: use the view name as key of the component Dominik Csapak
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Dominik Csapak @ 2026-11-30 12:52 UTC (permalink / raw)
  To: pdm-devel

like in PVE, reachable from the user menu. For now it only contains
the xterm.js settings (font family, font size, letter spacing and line
height) and the noVNC scaling mode.

The xterm.js settings are saved in the 'pve-xterm-*' entries of the
local browser storage, where the xterm.js console reads them from.

The noVNC scaling mode is saved in 'novnc-scaling' and passed to noVNC
as 'resize' parameter when showing or opening the console of a virtual
machine.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 ui/Cargo.toml                       |   2 +-
 ui/src/pve/utils.rs                 |  13 +-
 ui/src/top_nav_bar.rs               |  16 +-
 ui/src/widget/mod.rs                |   3 +
 ui/src/widget/my_settings_dialog.rs | 248 ++++++++++++++++++++++++++++
 5 files changed, 277 insertions(+), 5 deletions(-)
 create mode 100644 ui/src/widget/my_settings_dialog.rs

diff --git a/ui/Cargo.toml b/ui/Cargo.toml
index 32a2020b..03b836b6 100644
--- a/ui/Cargo.toml
+++ b/ui/Cargo.toml
@@ -24,7 +24,7 @@ serde_json = "1.0"
 wasm-bindgen = "0.2.92"
 wasm-bindgen-futures = "0.4"
 wasm-logger = "0.2"
-web-sys = { version = "0.3", features = ["Location", "DataTransfer", "Performance"] }
+web-sys = { version = "0.3", features = ["Location", "DataTransfer", "Performance", "Storage"] }
 yew = { version = "0.21",  features = ["csr"] }
 yew-router = { version = "0.18" }
 
diff --git a/ui/src/pve/utils.rs b/ui/src/pve/utils.rs
index 91cc03b0..b3acb81d 100644
--- a/ui/src/pve/utils.rs
+++ b/ui/src/pve/utils.rs
@@ -325,7 +325,17 @@ pub(crate) fn open_guest_console(remote: &str, node: &str, guest: GuestInfo, nov
             false,
         ),
     };
-    XTermJs::open_xterm_js_viewer(console_type, node, use_vnc);
+    XTermJs::new()
+        .console_type(console_type)
+        .node_name(node.to_string())
+        .vnc(use_vnc)
+        .resize(novnc_scaling_state().into_inner())
+        .open_viewer();
+}
+
+/// The scaling mode of noVNC that is selected in this browser, `None` for the default of noVNC.
+pub(crate) fn novnc_scaling_state() -> PersistentState<Option<String>> {
+    PersistentState::new("novnc-scaling")
 }
 
 /// Returns `console`, or why it cannot be shown if the user lacks `Sys.Console` or `node` runs a
@@ -399,6 +409,7 @@ pub(crate) fn qemu_console(props: &QemuConsoleProps) -> Html {
 
     let mut console = XTermJs::new();
     console.set_vnc(novnc);
+    console.set_resize(novnc_scaling_state().into_inner());
     console.set_node_name(props.node.clone());
     console.set_console_type(ConsoleType::RemotePveKVM(
         props.remote.clone(),
diff --git a/ui/src/top_nav_bar.rs b/ui/src/top_nav_bar.rs
index 7ccc388c..09da5a2d 100644
--- a/ui/src/top_nav_bar.rs
+++ b/ui/src/top_nav_bar.rs
@@ -23,7 +23,7 @@ use pbs_api_types::TaskListItem;
 use pdm_api_types::RemoteUpid;
 
 use crate::tasks::format_optional_remote_upid;
-use crate::widget::SearchBox;
+use crate::widget::{MySettingsDialog, SearchBox};
 
 mod change_password;
 
@@ -59,6 +59,7 @@ impl TopNavBar {
 
 #[derive(Clone)]
 pub enum ViewState {
+    MySettingsDialog,
     LanguageDialog,
     ThemeDialog,
     ChangePassword,
@@ -168,8 +169,14 @@ impl Component for PdmTopNavBar {
             });
 
         let menu = Menu::new()
-            // FIXME: implement
-            //.with_item(MenuItem::new(tr!("My Settings")).icon_class("fa fa-gear"))
+            .with_item(
+                MenuItem::new(tr!("My Settings"))
+                    .icon_class("fa fa-gear")
+                    .on_select(
+                        ctx.link()
+                            .callback(|_| Msg::ChangeView(Some(ViewState::MySettingsDialog))),
+                    ),
+            )
             .with_item(
                 MenuItem::new(tr!("Language"))
                     .icon_class("fa fa-language")
@@ -247,6 +254,9 @@ impl Component for PdmTopNavBar {
         }
 
         let dialog: Option<Html> = self.view_state.as_ref().map(|view_state| match view_state {
+            ViewState::MySettingsDialog => MySettingsDialog::new()
+                .on_close(ctx.link().callback(|_| Msg::ChangeView(None)))
+                .into(),
             ViewState::LanguageDialog => LanguageDialog::new()
                 .on_close(ctx.link().callback(|_| Msg::ChangeView(None)))
                 .into(),
diff --git a/ui/src/widget/mod.rs b/ui/src/widget/mod.rs
index 353be148..f719eef2 100644
--- a/ui/src/widget/mod.rs
+++ b/ui/src/widget/mod.rs
@@ -4,6 +4,9 @@ pub use bulk_action_window::{BulkActionWindow, bulk_action_disabled_reason};
 mod migrate_window;
 pub use migrate_window::MigrateWindow;
 
+mod my_settings_dialog;
+pub use my_settings_dialog::MySettingsDialog;
+
 mod snapshot_window;
 pub use snapshot_window::SnapshotWindow;
 
diff --git a/ui/src/widget/my_settings_dialog.rs b/ui/src/widget/my_settings_dialog.rs
new file mode 100644
index 00000000..c18c5519
--- /dev/null
+++ b/ui/src/widget/my_settings_dialog.rs
@@ -0,0 +1,248 @@
+use std::rc::Rc;
+use std::str::FromStr;
+
+use serde::{Deserialize, Serialize};
+use serde_json::json;
+use yew::html::IntoEventCallback;
+use yew::virtual_dom::{VComp, VNode};
+
+use pwt::css::ColorScheme;
+use pwt::prelude::*;
+use pwt::state::{PersistentState, local_storage};
+use pwt::widget::form::{Combobox, Field, Form, FormContext, Number};
+use pwt::widget::{Button, Container, Dialog, InputPanel, Row};
+
+use pwt_macros::builder;
+
+use crate::pve::utils::novnc_scaling_state;
+
+// The xterm.js console uses the text of its local storage entries as is, so they cannot be saved
+// as (JSON encoded) persistent states.
+fn load_xterm_setting<T: FromStr>(key: &str) -> Option<T> {
+    let res = local_storage()?.get_item(key).ok()??;
+    if res.is_empty() {
+        return None;
+    }
+    res.parse().ok()
+}
+
+fn save_xterm_setting<T: ToString>(key: &str, value: Option<T>) {
+    let Some(store) = local_storage() else {
+        return;
+    };
+    let result = match value.map(|s| s.to_string()) {
+        Some(value) if !value.is_empty() => store.set_item(key, &value),
+        Some(_) | None => store.remove_item(key),
+    };
+    if let Err(err) = result {
+        log::error!("could not save '{key}': {}", pwt::convert_js_error(err));
+    }
+}
+
+/// The xterm.js settings, named like the fields of the form.
+#[derive(Default, Deserialize, PartialEq, Serialize)]
+#[serde(rename_all = "camelCase")]
+struct XtermSettings {
+    font_family: Option<String>,
+    font_size: Option<u64>,
+    letter_spacing: Option<f64>,
+    line_height: Option<f64>,
+}
+
+impl XtermSettings {
+    fn load() -> Self {
+        Self {
+            font_family: load_xterm_setting("pve-xterm-fontFamily"),
+            font_size: load_xterm_setting("pve-xterm-fontSize"),
+            letter_spacing: load_xterm_setting("pve-xterm-letterSpacing"),
+            line_height: load_xterm_setting("pve-xterm-lineHeight"),
+        }
+    }
+
+    fn save(&self) {
+        save_xterm_setting("pve-xterm-fontFamily", self.font_family.as_ref());
+        save_xterm_setting("pve-xterm-fontSize", self.font_size);
+        save_xterm_setting("pve-xterm-letterSpacing", self.letter_spacing);
+        save_xterm_setting("pve-xterm-lineHeight", self.line_height);
+    }
+}
+
+#[derive(Clone, PartialEq, Properties)]
+#[builder]
+pub struct MySettingsDialog {
+    /// Dialog close callback.
+    #[builder_cb(IntoEventCallback, into_event_callback, ())]
+    #[prop_or_default]
+    pub on_close: Option<Callback<()>>,
+}
+
+impl Default for MySettingsDialog {
+    fn default() -> Self {
+        Self::new()
+    }
+}
+
+impl MySettingsDialog {
+    pub fn new() -> Self {
+        yew::props!(Self {})
+    }
+}
+
+pub enum Msg {
+    XtermFormChange,
+    XtermSave,
+    XtermReset,
+    NoVncScaling(String),
+}
+
+#[doc(hidden)]
+pub struct PdmMySettingsDialog {
+    xterm_form: FormContext,
+    xterm_saved: XtermSettings,
+    novnc_scaling: PersistentState<Option<String>>,
+}
+
+impl PdmMySettingsDialog {
+    /// Returns the xterm.js settings as entered in the form, or `None` if they are not valid.
+    fn current_valid_xterm_settings(&self) -> Option<XtermSettings> {
+        let form = self.xterm_form.read();
+        if !form.is_valid() {
+            return None;
+        }
+        serde_json::from_value(form.get_submit_data()).ok()
+    }
+}
+
+impl Component for PdmMySettingsDialog {
+    type Message = Msg;
+    type Properties = MySettingsDialog;
+
+    fn create(ctx: &Context<Self>) -> Self {
+        Self {
+            xterm_form: FormContext::new().on_change(ctx.link().callback(|_| Msg::XtermFormChange)),
+            xterm_saved: XtermSettings::load(),
+            novnc_scaling: novnc_scaling_state(),
+        }
+    }
+
+    fn update(&mut self, _ctx: &Context<Self>, msg: Self::Message) -> bool {
+        match msg {
+            Msg::XtermFormChange => true,
+            Msg::XtermSave => {
+                if let Some(settings) = self.current_valid_xterm_settings() {
+                    settings.save();
+                    self.xterm_saved = settings;
+                }
+                true
+            }
+            Msg::XtermReset => {
+                self.xterm_saved = XtermSettings::default();
+                self.xterm_saved.save();
+                self.xterm_form.load_form(json!(self.xterm_saved));
+                true
+            }
+            Msg::NoVncScaling(scaling) => {
+                self.novnc_scaling
+                    .update((!scaling.is_empty()).then_some(scaling));
+                false
+            }
+        }
+    }
+
+    fn view(&self, ctx: &Context<Self>) -> Html {
+        let props = ctx.props();
+        let link = ctx.link();
+
+        let current = self.current_valid_xterm_settings();
+        let can_save = current
+            .as_ref()
+            .is_some_and(|current| *current != self.xterm_saved);
+        let can_reset = current != Some(XtermSettings::default());
+
+        let section_title = |title: String| {
+            Container::new()
+                .class("pwt-font-title-medium")
+                .with_child(title)
+        };
+
+        let panel = InputPanel::new()
+            .padding(4)
+            .with_custom_child(section_title(tr!("xterm.js Settings")))
+            .with_field(
+                tr!("Font-Family"),
+                Field::new()
+                    .name("fontFamily")
+                    .placeholder(tr!("Default"))
+                    .default(self.xterm_saved.font_family.clone()),
+            )
+            .with_field(
+                tr!("Font-Size"),
+                Number::<u64>::new()
+                    .name("fontSize")
+                    .min(1)
+                    .placeholder(tr!("Default"))
+                    .default(self.xterm_saved.font_size),
+            )
+            .with_field(
+                tr!("Letter Spacing"),
+                Number::<f64>::new()
+                    .name("letterSpacing")
+                    .placeholder(tr!("Default"))
+                    .default(self.xterm_saved.letter_spacing),
+            )
+            .with_field(
+                tr!("Line Height"),
+                Number::<f64>::new()
+                    .name("lineHeight")
+                    .min(0.1)
+                    .step(0.1)
+                    .placeholder(tr!("Default"))
+                    .default(self.xterm_saved.line_height),
+            )
+            .with_custom_child(
+                Row::new()
+                    .gap(2)
+                    .with_flex_spacer()
+                    .with_child(
+                        Button::new(tr!("Reset"))
+                            .disabled(!can_reset)
+                            .on_activate(link.callback(|_| Msg::XtermReset)),
+                    )
+                    .with_child(
+                        Button::new(tr!("Save"))
+                            .class(ColorScheme::Primary)
+                            .disabled(!can_save)
+                            .on_activate(link.callback(|_| Msg::XtermSave)),
+                    ),
+            )
+            .with_custom_child(section_title(tr!("noVNC Settings")).padding_top(2))
+            .with_field(
+                tr!("Scaling mode"),
+                Combobox::from_key_value_pairs([
+                    ("scale", tr!("Local Scaling")),
+                    ("remote", tr!("Remote Resizing")),
+                    ("off", tr!("Off")),
+                ])
+                .placeholder(tr!("Default"))
+                .default(self.novnc_scaling.clone())
+                .on_change(link.callback(Msg::NoVncScaling)),
+            );
+
+        Dialog::new(tr!("My Settings"))
+            .min_width(400)
+            .on_close(props.on_close.clone())
+            .with_child(
+                Form::new()
+                    .form_context(self.xterm_form.clone())
+                    .with_child(panel),
+            )
+            .into()
+    }
+}
+
+impl From<MySettingsDialog> for VNode {
+    fn from(val: MySettingsDialog) -> Self {
+        let comp = VComp::new::<PdmMySettingsDialog>(Rc::new(val), None);
+        VNode::from(comp)
+    }
+}
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH datacenter-manager v3 6/8] ui: views: use the view name as key of the component
  2026-11-30 12:52 [PATCH datacenter-manager/proxmox-yew-comp/yew-widget-toolkit v3 0/8] ui: make the default dashboard configurable and add "My Settings" dialog Dominik Csapak
                   ` (4 preceding siblings ...)
  2026-11-30 12:52 ` [PATCH datacenter-manager v3 5/8] ui: add 'My Settings' dialog with xterm.js and noVNC settings Dominik Csapak
@ 2026-11-30 12:52 ` Dominik Csapak
  2026-11-30 12:52 ` [PATCH datacenter-manager v3 7/8] ui: make the default dashboard page configurable Dominik Csapak
  2026-11-30 12:52 ` [PATCH datacenter-manager v3 8/8] docs: web ui: describe the 'My Settings' dialog Dominik Csapak
  7 siblings, 0 replies; 9+ messages in thread
From: Dominik Csapak @ 2026-11-30 12:52 UTC (permalink / raw)
  To: pdm-devel

so that showing another view in the same place creates a new component
instead of updating the existing one.

Most of the state of the component belongs to the view. When the view
changed, that state was reset by hand, which is easy to miss for new
state: the refresh settings stayed those of the old view, and the
remote list was only watched if the component was created for the
default dashboard.

This did not matter so far, since each view has its own page in the
main menu, so the view of a component never changes. It will when users
can select a view as dashboard, since the dashboard page then changes
its view in place.

Since another view now always gets a new component, drop the resetting
of the state.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 ui/src/dashboard/view.rs | 35 ++++-------------------------------
 1 file changed, 4 insertions(+), 31 deletions(-)

diff --git a/ui/src/dashboard/view.rs b/ui/src/dashboard/view.rs
index f7045aa8..63c35a83 100644
--- a/ui/src/dashboard/view.rs
+++ b/ui/src/dashboard/view.rs
@@ -7,7 +7,7 @@ use gloo_timers::callback::Interval;
 use http::StatusCode;
 use js_sys::Date;
 use serde_json::{Value, json};
-use yew::virtual_dom::{VComp, VNode};
+use yew::virtual_dom::{Key, VComp, VNode};
 
 use proxmox_client::ApiResponseData;
 use proxmox_yew_comp::percent_encoding::percent_encode_component;
@@ -106,7 +106,9 @@ pub struct View {
 
 impl From<View> for VNode {
     fn from(val: View) -> Self {
-        let comp = VComp::new::<ViewComp>(Rc::new(val), None);
+        // most of the state belongs to the view, so another view gets a new component
+        let key = val.view.as_ref().map(|view| Key::from(view.as_str()));
+        let comp = VComp::new::<ViewComp>(Rc::new(val), key);
         VNode::from(comp)
     }
 }
@@ -1073,35 +1075,6 @@ impl Component for ViewComp {
         true
     }
 
-    fn changed(&mut self, ctx: &Context<Self>, old_props: &Self::Properties) -> bool {
-        // the list of views only changes the empty state
-        if ctx.props().view == old_props.view {
-            return true;
-        }
-        // this aborts a running save or load of the layout editor too
-        self.async_pool = AsyncPool::new();
-        if self.layout_edit == LayoutEditState::Editing {
-            self.editing_state.write().push(EditingMessage::Cancel);
-        }
-        self.layout_edit = LayoutEditState::Idle;
-        self.load_guard = None;
-        self.render_args.subscriptions.write().clear();
-        // the old pool took a pending request with it
-        self.migrations_loading = false;
-        // they belong to the old view
-        self.render_args.migrations.write().clear();
-        self.load_finished_time = None;
-        self.status_refused = false;
-        self.view_guests.clear();
-        self.bulk_dialog = None;
-        self.shown_task = None;
-        let view = ctx.props().view.clone();
-        self.async_pool.send_future(ctx.link().clone(), async move {
-            Msg::ViewTemplateLoaded(load_template(view).await)
-        });
-        true
-    }
-
     fn view(&self, ctx: &yew::Context<Self>) -> yew::Html {
         let props = ctx.props();
         let link = ctx.link();
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH datacenter-manager v3 7/8] ui: make the default dashboard page configurable
  2026-11-30 12:52 [PATCH datacenter-manager/proxmox-yew-comp/yew-widget-toolkit v3 0/8] ui: make the default dashboard configurable and add "My Settings" dialog Dominik Csapak
                   ` (5 preceding siblings ...)
  2026-11-30 12:52 ` [PATCH datacenter-manager v3 6/8] ui: views: use the view name as key of the component Dominik Csapak
@ 2026-11-30 12:52 ` Dominik Csapak
  2026-11-30 12:52 ` [PATCH datacenter-manager v3 8/8] docs: web ui: describe the 'My Settings' dialog Dominik Csapak
  7 siblings, 0 replies; 9+ messages in thread
From: Dominik Csapak @ 2026-11-30 12:52 UTC (permalink / raw)
  To: pdm-devel

by allowing users to select any of their views as the dashboard, saved
in the local storage of their browser.

The selection is in the 'My Settings' dialog. For that, pass the list
of views from the main app through the top nav bar to the dialog.

If the selected view does not exist (anymore), show a notice instead of
the dashboard.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 ui/src/dashboard/mod.rs             |  7 +++++++
 ui/src/dashboard/view.rs            | 18 ++++++++++++++++++
 ui/src/main.rs                      |  1 +
 ui/src/main_menu.rs                 | 21 +++++++++++++++++++--
 ui/src/top_nav_bar.rs               |  6 ++++++
 ui/src/widget/my_settings_dialog.rs | 27 ++++++++++++++++++++++++++-
 6 files changed, 77 insertions(+), 3 deletions(-)

diff --git a/ui/src/dashboard/mod.rs b/ui/src/dashboard/mod.rs
index 93a2d7f3..ed8e1a52 100644
--- a/ui/src/dashboard/mod.rs
+++ b/ui/src/dashboard/mod.rs
@@ -1,5 +1,7 @@
 use pwt::css;
 use pwt::prelude::*;
+use pwt::props::StorageLocation;
+use pwt::state::PersistentState;
 use pwt::widget::{Column, Fa, Row};
 
 mod top_entities;
@@ -54,6 +56,11 @@ pub use refresh_config_edit::create_refresh_config_edit_window;
 mod resource_tree;
 pub use resource_tree::create_resource_tree;
 
+/// The view that is selected as dashboard in this browser, `None` for the default dashboard.
+pub fn default_dashboard_state() -> PersistentState<Option<String>> {
+    PersistentState::new(StorageLocation::local("default-dashboard"))
+}
+
 fn loading_column() -> Column {
     Column::new()
         .padding(4)
diff --git a/ui/src/dashboard/view.rs b/ui/src/dashboard/view.rs
index 63c35a83..7d88d295 100644
--- a/ui/src/dashboard/view.rs
+++ b/ui/src/dashboard/view.rs
@@ -740,6 +740,14 @@ fn default_dashboard(
     }
 }
 
+/// Whether a request failed because the requested object does not exist.
+fn is_not_found(err: &Error) -> bool {
+    matches!(
+        err.downcast_ref::<proxmox_client::Error>(),
+        Some(proxmox_client::Error::Api(StatusCode::NOT_FOUND, _))
+    )
+}
+
 /// Whether a request was refused for lack of privileges.
 pub(super) fn is_forbidden(err: &Error) -> bool {
     matches!(
@@ -1081,6 +1089,16 @@ impl Component for ViewComp {
         if !self.template.has_data() {
             return Progress::new().into();
         }
+        match (&props.view, &self.template.data, &self.template.error) {
+            (Some(view), None, Some(err)) if is_not_found(err) => {
+                return empty_state(
+                    "search",
+                    tr!("View not found"),
+                    tr!("The configured view '{0}' was not found.", view),
+                );
+            }
+            _ => {}
+        }
 
         let may_add_remotes = self
             .acl_context
diff --git a/ui/src/main.rs b/ui/src/main.rs
index 0dd00971..1d680a79 100644
--- a/ui/src/main.rs
+++ b/ui/src/main.rs
@@ -325,6 +325,7 @@ impl Component for DatacenterManagerApp {
             .with_child(
                 TopNavBar::new(self.running_tasks.clone())
                     .username(username.clone())
+                    .view_list(self.view_list.clone())
                     .on_logout(ctx.link().callback(|_| Msg::Logout)),
             )
             .with_child({
diff --git a/ui/src/main_menu.rs b/ui/src/main_menu.rs
index 8d05328d..0524f177 100644
--- a/ui/src/main_menu.rs
+++ b/ui/src/main_menu.rs
@@ -5,7 +5,7 @@ use yew::virtual_dom::{Key, VComp, VNode};
 
 use pwt::css::{self, Display, FlexFit};
 use pwt::prelude::*;
-use pwt::state::{NavigationContextExt, Selection};
+use pwt::state::{NavigationContextExt, PersistentState, Selection};
 use pwt::widget::nav::{Menu, MenuItem, NavigationDrawer};
 use pwt::widget::{Container, Panel, Row, SelectionView, SelectionViewRenderInfo};
 
@@ -18,6 +18,7 @@ use crate::ceph::CephView;
 use crate::configuration::subscription_panel::SubscriptionPanel;
 use crate::configuration::subscription_registry::SubscriptionRegistryProps;
 use crate::configuration::views::ViewGrid;
+use crate::dashboard::default_dashboard_state;
 use crate::dashboard::view::View;
 use crate::guests::GuestPanel;
 use crate::remotes::{DisabledRemote, RemotesPanel};
@@ -63,6 +64,7 @@ impl MainMenu {
 pub enum Msg {
     Select(Key),
     UpdateAcl(AclContext),
+    UpdateDefaultDashboard,
 }
 
 pub struct PdmMainMenu {
@@ -70,6 +72,7 @@ pub struct PdmMainMenu {
     menu_selection: Selection,
     acl_context: AclContext,
     _acl_context_listener: ContextHandle<AclContext>,
+    default_dashboard: PersistentState<Option<String>>,
 }
 
 fn register_view(
@@ -120,11 +123,15 @@ impl Component for PdmMainMenu {
             .context(ctx.link().callback(Msg::UpdateAcl))
             .expect("acl context not present");
 
+        let default_dashboard = default_dashboard_state()
+            .on_update(ctx.link().callback(|_| Msg::UpdateDefaultDashboard));
+
         Self {
             active: Key::from("dashboard"),
             menu_selection: Selection::new(),
             acl_context,
             _acl_context_listener: acl_context_listener,
+            default_dashboard,
         }
     }
 
@@ -138,6 +145,10 @@ impl Component for PdmMainMenu {
                 self.acl_context = acl_context;
                 true
             }
+            Msg::UpdateDefaultDashboard => {
+                self.default_dashboard.load();
+                true
+            }
         }
     }
 
@@ -159,6 +170,8 @@ impl Component for PdmMainMenu {
 
         let mut menu = Menu::new();
 
+        let default_dashboard: Option<AttrValue> = self.default_dashboard.clone().map(|s| s.into());
+
         register_view(
             &mut menu,
             &mut content,
@@ -167,7 +180,11 @@ impl Component for PdmMainMenu {
             Some("fa fa-tachometer"),
             {
                 let has_views = !props.view_list.is_empty();
-                move |_| View::new(None).has_views(has_views).into()
+                move |_| {
+                    View::new(default_dashboard.clone())
+                        .has_views(has_views)
+                        .into()
+                }
             },
         );
 
diff --git a/ui/src/top_nav_bar.rs b/ui/src/top_nav_bar.rs
index 09da5a2d..2090b440 100644
--- a/ui/src/top_nav_bar.rs
+++ b/ui/src/top_nav_bar.rs
@@ -49,6 +49,11 @@ pub struct TopNavBar {
     #[builder(IntoPropValue, into_prop_value)]
     #[prop_or_default]
     pub username: Option<String>,
+
+    /// The views that can be selected as dashboard in the settings.
+    #[builder]
+    #[prop_or_default]
+    pub view_list: Vec<String>,
 }
 
 impl TopNavBar {
@@ -255,6 +260,7 @@ impl Component for PdmTopNavBar {
 
         let dialog: Option<Html> = self.view_state.as_ref().map(|view_state| match view_state {
             ViewState::MySettingsDialog => MySettingsDialog::new()
+                .view_list(props.view_list.clone())
                 .on_close(ctx.link().callback(|_| Msg::ChangeView(None)))
                 .into(),
             ViewState::LanguageDialog => LanguageDialog::new()
diff --git a/ui/src/widget/my_settings_dialog.rs b/ui/src/widget/my_settings_dialog.rs
index c18c5519..f2323bdb 100644
--- a/ui/src/widget/my_settings_dialog.rs
+++ b/ui/src/widget/my_settings_dialog.rs
@@ -14,6 +14,7 @@ use pwt::widget::{Button, Container, Dialog, InputPanel, Row};
 
 use pwt_macros::builder;
 
+use crate::dashboard::default_dashboard_state;
 use crate::pve::utils::novnc_scaling_state;
 
 // The xterm.js console uses the text of its local storage entries as is, so they cannot be saved
@@ -74,6 +75,11 @@ pub struct MySettingsDialog {
     #[builder_cb(IntoEventCallback, into_event_callback, ())]
     #[prop_or_default]
     pub on_close: Option<Callback<()>>,
+
+    /// The views that can be selected as dashboard.
+    #[builder]
+    #[prop_or_default]
+    pub view_list: Vec<String>,
 }
 
 impl Default for MySettingsDialog {
@@ -89,6 +95,7 @@ impl MySettingsDialog {
 }
 
 pub enum Msg {
+    DefaultDashboard(String),
     XtermFormChange,
     XtermSave,
     XtermReset,
@@ -97,6 +104,7 @@ pub enum Msg {
 
 #[doc(hidden)]
 pub struct PdmMySettingsDialog {
+    default_dashboard: PersistentState<Option<String>>,
     xterm_form: FormContext,
     xterm_saved: XtermSettings,
     novnc_scaling: PersistentState<Option<String>>,
@@ -119,6 +127,7 @@ impl Component for PdmMySettingsDialog {
 
     fn create(ctx: &Context<Self>) -> Self {
         Self {
+            default_dashboard: default_dashboard_state(),
             xterm_form: FormContext::new().on_change(ctx.link().callback(|_| Msg::XtermFormChange)),
             xterm_saved: XtermSettings::load(),
             novnc_scaling: novnc_scaling_state(),
@@ -127,6 +136,11 @@ impl Component for PdmMySettingsDialog {
 
     fn update(&mut self, _ctx: &Context<Self>, msg: Self::Message) -> bool {
         match msg {
+            Msg::DefaultDashboard(view) => {
+                self.default_dashboard
+                    .update((!view.is_empty()).then_some(view));
+                false
+            }
             Msg::XtermFormChange => true,
             Msg::XtermSave => {
                 if let Some(settings) = self.current_valid_xterm_settings() {
@@ -165,9 +179,20 @@ impl Component for PdmMySettingsDialog {
                 .with_child(title)
         };
 
+        let views = props.view_list.iter().map(|view| view.clone().into());
+
         let panel = InputPanel::new()
             .padding(4)
-            .with_custom_child(section_title(tr!("xterm.js Settings")))
+            .with_custom_child(section_title(tr!("Web Interface Settings")))
+            .with_field(
+                tr!("Dashboard"),
+                Combobox::new()
+                    .items(Rc::new(views.collect()))
+                    .placeholder(tr!("Default"))
+                    .default(self.default_dashboard.clone())
+                    .on_change(link.callback(Msg::DefaultDashboard)),
+            )
+            .with_custom_child(section_title(tr!("xterm.js Settings")).padding_top(2))
             .with_field(
                 tr!("Font-Family"),
                 Field::new()
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH datacenter-manager v3 8/8] docs: web ui: describe the 'My Settings' dialog
  2026-11-30 12:52 [PATCH datacenter-manager/proxmox-yew-comp/yew-widget-toolkit v3 0/8] ui: make the default dashboard configurable and add "My Settings" dialog Dominik Csapak
                   ` (6 preceding siblings ...)
  2026-11-30 12:52 ` [PATCH datacenter-manager v3 7/8] ui: make the default dashboard page configurable Dominik Csapak
@ 2026-11-30 12:52 ` Dominik Csapak
  7 siblings, 0 replies; 9+ messages in thread
From: Dominik Csapak @ 2026-11-30 12:52 UTC (permalink / raw)
  To: pdm-devel

including that the settings are saved in the browser, so that it is
clear that they are neither per user nor shared between browsers, and
what the notice for a missing dashboard view means.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 docs/views.rst  |  2 ++
 docs/web-ui.rst | 19 ++++++++++++++++++-
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/docs/views.rst b/docs/views.rst
index f54f9bf9..cd58b22f 100644
--- a/docs/views.rst
+++ b/docs/views.rst
@@ -5,6 +5,8 @@ Views
 
 Views allow you to add an interactive view on a selected set of resources.
 
+A view can also replace the default dashboard, see :ref:`my_settings`.
+
 You can add, edit, and remove views in the "Views" menu. A view can have a comment, which the list
 of views shows to describe what the view is for. Adding or removing a view, or changing its
 filters, requires the `Resource.Modify` privilege on `/view`. Changing only a view's comment or
diff --git a/docs/web-ui.rst b/docs/web-ui.rst
index 1812a11b..d1ff3147 100644
--- a/docs/web-ui.rst
+++ b/docs/web-ui.rst
@@ -52,12 +52,29 @@ The Proxmox Datacenter Manager graphical interface can be roughly split into thr
 * **Header**: On the left the header shows the current version information. In the middle a search
   bar is found that helps you find different remotes and resources. While on the right you can
   toggle the dark mode of the theme, go to the user documentation, open a list of tasks and open a
-  menu to configure the theme and language that is used as well as log out.
+  menu to change your settings (see :ref:`my_settings`), configure the theme and language that is
+  used as well as log out.
 * **Sidebar**: Below the header on the left the sidebar contains the main menu with the different
   menu options listed.
 * **Main Panel**: The biggest part of the interface is taken up by the main panel. Its content will
   change depending on the menu selected in the sidebar. To start, the dashboard will be shown.
 
+.. _my_settings:
+
+My Settings
+^^^^^^^^^^^
+
+The "My Settings" dialog in the user menu of the header contains settings of the web interface.
+They are saved in the local storage of the browser. So they apply to every user that logs in with
+this browser, but not when you log in with another browser or device.
+
+* **Dashboard**: The :ref:`view <views>` to show when selecting "Dashboard" in the sidebar, instead
+  of the default dashboard. If the selected view does not exist (anymore), a "View not found" notice
+  is shown instead. Clear the selection to return to the default dashboard.
+* **xterm.js Settings**: The font family, font size, letter spacing and line height of the
+  xterm.js based consoles. Empty settings use the default of the console.
+* **noVNC Settings**: The scaling mode of the noVNC console of virtual machines.
+
 .. _resource_search:
 
 Search
-- 
2.47.3





^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2026-11-30 12:53 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-30 12:52 [PATCH datacenter-manager/proxmox-yew-comp/yew-widget-toolkit v3 0/8] ui: make the default dashboard configurable and add "My Settings" dialog Dominik Csapak
2026-11-30 12:52 ` [PATCH yew-widget-toolkit v3 1/8] state: event: add helper to dispatch custom DOM events Dominik Csapak
2026-11-30 12:52 ` [PATCH yew-widget-toolkit v3 2/8] state: persistent state: allow listening for updates Dominik Csapak
2026-11-30 12:52 ` [PATCH proxmox-yew-comp v3 3/8] xtermjs: allow setting the noVNC scaling mode Dominik Csapak
2026-11-30 12:52 ` [PATCH datacenter-manager v3 4/8] ui: view selector: use a placeholder that can't conflict with a view Dominik Csapak
2026-11-30 12:52 ` [PATCH datacenter-manager v3 5/8] ui: add 'My Settings' dialog with xterm.js and noVNC settings Dominik Csapak
2026-11-30 12:52 ` [PATCH datacenter-manager v3 6/8] ui: views: use the view name as key of the component Dominik Csapak
2026-11-30 12:52 ` [PATCH datacenter-manager v3 7/8] ui: make the default dashboard page configurable Dominik Csapak
2026-11-30 12:52 ` [PATCH datacenter-manager v3 8/8] docs: web ui: describe the 'My Settings' dialog Dominik Csapak

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.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal