update x gestione refresh dati vocabolario

This commit is contained in:
Samuele Locatelli
2023-07-21 08:39:19 +02:00
parent 09c55be1e7
commit ccd9dca9fe
10 changed files with 134 additions and 84 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>WebDoorCreator - Egalware</i>
<h4>Version: 0.9.2307.2018</h4>
<h4>Version: 0.9.2307.2108</h4>
<br /> Release note:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
0.9.2307.2018
0.9.2307.2108
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>0.9.2307.2018</version>
<version>0.9.2307.2108</version>
<url>http://nexus.steamware.net/repository/SWS/WDC/stable/WDC.UI.zip</url>
<changelog>http://nexus.steamware.net/repository/SWS/WDC/stable/ChangeLog.html</changelog>
<mandatory>false</mandatory>
@@ -1,63 +1,55 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
using System.Net.Http;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.AspNetCore.Components.Forms;
using Microsoft.AspNetCore.Components.Routing;
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components.Web.Virtualization;
using Microsoft.JSInterop;
using EgwCoreLib.Razor;
using EgwCoreLib.Utils;
using WebDoorCreator.Data;
using WebDoorCreator.Data.DbModels;
using WebDoorCreator.UI;
using WebDoorCreator.UI.Components;
using WebDoorCreator.UI.Components.Buttons;
using WebDoorCreator.UI.Components.CompMan;
using WebDoorCreator.UI.Components.DoorMan;
using WebDoorCreator.UI.Components.DoorDef;
using WebDoorCreator.UI.Components.Gen;
using WebDoorCreator.UI.Components.Order;
using WebDoorCreator.UI.Components.Users;
using WebDoorCreator.UI.Components.Hardware;
using WebDoorCreator.UI.Components.SvgComp;
using WebDoorCreator.UI.Components.Filters;
using WebDoorCreator.UI.Components.Report;
using WebDoorCreator.UI.Components.FilesMan;
using WebDoorCreator.UI.Components.TemplateMan;
using WebDoorCreator.UI.Shared;
using WebDoorCreator.Data.Services;
using WebDoorCreator.UI.Pages;
using System.Runtime.InteropServices;
using WebDoorCreator.UI.Data;
namespace WebDoorCreator.UI.Components.FilesMan
{
public partial class HwMan
{
#region Protected Fields
protected List<DoorOpTypeModel> doorOpTypes = new List<DoorOpTypeModel>();
protected List<ListValuesModel> hwList = new List<ListValuesModel>();
#endregion Protected Fields
#region Protected Properties
protected DoorOpTypeModel? currHw2Show { get; set; } = null;
[Inject]
protected WebDoorCreatorService WDCService { get; set; } = null!;
[Inject]
protected WDCVocabularyService WDCVService { get; set; } = null!;
[Inject]
protected WDCUserService WDCUService { get; set; } = null!;
[Inject]
protected WDCVocabularyService WDCVService { get; set; } = null!;
#endregion Protected Properties
#region Protected Methods
protected string GetCompoName(string hwCode)
{
string answ = "";
var listValHw2Search = hwList.Where(x => x.TableName == hwCode).FirstOrDefault();
if (listValHw2Search != null)
{
answ = translate(listValHw2Search.Label);
}
return answ;
}
protected override async Task OnParametersSetAsync()
{
await ReloadData();
}
protected async Task ReloadData()
{
var temp = await WDCService.DoorOpTypeGetByHwCode("*", 0);
@@ -66,11 +58,18 @@ namespace WebDoorCreator.UI.Components.FilesMan
{
doorOpTypes = temp;
}
if(tempHwList != null)
if (tempHwList != null)
{
hwList = tempHwList;
}
}
protected async Task setCurrHw2Show(DoorOpTypeModel hw)
{
await Task.Delay(1);
currHw2Show = hw;
}
protected string translate(string lemma)
{
string answ = "";
@@ -80,26 +79,6 @@ namespace WebDoorCreator.UI.Components.FilesMan
return answ;
}
protected DoorOpTypeModel? currHw2Show { get; set; } = null;
protected string GetCompoName(string hwCode)
{
string answ = "";
var listValHw2Search = hwList.Where(x => x.TableName == hwCode).FirstOrDefault();
if(listValHw2Search != null)
{
answ = translate(listValHw2Search.Label);
}
return answ;
}
protected async Task setCurrHw2Show(DoorOpTypeModel hw)
{
await Task.Delay(1);
currHw2Show = hw;
}
#endregion Protected Methods
}
}
@@ -47,6 +47,11 @@
<span class="fa-solid fa-paint-roller pe-2" aria-hidden="true"></span> Template Management
</NavLink>
</div>
<div class="nav-item px-1 align-items-center">
<NavLink class="nav-link text-nowrap" href="ForceReload">
<span class="fa-solid fa-sync-alt pe-2" aria-hidden="true"></span> Reload Data
</NavLink>
</div>
</Authorized>
</AuthorizeView>
<!--help finale-->
+42 -15
View File
@@ -1,7 +1,6 @@
using Microsoft.AspNetCore.Identity.UI.Services;
using Newtonsoft.Json;
using NLog;
using Org.BouncyCastle.Asn1.X500;
using StackExchange.Redis;
using System.Diagnostics;
using WebDoorCreator.Data.Controllers;
@@ -10,8 +9,14 @@ namespace WebDoorCreator.UI.Data
{
public class WDCVocabularyService
{
#region Public Fields
public static WebDoorCreatorController dbController = null!;
#endregion Public Fields
#region Public Constructors
public WDCVocabularyService(IConfiguration configuration, IConnectionMultiplexer redisConnMult, IEmailSender emailSender)
{
_configuration = configuration;
@@ -49,7 +54,11 @@ namespace WebDoorCreator.UI.Data
Log.Info("Avviata classe WDCVocabularyService");
}
#endregion Public Constructors
#region Public Properties
public string CodApp { get; set; } = "";
public Dictionary<string, Dictionary<string, string>>? VocabularyLemmas
{
@@ -63,12 +72,17 @@ namespace WebDoorCreator.UI.Data
}
}
#endregion Public Properties
private Dictionary<string, Dictionary<string, string>>? _vocabularyLemmas { get; set; } = null;
#region Public Methods
private TimeSpan UltraLongCache
/// <summary>
/// Forza reload vocabolario
/// </summary>
/// <returns></returns>
public async Task ReloadVoc()
{
get => TimeSpan.FromSeconds(cacheTtlLong * 10 * rnd.Next(900, 1100) / 1000);
VocabularyLemmas = await VocLemmaGetAll();
}
public string Traduci(string lingua, string lemma)
@@ -124,6 +138,22 @@ namespace WebDoorCreator.UI.Data
return dbResult;
}
#endregion Public Methods
#region Protected Fields
protected const string redisBaseAddr = "WDC";
protected const string rKeyVocLemma = $"{redisBaseAddr}:Cache:VocLemma";
protected Random rnd = new Random();
#endregion Protected Fields
#region Private Fields
private static IConfiguration _configuration = null!;
private static JsonSerializerSettings? JSSettings;
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
private readonly IEmailSender _emailSender;
/// <summary>
/// Durata cache lunga IN SECONDI
@@ -140,20 +170,17 @@ namespace WebDoorCreator.UI.Data
/// </summary>
private IDatabase redisDb = null!;
protected const string redisBaseAddr = "WDC";
#endregion Private Fields
protected const string rKeyVocLemma = $"{redisBaseAddr}:Cache:VocLemma";
#region Private Properties
protected Random rnd = new Random();
private Dictionary<string, Dictionary<string, string>>? _vocabularyLemmas { get; set; } = null;
private static IConfiguration _configuration = null!;
private TimeSpan UltraLongCache
{
get => TimeSpan.FromSeconds(cacheTtlLong * 10 * rnd.Next(900, 1100) / 1000);
}
private static JsonSerializerSettings? JSSettings;
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
private readonly IEmailSender _emailSender;
public string CodApp { get; set; } = "";
#endregion Private Properties
}
}
@@ -0,0 +1,5 @@
@page "/ForceReload"
<h3>Refreshing Data</h3>
<LoadingData></LoadingData>
@@ -0,0 +1,34 @@
using Microsoft.AspNetCore.Components;
using WebDoorCreator.Data.Services;
using WebDoorCreator.UI.Data;
namespace WebDoorCreator.UI.Pages
{
public partial class ForceReload
{
#region Protected Properties
[Inject]
protected NavigationManager NavManager { get; set; } = null!;
[Inject]
protected WDCVocabularyService WDCVService { get; set; } = null!;
[Inject]
protected WebDoorCreatorService WDService { get; set; } = null!;
#endregion Protected Properties
#region Protected Methods
protected override async Task OnInitializedAsync()
{
await WDService.FlushCustomPattern("Cache");
await Task.Delay(1);
await WDCVService.ReloadVoc();
NavManager.NavigateTo("OrdersHomePage", true);
}
#endregion Protected Methods
}
}
+1 -1
View File
@@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<Version>0.9.2307.2018</Version>
<Version>0.9.2307.2108</Version>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>aspnet-WebDoorCreator.UI-dfe95fed-1398-4144-bd43-8b3a765d6608</UserSecretsId>
</PropertyGroup>
+6 -6
View File
@@ -7,12 +7,12 @@
},
"AllowedHosts": "*",
"ConnectionStrings": {
"Redis": "nkcredis.steamware.net:6379, DefaultDatabase=11, connectTimeout=5000, syncTimeout=5000, asyncTimeout=5000, abortConnect=false, ssl=false, password=BtN9Py1wtLfLRvmzWnOPJ7RytDM+CLiVsJ/16zduNTlV8IOPGNrtzJSXPUnImA5PqmUMhKaUqo9NdHIG",
"Identity.DB": "Server=SQL2016DEV;Database=WebDoorCreator; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=WebDoorCreator.UI;",
"WDC.DB": "Server=SQL2016DEV;Database=WebDoorCreator; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=WebDoorCreator.UI;"
//"Redis": "nkcredis.steamware.net:6379, DefaultDatabase=12, connectTimeout=5000, syncTimeout=5000, asyncTimeout=5000, abortConnect=false, ssl=false, password=BtN9Py1wtLfLRvmzWnOPJ7RytDM+CLiVsJ/16zduNTlV8IOPGNrtzJSXPUnImA5PqmUMhKaUqo9NdHIG",
//"Identity.DB": "Server=SQL2016PROD;Database=DCA_WebDoorCreator; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=WebDoorCreator.UI;",
//"WDC.DB": "Server=SQL2016PROD;Database=DCA_WebDoorCreator; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=WebDoorCreator.UI;"
//"Redis": "nkcredis.steamware.net:6379, DefaultDatabase=11, connectTimeout=5000, syncTimeout=5000, asyncTimeout=5000, abortConnect=false, ssl=false, password=BtN9Py1wtLfLRvmzWnOPJ7RytDM+CLiVsJ/16zduNTlV8IOPGNrtzJSXPUnImA5PqmUMhKaUqo9NdHIG",
//"Identity.DB": "Server=SQL2016DEV;Database=WebDoorCreator; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=WebDoorCreator.UI;",
//"WDC.DB": "Server=SQL2016DEV;Database=WebDoorCreator; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=WebDoorCreator.UI;"
"Redis": "nkcredis.steamware.net:6379, DefaultDatabase=12, connectTimeout=5000, syncTimeout=5000, asyncTimeout=5000, abortConnect=false, ssl=false, password=BtN9Py1wtLfLRvmzWnOPJ7RytDM+CLiVsJ/16zduNTlV8IOPGNrtzJSXPUnImA5PqmUMhKaUqo9NdHIG",
"Identity.DB": "Server=SQL2016PROD;Database=DCA_WebDoorCreator; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=WebDoorCreator.UI;",
"WDC.DB": "Server=SQL2016PROD;Database=DCA_WebDoorCreator; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=WebDoorCreator.UI;"
},
"ExternalProviders": {
"MailKit": {