Merge branch 'Release/StatTaskAndNumrecFix_03'

This commit is contained in:
Samuele Locatelli
2025-07-16 14:02:38 +02:00
11 changed files with 47 additions and 22 deletions
+2 -2
View File
@@ -36,7 +36,7 @@ namespace MP.Stats.Controllers
public async Task<List<TaskResultModel>> ExecuteAndReturnGet()
{
List<TaskResultModel> answ = new List<TaskResultModel>();
List<TaskListModel> listTask = await DService.TaskListAll(TaskMan.Objects.Enums.Task2ExeType.ALL, "");
List<TaskListModel> listTask = await DService.TaskListAll(TaskMan.Objects.Enums.Task2ExeType.ALL, false, "");
// verifico SE ci siano task in scadenza...
DateTime adesso = DateTime.Now;
var task2exe = listTask.Where(x => x.DtNextExec <= adesso).ToList();
@@ -56,7 +56,7 @@ namespace MP.Stats.Controllers
[HttpGet("GetList")]
public async Task<List<TaskListModel>> GetList()
{
List<TaskListModel> answ = await DService.TaskListAll(TaskMan.Objects.Enums.Task2ExeType.ALL, "");
List<TaskListModel> answ = await DService.TaskListAll(TaskMan.Objects.Enums.Task2ExeType.ALL, false, "");
return answ;
}
+2 -2
View File
@@ -4,8 +4,8 @@
<TargetFramework>net6.0</TargetFramework>
<RootNamespace>MP.Stats</RootNamespace>
<UserSecretsId>826e877c-ba70-4253-84cb-d0b1cafd4440</UserSecretsId>
<Version>6.16.2507.1611</Version>
<Version>6.16.2507.1611</Version>
<Version>6.16.2507.1613</Version>
<Version>6.16.2507.1613</Version>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>$(NoWarn);1591</NoWarn>
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
+1 -1
View File
@@ -1,3 +1,3 @@
@page "/TaskScheduler"
<TaskList></TaskList>
<TaskList RedisEnabled="@EnableRedis"></TaskList>
+7
View File
@@ -11,6 +11,7 @@ using MP.Data.DbModels;
using Microsoft.AspNetCore.DataProtection;
using MP.TaskMan.Models;
using static MP.TaskMan.Objects.Enums;
using Microsoft.Extensions.Configuration;
namespace MP.Stats.Pages
{
@@ -23,6 +24,9 @@ namespace MP.Stats.Pages
[Inject]
protected MessageService MServ { get; set; } = null!;
[Inject]
protected IConfiguration ConfMan { get; set; }
#endregion Protected Properties
#region Protected Methods
@@ -32,8 +36,11 @@ namespace MP.Stats.Pages
MServ.ShowSearch = true;
MServ.PageName = "Task Scheduler";
MServ.PageIcon = "oi oi-clock";
EnableRedis = ConfMan.GetValue<bool>("ServerConf:TaskEnableRedis");
}
private bool EnableRedis = true;
#endregion Protected Methods
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo statistiche MAPO</i>
<h4>Versione: 6.16.2507.1611</h4>
<h4>Versione: 6.16.2507.1613</h4>
<br />
Note di rilascio:
<ul>
+1 -1
View File
@@ -1 +1 @@
6.16.2507.1611
6.16.2507.1613
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2507.1611</version>
<version>6.16.2507.1613</version>
<url>https://nexus.steamware.net/repository/SWS/MP-STATS/stable/LAST/MP.Stats.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-STATS/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>
+1
View File
@@ -61,6 +61,7 @@
"FormatDur": "HH:mm.ss.ff",
"SpecialConf": {
"AppUrl": "/MP/STATS",
"TaskEnableRedis": false,
"TaskManConn": "MP.Stats",
"RedisBaseConf": "MP:TASK:STATS"
},
+20 -12
View File
@@ -247,7 +247,7 @@ namespace MP.TaskMan.Services
else
{
result = MLController.TaskExecGetFilt(TaskId, maxRec);
// serializzp e salvo...
// serializzo e salvo...
rawData = JsonConvert.SerializeObject(result);
await redisDb.StringSetAsync(currKey, rawData, FastCache);
}
@@ -263,10 +263,11 @@ namespace MP.TaskMan.Services
/// <summary>
/// Elenco TaskList gestiti
/// </summary>
/// <param name="TType"></param>
/// <param name="searchVal"></param>
/// <param name="TType">Tipo task da recuperare</param>
/// <param name="enabRedis">Abilitazioen cache REDIS</param>
/// <param name="searchVal">Valore cercato</param>
/// <returns></returns>
public async Task<List<TaskListModel>> TaskListAll(Task2ExeType TType, string searchVal = "")
public async Task<List<TaskListModel>> TaskListAll(Task2ExeType TType, bool enabRedis, string searchVal = "")
{
// setup parametri costanti
string source = "DB";
@@ -275,19 +276,26 @@ namespace MP.TaskMan.Services
List<TaskListModel>? result = new List<TaskListModel>();
// cerco in redis...
DateTime adesso = DateTime.Now;
string currKey = $"{RedisBaseKey}:List:{TType}";
RedisValue rawData = await redisDb.StringGetAsync(currKey);
if (rawData.HasValue)
if (enabRedis)
{
result = JsonConvert.DeserializeObject<List<TaskListModel>>($"{rawData}");
source = "REDIS";
string currKey = $"{RedisBaseKey}:List:{TType}";
RedisValue rawData = await redisDb.StringGetAsync(currKey);
if (enabRedis && rawData.HasValue && rawData.Length() > 2)
{
result = JsonConvert.DeserializeObject<List<TaskListModel>>($"{rawData}");
source = "REDIS";
}
else
{
result = MLController.TaskListGetAll(TType);
// serializzo e salvo...
rawData = JsonConvert.SerializeObject(result);
await redisDb.StringSetAsync(currKey, rawData, FastCache);
}
}
else
{
result = MLController.TaskListGetAll(TType);
// serializzp e salvo...
rawData = JsonConvert.SerializeObject(result);
await redisDb.StringSetAsync(currKey, rawData, FastCache);
}
if (result == null)
{
-1
View File
@@ -58,7 +58,6 @@
{
<TaskListTable CodGroup="item.Key" AllRecords="item.Value" EC_DoReset="DoReset" EC_ForceAll="ForceAll" EC_Cancel="DoCancel" EC_Clone="DoClone" EC_Select="DoSelect" EC_Edit="DoEdit" EC_Run="DoRun" EC_Move="DoMove"></TaskListTable>
}
@* <TaskListTable AllRecords="SearchRecords" EC_DoReset="DoReset" EC_ForceAll="ForceAll" EC_Cancel="DoCancel" EC_Clone="DoClone" EC_Select="DoSelect" EC_Edit="DoEdit" EC_Run="DoRun" EC_Move="DoMove"></TaskListTable> *@
</div>
</div>
}
+11 -1
View File
@@ -8,6 +8,16 @@ namespace MP.TaskMan
{
public partial class TaskList : ComponentBase
{
#region Public Properties
/// <summary>
/// Cache Redis abilitata o meno
/// </summary>
[Parameter]
public bool RedisEnabled { get; set; } = false;
#endregion Public Properties
#region Protected Properties
[Inject]
@@ -237,7 +247,7 @@ namespace MP.TaskMan
private async Task ReloadData()
{
SearchRecords = await TService.TaskListAll(TypeSel, SearchVal);
SearchRecords = await TService.TaskListAll(TypeSel, RedisEnabled, SearchVal);
// suddivido per gruppo e genero relativo display raggruppato
ListRecords = SearchRecords
.OrderBy(x => x.Group)