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 CBBF41FF161 for ; Sat, 27 Sep 2025 19:07:42 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 6BA6F2053F; Sat, 27 Sep 2025 19:07:46 +0200 (CEST) Message-ID: <9cc35cf3-208b-4bcf-b24a-3544221e1f8c@proxmox.com> Date: Sat, 27 Sep 2025 19:07:43 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Beta To: Proxmox Datacenter Manager development discussion , Dominik Csapak , Shannon Sterz References: <20250924145137.407070-1-s.sterz@proxmox.com> <20250924145137.407070-6-s.sterz@proxmox.com> <5d896cd1-2e37-463b-aafd-a9eb833fd254@proxmox.com> Content-Language: en-US From: Thomas Lamprecht In-Reply-To: <5d896cd1-2e37-463b-aafd-a9eb833fd254@proxmox.com> X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1758992846062 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 URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [mozilla.org] Subject: Re: [pdm-devel] [PATCH yew-comp 2/2] token_panel: implement a token panel 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-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pdm-devel-bounces@lists.proxmox.com Sender: "pdm-devel" Am 26.09.25 um 10:50 schrieb Dominik Csapak: >> +async fn load_api_tokens() -> Result, Error> { >> + let url = "/access/users/?include_tokens=1"; >> + let users: Vec = crate::http_get(url, None).await?; >> + let mut list: Vec = Vec::new(); >> + >> + for user in users.into_iter() { >> + list.extend(user.tokens) >> + } >> + >> + Ok(list) > > could also be written as > > Ok(users.into_iter().map(|user| user.tokens)) That misses a collect and that tokens is a list too, but while it cannot be written that way, one can do it almost like this using: Ok(users.into_iter().flat_map(|user| user.tokens).collect()) I made a follow-up commit doing so. Am 26.09.25 um 10:50 schrieb Dominik Csapak: >> + Dialog::new(tr!("Token Secret")) >> + .with_child( >> + Column::new() >> + .with_child( >> + InputPanel::new() >> + .padding(4) >> + .with_large_field( >> + tr!("Token ID"), >> + DisplayField::new() >> + .value(AttrValue::from( >> + secret["tokenid"].as_str().unwrap_or("").to_owned(), >> + )) >> + .border(true), >> + ) >> + .with_large_field( >> + tr!("Secret"), >> + DisplayField::new() >> + .value(AttrValue::from( >> + secret["value"].as_str().unwrap_or("").to_owned(), >> + )) >> + .border(true), >> + ), >> + ) >> + .with_child( >> + Container::new() >> + .style("opacity", "0") >> + .with_child(AttrValue::from( >> + secret["value"].as_str().unwrap_or("").to_owned(), >> + )) >> + .into_html_with_ref(self.secret_node_ref.clone()), > > does this actually work as a copy input? > > AFAICS: copy_to_clipboard wants to cast the noderef to a > HtmlInputElement, and i don't think a container qualifies for that? Would probably be better to rename it to something like copy_input_element_to_clipboard then, and add a new function copy_text_content_to_clipoard that simply takes the noderef's textContent [0]. As of is this rather confusing, doesn't help that the copy_to_clipboard fn silently ignores if it fails to cast the element. [0]: https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent > > couldn't we simply show the secret in a disabled textfield and use that for copying? then we don't have to add some extra 'hidden' container with the secret? There is already a field displaying the secret above, which should be usable? The whole thing seems like a useless indirection. Btw. I know this mirrors the original and I added the copy button there, but nowadays I'd prefer having a icon-only+tooltip button to the right of the input field for both fields. _______________________________________________ pdm-devel mailing list pdm-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel