From 5c3506b0fd502147f3ceab3bfb7c2eccabfc786d Mon Sep 17 00:00:00 2001 From: Annamaria Sassi Date: Fri, 6 Mar 2026 15:06:51 +0100 Subject: [PATCH] Corretta gestione jwd vuoto --- Test.UI/Components/Pages/BaseEdit.razor.cs | 4 +-- Test.UI/Components/Pages/EditJWD.razor.cs | 4 +-- Test.UI/Components/Pages/Home.razor.cs | 4 +-- WebWindowComplex/TableComp.razor | 4 +-- WebWindowComplex/TableComp.razor.cs | 31 ++++++++++--------- WebWindowComplex/WebWindowComplex.csproj | 4 ++- .../WebWindowConfigurator.csproj | 16 +++++++++- 7 files changed, 43 insertions(+), 24 deletions(-) diff --git a/Test.UI/Components/Pages/BaseEdit.razor.cs b/Test.UI/Components/Pages/BaseEdit.razor.cs index 3c21b67..878e010 100644 --- a/Test.UI/Components/Pages/BaseEdit.razor.cs +++ b/Test.UI/Components/Pages/BaseEdit.razor.cs @@ -382,8 +382,8 @@ namespace Test.UI.Components.Pages private void CloseObj(DataSave reqSave) { currJwd = reqSave.currJwd; - outClose = !reqSave.Dosave ? "Richiesto chiusura!" : ""; - outSave = reqSave.Dosave ? "Richiesto salvataggio!" : ""; + outClose = !reqSave.ForceSave ? "Richiesto chiusura!" : ""; + outSave = reqSave.ForceSave ? "Richiesto salvataggio!" : ""; } private void ConfInit() diff --git a/Test.UI/Components/Pages/EditJWD.razor.cs b/Test.UI/Components/Pages/EditJWD.razor.cs index 1a3c3cd..403a9c3 100644 --- a/Test.UI/Components/Pages/EditJWD.razor.cs +++ b/Test.UI/Components/Pages/EditJWD.razor.cs @@ -426,8 +426,8 @@ namespace Test.UI.Components.Pages private void CloseObj(DataSave reqSave) { currJwd = reqSave.currJwd; - outClose = !reqSave.Dosave ? "Richiesto chiusura!" : ""; - outSave = reqSave.Dosave ? "Richiesto salvataggio!" : ""; + outClose = !reqSave.ForceSave ? "Richiesto chiusura!" : ""; + outSave = reqSave.ForceSave ? "Richiesto salvataggio!" : ""; } private void ConfInit() diff --git a/Test.UI/Components/Pages/Home.razor.cs b/Test.UI/Components/Pages/Home.razor.cs index a2a8d55..0964fff 100644 --- a/Test.UI/Components/Pages/Home.razor.cs +++ b/Test.UI/Components/Pages/Home.razor.cs @@ -167,8 +167,8 @@ namespace Test.UI.Components.Pages private void CloseObj(DataSave reqSave) { currJwd = reqSave.currJwd; - outClose = !reqSave.Dosave ? "Richiesto chiusura!" : ""; - outSave = reqSave.Dosave ? "Richiesto salvataggio!" : ""; + outClose = !reqSave.ForceSave ? "Richiesto chiusura!" : ""; + outSave = reqSave.ForceSave ? "Richiesto salvataggio!" : ""; } private void ConfInit() diff --git a/WebWindowComplex/TableComp.razor b/WebWindowComplex/TableComp.razor index a4c4175..326fcb8 100644 --- a/WebWindowComplex/TableComp.razor +++ b/WebWindowComplex/TableComp.razor @@ -21,7 +21,7 @@ } - @* else if (listErrLink != null && listErrLink.Count > 0) + else if (listErrLink != null && listErrLink.Count > 0) {
Errore configurazione:
@@ -34,7 +34,7 @@
- } *@ + } else {
diff --git a/WebWindowComplex/TableComp.razor.cs b/WebWindowComplex/TableComp.razor.cs index 5568863..f00d73f 100644 --- a/WebWindowComplex/TableComp.razor.cs +++ b/WebWindowComplex/TableComp.razor.cs @@ -410,7 +410,7 @@ namespace WebWindowComplex DataSave dataSave = new DataSave() { currJwd = CurrJwd, - Dosave = false, + ForceSave = false, }; return EC_OnClose.InvokeAsync(dataSave); } @@ -572,7 +572,7 @@ namespace WebWindowComplex DataSave dataSave = new DataSave() { currJwd = CurrJwd, - Dosave = true, + ForceSave = true, }; return EC_OnClose.InvokeAsync(dataSave); } @@ -603,11 +603,11 @@ namespace WebWindowComplex { isLoading = true; // SOLO SE sono presenti... + listErrLink = new Dictionary(); if (ListPayload.IsPopulated() && LiveData.IsValid()) { bool updRequested = false; listErrPre = new Dictionary(); - listErrLink = new Dictionary(); listWarnings = new Dictionary(); // controllo elenchi BasePayload siano validi... if (ListPayload.IsValid()) @@ -634,6 +634,8 @@ namespace WebWindowComplex try { WindowFromJson = JsonConvert.DeserializeObject(LiveData.CurrJwd, new PolymorphicJsonConverter()) ?? new JsonWindow("", "", "", ""); + if (WindowFromJson == null || WindowFromJson.AreaList == null || WindowFromJson.AreaList.Count == 0) + WindowFromJson = BuildFrameDefault(); UpdateInputList(WindowFromJson); setCurrWindow(WindowFromJson); //SOLO SE non sono in edit... @@ -648,7 +650,8 @@ namespace WebWindowComplex listErrLink.Add("Window", $"Deserializing Error:{Environment.NewLine}{ex}"); Log.Error($"Errore nel deserializzare jwd: {ex.Message}"); // uso un oggetto "basico" per non fermarmi - await BuildFrameDefault(); + WindowFromJson =BuildFrameDefault(); + await DoPreviewSvg(true); } } else @@ -696,7 +699,9 @@ namespace WebWindowComplex } else { - await BuildFrameDefault(); + JsonWindow WindowFromJson = new JsonWindow("", "", "", ""); + WindowFromJson = BuildFrameDefault(); + await DoPreviewSvg(true); } } else @@ -707,7 +712,7 @@ namespace WebWindowComplex } } - private Task BuildFrameDefault() + private JsonWindow BuildFrameDefault() { // Costruisco window e setto i parametri Window window = new Window(); @@ -746,9 +751,7 @@ namespace WebWindowComplex frame.AreaList.Add(fill); JsonWindow jsonWindow = window.Serialize(); string jwd = JsonConvert.SerializeObject(jsonWindow); - JsonWindow WindowFromJson = JsonConvert.DeserializeObject(jwd, new PolymorphicJsonConverter()) ?? new JsonWindow("", "", "", ""); - setCurrWindow(WindowFromJson); - return DoPreviewSvg(true); + return JsonConvert.DeserializeObject(jwd, new PolymorphicJsonConverter()) ?? new JsonWindow("", "", "", ""); } /// @@ -761,9 +764,9 @@ namespace WebWindowComplex List groupIdList = new List(); SearchInWindow(window.AreaList.First(), groupIdList); var duplicati = groupIdList.GroupBy(x => x) - .Where(g => g.Count() > 1) - .Select(g => g.Key) - .ToList(); + .Where(g => g.Count() > 1) + .Select(g => g.Key) + .ToList(); if (duplicati.Count > 0) return false; else @@ -782,7 +785,7 @@ namespace WebWindowComplex } m_CurrWindow = WindowFromJson.Deserialize(); groupIdOK = CheckGroupId(m_CurrWindow); - if (m_CurrWindow.AreaList != null && m_CurrWindow.AreaList.Count > 0 && groupIdOK) + if (groupIdOK) { FrameWindow = m_CurrWindow.AreaList[0]; if (m_PreviousWindow != null) @@ -1957,6 +1960,6 @@ namespace WebWindowComplex public class DataSave { public string currJwd { get; set; } = ""; - public bool Dosave { get; set; } = true; + public bool ForceSave { get; set; } = true; } } diff --git a/WebWindowComplex/WebWindowComplex.csproj b/WebWindowComplex/WebWindowComplex.csproj index 743f5e4..77cf237 100644 --- a/WebWindowComplex/WebWindowComplex.csproj +++ b/WebWindowComplex/WebWindowComplex.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 3.1.3.611 + 3.1.3.615 Annamaria Sassi Egalware Componente gestione Configurazioni avanzate Window per LUX @@ -298,6 +298,8 @@ + + diff --git a/WebWindowConfigurator/WebWindowConfigurator.csproj b/WebWindowConfigurator/WebWindowConfigurator.csproj index 06f87a2..1a09ae1 100644 --- a/WebWindowConfigurator/WebWindowConfigurator.csproj +++ b/WebWindowConfigurator/WebWindowConfigurator.csproj @@ -6,7 +6,7 @@ net8.0 enable enable - 3.1.3.611 + 3.1.3.615 Annamaria Sassi Egalware Componente gestione JWD per LUX @@ -250,6 +250,20 @@ + + + + + + + + + + + + + +