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
  2025-12-16 13:58 ` Lukas Wagner
  0 siblings, 1 reply; 2+ messages 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] 2+ messages in thread

* Re: [pdm-devel] [PATCH datacenter-manager] ui: views: add view id schema validation
  2025-12-10 15:18 [pdm-devel] [PATCH datacenter-manager] ui: views: add view id schema validation Dominik Csapak
@ 2025-12-16 13:58 ` Lukas Wagner
  0 siblings, 0 replies; 2+ messages in thread
From: Lukas Wagner @ 2025-12-16 13:58 UTC (permalink / raw)
  To: Proxmox Datacenter Manager development discussion, Dominik Csapak

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@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@proxmox.com>
Reviewed-by: Lukas Wagner <l.wagner@proxmox.com>



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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-12-16 13:57 UTC | newest]

Thread overview: 2+ messages (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
2025-12-16 13:58 ` Lukas Wagner

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