diff --git a/Core/Utils.cs b/Core/Utils.cs
new file mode 100644
index 0000000..566c6b1
--- /dev/null
+++ b/Core/Utils.cs
@@ -0,0 +1,55 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Core
+{
+ public class Utils
+ {
+ ///
+ /// Effettua arrotondamento di un timespan ad un dato step di minuti
+ ///
+ /// vedere qui: https://stackoverflow.com/questions/1393696/rounding-datetime-objects
+ ///
+ /// DataOra originale
+ /// Minuti di arrotondamento richeisti
+ /// Arrotondamento x difetto (floor = true) o eccesso (false)
+ ///
+ public static TimeSpan TSpanRounded(TimeSpan TSpanOrig, int roundMin, bool isFloor)
+ {
+ long ticks = 0;
+ roundMin = roundMin <= 0 ? 1 : roundMin;
+ TimeOnly step = new TimeOnly(0, roundMin);
+ if (isFloor)
+ {
+ ticks = TSpanOrig.Ticks / step.Ticks;
+ }
+ else
+ {
+ ticks = (TSpanOrig.Ticks + step.Ticks - 1) / step.Ticks;
+ }
+ TimeSpan answ = new TimeSpan(ticks * step.Ticks);
+ return answ;
+ }
+
+ ///
+ /// Effettua arrotondamento di un timespan ad un dato step di minuti
+ ///
+ /// vedere qui: https://stackoverflow.com/questions/1393696/rounding-datetime-objects
+ ///
+ /// DataOra originale
+ /// Minuti di arrotondamento richeisti
+ ///
+ public static TimeSpan TSpanRounded(TimeSpan TSpanOrig, int roundMin)
+ {
+ long ticks = 0;
+ roundMin = roundMin <= 0 ? 1 : roundMin;
+ TimeOnly step = new TimeOnly(0, roundMin);
+ ticks = (TSpanOrig.Ticks + step.Ticks / 2) / step.Ticks;
+ TimeSpan answ = new TimeSpan(ticks * step.Ticks);
+ return answ;
+ }
+ }
+}
diff --git a/LiMan.Api/Resources/ChangeLog.html b/LiMan.Api/Resources/ChangeLog.html
index 05f4dbf..7b8852f 100644
--- a/LiMan.Api/Resources/ChangeLog.html
+++ b/LiMan.Api/Resources/ChangeLog.html
@@ -1,6 +1,6 @@
License Manager
- Versione: 2.1.2501.1112
+ Versione: 2.1.2501.1309
Note di rilascio:
-
diff --git a/LiMan.Api/Resources/VersNum.txt b/LiMan.Api/Resources/VersNum.txt
index fab5049..24770a5 100644
--- a/LiMan.Api/Resources/VersNum.txt
+++ b/LiMan.Api/Resources/VersNum.txt
@@ -1 +1 @@
-2.1.2501.1112
+2.1.2501.1309
diff --git a/LiMan.Api/Resources/manifest.xml b/LiMan.Api/Resources/manifest.xml
index 65e5182..ae0aea2 100644
--- a/LiMan.Api/Resources/manifest.xml
+++ b/LiMan.Api/Resources/manifest.xml
@@ -1,6 +1,6 @@
-
- 2.1.2501.1112
+ 2.1.2501.1309
https://nexus.steamware.net/repository/SWS/LiMan/stable/LAST/LiMan.UI.zip
https://nexus.steamware.net/repository/SWS/LiMan/stable/LAST/ChangeLog.html
false
diff --git a/LiMan.DB/Controllers/DbController.cs b/LiMan.DB/Controllers/DbController.cs
index de7a26d..ea9f53a 100644
--- a/LiMan.DB/Controllers/DbController.cs
+++ b/LiMan.DB/Controllers/DbController.cs
@@ -1468,6 +1468,82 @@ namespace LiMan.DB.Controllers
return fatto;
}
+ ///
+ /// Calcola statistiche install per il periodo indicato
+ ///
+ ///
+ ///
+ ///
+ public InstallStatusDTO InstallStatusGetInfo(DateTime dtStart, DateTime dtEnd)
+ {
+ InstallStatusDTO answ = new InstallStatusDTO();
+ using (LMDbContext localDbCtx = new LMDbContext(_configuration))
+ {
+ // conteggio preliminare licenze impiegate
+ var countSubLic = localDbCtx
+ .DbSetSubLicenze
+ .GroupBy(x => x.IdxLic)
+ .Select(g => new
+ {
+ IdxLic = g.Key,
+ NumLic = g.Count()
+ });
+
+ // raccolgo in primis info riguardo updater...
+ answ.UpdaterList = localDbCtx
+ .DbSetLicenze
+ .Where(x => x.CodApp == "UpdateManager")
+ .Select(x => new ApplicativoDTO()
+ {
+ IdxLic = x.IdxLic,
+ Chiave = x.Chiave,
+ CodApp = x.CodApp,
+ CodInst = x.CodInst,
+ Descrizione = x.Descrizione,
+ Tipo = x.Tipo,
+ Scadenza = x.Scadenza,
+ NumLicenze = x.NumLicenze,
+ NumLicenzeAttive = countSubLic.Where(s => s.IdxLic == x.IdxLic).Select(c => c.NumLic).FirstOrDefault(),
+ DataEnigma = x.DataEnigma,
+ Enigma = x.Enigma,
+ Payload = x.Payload
+ })
+ .ToList();
+
+ // recupero info x calcolare num chiamate nel periodo indicato...
+ var rawCallList = localDbCtx
+ .DbSetLogCall
+ .Where(x => x.DataRif >= dtStart && x.DataRif < dtEnd && x.TargetUrl.Contains("api/release"))
+ .ToList();
+
+ // eseguo conteggio x applicazione...
+ var countAppCall = rawCallList
+ .GroupBy(x => x.CodApp)
+ .OrderByDescending(x => x.Count())
+ .ToDictionary(g => g.Key, g => g.Count());
+ answ.ReqCountApp = countAppCall;
+
+ // ora conteggio per ORA chiamata...
+ var countHour = rawCallList
+ .GroupBy(x => x.DataRif.Date.AddHours(x.DataRif.Hour))
+ .ToDictionary(g => g.Key, g => g.Count());
+
+ answ.ReqCountHour = countHour;
+
+ // ora conteggio per GIORNO chiamata...
+ var countDay = rawCallList
+ .GroupBy(x => x.DataRif.Date)
+ .ToDictionary(g => g.Key, g => g.Count());
+
+ answ.ReqCountDay= countDay;
+
+ // ora passo a valorizzare i numeri relativi ad app e versioni...
+
+ }
+
+ return answ;
+ }
+
///
/// Effettua refresh del payload della licenza dato info + enigma generato dal client
///
diff --git a/LiMan.DB/DTO/AppRelStatusDTO.cs b/LiMan.DB/DTO/AppRelStatusDTO.cs
index 2d8921e..d9c4a75 100644
--- a/LiMan.DB/DTO/AppRelStatusDTO.cs
+++ b/LiMan.DB/DTO/AppRelStatusDTO.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
@@ -16,11 +17,61 @@ namespace LiMan.DB.DTO
public class AppRelStatusDTO
{
+ ///
+ /// CodApp Richiesta
+ ///
+ public string CodApp { get; set; } = "";
+
+ ///
+ /// Licenza Updater
+ ///
+ public int IdxLic { get; set; } = 0;
+
+ ///
+ /// Codice cliente
+ ///
+ public string Cliente { get; set; } = "";
+
+ ///
+ /// Istanza Updater (PC)
+ ///
+ public int IdxSubLic { get; set; } = 0;
+
+ ///
+ /// PC/Installazione specifica
+ ///
+ public string PcInst { get; set; } = "";
+
///
/// Conteggio del numero totale degli impieghi attivi (es conteggio IOB)
///
- public int NumLicenzeAttive { get; set; } = 1;
+ public int NumImp { get; set; } = 1;
+
+ ///
+ /// Versione Installata
+ ///
+ public string VersNumInstall { get; set; } = "0.0.0.0";
+
+ ///
+ /// Versione Release corrente
+ ///
+ public string VersNumCurrent { get; set; } = "0.0.0.0";
+
+ ///
+ /// Status aggiornamento:
+ /// 4 = corrente, 4 blocchi uguali (0.0.0.0)
+ /// 3 = 3 uguali, cambia 4 blocco (0.0.0.x)
+ /// 2 = 2 uguali, cambia 3 blocco (0.0.x.x)
+ /// 1 = 1 uguali, cambia 2 blocco (0.x.x.x)
+ /// 0 = 0 uguali, cambia 1 blocco (x.x.x.x)
+ ///
+ public int UpToDateStatus { get;set; } = 0;
+
+ ///
+ /// Data Ora ultimo controllo
+ ///
+ public DateTime DtCheck { get; set; } = DateTime.Now;
}
}
diff --git a/LiMan.DB/DTO/InstallStatusDTO.cs b/LiMan.DB/DTO/InstallStatusDTO.cs
index 546f44e..e70d86d 100644
--- a/LiMan.DB/DTO/InstallStatusDTO.cs
+++ b/LiMan.DB/DTO/InstallStatusDTO.cs
@@ -22,6 +22,11 @@ namespace LiMan.DB.DTO
///
public List UpdaterList { get; set; } = new List();
+ ///
+ /// Elenco chiamate con conteggio x CodApp
+ ///
+ public Dictionary ReqCountApp { get; set; } = new Dictionary();
+
///
/// Lista delle ultime richieste registrate (TargetUrl like '%release%') come conteggio orario (tipicamente 15 gg)
///
@@ -37,6 +42,15 @@ namespace LiMan.DB.DTO
///
public List InstallRelList { get; set; } = new List();
+ [NotMapped]
+ public int TotalUpdaterAct
+ {
+ get
+ {
+ return UpdaterList.Sum(x => x.NumLicenzeAttive);
+ }
+ }
+
///
/// Conteggio totale di tutte le applicazioni gestite, come somma CONTEGGIO degli applicativi diversi gestiti (per cliente)
///
@@ -57,7 +71,7 @@ namespace LiMan.DB.DTO
{
get
{
- return UpdaterList.Sum(x => x.NumLicenzeAttive) + InstallRelList.Sum(x => x.NumLicenzeAttive);
+ return UpdaterList.Sum(x => x.NumLicenzeAttive) + InstallRelList.Sum(x => x.NumImp);
}
}
diff --git a/LiMan.Transfer/Resources/ChangeLog.html b/LiMan.Transfer/Resources/ChangeLog.html
index 9e59e77..75da9e4 100644
--- a/LiMan.Transfer/Resources/ChangeLog.html
+++ b/LiMan.Transfer/Resources/ChangeLog.html
@@ -1,6 +1,6 @@
License Manager
-
Versione: 2.1.2501.1111
+ Versione: 2.1.2501.1309
Note di rilascio:
diff --git a/LiMan.Transfer/Resources/VersNum.txt b/LiMan.Transfer/Resources/VersNum.txt
index 6b1e063..24770a5 100644
--- a/LiMan.Transfer/Resources/VersNum.txt
+++ b/LiMan.Transfer/Resources/VersNum.txt
@@ -1 +1 @@
-2.1.2501.1111
+2.1.2501.1309
diff --git a/LiMan.Transfer/Resources/manifest.xml b/LiMan.Transfer/Resources/manifest.xml
index d3e4fa0..1760576 100644
--- a/LiMan.Transfer/Resources/manifest.xml
+++ b/LiMan.Transfer/Resources/manifest.xml
@@ -1,6 +1,6 @@
-
- 2.1.2501.1111
+ 2.1.2501.1309
https://nexus.steamware.net/repository/SWS/LiMan/stable/LAST/LiMan.Transfer.zip
https://nexus.steamware.net/repository/SWS/LiMan/stable/LAST/ChangeLog.html
false
diff --git a/LiMan.UI/Components/EnrollList.razor b/LiMan.UI/Components/EnrollList.razor
index be366d7..eb90dc2 100644
--- a/LiMan.UI/Components/EnrollList.razor
+++ b/LiMan.UI/Components/EnrollList.razor
@@ -103,14 +103,14 @@ else if (SelRecord != null)
@@ -230,6 +230,12 @@ else
}
+
}
diff --git a/LiMan.UI/Components/EnrollList.razor.cs b/LiMan.UI/Components/EnrollList.razor.cs
index 6e55f12..729f66b 100644
--- a/LiMan.UI/Components/EnrollList.razor.cs
+++ b/LiMan.UI/Components/EnrollList.razor.cs
@@ -152,6 +152,7 @@ namespace LiMan.UI.Components
protected override async Task OnParametersSetAsync()
{
+ await ReloadLicData();
await ReloadData();
}
@@ -286,6 +287,25 @@ namespace LiMan.UI.Components
ListInstall = await LMDService.InstallazioniNextGetAll();
}
+ ///
+ /// Recupera info licenza dato Idx x indicare licenza di assegnazione dell'enroll
+ ///
+ ///
+ ///
+ protected string DescrLic(int idxLic)
+ {
+ string answ = "NA";
+ if (idxLic > 0 && ListLicenze != null && ListLicenze.Count > 0)
+ {
+ var sRec = ListLicenze.FirstOrDefault(x => x.IdxLic == idxLic);
+ if (sRec != null)
+ {
+ answ = $"{sRec.CodInst}";
+ }
+ }
+ return answ;
+ }
+
#endregion Private Methods
}
}
\ No newline at end of file
diff --git a/LiMan.UI/Components/InstallInfoStats.razor b/LiMan.UI/Components/InstallInfoStats.razor
new file mode 100644
index 0000000..d0d0272
--- /dev/null
+++ b/LiMan.UI/Components/InstallInfoStats.razor
@@ -0,0 +1,54 @@
+
+
+
+
+ @if (isLoading)
+ {
+
+ }
+ else
+ {
+
+
+
+
-
+ Updater info
+
+
-
+
+ Licenze
+
+ @InfoStats.UpdaterList.Count
+
+
-
+
+ Istanze
+
+ @InfoStats.TotalUpdaterAct
+
+
-
+
+ Call / Hour
+
+ ???
+
+
-
+
+ Call / Day
+
+ ???
+
+
+
+
+
+
+ }
+
+
+
+
diff --git a/LiMan.UI/Components/InstallInfoStats.razor.cs b/LiMan.UI/Components/InstallInfoStats.razor.cs
new file mode 100644
index 0000000..2ddb425
--- /dev/null
+++ b/LiMan.UI/Components/InstallInfoStats.razor.cs
@@ -0,0 +1,35 @@
+using LiMan.DB.DTO;
+using LiMan.UI.Data;
+using Microsoft.AspNetCore.Components;
+using System;
+using System.Threading.Tasks;
+
+namespace LiMan.UI.Components
+{
+ public partial class InstallInfoStats
+ {
+
+
+ protected override async Task OnInitializedAsync()
+ {
+ await ReloadData();
+ }
+
+ [Inject]
+ protected LiManDataService LMDService { get; set; } = null!;
+
+ private DateTime DtInizio { get; set; } = DateTime.Today.AddMonths(-1);
+ private DateTime DtFine { get; set; } = DateTime.Today.AddHours(DateTime.Now.Hour);
+
+ private async Task ReloadData()
+ {
+ isLoading = true;
+ InfoStats = await LMDService.InstallStatusGetInfo(DtInizio, DtFine);
+ isLoading = false;
+ }
+
+ private bool isLoading { get; set; } = false;
+
+ private InstallStatusDTO InfoStats { get; set; } = new InstallStatusDTO();
+ }
+}
\ No newline at end of file
diff --git a/LiMan.UI/Data/LiManDataService.cs b/LiMan.UI/Data/LiManDataService.cs
index 635fa3d..49ec8d6 100644
--- a/LiMan.UI/Data/LiManDataService.cs
+++ b/LiMan.UI/Data/LiManDataService.cs
@@ -885,6 +885,55 @@ namespace LiMan.UI.Data
}
#endif
+ ///
+ /// Recupera info statistiche installazione dato periodo riferimento, da cache o da db
+ ///
+ ///
+ ///
+ public async Task InstallStatusGetInfo(DateTime dtStart, DateTime dtEnd)
+ {
+ string source = "DB";
+ InstallStatusDTO dbResult = new InstallStatusDTO();
+ try
+ {
+ string currKey = $"{Const.rKeyConfig}:InstVerSta:{dtStart:yyyyMMdd-HHmmss}:{dtEnd:yyyyMMdd-HHmmss}";
+ Stopwatch sw = new Stopwatch();
+ sw.Start();
+ string? rawData = await redisDb.StringGetAsync(currKey);
+ if (!string.IsNullOrEmpty(rawData))
+ {
+ source = "REDIS";
+ var tempResult = JsonConvert.DeserializeObject(rawData);
+ if (tempResult == null)
+ {
+ dbResult = new InstallStatusDTO();
+ }
+ else
+ {
+ dbResult = tempResult;
+ }
+ }
+ else
+ {
+ dbResult = dbControllerNext.InstallStatusGetInfo(dtStart, dtEnd);
+ rawData = JsonConvert.SerializeObject(dbResult, JSSettings);
+ await redisDb.StringSetAsync(currKey, rawData, UltraLongCache);
+ }
+ if (dbResult == null)
+ {
+ dbResult = new InstallStatusDTO();
+ }
+ sw.Stop();
+ TimeSpan ts = sw.Elapsed;
+ Log.Debug($"InstallStatusGetInfo | {source} in: {ts.TotalMilliseconds} ms");
+ }
+ catch (Exception exc)
+ {
+ Log.Error($"Error during InstallStatusGetInfo:{Environment.NewLine}{exc}");
+ }
+ return dbResult;
+ }
+
///
/// invalida tutta la cache in caso di update
///
diff --git a/LiMan.UI/LiMan.UI.csproj b/LiMan.UI/LiMan.UI.csproj
index 6567f33..80a889d 100644
--- a/LiMan.UI/LiMan.UI.csproj
+++ b/LiMan.UI/LiMan.UI.csproj
@@ -2,7 +2,7 @@
net6.0
- 2.1.2501.1112
+ 2.1.2501.1309
LiMan.UI
LiMan.UI
diff --git a/LiMan.UI/Pages/InstallVersStats.razor b/LiMan.UI/Pages/InstallVersStats.razor
new file mode 100644
index 0000000..26ed765
--- /dev/null
+++ b/LiMan.UI/Pages/InstallVersStats.razor
@@ -0,0 +1,7 @@
+@page "/InstallVersStats"
+@attribute [Authorize]
+
+
+
+
+
diff --git a/LiMan.UI/Pages/InstallVersStats.razor.cs b/LiMan.UI/Pages/InstallVersStats.razor.cs
new file mode 100644
index 0000000..2d86cb5
--- /dev/null
+++ b/LiMan.UI/Pages/InstallVersStats.razor.cs
@@ -0,0 +1,7 @@
+namespace LiMan.UI.Pages
+{
+ public partial class InstallVersStats
+ {
+
+ }
+}
\ No newline at end of file
diff --git a/LiMan.UI/Resources/ChangeLog.html b/LiMan.UI/Resources/ChangeLog.html
index 05f4dbf..7b8852f 100644
--- a/LiMan.UI/Resources/ChangeLog.html
+++ b/LiMan.UI/Resources/ChangeLog.html
@@ -1,6 +1,6 @@
License Manager
- Versione: 2.1.2501.1112
+ Versione: 2.1.2501.1309
Note di rilascio:
-
diff --git a/LiMan.UI/Resources/VersNum.txt b/LiMan.UI/Resources/VersNum.txt
index fab5049..24770a5 100644
--- a/LiMan.UI/Resources/VersNum.txt
+++ b/LiMan.UI/Resources/VersNum.txt
@@ -1 +1 @@
-2.1.2501.1112
+2.1.2501.1309
diff --git a/LiMan.UI/Resources/manifest.xml b/LiMan.UI/Resources/manifest.xml
index 65e5182..ae0aea2 100644
--- a/LiMan.UI/Resources/manifest.xml
+++ b/LiMan.UI/Resources/manifest.xml
@@ -1,6 +1,6 @@
-
- 2.1.2501.1112
+ 2.1.2501.1309
https://nexus.steamware.net/repository/SWS/LiMan/stable/LAST/LiMan.UI.zip
https://nexus.steamware.net/repository/SWS/LiMan/stable/LAST/ChangeLog.html
false
diff --git a/LiMan.UI/Shared/NavMenu.razor b/LiMan.UI/Shared/NavMenu.razor
index 3a2bcc3..c50edb9 100644
--- a/LiMan.UI/Shared/NavMenu.razor
+++ b/LiMan.UI/Shared/NavMenu.razor
@@ -24,6 +24,11 @@
+ -
+
+
+
+
-