COmpletata prima review blocco gestione errori/warnings
This commit is contained in:
@@ -5,17 +5,31 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@if (validErrors != null && validErrors.Count > 0)
|
||||
if (listErrPre != null && listErrPre.Count > 0)
|
||||
{
|
||||
<div class="alert alert-danger">
|
||||
<div class="fs-3">Errori validazione!</div>
|
||||
<div class="col-12 col-md-6 col-lg-3">
|
||||
|
||||
<ul class="list-group">
|
||||
@foreach (var item in validErrors)
|
||||
@foreach (var item in listErrPre)
|
||||
{
|
||||
<li class="list-group-item">@item</li>
|
||||
<li class="list-group-item">@item.Value</li>
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
else if (listErrLink != null && listErrLink.Count > 0)
|
||||
{
|
||||
<div class="alert alert-danger">
|
||||
<div class="fs-3">Errore configurazione:</div>
|
||||
<div class="col-12">
|
||||
|
||||
<ul class="list-group">
|
||||
@foreach (var item in listErrLink)
|
||||
{
|
||||
<li class="list-group-item">@item.Value</li>
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
@@ -860,7 +874,7 @@
|
||||
<div class="row">
|
||||
<div class="input-group mb-2">
|
||||
<label class="input-group-text" for="ColorWindow">Window</label>
|
||||
<select class="form-select" id="ColorWindow" @bind="@m_CurrWindow.sColorMaterial">
|
||||
<select class="form-select @(cssValid("ColorMaterial"))" id="ColorWindow" @bind="@m_CurrWindow.sColorMaterial">
|
||||
@foreach (string colorMaterial in ListPayload.ColorMaterial)
|
||||
{
|
||||
<option value="@colorMaterial">@colorMaterial</option>
|
||||
@@ -896,6 +910,21 @@
|
||||
@outSvg
|
||||
</div>
|
||||
}
|
||||
if (listWarnings != null && listWarnings.Count > 0)
|
||||
{
|
||||
<div class="alert alert-warning">
|
||||
<div class="fs-3">Mancata corrispondenza valori:</div>
|
||||
<div class="col-12 col-md-6 col-lg-3">
|
||||
|
||||
<ul class="list-group">
|
||||
@foreach (var item in listWarnings)
|
||||
{
|
||||
<li class="list-group-item">@item.Value</li>
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
}
|
||||
</div>
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace WebWindowComplex
|
||||
/// Sollevo evento errore validazione con una lista di errori rilevati
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public EventCallback<List<string>> EC_ValidError { get; set; }
|
||||
public EventCallback<Dictionary<string, string>> EC_ValidError { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Elenco anagrafiche di base
|
||||
@@ -550,6 +550,11 @@ namespace WebWindowComplex
|
||||
await EC_OnSelectedTemplate.InvokeAsync(newSel);
|
||||
}
|
||||
|
||||
protected override void OnAfterRender(bool firstRender)
|
||||
{
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Primo init componente
|
||||
/// </summary>
|
||||
@@ -559,19 +564,11 @@ namespace WebWindowComplex
|
||||
editLock = false;
|
||||
// reset variabile errori
|
||||
bError = false;
|
||||
validErrors = new List<string>();
|
||||
listErrPre = new Dictionary<string, string>();
|
||||
listErrLink = new Dictionary<string, string>();
|
||||
listWarnings = new Dictionary<string, string>();
|
||||
}
|
||||
|
||||
protected override void OnAfterRender(bool firstRender)
|
||||
{
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Booleana fase loading
|
||||
/// </summary>
|
||||
private bool isLoading = false;
|
||||
|
||||
/// <summary>
|
||||
/// Gestione update post ricezione parametri da controllo chiamante
|
||||
/// </summary>
|
||||
@@ -582,7 +579,9 @@ namespace WebWindowComplex
|
||||
if (ListPayload.IsPopulated() && LiveData.IsValid())
|
||||
{
|
||||
bool updateSvg = false;
|
||||
validErrors = new List<string>();
|
||||
listErrPre = new Dictionary<string, string>();
|
||||
listErrLink = new Dictionary<string, string>();
|
||||
listWarnings = new Dictionary<string, string>();
|
||||
// controllo elenchi BasePayload siano validi...
|
||||
if (ListPayload.IsValid())
|
||||
{
|
||||
@@ -600,15 +599,27 @@ namespace WebWindowComplex
|
||||
m_SelSVG = LiveData.SvgPreview;
|
||||
// Aggiornati parametri di ingresso selezionati
|
||||
UpdateSelParameter();
|
||||
JsonWindow WindowFromJson = JsonConvert.DeserializeObject<JsonWindow>(LiveData.CurrJwd, new PolymorphicJsonConverter()) ?? new JsonWindow("", "", "", "");
|
||||
setCurrWindow(WindowFromJson);
|
||||
//SOLO SE non sono in edit...
|
||||
if (!editLock)
|
||||
JsonWindow WindowFromJson = new JsonWindow("", "", "", "");
|
||||
// provo a deserializzare
|
||||
try
|
||||
{
|
||||
currStep = CompileStep.Tree;
|
||||
WindowFromJson = JsonConvert.DeserializeObject<JsonWindow>(LiveData.CurrJwd, new PolymorphicJsonConverter()) ?? new JsonWindow("", "", "", "");
|
||||
setCurrWindow(WindowFromJson);
|
||||
//SOLO SE non sono in edit...
|
||||
if (!editLock)
|
||||
{
|
||||
currStep = CompileStep.Tree;
|
||||
}
|
||||
}
|
||||
// altrimenti errore!
|
||||
catch (Exception ex)
|
||||
{
|
||||
listErrLink.Add("Window", $"Deserializing Error:{Environment.NewLine}{ex}");
|
||||
}
|
||||
|
||||
updateSvg = true;
|
||||
}
|
||||
checkWarnings();
|
||||
}
|
||||
else if (CurrSelection != null && CurrSelection.Template != null)
|
||||
{
|
||||
@@ -618,9 +629,19 @@ namespace WebWindowComplex
|
||||
m_SelTemplate = CurrSelection.Template;
|
||||
// Aggiornamento parametri di ingresso selezionati
|
||||
UpdateSelParameter();
|
||||
JsonWindow WindowFromJson = JsonConvert.DeserializeObject<JsonWindow>(m_SelTemplate.JWD, new PolymorphicJsonConverter()) ?? new JsonWindow("", "", "", "");
|
||||
setCurrWindow(WindowFromJson);
|
||||
currStep = CompileStep.Template;
|
||||
JsonWindow WindowFromJson = new JsonWindow("", "", "", "");
|
||||
// provo a deserializzare
|
||||
try
|
||||
{
|
||||
WindowFromJson = JsonConvert.DeserializeObject<JsonWindow>(m_SelTemplate.JWD, new PolymorphicJsonConverter()) ?? new JsonWindow("", "", "", "");
|
||||
setCurrWindow(WindowFromJson);
|
||||
currStep = CompileStep.Template;
|
||||
}
|
||||
// altrimenti errore!
|
||||
catch (Exception ex)
|
||||
{
|
||||
listErrLink.Add("Window", $"Deserializing Error:{Environment.NewLine}{ex}");
|
||||
}
|
||||
}
|
||||
updateSvg = true;
|
||||
}
|
||||
@@ -635,38 +656,72 @@ namespace WebWindowComplex
|
||||
}
|
||||
else
|
||||
{
|
||||
// verifico 1:1 le liste e indico cosa manca
|
||||
if (ListPayload.Hardware == null || ListPayload.Hardware.Count == 0)
|
||||
{
|
||||
validErrors.Add("Missing Hardware List!");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ListPayload.FamilyHardware == null || ListPayload.FamilyHardware.Count == 0)
|
||||
{
|
||||
validErrors.Add("Missing Famly HW List!");
|
||||
}
|
||||
}
|
||||
if (ListPayload.Glass == null || ListPayload.Glass.Count == 0)
|
||||
{
|
||||
validErrors.Add("Missing Glass List!");
|
||||
}
|
||||
if (ListPayload.Material == null || ListPayload.Material.Count == 0)
|
||||
{
|
||||
validErrors.Add("Missing Material List!");
|
||||
}
|
||||
if (ListPayload.ColorMaterial == null || ListPayload.ColorMaterial.Count == 0)
|
||||
{
|
||||
validErrors.Add("Missing ColorMaterial List!");
|
||||
}
|
||||
checkErrorPre();
|
||||
}
|
||||
isLoading = false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco errori preliminari di validazione
|
||||
/// Verifica errori prelimionari per mostrare dove sia il problema
|
||||
/// </summary>
|
||||
private List<string> validErrors = new List<string>();
|
||||
private void checkErrorPre()
|
||||
{
|
||||
// verifico 1:1 le liste e indico cosa manca
|
||||
if (ListPayload.Hardware == null || ListPayload.Hardware.Count == 0)
|
||||
{
|
||||
listErrPre.Add("Hardware", "Missing Hardware List!");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ListPayload.FamilyHardware == null || ListPayload.FamilyHardware.Count == 0)
|
||||
{
|
||||
listErrPre.Add("FamilyHardware", "Missing Famly HW List!");
|
||||
}
|
||||
}
|
||||
if (ListPayload.Glass == null || ListPayload.Glass.Count == 0)
|
||||
{
|
||||
listErrPre.Add("Glass", "Missing Glass List!");
|
||||
}
|
||||
if (ListPayload.Material == null || ListPayload.Material.Count == 0)
|
||||
{
|
||||
listErrPre.Add("Material", "Missing Material List!");
|
||||
}
|
||||
if (ListPayload.ColorMaterial == null || ListPayload.ColorMaterial.Count == 0)
|
||||
{
|
||||
listErrPre.Add("ColorMaterial", "Missing ColorMaterial List!");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifica warning minori (es coerenza colori...)
|
||||
/// </summary>
|
||||
private void checkWarnings()
|
||||
{
|
||||
// verifico 1:1 le liste e i valori siano coerenti...
|
||||
if (ListPayload.ColorMaterial != null && ListPayload.ColorMaterial.Count > 0)
|
||||
{
|
||||
// verifico colore attuale sia consistente...
|
||||
if (m_CurrWindow != null)
|
||||
{
|
||||
if (!ListPayload.ColorMaterial.Contains(m_CurrWindow.sColorMaterial))
|
||||
{
|
||||
listWarnings.Add("ColorMaterial", $"Missing Color: {m_CurrWindow.sColorMaterial}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Calcola CSS warning
|
||||
/// </summary>
|
||||
/// <param name="fKey"></param>
|
||||
/// <returns></returns>
|
||||
protected string cssValid(string fKey)
|
||||
{
|
||||
return listWarnings.ContainsKey(fKey) ? "border border-danger" : "";
|
||||
}
|
||||
|
||||
protected void setCurrWindow(JsonWindow WindowFromJson)
|
||||
{
|
||||
if (m_CurrWindow != null)
|
||||
@@ -729,12 +784,40 @@ namespace WebWindowComplex
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private bool bError = false;
|
||||
|
||||
private int currAnta = 0;
|
||||
|
||||
private int currFill = -1;
|
||||
|
||||
private int currSash = -1;
|
||||
|
||||
private int currSplit = -1;
|
||||
|
||||
private CompileStep currStep;
|
||||
|
||||
private bool editLock = false;
|
||||
|
||||
/// <summary>
|
||||
/// Booleana fase loading
|
||||
/// </summary>
|
||||
private bool isLoading = false;
|
||||
|
||||
/// <summary>
|
||||
/// ELenco errori di coerenza/link dati (vanno risolti per disegnare/procedere)
|
||||
/// </summary>
|
||||
private Dictionary<string, string> listErrLink = new Dictionary<string, string>();
|
||||
|
||||
/// <summary>
|
||||
/// Elenco errori preliminari (mancano elementi di base di validazione modello dati))
|
||||
/// </summary>
|
||||
private Dictionary<string, string> listErrPre = new Dictionary<string, string>();
|
||||
|
||||
/// <summary>
|
||||
/// Elenco warnings non bloccanti
|
||||
/// </summary>
|
||||
private Dictionary<string, string> listWarnings = new Dictionary<string, string>();
|
||||
|
||||
private List<Fill> m_FillList = new List<Fill>();
|
||||
|
||||
private Frame? m_Frame;
|
||||
@@ -772,6 +855,11 @@ namespace WebWindowComplex
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private void AddSashToFrame(Frame f)
|
||||
{
|
||||
bError = f.AddSash();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per andare allo step successivo
|
||||
/// </summary>
|
||||
@@ -1060,12 +1148,6 @@ namespace WebWindowComplex
|
||||
currStep = CompileStep.Tree;
|
||||
}
|
||||
|
||||
private bool bError = false;
|
||||
private void AddSashToFrame(Frame f)
|
||||
{
|
||||
bError = f.AddSash();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Metodo per scambiare due aree di uno split
|
||||
/// </summary>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Version>2.7.10.1009</Version>
|
||||
<Version>2.7.10.1010</Version>
|
||||
<Authors>Annamaria Sassi</Authors>
|
||||
<Company>Egalware</Company>
|
||||
<Description>Componente gestione Configurazioni avanzate Window per LUX</Description>
|
||||
@@ -152,6 +152,18 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user