From: Shannon Sterz <s.sterz@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [pdm-devel] [PATCH datacenter-manager 1/2] ui: node url list: validate list of endpoints
Date: Fri, 19 Dec 2025 13:37:57 +0100 [thread overview]
Message-ID: <20251219123758.151318-2-s.sterz@proxmox.com> (raw)
In-Reply-To: <20251219123758.151318-1-s.sterz@proxmox.com>
otherwise user can manually edit these fields. when adding a remote
through a wizzard the api will return an error that the value doesn't
match the validation regex instantly. hence, there it is mostly a ux
issue.
when editing a remote, however, the api doesn't validate the url. so
adding, for a example a protocol (e.g. "https://") to the hostname/ip
field, will lead to connection errors when looking at the remote's
overview.
Signed-off-by: Shannon Sterz <s.sterz@proxmox.com>
---
lib/pdm-api-types/src/lib.rs | 3 +++
ui/src/remotes/node_url_list.rs | 2 ++
2 files changed, 5 insertions(+)
diff --git a/lib/pdm-api-types/src/lib.rs b/lib/pdm-api-types/src/lib.rs
index 5daaa3f..d4cc7ef 100644
--- a/lib/pdm-api-types/src/lib.rs
+++ b/lib/pdm-api-types/src/lib.rs
@@ -137,6 +137,9 @@ pub const HOST_PORT_FORMAT: ApiStringFormat = ApiStringFormat::Pattern(&HOST_POR
pub const HOST_OPTIONAL_PORT_FORMAT: ApiStringFormat =
ApiStringFormat::Pattern(&HOST_OPTIONAL_PORT_REGEX);
pub const HTTP_URL_FORMAT: ApiStringFormat = ApiStringFormat::Pattern(&HTTP_URL_REGEX);
+pub const HOST_OPTIONAL_PORT_SCHEMA: Schema = StringSchema::new("A host with an optional port.")
+ .format(&HOST_OPTIONAL_PORT_FORMAT)
+ .schema();
pub const DAILY_DURATION_FORMAT: ApiStringFormat =
ApiStringFormat::VerifyFn(|s| parse_daily_duration(s).map(drop));
diff --git a/ui/src/remotes/node_url_list.rs b/ui/src/remotes/node_url_list.rs
index 89999ef..c558022 100644
--- a/ui/src/remotes/node_url_list.rs
+++ b/ui/src/remotes/node_url_list.rs
@@ -16,6 +16,7 @@ use pwt::{css, prelude::*};
use proxmox_yew_comp::{SchemaValidation, Status};
use pdm_api_types::remotes::NodeUrl;
+use pdm_api_types::HOST_OPTIONAL_PORT_SCHEMA;
use proxmox_schema::property_string::PropertyString;
use proxmox_schema::api_types::CERT_FINGERPRINT_SHA256_SCHEMA;
@@ -254,6 +255,7 @@ fn columns(ctx: &ManagedFieldContext<PdmNodeUrlField>) -> Rc<Vec<DataTableHeader
Field::new()
.on_change(link.callback(move |value| Msg::UpdateHostname(index, value)))
.required(true)
+ .schema(HOST_OPTIONAL_PORT_SCHEMA)
.value(item.data.hostname.clone())
.into()
}
--
2.47.3
_______________________________________________
pdm-devel mailing list
pdm-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel
next prev parent reply other threads:[~2025-12-19 12:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-19 12:37 [pdm-devel] [PATCH datacenter-manager 0/2] validate remote hostname Shannon Sterz
2025-12-19 12:37 ` Shannon Sterz [this message]
2025-12-19 12:37 ` [pdm-devel] [PATCH datacenter-manager 2/2] api types: node url: validate hostname 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=20251219123758.151318-2-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 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.