public inbox for pdm-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: Shannon Sterz <s.sterz@proxmox.com>
Cc: Proxmox Datacenter Manager development discussion
	<pdm-devel@lists.proxmox.com>
Subject: Re: [pdm-devel] [PATCH datacenter-manager v3 15/18] ui: main menu: add optional view_list property
Date: Mon, 24 Nov 2025 12:06:56 +0100	[thread overview]
Message-ID: <13922e74-552b-454e-98f6-63da8180578e@proxmox.com> (raw)
In-Reply-To: <DEB26BO9A9SE.1TSRT7ZELS7XN@proxmox.com>



On 11/17/25 4:00 PM, Shannon Sterz wrote:
> comments in-line.
> 
> On Mon Nov 17, 2025 at 1:44 PM CET, Dominik Csapak wrote:
>> to show them in the navigation. The main 'View' entry point leads to the
>> CRUD grid for editing, and the views are listed below as separate
>> entries.
>>
>> If an entry is selected but we did not get any list (e.g. it's not
>> loaded yet), simply add a dummy entry for that view. This prevent issues
>> when the page is reloaded on a view.
>>
>> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
>> ---
>>   ui/src/main_menu.rs | 55 ++++++++++++++++++++++++++++++++++++++++++++-
>>   1 file changed, 54 insertions(+), 1 deletion(-)
>>
>> diff --git a/ui/src/main_menu.rs b/ui/src/main_menu.rs
>> index 883c482a..fd64e330 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::Selection;
>> +use pwt::state::{NavigationContextExt, Selection};
>>   use pwt::widget::nav::{Menu, MenuItem, NavigationDrawer};
>>   use pwt::widget::{Container, Row, SelectionView, SelectionViewRenderInfo};
>>
>> @@ -13,6 +13,7 @@ use proxmox_yew_comp::{NotesView, XTermJs};
>>
>>   use pdm_api_types::remotes::RemoteType;
>>
>> +use crate::configuration::views::ViewGrid;
>>   use crate::dashboard::view::View;
>>   use crate::remotes::RemotesPanel;
>>   use crate::sdn::evpn::EvpnPanel;
>> @@ -53,6 +54,10 @@ pub struct MainMenu {
>>       #[builder]
>>       #[prop_or_default]
>>       pub remote_list: Vec<RemoteListCacheEntry>,
>> +
>> +    #[builder]
>> +    #[prop_or_default]
>> +    pub view_list: Vec<String>,
>>   }
>>
>>   impl MainMenu {
>> @@ -130,6 +135,14 @@ impl Component for PdmMainMenu {
>>           let scope = ctx.link().clone();
>>           let props = ctx.props();
>>
>> +        let route_view = match ctx.link().nav_context() {
>> +            Some(nav) => match nav.path().split_once("-") {
>> +                Some(("view", view)) => Some(view.to_string()),
>> +                _ => None,
>> +            },
>> +            None => None,
>> +        };
>> +
>>           let mut content = SelectionView::new()
>>               .class(FlexFit)
>>               .selection(self.menu_selection.clone());
>> @@ -145,6 +158,46 @@ impl Component for PdmMainMenu {
>>               move |_| View::new(None).into(),
>>           );
>>
>> +        let mut views = Menu::new();
>> +
>> +        let mut found = false;
>> +
>> +        for view in &props.view_list {
>> +            let view = view.to_string();
>> +            if route_view.as_ref() == Some(&view) {
>> +                found = true;
>> +            }
>> +            register_view(
>> +                &mut views,
>> +                &mut content,
>> +                view.clone(),
>> +                &format!("view-{view}"),
>> +                Some("fa fa-tachometer"),
> 
> imo, having the dashboard and views menu and all view use the tachometer
> looks a bit akward fa-eye or fa-picutre-o would be good candidates imo
> (or we drop/change the dashboard entry).

agree, I'll use fa-eye (picture-o looks a bit too much like the default
'broken' image placeholder in the browser)

> 
>> +                move |_| View::new(Some(view.clone().into())).into(),
>> +            );
>> +        }
>> +
>> +        if let (false, Some(view)) = (found, route_view) {
>> +            register_view(
>> +                &mut views,
>> +                &mut content,
>> +                view.clone(),
>> +                &format!("view-{view}"),
>> +                Some("fa fa-tachometer"),
>> +                move |_| View::new(Some(view.clone().into())).into(),
>> +            );
>> +        }
>> +
>> +        register_submenu(
>> +            &mut menu,
>> +            &mut content,
>> +            tr!("Views"),
>> +            "views",
>> +            Some("fa fa-tachometer"),
>> +            move |_| ViewGrid::new().into(),
>> +            views,
>> +        );
> 
> imo it's a bit awkward that the triangle for the submenu is now always
> present. whether there is a view or not.

this is the case for every submenu in the nav menu currently
i'll see how can change that there (but it should not make
a difference for this patch)

> 
>> +
>>           register_view(
>>               &mut menu,
>>               &mut content,
> 



_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel


  reply	other threads:[~2025-11-24 11:06 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-17 12:44 [pdm-devel] [PATCH datacenter-manager v3 00/18] enable custom views on the UI Dominik Csapak
2025-11-17 12:44 ` [pdm-devel] [PATCH datacenter-manager v3 01/18] lib: pdm-config: views: add locking/saving methods Dominik Csapak
2025-11-17 12:44 ` [pdm-devel] [PATCH datacenter-manager v3 02/18] lib: api-types: add 'layout' property to ViewConfig Dominik Csapak
2025-11-17 14:58   ` Shannon Sterz
2025-11-24  9:55     ` Dominik Csapak
2025-11-24 10:14       ` Dominik Csapak
2025-11-24 10:26         ` Shannon Sterz
2025-11-17 12:44 ` [pdm-devel] [PATCH datacenter-manager v3 03/18] server: api: implement CRUD api for views Dominik Csapak
2025-11-17 14:58   ` Shannon Sterz
2025-11-17 12:44 ` [pdm-devel] [PATCH datacenter-manager v3 04/18] server: api: resources: add 'view' category to search syntax Dominik Csapak
2025-11-17 12:44 ` [pdm-devel] [PATCH datacenter-manager v3 05/18] ui: remote selector: allow forcing of value Dominik Csapak
2025-11-17 12:44 ` [pdm-devel] [PATCH datacenter-manager v3 06/18] ui: dashboard types: add missing 'default' to de-serialization Dominik Csapak
2025-11-17 14:59   ` Shannon Sterz
2025-11-17 12:44 ` [pdm-devel] [PATCH datacenter-manager v3 07/18] ui: dashboard: status row: add optional 'editing state' Dominik Csapak
2025-11-17 12:44 ` [pdm-devel] [PATCH datacenter-manager v3 08/18] ui: dashboard: prepare view for editing custom views Dominik Csapak
2025-11-17 14:59   ` Shannon Sterz
2025-11-24 10:32     ` Dominik Csapak
2025-11-17 12:44 ` [pdm-devel] [PATCH datacenter-manager v3 09/18] ui: views: implement view loading from api Dominik Csapak
2025-11-17 14:59   ` Shannon Sterz
2025-11-17 12:44 ` [pdm-devel] [PATCH datacenter-manager v3 10/18] ui: views: make 'view' name property optional Dominik Csapak
2025-11-17 14:59   ` Shannon Sterz
2025-11-17 12:44 ` [pdm-devel] [PATCH datacenter-manager v3 11/18] ui: views: add 'view' parameter to api calls Dominik Csapak
2025-11-17 12:44 ` [pdm-devel] [PATCH datacenter-manager v3 12/18] ui: views: save updated layout to backend Dominik Csapak
2025-11-17 15:00   ` Shannon Sterz
2025-11-17 12:44 ` [pdm-devel] [PATCH datacenter-manager v3 13/18] ui: add view list context Dominik Csapak
2025-11-17 12:44 ` [pdm-devel] [PATCH datacenter-manager v3 14/18] ui: configuration: add view CRUD panels Dominik Csapak
2025-11-17 15:00   ` Shannon Sterz
2025-11-17 12:44 ` [pdm-devel] [PATCH datacenter-manager v3 15/18] ui: main menu: add optional view_list property Dominik Csapak
2025-11-17 15:01   ` Shannon Sterz
2025-11-24 11:06     ` Dominik Csapak [this message]
2025-11-17 12:44 ` [pdm-devel] [PATCH datacenter-manager v3 16/18] ui: load view list on page init Dominik Csapak
2025-11-17 12:44 ` [pdm-devel] [PATCH datacenter-manager v3 17/18] lib/ui: move views types to pdm-api-types Dominik Csapak
2025-11-17 12:44 ` [pdm-devel] [PATCH datacenter-manager v3 18/18] server: api: views: check layout string for validity Dominik Csapak
2025-11-17 15:03 ` [pdm-devel] [PATCH datacenter-manager v3 00/18] enable custom views on the UI Shannon Sterz
2025-11-24 11:09   ` Dominik Csapak

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=13922e74-552b-454e-98f6-63da8180578e@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=pdm-devel@lists.proxmox.com \
    --cc=s.sterz@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
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal