From: Dominik Csapak <d.csapak@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [pdm-devel] [PATCH yew-comp 1/1] apt package manager: add property for custom subscription alert message
Date: Wed, 3 Dec 2025 13:18:18 +0100 [thread overview]
Message-ID: <20251203121848.2600456-1-d.csapak@proxmox.com> (raw)
If given, will show an alert dialog with those instead of the default
subscription alert dialog.
In the long term, having both url+title/message in some kind of struct
like EditableProperty would be nicer, but this should be fine for now.
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
src/apt_package_manager.rs | 30 ++++++++++++++++++++----------
1 file changed, 20 insertions(+), 10 deletions(-)
diff --git a/src/apt_package_manager.rs b/src/apt_package_manager.rs
index b419957..82d536f 100644
--- a/src/apt_package_manager.rs
+++ b/src/apt_package_manager.rs
@@ -17,7 +17,7 @@ use pwt::state::{Selection, SlabTree, TreeStore};
use pwt::widget::data_table::{
DataTable, DataTableCellRenderArgs, DataTableColumn, DataTableHeader, DataTableHeaderGroup,
};
-use pwt::widget::{Button, Container, Toolbar, Tooltip};
+use pwt::widget::{AlertDialog, Button, Container, Toolbar, Tooltip};
use pwt::AsyncPool;
use crate::percent_encoding::percent_encode_component;
@@ -61,10 +61,16 @@ pub struct AptPackageManager {
#[builder_cb(IntoEventCallback, into_event_callback, ())]
pub on_upgrade: Option<Callback<()>>,
+ // todo refactor url+message into a struct like EditableProperty
#[prop_or_default]
#[builder(IntoPropValue, into_prop_value)]
/// The base url for the subscription check
pub subscription_url: Option<AttrValue>,
+
+ #[prop_or_default]
+ #[builder(IntoPropValue, into_prop_value)]
+ /// Custom subscription dialog title and message
+ pub subscription_message: Option<(String, Html)>,
}
impl Default for AptPackageManager {
@@ -321,15 +327,19 @@ impl LoadableComponent for ProxmoxAptPackageManager {
let props = ctx.props();
let task_base_url = props.task_base_url.clone();
let command = format!("{}/update", props.base_url);
- Some(
- SubscriptionAlert::new("notfound")
- .on_close(move |_| {
- link.change_view(None);
- link.task_base_url(task_base_url.clone());
- link.start_task(&command, None, false);
- })
- .into(),
- )
+ let on_close = move |_| {
+ link.change_view(None);
+ link.task_base_url(task_base_url.clone());
+ link.start_task(&command, None, false);
+ };
+ Some(if let Some(msg) = props.subscription_message.clone() {
+ AlertDialog::new(msg.1)
+ .title(msg.0)
+ .on_close(on_close)
+ .into()
+ } else {
+ SubscriptionAlert::new("notfound").on_close(on_close).into()
+ })
}
}
}
--
2.47.3
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
next reply other threads:[~2025-12-03 12:18 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-03 12:18 Dominik Csapak [this message]
2025-12-03 12:18 ` [pdm-devel] [PATCH datacenter-manager 1/1] ui: pdm update panel: show correct subscription notice message Dominik Csapak
2025-12-03 12:51 ` [pdm-devel] superseded: [PATCH yew-comp 1/1] apt package manager: add property for custom subscription alert message Dominik Csapak
2025-12-03 12:51 ` [pdm-devel] " Thomas Lamprecht
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=20251203121848.2600456-1-d.csapak@proxmox.com \
--to=d.csapak@proxmox.com \
--cc=pdm-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox