all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pdm-devel@lists.proxmox.com
Subject: [pdm-devel] [PATCH datacenter-manager] ui: views: add view id schema validation
Date: Wed, 10 Dec 2025 16:18:36 +0100	[thread overview]
Message-ID: <20251210151841.3617325-1-d.csapak@proxmox.com> (raw)

so the user gets instant feedback about the validity of the id.

Signed-off-by: Dominik Csapak <d.csapak@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)
-- 
2.47.3



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


             reply	other threads:[~2025-12-10 15:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-10 15:18 Dominik Csapak [this message]
2025-12-16 13:58 ` Lukas Wagner

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=20251210151841.3617325-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 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