[pdm-devel] [PATCH datacenter-manager] ui: views: add view id schema validation
Lukas Wagner
l.wagner at proxmox.com
Tue Dec 16 14:58:28 CET 2025
On Wed Dec 10, 2025 at 4:18 PM CET, Dominik Csapak wrote:
> so the user gets instant feedback about the validity of the id.
>
> Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
> ---
> ui/src/configuration/views.rs | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/ui/src/configuration/views.rs b/ui/src/configuration/views.rs
> index 810bda36..dcb0672c 100644
> --- a/ui/src/configuration/views.rs
> +++ b/ui/src/configuration/views.rs
> @@ -4,11 +4,12 @@ use std::rc::Rc;
>
> use anyhow::{bail, Error};
>
> +use pdm_api_types::VIEW_ID_SCHEMA;
> use yew::virtual_dom::{Key, VComp, VNode};
>
> use proxmox_yew_comp::form::delete_empty_values;
> use proxmox_yew_comp::percent_encoding::percent_encode_component;
> -use proxmox_yew_comp::{http_delete, http_get, http_post, http_put, EditWindow};
> +use proxmox_yew_comp::{http_delete, http_get, http_post, http_put, EditWindow, SchemaValidation};
> use proxmox_yew_comp::{
> LoadableComponent, LoadableComponentContext, LoadableComponentMaster,
> LoadableComponentScopeExt, LoadableComponentState,
> @@ -341,7 +342,13 @@ fn input_panel(form_ctx: &FormContext, mode: InputPanelMode) -> Html {
>
> match mode {
> InputPanelMode::Create(store) => {
> - input_panel.add_field(tr!("Name"), Field::new().name("id").required(true));
> + input_panel.add_field(
> + tr!("Name"),
> + Field::new()
> + .name("id")
> + .schema(&VIEW_ID_SCHEMA)
> + .required(true),
> + );
> input_panel.add_right_field(
> tr!("Copy Layout from"),
> ViewSelector::new(store)
LGTM!
Tested-by: Lukas Wagner <l.wagner at proxmox.com>
Reviewed-by: Lukas Wagner <l.wagner at proxmox.com>
More information about the pdm-devel
mailing list