public inbox for pdm-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pdm-devel] [PATCH datacenter-manager] ui: views: add view id schema validation
@ 2025-12-10 15:18 Dominik Csapak
  0 siblings, 0 replies; only message in thread
From: Dominik Csapak @ 2025-12-10 15:18 UTC (permalink / raw)
  To: pdm-devel

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-12-10 15:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-10 15:18 [pdm-devel] [PATCH datacenter-manager] ui: views: add view id schema validation Dominik Csapak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal