all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Shannon Sterz <s.sterz@proxmox.com>
To: yew-devel@lists.proxmox.com
Subject: [yew-devel] [PATCH yew-comp v3 1/1] token panel: use new `selected_record` helper
Date: Fri, 21 Nov 2025 17:14:23 +0100	[thread overview]
Message-ID: <20251121161423.390869-3-s.sterz@proxmox.com> (raw)
In-Reply-To: <20251121161423.390869-1-s.sterz@proxmox.com>

instead of re-implementing it here

Signed-off-by: Shannon Sterz <s.sterz@proxmox.com>
---
 src/token_panel.rs | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/src/token_panel.rs b/src/token_panel.rs
index bbd2e79..6dfdccd 100644
--- a/src/token_panel.rs
+++ b/src/token_panel.rs
@@ -220,7 +220,7 @@ impl LoadableComponent for ProxmoxTokenView {
         match msg {
             Msg::Refresh => true,
             Msg::Remove => {
-                let Some(record) = self.get_selected_record() else {
+                let Some(record) = self.store.selected_record(&self.selection) else {
                     return false;
                 };
 
@@ -245,7 +245,7 @@ impl LoadableComponent for ProxmoxTokenView {
                 false
             }
             Msg::Regenerate => {
-                let Some(record) = self.get_selected_record() else {
+                let Some(record) = self.store.selected_record(&self.selection) else {
                     return false;
                 };
                 let user = record.tokenid.user().to_string();
@@ -304,12 +304,6 @@ impl LoadableComponent for ProxmoxTokenView {
 }
 
 impl ProxmoxTokenView {
-    fn get_selected_record(&self) -> Option<ApiToken> {
-        self.selection
-            .selected_key()
-            .and_then(|key| self.store.read().lookup_record(&key).cloned())
-    }
-
     fn create_show_permissions_dialog(
         &self,
         ctx: &LoadableComponentContext<Self>,
-- 
2.47.3



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


  parent reply	other threads:[~2025-11-21 16:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-21 16:14 [yew-devel] [PATCH yew-comp/yew-widget-toolkit v3 0/2] add helpers to get a record via a Selection from a Store Shannon Sterz
2025-11-21 16:14 ` [yew-devel] [PATCH yew-widget-toolkit v3 1/1] store: add helper methods to extract a record via a selection Shannon Sterz
2025-11-21 16:14 ` Shannon Sterz [this message]
2025-11-27 21:27   ` [yew-devel] applied: [PATCH yew-comp v3 1/1] token panel: use new `selected_record` helper Thomas Lamprecht
2025-11-21 16:15 ` [yew-devel] Superseded: Re: [PATCH yew-comp/yew-widget-toolkit v3 0/2] add helpers to get a record via a Selection from a Store Shannon Sterz
2025-11-21 16:17   ` Shannon Sterz

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=20251121161423.390869-3-s.sterz@proxmox.com \
    --to=s.sterz@proxmox.com \
    --cc=yew-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal