From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 2FC6F1FF15E for ; Mon, 24 Nov 2025 12:06:49 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id E92AC1FF8F; Mon, 24 Nov 2025 12:06:59 +0100 (CET) Message-ID: <13922e74-552b-454e-98f6-63da8180578e@proxmox.com> Date: Mon, 24 Nov 2025 12:06:56 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Beta To: Shannon Sterz References: <20251117125041.1931382-1-d.csapak@proxmox.com> <20251117125041.1931382-16-d.csapak@proxmox.com> Content-Language: en-US From: Dominik Csapak In-Reply-To: X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1763982381838 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.030 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: Re: [pdm-devel] [PATCH datacenter-manager v3 15/18] ui: main menu: add optional view_list property X-BeenThere: pdm-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Datacenter Manager development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox Datacenter Manager development discussion Cc: Proxmox Datacenter Manager development discussion Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: pdm-devel-bounces@lists.proxmox.com Sender: "pdm-devel" 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 >> --- >> 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, >> + >> + #[builder] >> + #[prop_or_default] >> + pub view_list: Vec, >> } >> >> 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