From: Shannon Sterz <s.sterz@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [PATCH datacenter-manager 5/6] ui: auto-installer: load fingerprint and use it as initial value
Date: Wed, 27 May 2026 14:52:16 +0200 [thread overview]
Message-ID: <20260527125217.260760-6-s.sterz@proxmox.com> (raw)
In-Reply-To: <20260527125217.260760-1-s.sterz@proxmox.com>
the answers and token panel now load the fingerprint when initialized
and hand it over to dialogs that they spawn to add the fingerprint to
the command presented to the user.
Signed-off-by: Shannon Sterz <s.sterz@proxmox.com>
---
.../prepared_answer_add_wizard.rs | 4 +--
.../auto_installer/prepared_answer_form.rs | 12 ++++++--
.../auto_installer/prepared_answers_panel.rs | 28 +++++++++++++++++--
ui/src/remotes/auto_installer/token_panel.rs | 19 +++++++++++++
4 files changed, 57 insertions(+), 6 deletions(-)
diff --git a/ui/src/remotes/auto_installer/prepared_answer_add_wizard.rs b/ui/src/remotes/auto_installer/prepared_answer_add_wizard.rs
index e909b6e..03d78be 100644
--- a/ui/src/remotes/auto_installer/prepared_answer_add_wizard.rs
+++ b/ui/src/remotes/auto_installer/prepared_answer_add_wizard.rs
@@ -44,7 +44,7 @@ pub struct AddAnswerWizardProperties {
}
impl AddAnswerWizardProperties {
- pub fn new() -> Self {
+ pub fn new(fingerprint: Option<String>) -> Self {
let mut template_counters = BTreeMap::new();
template_counters.insert("installation_nr".to_owned(), 0i32);
@@ -79,8 +79,8 @@ impl AddAnswerWizardProperties {
disk_filter: BTreeMap::new(),
disk_filter_match: None,
// post hook
- post_hook_cert_fp: None,
post_hook_base_url: pdm_origin(),
+ post_hook_cert_fp: fingerprint,
// templating
template_counters,
// subscription
diff --git a/ui/src/remotes/auto_installer/prepared_answer_form.rs b/ui/src/remotes/auto_installer/prepared_answer_form.rs
index 44cfcc5..46867a2 100644
--- a/ui/src/remotes/auto_installer/prepared_answer_form.rs
+++ b/ui/src/remotes/auto_installer/prepared_answer_form.rs
@@ -974,6 +974,7 @@ pub fn render_show_secret_dialog(
config_id: Option<&str>,
token: &AnswerToken,
secret: &str,
+ fingerprint: &Option<String>,
on_close: Callback<()>,
) -> Option<yew::Html> {
let token = format!("{}:{secret}", token.id);
@@ -1009,10 +1010,17 @@ pub fn render_show_secret_dialog(
"{}/api2/json/auto-install/answer",
pdm_origin().unwrap_or_else(|| "https://pdm.example.com:8443".to_owned())
);
- let commandline = format!(
- "proxmox-auto-install-assistant prepare-iso --fetch-from http --url {answer_url} --answer-auth-token {token} INPUT.iso",
+
+ let mut commandline = format!(
+ "proxmox-auto-install-assistant prepare-iso --fetch-from http --url {answer_url} --answer-auth-token {token}",
);
+ if let Some(fingerprint) = fingerprint {
+ commandline = format!("{commandline} --cert-fingerprint {fingerprint}");
+ }
+
+ commandline = format!("{commandline} INPUT.iso");
+
let copy_commandline_view = Container::new()
.class("pwt-form-grid-col4")
.with_child(FieldLabel::new(tr!("Command Line")))
diff --git a/ui/src/remotes/auto_installer/prepared_answers_panel.rs b/ui/src/remotes/auto_installer/prepared_answers_panel.rs
index 0cff7fd..a55c029 100644
--- a/ui/src/remotes/auto_installer/prepared_answers_panel.rs
+++ b/ui/src/remotes/auto_installer/prepared_answers_panel.rs
@@ -66,6 +66,7 @@ enum Message {
token: AnswerToken,
secret: String,
},
+ FingerprintLoaded(Option<String>),
}
struct PreparedAnswersPanelComponent {
@@ -73,6 +74,7 @@ struct PreparedAnswersPanelComponent {
selection: Selection,
store: Store<PreparedInstallationConfig>,
columns: Rc<Vec<DataTableHeader<PreparedInstallationConfig>>>,
+ fingerprint: Option<String>,
}
pwt::impl_deref_mut_property!(
@@ -94,12 +96,24 @@ impl LoadableComponent for PreparedAnswersPanelComponent {
|a: &PreparedInstallationConfig, b: &PreparedInstallationConfig| a.id.cmp(&b.id),
);
+ let link = ctx.link().clone();
+ ctx.link().spawn(async move {
+ link.send_message(Message::FingerprintLoaded(
+ pdm_client()
+ .certificate_info()
+ .await
+ .ok()
+ .and_then(|mut c| c.pop().and_then(|c| c.fingerprint)),
+ ));
+ });
+
Self {
state: LoadableComponentState::new(),
selection: Selection::new()
.on_select(ctx.link().callback(|_| Message::SelectionChange)),
store,
columns: Rc::new(columns()),
+ fingerprint: None,
}
}
@@ -148,6 +162,10 @@ impl LoadableComponent for PreparedAnswersPanelComponent {
}));
false
}
+ Message::FingerprintLoaded(fp) => {
+ self.fingerprint = fp;
+ false
+ }
}
}
@@ -221,7 +239,7 @@ impl LoadableComponent for PreparedAnswersPanelComponent {
match view_state {
Self::ViewState::Create => Some(
- AddAnswerWizardProperties::new()
+ AddAnswerWizardProperties::new(self.fingerprint.clone())
.on_submit_result(on_submit_result)
.on_close(on_close)
.into(),
@@ -259,7 +277,13 @@ impl LoadableComponent for PreparedAnswersPanelComponent {
config_id,
token,
secret,
- } => render_show_secret_dialog(Some(config_id), token, secret, on_close),
+ } => render_show_secret_dialog(
+ Some(config_id),
+ token,
+ secret,
+ &self.fingerprint,
+ on_close,
+ ),
}
}
}
diff --git a/ui/src/remotes/auto_installer/token_panel.rs b/ui/src/remotes/auto_installer/token_panel.rs
index d213f39..d5f1ff7 100644
--- a/ui/src/remotes/auto_installer/token_panel.rs
+++ b/ui/src/remotes/auto_installer/token_panel.rs
@@ -53,6 +53,7 @@ enum Message {
SelectionChange,
RemoveEntry,
RegenerateSecret,
+ FingerprintLoaded(Option<String>),
}
struct AuthTokenPanelComponent {
@@ -60,6 +61,7 @@ struct AuthTokenPanelComponent {
selection: Selection,
store: Store<AnswerToken>,
columns: Rc<Vec<DataTableHeader<AnswerToken>>>,
+ fingerprint: Option<String>,
}
pwt::impl_deref_mut_property!(
@@ -78,12 +80,24 @@ impl LoadableComponent for AuthTokenPanelComponent {
Store::with_extract_key(|record: &AnswerToken| Key::from(record.id.to_string()));
store.set_sorter(|a: &AnswerToken, b: &AnswerToken| a.id.cmp(&b.id));
+ let link = ctx.link().clone();
+ ctx.link().spawn(async move {
+ link.send_message(Message::FingerprintLoaded(
+ pdm_client()
+ .certificate_info()
+ .await
+ .ok()
+ .and_then(|mut c| c.pop().and_then(|c| c.fingerprint)),
+ ));
+ });
+
Self {
state: LoadableComponentState::new(),
selection: Selection::new()
.on_select(ctx.link().callback(|_| Message::SelectionChange)),
store,
columns: Rc::new(columns()),
+ fingerprint: None,
}
}
@@ -142,6 +156,10 @@ impl LoadableComponent for AuthTokenPanelComponent {
}
false
}
+ Message::FingerprintLoaded(fingerprint) => {
+ self.fingerprint = fingerprint;
+ false
+ }
}
}
@@ -209,6 +227,7 @@ impl LoadableComponent for AuthTokenPanelComponent {
None,
token,
secret,
+ &self.fingerprint,
ctx.link().change_view_callback(|_| None),
),
}
--
2.47.3
next prev parent reply other threads:[~2026-05-27 12:52 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-27 12:52 [PATCH datacenter-manager 0/6] improve handling of base url and certificate fingerprint for auto-installer gui Shannon Sterz
2026-05-27 12:52 ` [PATCH datacenter-manager 1/6] server: api: certificates: allow anybody to query the certificate info Shannon Sterz
2026-05-27 14:12 ` Filip Schauer
2026-05-27 14:16 ` Lukas Wagner
2026-05-27 14:17 ` Shannon Sterz
2026-05-27 12:52 ` [PATCH datacenter-manager 2/6] pdm-client: add function to query the PDM hosts " Shannon Sterz
2026-05-27 12:52 ` [PATCH datacenter-manager 3/6] ui: remotes: auto-installer: set pdm_origin() as placeholder not tip Shannon Sterz
2026-05-27 12:52 ` [PATCH datacenter-manager 4/6] ui: remotes: auto-installer: use pdm_origin() to set initial pdm url Shannon Sterz
2026-05-27 12:52 ` Shannon Sterz [this message]
2026-05-27 12:52 ` [PATCH datacenter-manager 6/6] ui: auto-installer: use info from answer to format preparation command Shannon Sterz
2026-05-27 13:11 ` [PATCH datacenter-manager 0/6] improve handling of base url and certificate fingerprint for auto-installer gui Lukas Wagner
2026-05-27 14:02 ` applied: " 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=20260527125217.260760-6-s.sterz@proxmox.com \
--to=s.sterz@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