From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 670801FF15E for ; Mon, 15 Sep 2025 15:44:05 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 0DCE5250B4; Mon, 15 Sep 2025 15:44:11 +0200 (CEST) Message-ID: <38a386ee-802a-4cc1-892c-41c0e4b3d756@proxmox.com> Date: Mon, 15 Sep 2025 15:44:06 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Beta To: Proxmox Datacenter Manager development discussion , Shannon Sterz References: <20250911113926.223147-2-s.sterz@proxmox.com> <20250911113926.223147-4-s.sterz@proxmox.com> Content-Language: en-US From: Dominik Csapak In-Reply-To: <20250911113926.223147-4-s.sterz@proxmox.com> X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1757943840055 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.026 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 RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. 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 1/1] ui: enable the top navigation bar's documentation button 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 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: pdm-devel-bounces@lists.proxmox.com Sender: "pdm-devel" two comments inline: On 9/11/25 1:40 PM, Shannon Sterz wrote: > and make it open the beta documentation in a new tab for now. > > Signed-off-by: Shannon Sterz > --- > ui/Cargo.toml | 2 +- > ui/src/top_nav_bar.rs | 20 +++++++++++++++++--- > 2 files changed, 18 insertions(+), 4 deletions(-) > > diff --git a/ui/Cargo.toml b/ui/Cargo.toml > index 43424db..c60426a 100644 > --- a/ui/Cargo.toml > +++ b/ui/Cargo.toml > @@ -23,7 +23,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"] } > +web-sys = { version = "0.3", features = ["Location", "HtmlAnchorElement"] } > yew = { version = "0.21", features = ["csr"] } > yew-router = { version = "0.18" } > > diff --git a/ui/src/top_nav_bar.rs b/ui/src/top_nav_bar.rs > index 9b1e37e..f348592 100644 > --- a/ui/src/top_nav_bar.rs > +++ b/ui/src/top_nav_bar.rs > @@ -3,6 +3,8 @@ use std::rc::Rc; > use anyhow::Error; > use pwt::css::ColorScheme; > use serde::Deserialize; > +use wasm_bindgen::{JsCast, UnwrapThrowExt}; > +use web_sys::HtmlAnchorElement; > > use pwt::prelude::*; > use pwt::widget::menu::{Menu, MenuButton, MenuEntry, MenuEvent, MenuItem}; > @@ -181,10 +183,22 @@ impl Component for PdmTopNavBar { > Tooltip::new( > Button::new(tr!("Documentation")) > .icon_class("fa fa-book") > - .disabled(true) > - .class(ColorScheme::Neutral), > + .class(ColorScheme::Neutral) > + .onclick(|_| { for new code, it would be better to use 'on_activate'. we try to be consistent here across our components and use our own wrapper that handles mouse + keyboard correctly (on the button it literally is just the onclick handler, but using our wrapper here too promotes it for others that might copy & paste these things) > + let document = gloo_utils::document(); > + let _ = document.create_element("a").map(|a| { > + let atag: HtmlAnchorElement = a > + .dyn_into() > + .expect_throw("an a tag should always be an anchor element"); > + atag.set_href( > + "https://pve.proxmox.com/wiki/Proxmox_Datacenter_Manager_Beta_Documentation", > + ); > + atag.set_target("_blank"); > + atag.click(); is there a special reason why you create an 'a' tag and click on it? e.g. for the pve ui links we always use: `let _ = window().open_with_url(&url.href());` wouldn't it here also be easier to use something like: `let _ = window().open_with_url_and_target("https://pve...", "_blank");` ? > + }); > + }), > ) > - .tip(tr!("Coming soon")), > + .tip(tr!("Open the Beta documentation in a new tab.")), > ); > > if let Some(username) = &props.username { _______________________________________________ pdm-devel mailing list pdm-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel