[Feature] Campo nome obbligatorio nella form di creazione connessioni
Aggiunto attributo [Required] al campo Name nelle classi DTO DatabaseCredential e RestApiCredential in CredentialManager/Models/CredentialModels.cs. Modifiche: - Aggiunto `using System.ComponentModel.DataAnnotations` al file - DatabaseCredential.Name: [Required(ErrorMessage = "Il nome è obbligatorio")] - RestApiCredential.Name: [Required(ErrorMessage = "Il nome è obbligatorio")] Il DataAnnotationsValidator già presente nelle EditForm di CredentialManagement.razor intercetta automaticamente il vincolo e impedisce la submit mostrando il messaggio di errore inline quando il campo è vuoto, senza modifiche alla logica di salvataggio. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
namespace CredentialManager.Models;
|
namespace CredentialManager.Models;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -80,6 +82,7 @@ public enum OdbcConnectionMode
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class DatabaseCredential
|
public class DatabaseCredential
|
||||||
{
|
{
|
||||||
|
[Required(ErrorMessage = "Il nome è obbligatorio")]
|
||||||
public string Name { get; set; } = string.Empty;
|
public string Name { get; set; } = string.Empty;
|
||||||
public DatabaseType DatabaseType { get; set; }
|
public DatabaseType DatabaseType { get; set; }
|
||||||
public string Host { get; set; } = string.Empty;
|
public string Host { get; set; } = string.Empty;
|
||||||
@@ -102,6 +105,7 @@ public class DatabaseCredential
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class RestApiCredential
|
public class RestApiCredential
|
||||||
{
|
{
|
||||||
|
[Required(ErrorMessage = "Il nome è obbligatorio")]
|
||||||
public string Name { get; set; } = string.Empty;
|
public string Name { get; set; } = string.Empty;
|
||||||
public RestServiceType ServiceType { get; set; } = RestServiceType.Generic;
|
public RestServiceType ServiceType { get; set; } = RestServiceType.Generic;
|
||||||
public string BaseUrl { get; set; } = string.Empty;
|
public string BaseUrl { get; set; } = string.Empty;
|
||||||
|
|||||||
Reference in New Issue
Block a user