From: "Lukas Wagner" <l.wagner@proxmox.com>
To: "Dominik Csapak" <d.csapak@proxmox.com>, <pdm-devel@lists.proxmox.com>
Subject: Re: [PATCH datacenter-manager 3/3] ui: make the default dashboard page configurable
Date: Wed, 02 Sep 2026 10:26:35 +0200 [thread overview]
Message-ID: <DL4ORPRO3PRU.22VOQJCCWG320@proxmox.com> (raw)
In-Reply-To: <20260820081746.989972-4-d.csapak@proxmox.com>
Thanks for these patches!
On Thu Aug 20, 2026 at 10:17 AM CEST, Dominik Csapak wrote:
> by allowing to set the user any view as their dashboard, saved in their
> local browser storage.
>
> It adds the selection combobox on the 'views' configuration page in the
> toolbar.
>
>From a user's perspective, I think having such a setting presented this
way is a bit confusing, since there is no hint about this being a
browser-local setting. If I didn't read the patch notes, my instinct
while exploring the UI on my own would be that this is a global setting
that affects all sessions and all users.
Adding a hint for this in the toolbar, either as a label or tooltip
seems a bit inpractical to me, mostly due to space constraints for
a label or discoverability for a tooltip.
Some alternatives could be:
- Replace the combobox in the toolbar with a button, e.g. "Configure
Dashboard", pressing that button shows a dialog that allows selecting
a view, while also explaining that this is a local setting.
I would position this button on the right-hand side, to differentiate
it from the 'entity-management' buttons add/modify/delete.
- The dashboard already has a couple local settings, such as the refresh
interval, etc., these are in the 'gear' menu in the toolbar. Maybe
on could select a view in there?
Would in general also not hurt to add a note there that all of these
settings are local
- Have a 'My Settings' dialog in the user menu similar to PVE
- Abandon the local setting altogether and make it a per-user setting
that is stored in the backend. Might require bigger changes, since I
don't think we have any good way to store per-user properties right
now. Users that routinely use multiple browsers and/or devices might
prefer this over a local setting.
What do you think?
One further thing that I have noticed: If a view that is used as a
dashboard is deleted, we should probably fall back to the default
dashboard again. Otherwise user might complain about 'broken' dashboards
without a clear indication about what is wrong.
> Most of the code is just extending the ViewSelector so it can work in
> other situations than the 'add view' dialog:
> * add on_change property
> * add dashboard_name property to show different text in different
> contexts
> * passing through the 'default' property from the combobos
>
> It also refactors the '__dashboard__' string this does not have to be
> hardcoded in different places.
>
[snip]
> diff --git a/ui/src/widget/mod.rs b/ui/src/widget/mod.rs
> index 07c47e36..1eaf0ffd 100644
> --- a/ui/src/widget/mod.rs
> +++ b/ui/src/widget/mod.rs
> @@ -31,7 +31,7 @@ pub use remote_selector::RemoteSelector;
> mod remote_endpoint_selector;
>
> mod view_selector;
> -pub use view_selector::ViewSelector;
> +pub use view_selector::{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..8bc15b0a 100644
> --- a/ui/src/widget/view_selector.rs
> +++ b/ui/src/widget/view_selector.rs
> @@ -6,12 +6,29 @@ use pwt::widget::form::Combobox;
> use pwt_macros::{builder, widget};
>
> use pdm_api_types::views::ViewConfig;
> +use yew::html::{IntoEventCallback, IntoPropValue};
> +
> +pub const DASHBOARD_VALUE: &str = "__dashboard__";
Do you think it would be possible to get this working without such a
magic value? So rather, in the code, instead of having a String for the
view ID, have a Option<String> where None is the default dashboard and
Some(id) is a specific view?
If that is impractical, we should probably disallow views with this
specific name from being created in the backend. I managed to get some
odd behavior after creating a view with this specific name.
Probably a bit unlikely for a user to create a view with this specific
name by accident, but if we can avoid having conflicts/issues altogether
with some changes in the code, that would of course be better.
>
> #[widget(comp=ViewSelectorComp, @input)]
> #[derive(Clone, Properties, PartialEq)]
> #[builder]
> pub struct ViewSelector {
> store: Store<ViewConfig>,
> +
> + /// Change callback
> + #[builder_cb(IntoEventCallback, into_event_callback, String)]
> + #[prop_or_default]
> + pub on_change: Option<Callback<String>>,
> +
> + /// The default value
> + #[builder(IntoPropValue, into_prop_value)]
> + #[prop_or_default]
> + pub default: Option<AttrValue>,
> +
> + #[builder]
> + #[prop_or(tr!("Dashboard"))]
> + pub dashboard_name: String,
> }
>
> impl ViewSelector {
> @@ -32,19 +49,23 @@ impl Component for ViewSelectorComp {
> }
>
> fn view(&self, ctx: &Context<Self>) -> Html {
> - let mut list = vec!["__dashboard__".into()];
> + let props = ctx.props();
> + let mut list = vec![DASHBOARD_VALUE.into()];
> let store = &ctx.props().store;
> for item in store.read().data().iter() {
> list.push(item.id.clone().into());
> }
> Combobox::new()
> - .items(Rc::new(list))
> + .with_std_props(&ctx.props().std_props)
> .with_input_props(&ctx.props().input_props)
> - .on_change(|_| {})
> + .items(Rc::new(list))
> + .on_change(props.on_change.clone())
> + .default(props.default.clone())
> .render_value({
> + let name = props.dashboard_name.clone();
> move |value: &AttrValue| {
> - if value == "__dashboard__" {
> - html! {{tr!("Dashboard")}}
> + if value == DASHBOARD_VALUE {
> + html! {{&name}}
> } else {
> html! {{value}}
> }
next prev parent reply other threads:[~2026-09-02 8:26 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-20 8:17 [PATCH datacenter-manager/yew-widget-toolkit 0/3] ui: make the default dashboard configurable Dominik Csapak
2026-08-20 8:17 ` [PATCH yew-widget-toolkit 1/3] state: event: add helpers for custom DOM events Dominik Csapak
2026-08-20 8:17 ` [PATCH yew-widget-toolkit 2/3] state: persistent state: allow listening for updates Dominik Csapak
2026-08-20 8:17 ` [PATCH datacenter-manager 3/3] ui: make the default dashboard page configurable Dominik Csapak
2026-09-02 8:26 ` Lukas Wagner [this message]
2026-09-02 11:10 ` Dominik Csapak
2026-09-02 11:54 ` Lukas Wagner
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=DL4ORPRO3PRU.22VOQJCCWG320@proxmox.com \
--to=l.wagner@proxmox.com \
--cc=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