Tentativo cache HistPlot (non si vede +...)

This commit is contained in:
Samuele Locatelli
2022-09-23 17:05:06 +02:00
parent 294896905e
commit 948675e24c
25 changed files with 196 additions and 69 deletions
+1 -1
View File
@@ -6,7 +6,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Platforms>AnyCPU;x86;x64</Platforms>
<Version>1.2.2209.2315</Version>
<Version>1.2.2209.2317</Version>
</PropertyGroup>
<ItemGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>MAPO-MONO</i>
<h4>Version: 1.2.2209.2315</h4>
<h4>Version: 1.2.2209.2317</h4>
<br /> Release Note:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
1.2.2209.2315
1.2.2209.2317
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>1.2.2209.2315</version>
<version>1.2.2209.2317</version>
<url>http://nexus.steamware.net/repository/SWS/MP.MONO.ANALYZER/stable/LAST/MP.Mon.zip</url>
<changelog>http://nexus.steamware.net/repository/SWS/MP.MONO.ANALYZER/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>
+4
View File
@@ -55,6 +55,10 @@ namespace MP.MONO.Core
public static readonly string TOOLS_CURR_KEY = $"{BASE_HASH}:Current:Tools";
public static readonly string COUNT_CURR_KEY = $"{BASE_HASH}:Current:Counters";
// REDIS KEY Dati cache
public static readonly string DATA_LOG_KEY = $"{BASE_HASH}:Cache:DataLog";
// REDIS Channels messaggi (verso UI)
public static readonly string ACT_LOG_M_QUEUE = $"ActivityLog";
public static readonly string ALARM_M_QUEUE = $"Alarms";
+1 -1
View File
@@ -6,7 +6,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Platforms>AnyCPU;x86;x64</Platforms>
<Version>1.2.2209.2315</Version>
<Version>1.2.2209.2317</Version>
</PropertyGroup>
<ItemGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>MAPO-MONO</i>
<h4>Version: 1.2.2209.2315</h4>
<h4>Version: 1.2.2209.2317</h4>
<br /> Release Note:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
1.2.2209.2315
1.2.2209.2317
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>1.2.2209.2315</version>
<version>1.2.2209.2317</version>
<url>http://nexus.steamware.net/repository/SWS/MP.MONO.DECODER/stable/LAST/MP.Mon.zip</url>
<changelog>http://nexus.steamware.net/repository/SWS/MP.MONO.DECODER/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>
+1 -1
View File
@@ -6,7 +6,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Platforms>AnyCPU;x86;x64</Platforms>
<Version>1.2.2209.2315</Version>
<Version>1.2.2209.2317</Version>
</PropertyGroup>
<ItemGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>MAPO-MONO</i>
<h4>Version: 1.2.2209.2315</h4>
<h4>Version: 1.2.2209.2317</h4>
<br /> Release Note:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
1.2.2209.2315
1.2.2209.2317
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>1.2.2209.2315</version>
<version>1.2.2209.2317</version>
<url>http://nexus.steamware.net/repository/SWS/MP.MONO.SIM/stable/LAST/MP.Mon.zip</url>
<changelog>http://nexus.steamware.net/repository/SWS/MP.MONO.SIM/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>
+5 -1
View File
@@ -27,4 +27,8 @@
</div>
</div>
}
@*else
{
<LoadingData></LoadingData>
}
*@
+30 -37
View File
@@ -1,5 +1,6 @@
using Microsoft.AspNetCore.Components;
using MP.MONO.Data;
using MP.MONO.UI.Data;
using MP.MONO.Data.DbModels;
namespace MP.MONO.UI.Components
@@ -31,8 +32,7 @@ namespace MP.MONO.UI.Components
#region Protected Properties
protected string _selParam { get; set; } = "";
protected DateTime DateFrom { get; set; } = DateTime.Today.AddDays(-1);
protected DateTime DateTo { get; set; } = DateTime.Today.AddDays(1);
protected string? MaxVal
{
@@ -65,22 +65,32 @@ namespace MP.MONO.UI.Components
#endregion Protected Properties
#region Public Properties
protected DataLogFilter _SelFilter { get; set; } = new DataLogFilter();
[Parameter]
public DateTime EndDate
public DataLogFilter SelFilter
{
get
{
return DateTo;
}
get => _SelFilter;
set
{
DateTo = value;
var pUpd = Task.Run(async () => await ReloadData());
pUpd.Wait();
if (!_SelFilter.Equals(value))
{
_SelFilter = value;
var pUpd = Task.Run(async () => await ReloadData());
pUpd.Wait();
}
}
}
//[Parameter]
//public DateTime EndDate
private DateTime EndDate
{
get => _SelFilter.DtEnd;
//set => _SelFilter.DtEnd = value;
}
[Parameter]
public int MachineId { get; set; } = 1;
@@ -92,36 +102,16 @@ namespace MP.MONO.UI.Components
[Parameter]
public string SelectedParam
{
get
{
return _selParam;
}
set
{
// controllo se è variato
if (_selParam != value)
{
// salvo
_selParam = value;
var pUpd = Task.Run(async () => await ReloadData());
pUpd.Wait();
}
}
get => _selParam;
set => _selParam = value;
}
[Parameter]
public DateTime StartDate
//[Parameter]
//public DateTime StartDate
private DateTime StartDate
{
get
{
return DateFrom;
}
set
{
DateFrom = value;
var pUpd = Task.Run(async () => await ReloadData());
pUpd.Wait();
}
get => _SelFilter.DtStart;
//set => _SelFilter.DtStart = value;
}
#endregion Public Properties
@@ -151,6 +141,9 @@ namespace MP.MONO.UI.Components
protected override async Task OnInitializedAsync()
{
//isLoading = true;
//ListRecords = null;
//await Task.Delay(1);
await ReloadData();
await Task.Delay(1);
}
+20 -3
View File
@@ -193,13 +193,30 @@ namespace MP.MONO.UI.Data
public async Task<List<DataLogModel>> DataLogGetFilt(int machineId, string fluxType, DateTime inizio, DateTime fine)
{
string source = "DB";
List<DataLogModel> dbResult = new List<DataLogModel>();
string currKey = $"{Constants.DATA_LOG_KEY}:{machineId}:{fluxType.Replace(" ", "_")}:{inizio:yyyyMMdd}:{fine:yyyyMMdd}";
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
var dbResult = dbController.DataLogGetFilt(machineId, fluxType, inizio, fine);
string rawData = await redisDb.StringGetAsync(currKey);
if (!string.IsNullOrEmpty(rawData))
{
source = "REDIS";
var redisRes = JsonConvert.DeserializeObject<List<DataLogModel>>(rawData);
dbResult = redisRes != null ? dbResult : new List<DataLogModel>();
}
else
{
dbResult = dbController.DataLogGetFilt(machineId, fluxType, inizio, fine);
// salvo per 1 minuto...
rawData=JsonConvert.SerializeObject(dbResult);
// test!!!
await redisDb.StringSetAsync(currKey, rawData, TimeSpan.FromSeconds(60));
}
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"Effettuata lettura da DB ParamLogGetFilt: {ts.TotalMilliseconds} ms");
return await Task.FromResult(dbResult);
Log.Info($"DataLogGetFilt | {machineId} | {fluxType} | {inizio:yyyyMMdd}-{fine:yyyyMMdd} | {source} | {ts.TotalMilliseconds} ms");
return dbResult;
}
public void Dispose()
+28
View File
@@ -0,0 +1,28 @@
namespace MP.MONO.UI.Data
{
public class DataLogFilter
{
public DateTime DtStart { get; set; } = DateTime.Today;
public DateTime DtEnd { get; set; } = DateTime.Today;
public override bool Equals(object obj)
{
if (!(obj is DataLogFilter item))
return false;
if (DtStart != item.DtStart)
return false;
if (DtEnd != item.DtEnd)
return false;
return true;
}
public override int GetHashCode()
{
return base.GetHashCode();
}
}
}
+5 -1
View File
@@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<Platforms>AnyCPU;x86;x64</Platforms>
<Version>1.2.2209.2315</Version>
<Version>1.2.2209.2317</Version>
</PropertyGroup>
<ItemGroup>
@@ -15,10 +15,14 @@
<ItemGroup>
<Content Remove="compilerconfig.json" />
<Content Remove="Components\ChartController.razor" />
<Content Remove="NLog.config" />
</ItemGroup>
<ItemGroup>
<None Include="compilerconfig.json" />
<None Include="NLog.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
+58
View File
@@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
autoReload="true"
throwExceptions="false"
internalLogLevel="Off" internalLogFile="c:\temp\nlog-internal.log">
<!-- optional, add some variables
https://github.com/nlog/NLog/wiki/Configuration-file#variables
-->
<variable name="myvar" value="myvalue" />
<!--
See https://github.com/nlog/nlog/wiki/Configuration-file
for information on customizing logging rules and outputs.
-->
<targets>
<!--
add your targets here
See https://github.com/nlog/NLog/wiki/Targets for possible targets.
See https://github.com/nlog/NLog/wiki/Layout-Renderers for the possible layout renderers.
-->
<!--
Write events to a file with the date in the filename.
<target xsi:type="File" name="f" fileName="${basedir}/logs/${shortdate}.log"
layout="${longdate} ${uppercase:${level}} ${message}" />
-->
<target xsi:type="File"
name="fileTarget"
fileName="${basedir}/logs/${shortdate}.log"
layout="${longdate} | ${uppercase:${level}} | ${logger:shortName=false} | ${message}"
archiveFileName="${basedir}/logs/${shortdate}.{###}.zip"
archiveNumbering="Sequence"
archiveAboveSize="1024000"
maxArchiveFiles="90"
enableArchiveFileCompression="true"
keepFileOpen="false"
/>
<target xsi:type="ColoredConsole"
name="consoleTarget"
layout="${longdate} | ${uppercase:${level}} | ${logger:shortName=true}| ${message}" />
</targets>
<rules>
<!-- add your logging rules here -->
<!--
Write all events with minimal level of Debug (So Debug, Info, Warn, Error and Fatal, but not Trace) to "f"
<logger name="*" minlevel="Debug" writeTo="f" />
-->
<!--<logger name="Microsoft.*" maxlevel="Info" final="true" />-->
<!--<logger name="*" minlevel="Trace" writeTo="consoleTarget" />-->
<logger name="*" minlevel="Info" writeTo="fileTarget" />
</rules>
</nlog>
+15 -10
View File
@@ -73,18 +73,23 @@
{
<div class="row">
@foreach (var item in selParams)
@if (isRT)
{
<div class="@pcss">
@if (isRT)
{
@foreach (var item in selParams)
{
<div class="@pcss">
<ParamPlotRT SelectedParam="@item" maxRecord="@maxRecord" sampleSecMin="@sampleSecMin"></ParamPlotRT>
}
else
{
<ParamPlot SelectedParam="@item" StartDate="@DateFrom" EndDate="@DateTo"></ParamPlot>
}
</div>
</div>
}
}
else
{
@foreach (var item in selParams)
{
<div class="@pcss">
<ParamPlot SelectedParam="@item" SelFilter="@SelFilter"></ParamPlot>
</div>
}
}
</div>
}
+15 -2
View File
@@ -1,3 +1,6 @@
using MP.MONO.UI.Data;
namespace MP.MONO.UI.Pages
{
public partial class Parameters
@@ -7,8 +10,18 @@ namespace MP.MONO.UI.Pages
private int maxRecord = 120;
private bool showParam = false;
private DateTime DateFrom = DateTime.Today.AddDays(-2);
private DateTime DateTo = DateTime.Today.AddDays(1);
private DateTime DateFrom
{
get => SelFilter.DtStart;
set => SelFilter.DtStart = value;
}
private DateTime DateTo
{
get => SelFilter.DtEnd;
set => SelFilter.DtEnd = value;
}
protected DataLogFilter SelFilter { get; set; } = new DataLogFilter();
#endregion Private Fields
+1
View File
@@ -50,6 +50,7 @@ namespace MP.MONO.UI.Pages
ListRecords = await MMDataService.AlarmRecGetParetoFreq(1, adesso.AddHours(-numHourPrev), adesso);
totalCount = ListRecords.Count;
totalEvents = ListRecords.Sum(x => x.EventCount);
await Task.Delay(1);
}
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>MAPO-MONO</i>
<h4>Version: 1.2.2209.2315</h4>
<h4>Version: 1.2.2209.2317</h4>
<br /> Release Note:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
1.2.2209.2315
1.2.2209.2317
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>1.2.2209.2315</version>
<version>1.2.2209.2317</version>
<url>http://nexus.steamware.net/repository/SWS/MP.MONO.UI/stable/LAST/MP.Mon.zip</url>
<changelog>http://nexus.steamware.net/repository/SWS/MP.MONO.UI/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>