From 9d6f692b4d9e6453fe102e71cce3747fa0bd6df5 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Fri, 25 Oct 2024 19:18:50 +0200 Subject: [PATCH 1/7] Inizio bozza aggiunta progetto gestione TaskMan --- MP-LAND.sln | 8 ++ MP.TaskMan/Component1.razor | 3 + MP.TaskMan/Component1.razor.css | 6 ++ MP.TaskMan/ExampleJsInterop.cs | 37 +++++++ MP.TaskMan/MP.TaskMan.csproj | 39 +++++++ MP.TaskMan/TaskEdit.razor | 101 +++++++++++++++++++ MP.TaskMan/TaskEdit.razor.cs | 44 ++++++++ MP.TaskMan/TaskExeList.razor | 100 ++++++++++++++++++ MP.TaskMan/TaskExeList.razor.cs | 134 +++++++++++++++++++++++++ MP.TaskMan/_Imports.razor | 1 + MP.TaskMan/wwwroot/background.png | Bin 0 -> 378 bytes MP.TaskMan/wwwroot/exampleJsInterop.js | 6 ++ 12 files changed, 479 insertions(+) create mode 100644 MP.TaskMan/Component1.razor create mode 100644 MP.TaskMan/Component1.razor.css create mode 100644 MP.TaskMan/ExampleJsInterop.cs create mode 100644 MP.TaskMan/MP.TaskMan.csproj create mode 100644 MP.TaskMan/TaskEdit.razor create mode 100644 MP.TaskMan/TaskEdit.razor.cs create mode 100644 MP.TaskMan/TaskExeList.razor create mode 100644 MP.TaskMan/TaskExeList.razor.cs create mode 100644 MP.TaskMan/_Imports.razor create mode 100644 MP.TaskMan/wwwroot/background.png create mode 100644 MP.TaskMan/wwwroot/exampleJsInterop.js diff --git a/MP-LAND.sln b/MP-LAND.sln index 2113d66c..c14fcb70 100644 --- a/MP-LAND.sln +++ b/MP-LAND.sln @@ -11,6 +11,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Egw.Core", "Egw.Core\Egw.Co EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MP.Data", "MP.Data\MP.Data.csproj", "{EE871AE5-9B5E-493E-8E59-F77234979AD7}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MP.TaskMan", "MP.TaskMan\MP.TaskMan.csproj", "{8BBD39D5-9390-4EBA-979B-954DC8FFC850}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug_LiManDebug|Any CPU = Debug_LiManDebug|Any CPU @@ -42,6 +44,12 @@ Global {EE871AE5-9B5E-493E-8E59-F77234979AD7}.Debug|Any CPU.Build.0 = Debug|Any CPU {EE871AE5-9B5E-493E-8E59-F77234979AD7}.Release|Any CPU.ActiveCfg = Release|Any CPU {EE871AE5-9B5E-493E-8E59-F77234979AD7}.Release|Any CPU.Build.0 = Release|Any CPU + {8BBD39D5-9390-4EBA-979B-954DC8FFC850}.Debug_LiManDebug|Any CPU.ActiveCfg = Debug|Any CPU + {8BBD39D5-9390-4EBA-979B-954DC8FFC850}.Debug_LiManDebug|Any CPU.Build.0 = Debug|Any CPU + {8BBD39D5-9390-4EBA-979B-954DC8FFC850}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8BBD39D5-9390-4EBA-979B-954DC8FFC850}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8BBD39D5-9390-4EBA-979B-954DC8FFC850}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8BBD39D5-9390-4EBA-979B-954DC8FFC850}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/MP.TaskMan/Component1.razor b/MP.TaskMan/Component1.razor new file mode 100644 index 00000000..7558f967 --- /dev/null +++ b/MP.TaskMan/Component1.razor @@ -0,0 +1,3 @@ +
+ This component is defined in the MP.TaskMan library. +
diff --git a/MP.TaskMan/Component1.razor.css b/MP.TaskMan/Component1.razor.css new file mode 100644 index 00000000..c6afca40 --- /dev/null +++ b/MP.TaskMan/Component1.razor.css @@ -0,0 +1,6 @@ +.my-component { + border: 2px dashed red; + padding: 1em; + margin: 1em 0; + background-image: url('background.png'); +} diff --git a/MP.TaskMan/ExampleJsInterop.cs b/MP.TaskMan/ExampleJsInterop.cs new file mode 100644 index 00000000..ec45f6e4 --- /dev/null +++ b/MP.TaskMan/ExampleJsInterop.cs @@ -0,0 +1,37 @@ +using Microsoft.JSInterop; + +namespace MP.TaskMan +{ + // This class provides an example of how JavaScript functionality can be wrapped + // in a .NET class for easy consumption. The associated JavaScript module is + // loaded on demand when first needed. + // + // This class can be registered as scoped DI service and then injected into Blazor + // components for use. + + public class ExampleJsInterop : IAsyncDisposable + { + private readonly Lazy> moduleTask; + + public ExampleJsInterop(IJSRuntime jsRuntime) + { + moduleTask = new(() => jsRuntime.InvokeAsync( + "import", "./_content/MP.TaskMan/exampleJsInterop.js").AsTask()); + } + + public async ValueTask Prompt(string message) + { + var module = await moduleTask.Value; + return await module.InvokeAsync("showPrompt", message); + } + + public async ValueTask DisposeAsync() + { + if (moduleTask.IsValueCreated) + { + var module = await moduleTask.Value; + await module.DisposeAsync(); + } + } + } +} diff --git a/MP.TaskMan/MP.TaskMan.csproj b/MP.TaskMan/MP.TaskMan.csproj new file mode 100644 index 00000000..6f2a7fe4 --- /dev/null +++ b/MP.TaskMan/MP.TaskMan.csproj @@ -0,0 +1,39 @@ + + + + net6.0 + enable + enable + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/MP.TaskMan/TaskEdit.razor b/MP.TaskMan/TaskEdit.razor new file mode 100644 index 00000000..69d6674a --- /dev/null +++ b/MP.TaskMan/TaskEdit.razor @@ -0,0 +1,101 @@ +@if (CurrRecord != null) +{ +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+ @*
+
+ + +
+
+
+
+ + +
+
*@ +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+ + +
+
+
+ +
+
+} + diff --git a/MP.TaskMan/TaskEdit.razor.cs b/MP.TaskMan/TaskEdit.razor.cs new file mode 100644 index 00000000..df68fe96 --- /dev/null +++ b/MP.TaskMan/TaskEdit.razor.cs @@ -0,0 +1,44 @@ +using Microsoft.AspNetCore.Components; + +namespace MP.TaskMan +{ + public partial class TaskEdit + { + #region Public Properties + + [Parameter] + public TaskListModel? CurrRecord { get; set; } = null; + + [Parameter] + public EventCallback EC_update { get; set; } + + #endregion Public Properties + + #region Protected Properties + + [Inject] + protected TaskService TService { get; set; } + + #endregion Protected Properties + + #region Protected Methods + + protected async Task doCancel() + { + await EC_update.InvokeAsync(false); + } + + protected async Task doSave() + { + bool fatto = false; + await Task.Delay(1); + if (CurrRecord != null) + { + fatto = await TService.TaskListUpsert(CurrRecord); + } + await EC_update.InvokeAsync(fatto); + } + + #endregion Protected Methods + } +} \ No newline at end of file diff --git a/MP.TaskMan/TaskExeList.razor b/MP.TaskMan/TaskExeList.razor new file mode 100644 index 00000000..99220f54 --- /dev/null +++ b/MP.TaskMan/TaskExeList.razor @@ -0,0 +1,100 @@ + +
+
+
+
+
+ History +
+
+ @if (CurrRecord != null) + { +
@TextReduce(CurrRecord.Command, 40)
+
@TextReduce(CurrRecord.Args, 60)
+ } +
+
+
+
+ +
+
+
+
+
+ @if (ListRecords == null) + { + + } + else if (totalCount == 0) + { +
Nessun record trovato
+ } + else + { +
+
+ + + + + + + + + + + @foreach (var record in ListRecords) + { + + + + + + + + + + } + +
#InizioFineEsito
+ @record.TaskExecId + + @($"{record.DtStart:HH:mm:ss.fff}") +
@($"{record.DtStart:yyyy-MM.dd ddd}")
+
+ @($"{record.DtEnd:HH:mm:ss.fff}") +
@($"{record.DtEnd:yyyy-MM.dd ddd}")
+
+
+
+ @if (@record.IsError) + { + + } + else + { + + } +
+
+ @($"{record.Duration:N3}") sec +
+
+
+
+
@record.Result
+
+
+
+
+ } +
+ +
\ No newline at end of file diff --git a/MP.TaskMan/TaskExeList.razor.cs b/MP.TaskMan/TaskExeList.razor.cs new file mode 100644 index 00000000..dcec09b2 --- /dev/null +++ b/MP.TaskMan/TaskExeList.razor.cs @@ -0,0 +1,134 @@ +using MailKit; +using Microsoft.AspNetCore.Components; +using MongoDB.Bson; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using NLog; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace MP.TaskMan +{ + public partial class TaskExeList + { + #region Public Properties + + [Parameter] + public TaskListModel? CurrRecord { get; set; } = null; + + #endregion Public Properties + + #region Protected Fields + + protected bool isLoading = false; + + #endregion Protected Fields + + #region Protected Properties + + [Inject] + protected NavigationManager NavManager { get; set; } + + /// + /// Show error mode: 0 = tutti 1 = solo errori 2 = solo ok + /// + protected int ShowErrorMode + { + get => showErrorMode; + set + { + if (showErrorMode != value) + { + showErrorMode = value; + var pUpd = Task.Run(async () => await ReloadData()); + pUpd.Wait(); + } + } + } + + protected int totalCount { get; set; } = 0; + + [Inject] + protected TaskService TService { get; set; } + + #endregion Protected Properties + + #region Protected Methods + + protected string alCss(TaskExecModel TaskRec) + { + return TaskRec.IsError ? "alert-danger" : "alert-success"; + } + + protected async Task ForceReload(int newNum) + { + numRecord = newNum; + await ReloadData(); + } + + protected async Task ForceReloadPage(int newNum) + { + currPage = newNum; + await ReloadData(); + } + + protected override async Task OnInitializedAsync() + { + await ReloadData(); + } + + protected string TextReduce(string textOriginal, int maxChar) + { + string answ = textOriginal; + if (answ.Length > maxChar) + { + answ = $"{textOriginal.Substring(0, maxChar / 2)} ... {textOriginal.Substring(answ.Length - maxChar / 2)}"; + } + return answ; + } + + #endregion Protected Methods + + #region Private Fields + + private static Logger Log = LogManager.GetCurrentClassLogger(); + + private List ListRecords; + private List SearchRecords; + + #endregion Private Fields + + #region Private Properties + + private int currPage { get; set; } = 1; + private int numRecord { get; set; } = 10; + private int showErrorMode { get; set; } = 0; + + #endregion Private Properties + + #region Private Methods + + private async Task ReloadData() + { + SearchRecords = await TService.TaskExecGetFilt(CurrRecord.TaskId, 1000, ""); + // se non tutti filtro... + if (ShowErrorMode != 0) + { + if (ShowErrorMode == 1) + { + SearchRecords = SearchRecords.FindAll(x => x.IsError); + } + else if (ShowErrorMode == 2) + { + SearchRecords = SearchRecords.FindAll(x => !x.IsError); + } + } + totalCount = SearchRecords.Count; + ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList(); + } + + #endregion Private Methods + } +} \ No newline at end of file diff --git a/MP.TaskMan/_Imports.razor b/MP.TaskMan/_Imports.razor new file mode 100644 index 00000000..77285129 --- /dev/null +++ b/MP.TaskMan/_Imports.razor @@ -0,0 +1 @@ +@using Microsoft.AspNetCore.Components.Web diff --git a/MP.TaskMan/wwwroot/background.png b/MP.TaskMan/wwwroot/background.png new file mode 100644 index 0000000000000000000000000000000000000000..e15a3bde6e2bdb380df6a0b46d7ed00bdeb0aaa8 GIT binary patch literal 378 zcmeAS@N?(olHy`uVBq!ia0vp^x**KK1SGdsl%54rjKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCij$3p^r=85sBugD~Uq{1qucLCF%=h?3y^w370~qEv>0#LT=By}Z;C1rt33 zJwr2>%=KS^ie7oTIEF;HpS|GCbyPusHSqiXaCu3qf)82(9Gq&mZq2{Kq}M*X&MWtJ zSi1Jo7ZzfImg%g=t(qo=wsSR2lZoP(Rj#3wacN=q0?Br(rXzgZEGK2$ID{|A=5S{xJEuzSH>!M+7wSY6hB<=-E^*n0W7 S8wY^CX7F_Nb6Mw<&;$S{dxtsz literal 0 HcmV?d00001 diff --git a/MP.TaskMan/wwwroot/exampleJsInterop.js b/MP.TaskMan/wwwroot/exampleJsInterop.js new file mode 100644 index 00000000..ea8d76ad --- /dev/null +++ b/MP.TaskMan/wwwroot/exampleJsInterop.js @@ -0,0 +1,6 @@ +// This is a JavaScript module that is loaded on demand. It can export any number of +// functions, and may import other JavaScript modules if required. + +export function showPrompt(message) { + return prompt(message, 'Type anything here'); +} From 880df2a1802ed156caee41306285f1c6dbe1d0a7 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Fri, 25 Oct 2024 19:24:40 +0200 Subject: [PATCH 2/7] TaskMan: - continuo porting (NON ok...) --- MP.TaskMan/MP.TaskMan.csproj | 5 +- MP.TaskMan/Models/TaskExecModel.cs | 63 +++++ MP.TaskMan/Models/TaskListModel.cs | 87 +++++++ MP.TaskMan/Models/TaskResultModel.cs | 37 +++ MP.TaskMan/Objects/Enums.cs | 216 ++++++++++++++++ MP.TaskMan/Services/BaseServ.cs | 70 +++++ MP.TaskMan/Services/TaskService.cs | 370 +++++++++++++++++++++++++++ MP.TaskMan/TaskEdit.razor | 6 +- MP.TaskMan/TaskEdit.razor.cs | 1 + MP.TaskMan/_Imports.razor | 1 + 10 files changed, 849 insertions(+), 7 deletions(-) create mode 100644 MP.TaskMan/Models/TaskExecModel.cs create mode 100644 MP.TaskMan/Models/TaskListModel.cs create mode 100644 MP.TaskMan/Models/TaskResultModel.cs create mode 100644 MP.TaskMan/Objects/Enums.cs create mode 100644 MP.TaskMan/Services/BaseServ.cs create mode 100644 MP.TaskMan/Services/TaskService.cs diff --git a/MP.TaskMan/MP.TaskMan.csproj b/MP.TaskMan/MP.TaskMan.csproj index 6f2a7fe4..3125651f 100644 --- a/MP.TaskMan/MP.TaskMan.csproj +++ b/MP.TaskMan/MP.TaskMan.csproj @@ -7,12 +7,10 @@ - - @@ -23,6 +21,7 @@ + @@ -30,8 +29,6 @@ - - diff --git a/MP.TaskMan/Models/TaskExecModel.cs b/MP.TaskMan/Models/TaskExecModel.cs new file mode 100644 index 00000000..8a1c9332 --- /dev/null +++ b/MP.TaskMan/Models/TaskExecModel.cs @@ -0,0 +1,63 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +#nullable disable +// +// This is here so CodeMaid doesn't reorganize this document +// +namespace MP.TaskMan.Models +{ + [Table("TaskExec")] + public partial class TaskExecModel + { + #region Public Properties + + [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)] + public int TaskExecId { get; set; } = 0; + + /// + /// task Id di riferimento + /// + public int TaskId { get; set; } = 0; + + /// + /// DataOra inizio + /// + public DateTime DtStart { get; set; } = DateTime.Now; + + /// + /// DataOra fine + /// + public DateTime DtEnd { get; set; } = DateTime.Now.AddDays(-1); + + /// + /// Durata ultima esecuzione in secondi + /// + [NotMapped] + public double Duration + { + get => DtEnd.Subtract(DtStart).TotalSeconds; + } + + /// + /// Esito in Errore + /// + public bool IsError { get; set; } = false; + + /// + /// Ultimo risultato registrato + /// + public string Result { get; set; } = ""; + + /// + /// Navigazione oggetto TaskList + /// + [ForeignKey("TaskId")] + public virtual TaskListModel TaskListNav { get; set; } = null!; + + + #endregion Public Properties + } +} \ No newline at end of file diff --git a/MP.TaskMan/Models/TaskListModel.cs b/MP.TaskMan/Models/TaskListModel.cs new file mode 100644 index 00000000..950ef5ad --- /dev/null +++ b/MP.TaskMan/Models/TaskListModel.cs @@ -0,0 +1,87 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using static MP.TaskMan.Objects.Enums; + +#nullable disable +// +// This is here so CodeMaid doesn't reorganize this document +// +namespace MP.TaskMan.Models +{ + [Table("TaskList")] + public partial class TaskListModel + { + #region Public Properties + + [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)] + public int TaskId { get; set; } = 0; + + /// + /// Ordinale x esecuzione + /// + public int Ordinal { get; set; } = 0; + + /// + /// Nome Task + /// + public string Name { get; set; } = ""; + + /// + /// Descrizione Task + /// + public string Descript { get; set; } = ""; + + /// + /// Tipo Task + /// + public Task2ExeType TType { get; set; } = Task2ExeType.ND; + + /// + /// Comando da invocare + /// + public string Command { get; set; } = ""; + + /// + /// Elenco argomenti (json) + /// + public string Args { get; set; } = ""; + + /// + /// Frequenza esecuzione da enum + /// + public TaskFreqType Freq { get; set; } = TaskFreqType.ND; + + /// + /// Cadenza esecuzione + /// + public int Cad { get; set; } = 1; + + /// + /// DataOra ultima esecuzione + /// + public DateTime DtLastExec { get; set; } = DateTime.Today.AddYears(-10); + /// + /// DataOra ultima esecuzione + /// + public DateTime DtNextExec { get; set; } = DateTime.Today.AddYears(-9); + + /// + /// Durata ultima esecuzione in secondi + /// + public double LastDuration { get; set; } = 0; + + /// + /// Esito ultima esecuzione in Errore + /// + public bool LastIsError { get; set; } = false; + + /// + /// Ultimo risultato registrato + /// + public string LastResult { get; set; } = ""; + + #endregion Public Properties + } +} \ No newline at end of file diff --git a/MP.TaskMan/Models/TaskResultModel.cs b/MP.TaskMan/Models/TaskResultModel.cs new file mode 100644 index 00000000..e1b929c7 --- /dev/null +++ b/MP.TaskMan/Models/TaskResultModel.cs @@ -0,0 +1,37 @@ +using Microsoft.EntityFrameworkCore; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using static MP.TaskMan.Objects.Enums; + +#nullable disable +// +// This is here so CodeMaid doesn't reorganize this document +// +namespace MP.TaskMan.Models +{ + [NotMapped] + public partial class TaskResultModel + { + #region Public Properties + + /// + /// Tipo di task eseguito + /// + public string Task { get; set; } = ""; + + /// + /// Risultato: >0 = successo, <0 = errore + /// + public int ExecResult { get; set; } = 0; + + /// + /// Risultato esecuzione testuale + /// + public string TextResult { get; set; } = ""; + + + #endregion Public Properties + } +} \ No newline at end of file diff --git a/MP.TaskMan/Objects/Enums.cs b/MP.TaskMan/Objects/Enums.cs new file mode 100644 index 00000000..6173e302 --- /dev/null +++ b/MP.TaskMan/Objects/Enums.cs @@ -0,0 +1,216 @@ +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace MP.TaskMan.Objects +{ + public class Enums + { + #region Public Enums + + /// + /// Intervallo dati (es per definizione quanti dati FluxLog tenere x intervallo + /// + public enum DataInterval + { + minute, + hour, + day + } + + public enum DataItemCategory + { + CONDITION = 0, + EVENT = 1, + SAMPLE = 2 + } + + /// + /// Tipo di esito (generico) + /// + public enum esitoExec + { + undone, + ok, + error + } + + //[JsonConverter(typeof(StringEnumConverter))] + public enum Task2ExeType + { + /// + /// Tipo indefinito / ALL + /// + ND, + + /// + /// Chiamata exe esterno + /// + Exe, + + /// + /// Chiamata a SQL Command + /// + SqlCommand, + + /// + /// Chiamata a SQL Stored Procedure + /// + SqlStored, + + /// + /// Chiamata REST tipo Get + /// + RestCallGet, + + ///// + ///// Chiamata REST tipo Post + ///// + //RestCallPost + } + + //[JsonConverter(typeof(StringEnumConverter))] + public enum TaskFreqType + { + /// + /// Tipo indefinito / ALL + /// + ND, + + /// + /// Secondi + /// + Sec, + + /// + /// Minuti + /// + Min, + + /// + /// Ore + /// + Hour, + + /// + /// Giorni + /// + Day, + + /// + /// Settimane + /// + Week, + + /// + /// Mesi + /// + Month, + + /// + /// Anni + /// + Year + } + + /// + /// Elenco task ammessi (x IOB-WIN da eseguire...) + /// + public enum taskType + { + /// + /// Task nullo / fake + /// + nihil, + + /// + /// Rimanda a PLC eventuale segnale NON in setup (MA NON RESETTA) + /// + fixStopSetup, + + /// + /// Indica al PLC di forzare il reset del contapezzi + /// + forceResetPzCount, + + /// + /// Indica al PLC di forzare il NUOVO valore di contapezzi (impostato come value) + /// + forceSetPzCount, + + /// + /// Imposta Articolo su PLC + /// + setArt, + + /// + /// Imposta Commessa su PLC + /// + setComm, + + /// + /// Set di un PARAMETRO su PLC (in value avremo un JSON object) + /// + setParameter, + + /// + /// Set Programma CNC su PLC + /// + setProg, + + /// + /// Indica al PLC di impostare il numero di pezzi da produrre per la commessa (impostato + /// come value) + /// + setPzComm, + + /// + /// Indica al PLC iniziato setup (e secondo casi ferma contapezzi /resetta) + /// + startSetup, + + /// + /// Indica al PLC finito setup (e secondo casi ferma contapezzi /resetta) + /// + stopSetup, + + /// + /// Richiesta invio watchdog a PLC + /// + sendWatchDogMes2Plc, + + /// + /// Indica che è FINITA la produzione (e quindi cancello dati backup) + /// + endProd, + + /// + /// Richiesta esecuzione di un sync dei dati DB di frontiera + /// + syncDbData, + + /// + /// Imposta Fornitore (es grower x ICOEL) + /// + setSupplier, + + /// + /// Effettua processing other info (es ritorno consumi x ricette FIMAT) + /// + processOtherInfo + } + + /// + /// Finestra temporale di aggregazione dati VC + /// + public enum timeWindow + { + free, + hour, + day, + week, + month + } + + #endregion Public Enums + } +} \ No newline at end of file diff --git a/MP.TaskMan/Services/BaseServ.cs b/MP.TaskMan/Services/BaseServ.cs new file mode 100644 index 00000000..f4a2660f --- /dev/null +++ b/MP.TaskMan/Services/BaseServ.cs @@ -0,0 +1,70 @@ +using Microsoft.Extensions.Configuration; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MP.TaskMan.Services +{ + /// + /// Classe di partenza x costruzione servizi di accesso dati + cache + /// + public class BaseServ + { + #region Protected Properties + + /// + /// Durata cache breve (1 min circa + perturbazione percentuale +/-10%) + /// + protected TimeSpan FastCache + { + get => TimeSpan.FromSeconds(cacheTtlShort * rnd.Next(900, 1100) / 1000); + } + + /// + /// Durata cache lunga (+ perturbazione percentuale +/-10%) + /// + protected TimeSpan LongCache + { + get => TimeSpan.FromSeconds(cacheTtlLong * rnd.Next(900, 1100) / 1000); + } + + /// + /// Durata cache MOLTO breve (10 sec circa + perturbazione percentuale +/-10%) + /// + protected TimeSpan UltraFastCache + { + get => TimeSpan.FromSeconds(cacheTtlShort / 6 * rnd.Next(900, 1100) / 1000); + } + + /// + /// Durata cache MOLTO lunga (+ perturbazione percentuale +/-10%) + /// + protected TimeSpan UltraLongCache + { + get => TimeSpan.FromSeconds(cacheTtlLong * 10 * rnd.Next(900, 1100) / 1000); + } + + #endregion Protected Properties + + + protected static IConfiguration _configuration = null!; + + #region Private Fields + + /// + /// Durata cache lunga IN SECONDI + /// + private int cacheTtlLong = 60 * 5; + + /// + /// Durata cache breve IN SECONDI + /// + private int cacheTtlShort = 60 * 1; + + private Random rnd = new Random(); + + #endregion Private Fields + } +} \ No newline at end of file diff --git a/MP.TaskMan/Services/TaskService.cs b/MP.TaskMan/Services/TaskService.cs new file mode 100644 index 00000000..0d252495 --- /dev/null +++ b/MP.TaskMan/Services/TaskService.cs @@ -0,0 +1,370 @@ +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Options; +using MP.AppAuth.Services; +using MP.TaskMan.Controllers; +using MP.TaskMan.DatabaseModels; +using Newtonsoft.Json; +using NLog; +using StackExchange.Redis; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using static MP.TaskMan.Objects.Enums; + +namespace MP.TaskMan.Services +{ + public class TaskService : BaseServ, IDisposable + { + #region Public Constructors + + /// + /// Init servizio TAB + /// + /// + public TaskService(IConfiguration configuration) + { + _configuration = configuration; + + // setup compoenti REDIS + redisConn = ConnectionMultiplexer.Connect(_configuration.GetConnectionString("Redis")); + redisDb = redisConn.GetDatabase(); + + // conf DB + ConnStr = _configuration.GetConnectionString("MP.All"); + if (string.IsNullOrEmpty(ConnStr)) + { + Log.Error("ConnString empty!"); + } + else + { + StringBuilder sb = new StringBuilder(); + MLController = new MpLandController(configuration); + sb.AppendLine($"TaskService | MpLandController OK"); + Log.Info(sb.ToString()); + // sistemo i parametri x redHas... + CodModulo = _configuration.GetValue("ServerConf:CodModulo"); + var cstringArray = ConnStr.Split(";"); + foreach (var item in cstringArray) + { + var cData = item.Trim().Split("="); + if (cData.Length == 2) + { + if (!connStrParams.ContainsKey(cData[0])) + { + connStrParams.Add(cData[0], cData[1]); + } + } + } + // sistemo + DataSource = connStrParams["Server"]; + DataBase = connStrParams["Database"]; + } + + // conf rest call service + RCallService = new RestCallService(_configuration); + } + + #endregion Public Constructors + + #region Public Events + + /// + /// Evento richiesta rilettura dati pagina (x refresh pagine aperte) + /// + public event EventHandler ReloadRequest = delegate { }; + + #endregion Public Events + + #region Public Methods + + public void Dispose() + { + // Clear database controller + MLController.Dispose(); + // redis dispose + redisConn = null; + redisDb = null; + } + + /// + /// Chiamata esecuzione di un singolo task programmato + /// + /// Task richiesto + /// Se true rischedula successiva chiamata + /// + public async Task ExecuteTask(TaskListModel TaskRec, bool SchedNext) + { + TaskResultModel answ = new TaskResultModel() + { + Task = $"TaskId: {TaskRec.TaskId} | {TaskRec.TType}", + ExecResult = -1, + TextResult = "Task Not recognized" + }; + // verifico tipo di task ed eseguo di conseguenza... + switch (TaskRec.TType) + { + //case Task2ExeType.ND: + // break; + //case Task2ExeType.Exe: + // break; + //case Task2ExeType.SqlCommand: + // break; + case Task2ExeType.SqlStored: + answ = MLController.ExecuteSqlTask(TaskRec.TaskId, SchedNext); + break; + case Task2ExeType.RestCallGet: + DateTime dtStart = DateTime.Now; + // in primis testo la chiamata al servizio Health + string rAnsw = await RCallService.CheckServer(); + // se ok effettuo vera chiamata... + if (rAnsw.ToUpper() == "OK") + { + var callResp = await RCallService.CallRestGet(TaskRec.Command, TaskRec.Args); + DateTime dtEnd = DateTime.Now; + TaskExecModel tExeMod = new TaskExecModel() + { + DtEnd = dtEnd, + DtStart = dtStart, + IsError = callResp.StatusCode != System.Net.HttpStatusCode.OK, + TaskId = TaskRec.TaskId, + Result = $"{callResp.Content}".Replace("\"", ""), + }; + // salvo su DB + answ = MLController.TaskExecSaveExecuted(TaskRec.TaskId, SchedNext, tExeMod); + } + break; + default: + break; + } + // svuoto cache! + await FlushCache("Task"); + return answ; + } + + /// + /// Pulizia cache Redis (tutta) + /// + /// + public async Task FlushCache() + { + RedisValue pattern = new RedisValue($"{redisBaseKey}:*"); + bool answ = await ExecFlushRedisPattern(pattern); + return answ; + } + + /// + /// Pulizia cache Redis per chiave specifica (da redisBaseKey...) + /// + /// + public async Task FlushCache(string KeyReq) + { + RedisValue pattern = new RedisValue($"{redisBaseKey}:{KeyReq}:*"); + bool answ = await ExecFlushRedisPattern(pattern); + return answ; + } + + /// + /// Invio notifica rilettura (con parametro) + /// + /// + public void NotifyReloadRequest(string message) + { + if (ReloadRequest != null) + { + // messaggio + ReloadEventArgs rea = new ReloadEventArgs(message); + ReloadRequest.Invoke(this, rea); + } + } + + public void rollBackEdit(object item) + { + MLController.RollBackEntity(item); + } + + /// + /// Ricerca task dato tipo + num max (desc) + /// + /// TaskId da cui deriva + /// + public async Task> TaskExecGetFilt(int TaskId, int maxRec, string searchVal) + { + // setup parametri costanti + string source = "DB"; + Stopwatch sw = new Stopwatch(); + sw.Start(); + List result = new List(); + // cerco in redis... + DateTime adesso = DateTime.Now; + string currKey = $"{redisBaseKey}:Task:ExecList:{TaskId}:{adesso:yyMMdd}:{adesso:HHmm}:{maxRec}"; + RedisValue rawData = await redisDb.StringGetAsync(currKey); + if (rawData.HasValue) + { + result = JsonConvert.DeserializeObject>($"{rawData}"); + source = "REDIS"; + } + else + { + result = MLController.TaskExecGetFilt(TaskId, maxRec); + // serializzp e salvo... + rawData = JsonConvert.SerializeObject(result); + await redisDb.StringSetAsync(currKey, rawData, FastCache); + } + if (result == null) + { + result = new List(); + } + sw.Stop(); + Log.Debug($"TaskExecGetFilt | {source} | {sw.Elapsed.TotalMilliseconds}ms"); + return result; + } + + /// + /// Elenco TaskList gestiti + /// + /// + /// + /// + public async Task> TaskListAll(Task2ExeType TType, string searchVal = "") + { + // setup parametri costanti + string source = "DB"; + Stopwatch sw = new Stopwatch(); + sw.Start(); + List result = new List(); + // cerco in redis... + DateTime adesso = DateTime.Now; + string currKey = $"{redisBaseKey}:Task:List:{TType}"; + RedisValue rawData = await redisDb.StringGetAsync(currKey); + if (rawData.HasValue) + { + result = JsonConvert.DeserializeObject>($"{rawData}"); + source = "REDIS"; + } + else + { + result = MLController.TaskListGetAll(TType); + // serializzp e salvo... + rawData = JsonConvert.SerializeObject(result); + await redisDb.StringSetAsync(currKey, rawData, FastCache); + } + if (result == null) + { + result = new List(); + } + // se necessario filtro.. + if (!string.IsNullOrEmpty(searchVal)) + { + result = result + .Where(x => x.Name.Contains(searchVal, StringComparison.InvariantCultureIgnoreCase) + || x.Descript.Contains(searchVal, StringComparison.InvariantCultureIgnoreCase)) + .ToList(); + } + sw.Stop(); + Log.Debug($"TaskListAll | {source} | {sw.Elapsed.TotalMilliseconds}ms"); + return result; + } + + /// + /// Update ordinamento task + /// + /// Record da spostare x priorità + /// + public async Task TaskListMove(TaskListModel rec2upd, bool moveUp) + { + bool dbResult = MLController.TaskListMove(rec2upd, moveUp); + // svuoto cache! + await FlushCache("Task"); + return await Task.FromResult(dbResult); + } + + /// + /// Update/Insert record TaskList + /// + /// + /// + public async Task TaskListUpsert(TaskListModel rec2upd) + { + bool dbResult = MLController.TaskListUpsert(rec2upd); + // svuoto cache! + await FlushCache("Task"); + return dbResult; + } + + #endregion Public Methods + + #region Protected Fields + + /// + /// Oggetto per connessione a REDIS + /// + protected ConnectionMultiplexer redisConn = null!; + + /// + /// Oggetto DB redis da impiegare x chiamate R/W + /// + protected IDatabase redisDb = null!; + + #endregion Protected Fields + + #region Private Fields + + private static Logger Log = LogManager.GetCurrentClassLogger(); + + private string CodModulo = ""; + + private string ConnStr = ""; + + private Dictionary connStrParams = new Dictionary(); + + private string DataBase = ""; + + private string DataSource = ""; + + private string redisBaseKey = "MP:TASK"; + + #endregion Private Fields + + #region Private Properties + + private static MpLandController MLController { get; set; } = null!; + private RestCallService RCallService { get; set; } = null!; + + #endregion Private Properties + + #region Private Methods + + /// + /// Esegue flush memoria redis dato pattern + /// + /// + /// + private async Task ExecFlushRedisPattern(RedisValue pattern) + { + bool answ = false; + var listEndpoints = redisConn.GetEndPoints(); + foreach (var endPoint in listEndpoints) + { + //var server = redisConnAdmin.GetServer(listEndpoints[0]); + var server = redisConn.GetServer(endPoint); + if (server != null) + { + var keyList = server.Keys(redisDb.Database, pattern); + foreach (var item in keyList) + { + await redisDb.KeyDeleteAsync(item); + } + answ = true; + } + } + // notifico update ai client in ascolto x reset cache + NotifyReloadRequest($"FlushRedisCache | {pattern}"); + return answ; + } + + #endregion Private Methods + } +} \ No newline at end of file diff --git a/MP.TaskMan/TaskEdit.razor b/MP.TaskMan/TaskEdit.razor index 69d6674a..566a5e22 100644 --- a/MP.TaskMan/TaskEdit.razor +++ b/MP.TaskMan/TaskEdit.razor @@ -11,7 +11,7 @@
- @foreach (var option in Enum.GetValues(typeof(MP.Data.Objects.Enums.TaskFreqType))) + @foreach (var option in Enum.GetValues(typeof(MP.TaskMan.Objects.Enums.TaskFreqType))) {
-
-
-
- - -
-
-
-
- - -
-
-
-
-
-
- - -
-
-
-
- - -
-
-
-
- - -
-
-
-
- - -
-
-
- -
-
-} - diff --git a/MP.Land/Components/TaskEdit.razor.cs b/MP.Land/Components/TaskEdit.razor.cs deleted file mode 100644 index da8867a9..00000000 --- a/MP.Land/Components/TaskEdit.razor.cs +++ /dev/null @@ -1,47 +0,0 @@ -using Microsoft.AspNetCore.Components; -using MP.Data.DatabaseModels; -using MP.Data.Services; -using System.Threading.Tasks; - -namespace MP.Land.Components -{ - public partial class TaskEdit - { - #region Public Properties - - [Parameter] - public TaskListModel? CurrRecord { get; set; } = null; - - [Parameter] - public EventCallback EC_update { get; set; } - - #endregion Public Properties - - #region Protected Properties - - [Inject] - protected TaskService TService { get; set; } - - #endregion Protected Properties - - #region Protected Methods - - protected async Task doCancel() - { - await EC_update.InvokeAsync(false); - } - - protected async Task doSave() - { - bool fatto = false; - await Task.Delay(1); - if (CurrRecord != null) - { - fatto = await TService.TaskListUpsert(CurrRecord); - } - await EC_update.InvokeAsync(fatto); - } - - #endregion Protected Methods - } -} \ No newline at end of file diff --git a/MP.Land/Components/TaskExeList.razor b/MP.Land/Components/TaskExeList.razor deleted file mode 100644 index 99220f54..00000000 --- a/MP.Land/Components/TaskExeList.razor +++ /dev/null @@ -1,100 +0,0 @@ - -
-
-
-
-
- History -
-
- @if (CurrRecord != null) - { -
@TextReduce(CurrRecord.Command, 40)
-
@TextReduce(CurrRecord.Args, 60)
- } -
-
-
-
- -
-
-
-
-
- @if (ListRecords == null) - { - - } - else if (totalCount == 0) - { -
Nessun record trovato
- } - else - { -
-
- - - - - - - - - - - @foreach (var record in ListRecords) - { - - - - - - - - - - } - -
#InizioFineEsito
- @record.TaskExecId - - @($"{record.DtStart:HH:mm:ss.fff}") -
@($"{record.DtStart:yyyy-MM.dd ddd}")
-
- @($"{record.DtEnd:HH:mm:ss.fff}") -
@($"{record.DtEnd:yyyy-MM.dd ddd}")
-
-
-
- @if (@record.IsError) - { - - } - else - { - - } -
-
- @($"{record.Duration:N3}") sec -
-
-
-
-
@record.Result
-
-
-
-
- } -
- -
\ No newline at end of file diff --git a/MP.Land/Components/TaskExeList.razor.cs b/MP.Land/Components/TaskExeList.razor.cs deleted file mode 100644 index 67658db4..00000000 --- a/MP.Land/Components/TaskExeList.razor.cs +++ /dev/null @@ -1,136 +0,0 @@ -using MailKit; -using Microsoft.AspNetCore.Components; -using MongoDB.Bson; -using MP.Data.DatabaseModels; -using MP.Data.Services; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; -using NLog; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace MP.Land.Components -{ - public partial class TaskExeList - { - #region Public Properties - - [Parameter] - public TaskListModel? CurrRecord { get; set; } = null; - - #endregion Public Properties - - #region Protected Fields - - protected bool isLoading = false; - - #endregion Protected Fields - - #region Protected Properties - - [Inject] - protected NavigationManager NavManager { get; set; } - - /// - /// Show error mode: 0 = tutti 1 = solo errori 2 = solo ok - /// - protected int ShowErrorMode - { - get => showErrorMode; - set - { - if (showErrorMode != value) - { - showErrorMode = value; - var pUpd = Task.Run(async () => await ReloadData()); - pUpd.Wait(); - } - } - } - - protected int totalCount { get; set; } = 0; - - [Inject] - protected TaskService TService { get; set; } - - #endregion Protected Properties - - #region Protected Methods - - protected string alCss(TaskExecModel TaskRec) - { - return TaskRec.IsError ? "alert-danger" : "alert-success"; - } - - protected async Task ForceReload(int newNum) - { - numRecord = newNum; - await ReloadData(); - } - - protected async Task ForceReloadPage(int newNum) - { - currPage = newNum; - await ReloadData(); - } - - protected override async Task OnInitializedAsync() - { - await ReloadData(); - } - - protected string TextReduce(string textOriginal, int maxChar) - { - string answ = textOriginal; - if (answ.Length > maxChar) - { - answ = $"{textOriginal.Substring(0, maxChar / 2)} ... {textOriginal.Substring(answ.Length - maxChar / 2)}"; - } - return answ; - } - - #endregion Protected Methods - - #region Private Fields - - private static Logger Log = LogManager.GetCurrentClassLogger(); - - private List ListRecords; - private List SearchRecords; - - #endregion Private Fields - - #region Private Properties - - private int currPage { get; set; } = 1; - private int numRecord { get; set; } = 10; - private int showErrorMode { get; set; } = 0; - - #endregion Private Properties - - #region Private Methods - - private async Task ReloadData() - { - SearchRecords = await TService.TaskExecGetFilt(CurrRecord.TaskId, 1000, ""); - // se non tutti filtro... - if (ShowErrorMode != 0) - { - if (ShowErrorMode == 1) - { - SearchRecords = SearchRecords.FindAll(x => x.IsError); - } - else if (ShowErrorMode == 2) - { - SearchRecords = SearchRecords.FindAll(x => !x.IsError); - } - } - totalCount = SearchRecords.Count; - ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList(); - } - - #endregion Private Methods - } -} \ No newline at end of file diff --git a/MP.Land/MP.Land.csproj b/MP.Land/MP.Land.csproj index 0a170296..7c10aff5 100644 --- a/MP.Land/MP.Land.csproj +++ b/MP.Land/MP.Land.csproj @@ -3,7 +3,7 @@ net6.0 MP.Land - 6.16.2410.2519 + 6.16.2410.2611 Debug;Release;Debug_LiManDebug @@ -11,9 +11,12 @@ + + + @@ -21,8 +24,11 @@ + + + @@ -63,6 +69,7 @@ + diff --git a/MP.Land/Pages/TaskScheduler.razor b/MP.Land/Pages/TaskScheduler.razor index accc34b3..4cb01b87 100644 --- a/MP.Land/Pages/TaskScheduler.razor +++ b/MP.Land/Pages/TaskScheduler.razor @@ -10,7 +10,7 @@
- @if (TypeSel != MP.Data.Objects.Enums.Task2ExeType.ND) + @if (TypeSel != MP.TaskMan.Objects.Enums.Task2ExeType.ND) { @if (currRecord == null) { @@ -26,7 +26,7 @@ } - @foreach (var option in Enum.GetValues(typeof(MP.TaskMan.Objects.Enums.Task2ExeType))) - { - - } - -
-
- - - -
- @if (isLoading) - { - - - } - else if (ListRecords == null) - { - - } - else if (totalCount == 0) - { -
Nessun record trovato
- } - else - { -
-
- - - - - - - - @if (detRecord == null) - { - - } - - @if (detRecord == null) - { - - - - - } - - - - @foreach (var record in ListRecords) - { - - - - - - @if (detRecord == null) - { - - } - - @if (detRecord == null) - { - - - - - } - - @if (DetailTaskId != null && DetailTaskId.TaskId == record.TaskId) - { - - - - } - } - -
- - OrdTaskTipoCommandSched.LastNextResult - -
- - @if (detRecord == null) - { - @if (currRecord == null) - { - - - } - else - { - - } - } - - @if (detRecord == null) - { - @if (record.Ordinal == minOrdinal) - { - - } - else - { - - } - } - @record.Ordinal - @if (detRecord == null) - { - @if (record.Ordinal == maxOrdinal) - { - - } - else - { - - } - } - -
@record.Name
-
@record.Descript
-
- @record.TType - -
@TextReduce(record.Command, 32)
-
@TextReduce(record.Args, 40)
-
@record.Freq × @record.Cad -
@($"{record.DtLastExec:yyyy-MM-dd}")
-
@($"{record.DtLastExec:ddd HH:mm:ss}")
-
-
@($"{record.DtNextExec:yyyy-MM-dd}")
-
@($"{record.DtNextExec:ddd HH:mm:ss}")
-
- @($"{record.LastDuration:N3}") sec - - -
-
-
-
@record.LastResult
-
-
-
-
-
- } -
- - - - @if (detRecord != null && !isLoading) - { -
- -
- } - \ No newline at end of file + \ No newline at end of file diff --git a/MP.Land/Pages/TaskScheduler.razor.cs b/MP.Land/Pages/TaskScheduler.razor.cs index b88e123b..dff3c10a 100644 --- a/MP.Land/Pages/TaskScheduler.razor.cs +++ b/MP.Land/Pages/TaskScheduler.razor.cs @@ -14,392 +14,24 @@ using MP.TaskMan.Services; namespace MP.Land.Pages { - public partial class TaskScheduler : ComponentBase, IDisposable + public partial class TaskScheduler : ComponentBase { - #region Public Methods - - public string checkSelect(int TaskId) - { - string answ = ""; - if (currRecord != null) - { - try - { - answ = (currRecord.TaskId == TaskId) ? "table-info" : ""; - } - catch - { } - } - else if (detRecord != null) - { - answ = (detRecord.TaskId == TaskId) ? "table-info" : ""; - } - return answ; - } - - public void Dispose() - { - MessageService.EA_SearchUpdated -= OnSeachUpdated; - } - - public async void OnSeachUpdated() - { - await InvokeAsync(() => - { - Task task = ReloadData(); - StateHasChanged(); - }); - } - - #endregion Public Methods - - #region Protected Fields - - protected string fileName = "TaskList.csv"; - - #endregion Protected Fields - #region Protected Properties [Inject] - protected IJSRuntime JSRuntime { get; set; } - - protected string mainCss - { - get => detRecord == null ? "col-12" : "col-6"; - } - - protected int maxOrdinal { get; set; } = 999; - - [Inject] - protected Data.MessageService MessageService { get; set; } - - protected int minOrdinal { get; set; } = 0; - - [Inject] - protected NavigationManager NavManager { get; set; } - - protected int totalCount { get; set; } = 0; - - [Inject] - protected TaskService TService { get; set; } - - protected Task2ExeType TypeSel - { - get => typeSel; - set - { - if (typeSel != value) - { - typeSel = value; - var pUpd = Task.Run(async () => - { - await ReloadData(); - }); - pUpd.Wait(); - } - } - } + protected Data.MessageService MServ { get; set; } = null!; #endregion Protected Properties #region Protected Methods - protected async Task addNew() + protected override void OnInitialized() { - currRecord = new TaskListModel() - { - Name = "Nuovo Task", - TType = TypeSel, - Descript = "Descrizione Task", - DtLastExec = DateTime.Today, - DtNextExec = DateTime.Today.AddDays(1) - }; - await ReloadData(); - } - - /// - /// Gestione display avanzamento step - /// - /// - protected async Task advStep(int currStep) - { - currVal = currStep; - nextVal = currVal + 1; - await InvokeAsync(StateHasChanged); - } - - protected string alCss(TaskListModel TaskRec) - { - return TaskRec.LastIsError ? "alert-danger" : "alert-success"; - } - - protected string btnCss(TaskListModel TaskRec) - { - string answ = DetailTaskId != null && DetailTaskId.TaskId == TaskRec.TaskId ? "btn-" : "btn-outline-"; - answ += TaskRec.LastIsError ? "danger" : "success"; - return answ; - } - - protected async Task doCancel() - { - currRecord = null; - detRecord = null; - await ReloadData(); - } - - protected async Task doClone(TaskListModel selRec) - { - if (!await JSRuntime.InvokeAsync("confirm", $"Confermi di voler duplicare il record selezionato?")) - return; - currRecord = new TaskListModel() - { - Args = selRec.Args, - Name = $"Copia di {selRec.Name}", - Cad = selRec.Cad, - Command = selRec.Command, - Descript = $"Copia di {selRec.Descript}", - DtNextExec = DateTime.Today.AddDays(1), - DtLastExec = DateTime.Today.AddYears(-10), - Freq = selRec.Freq, - LastDuration = 0, - LastIsError = false, - LastResult = "", - TType = selRec.TType, - Ordinal = SearchRecords.Count + 1, - }; - await ReloadData(); - } - - protected async Task doEdit(TaskListModel selRec) - { - currRecord = selRec; - await ReloadData(); - } - - protected async Task doMove(TaskListModel currRec, bool goUp) - { - await TService.TaskListMove(currRec, goUp); - detRecord = null; - currRecord = null; - await ReloadData(); - } - - protected async Task doReset() - { - detRecord = null; - currRecord = null; - await TService.FlushCache(); - await ReloadData(); - } - - protected async Task doRun(TaskListModel selRec) - { - // SE non è ancora scaduto chiedo conferma - if (selRec.DtNextExec > DateTime.Now) - { - if (!await JSRuntime.InvokeAsync("confirm", $"Confermi esecuzione forzata task non scaduto?{Environment.NewLine}[{selRec.TaskId}]: {selRec.Name} - {selRec.Descript}{Environment.NewLine}Prossima schedulazione: {selRec.DtNextExec:yyyy-MM-dd HH:mm:ss}")) - return; - } - - // imposto tempo atteso esecuzione da ultimo... - isLoading = true; - MaxVal = 4; - int currStep = 0; - await advStep(currStep); - expTimeMsec = (int)(1000 * selRec.LastDuration) / 4; - detRecord = null; - await advStep(currStep++); - await Task.Delay(100); - await advStep(currStep++); - // chiama esecuzione task - var result = await TService.ExecuteTask(selRec, false); - await advStep(currStep++); - isLoading = false; - await Task.Delay(100); - await advStep(currStep++); - await ReloadData(); - } - - protected async Task doSelect(TaskListModel selRec) - { - detRecord = null; - currRecord = null; - DetailTaskId = null; - isLoading = true; - detRecord = selRec; - await ReloadData(); - isLoading = false; - } - - protected async Task forceAll() - { - if (!await JSRuntime.InvokeAsync("confirm", $"Confermi esecuzione forzata di tutti i task?")) - return; - - isLoading = true; - detRecord = null; - await Task.Delay(100); - foreach (var taskRec in SearchRecords) - { - var result = await TService.ExecuteTask(taskRec, false); - } - isLoading = false; - await Task.Delay(100); - await ReloadData(); - } - - protected async Task ForceReload(int newNum) - { - numRecord = newNum; - await ReloadData(); - } - - protected async Task ForceReloadPage(int newNum) - { - currPage = newNum; - await ReloadData(); - } - - protected async Task forceUpdate(bool doForce) - { - currRecord = null; - await ReloadData(); - } - - protected string iconCss(TaskListModel TaskRec) - { - return TaskRec.LastIsError ? "fa-thumbs-down" : "fa-thumbs-up"; - } - - protected override async Task OnInitializedAsync() - { - clearFile(); - numRecord = 10; - MessageService.ShowSearch = false; - MessageService.PageName = "Task Scheduler"; - MessageService.PageIcon = "oi oi-clock"; - MessageService.EA_SearchUpdated += OnSeachUpdated; - await ReloadData(); - } - - protected void ResetData() - { - clearFile(); - TService.rollBackEdit(currRecord); - currRecord = null; - } - - protected async Task ResetFilter(SelectData newFilter) - { - clearFile(); - detRecord = null; - currRecord = null; - SearchRecords = null; - ListRecords = null; - await ReloadData(); - } - - protected double righDiv(double num, double den) - { - if (den == 0) - { - den = 1; - } - double answ = num / den; - return answ; - } - - protected string TextReduce(string textOriginal, int maxChar) - { - string answ = textOriginal; - if (answ.Length > maxChar) - { - answ = $"{textOriginal.Substring(0, maxChar / 2)} ... {textOriginal.Substring(answ.Length - maxChar / 2)}"; - } - return answ; - } - - protected void ToggleDetail(TaskListModel TaskRec) - { - if (DetailTaskId == null) - { - DetailTaskId = TaskRec; - } - else - { - DetailTaskId = (DetailTaskId.TaskId == TaskRec.TaskId) ? null : TaskRec; - } + MServ.ShowSearch = true; + MServ.PageName = "Task Scheduler"; + MServ.PageIcon = "oi oi-clock"; } #endregion Protected Methods - - #region Private Fields - - private double currVal = 0; - private TaskListModel? DetailTaskId = null; - private List ListRecords; - private int MaxVal = 10; - private double nextVal = 0; - private List SearchRecords; - - #endregion Private Fields - - #region Private Properties - - private int currPage { get; set; } = 1; - - private TaskListModel currRecord { get; set; } = null; - - private TaskListModel detRecord { get; set; } = null; - - private int expTimeMsec { get; set; } = 30000; - - private string fullPath - { - get => $"{Directory.GetCurrentDirectory()}\\temp\\{fileName}"; - } - - private bool isLoading { get; set; } = false; - private int numRecord { get; set; } = 10; - - private Task2ExeType typeSel { get; set; } = Task2ExeType.ND; - - #endregion Private Properties - - #region Private Methods - - private string btnRunCss(DateTime dtNextExe) - { - DateTime adesso = DateTime.Now; - string answ = dtNextExe < adesso ? "btn-success" : "btn-warning"; - return answ; - } - - private async void clearFile() - { - await Task.Run(() => File.Delete(fullPath)); - } - - private async Task ExportCsv() - { - isLoading = true; - // salvo davvero! - await MP.Data.Utils.SaveToCsv(SearchRecords, fullPath, ';'); - isLoading = false; - } - - private async Task ReloadData() - { - SearchRecords = await TService.TaskListAll(TypeSel, ""); - totalCount = SearchRecords.Count; - var firstRec = SearchRecords.OrderBy(x => x.Ordinal).FirstOrDefault(); - minOrdinal = firstRec != null ? firstRec.Ordinal : 0; - var lastRec = SearchRecords.OrderByDescending(x => x.Ordinal).FirstOrDefault(); - maxOrdinal = lastRec != null ? lastRec.Ordinal : 9999; - ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList(); - } - - #endregion Private Methods } } \ No newline at end of file diff --git a/MP.Land/Resources/ChangeLog.html b/MP.Land/Resources/ChangeLog.html index 97dbacdb..f1632ace 100644 --- a/MP.Land/Resources/ChangeLog.html +++ b/MP.Land/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo Tablet MAPO - DotNet6 -

Versione: 6.16.2410.2611

+

Versione: 6.16.2410.2612


Note di rilascio:
    diff --git a/MP.Land/Resources/VersNum.txt b/MP.Land/Resources/VersNum.txt index f52a95aa..e9c2ab4a 100644 --- a/MP.Land/Resources/VersNum.txt +++ b/MP.Land/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2410.2611 +6.16.2410.2612 diff --git a/MP.Land/Resources/manifest.xml b/MP.Land/Resources/manifest.xml index bbab1a7a..5f1e8470 100644 --- a/MP.Land/Resources/manifest.xml +++ b/MP.Land/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2410.2611 + 6.16.2410.2612 https://nexus.steamware.net/repository/SWS/MP-LAND/stable/LAST/MP.Land.zip https://nexus.steamware.net/repository/SWS/MP-LAND/stable/LAST/ChangeLog.html false diff --git a/MP.Land/Shared/NavMenu.razor.cs b/MP.Land/Shared/NavMenu.razor.cs index b8f7574c..7485ff52 100644 --- a/MP.Land/Shared/NavMenu.razor.cs +++ b/MP.Land/Shared/NavMenu.razor.cs @@ -111,7 +111,6 @@ namespace MP.Land.Shared private async Task ReloadData() { isLoading = true; - await Task.Delay(1); // sistemo elenco pagine safe... SafePages = ConfMan.GetValue("Application:SafePages").ToLower(); var authState = await AuthStateProvider.GetAuthenticationStateAsync(); diff --git a/MP.Stats/Data/MpStatsService.cs b/MP.Stats/Data/MpStatsService.cs index 36bbd02f..ba7a00f0 100644 --- a/MP.Stats/Data/MpStatsService.cs +++ b/MP.Stats/Data/MpStatsService.cs @@ -127,6 +127,7 @@ namespace MP.Stats.Data return Task.FromResult(answ); } +#if false /// /// Aggiorna record calcolando prossima scadenza dato ultima esecuzione /// @@ -140,7 +141,8 @@ namespace MP.Stats.Data dtNext = dbController.CalcNextExe(taskRec); } return dtNext; - } + } +#endif public Task> CommesseGetSearch(int numRecord, string searchVal = "") { @@ -162,6 +164,7 @@ namespace MP.Stats.Data redisDb = null; } +#if false /// /// Chiamata esecuzione di un singolo task programmato /// @@ -174,7 +177,8 @@ namespace MP.Stats.Data // svuoto cache! await FlushCache("Task"); return await Task.FromResult(dbResult); - } + } +#endif /// /// Pulizia cache Redis (tutta) @@ -559,6 +563,7 @@ namespace MP.Stats.Data return result; } +#if false /// /// Ricerca task dato tipo + num max (desc) /// @@ -666,7 +671,8 @@ namespace MP.Stats.Data // svuoto cache! await FlushCache("Task"); return await Task.FromResult(dbResult); - } + } +#endif #endregion Public Methods diff --git a/MP.Stats/MP.Stats.csproj b/MP.Stats/MP.Stats.csproj index b25a603b..9957de5d 100644 --- a/MP.Stats/MP.Stats.csproj +++ b/MP.Stats/MP.Stats.csproj @@ -4,18 +4,25 @@ net6.0 MP.Stats 826e877c-ba70-4253-84cb-d0b1cafd4440 - 6.16.2410.2318 - 6.16.2410.2318 + 6.16.2410.2612 + 6.16.2410.2612 true $(NoWarn);1591 + + + + + + + @@ -32,6 +39,7 @@ + @@ -188,7 +196,7 @@ - + @@ -216,6 +224,10 @@ Always + + + + diff --git a/MP.Stats/Pages/Controlli.razor.cs b/MP.Stats/Pages/Controlli.razor.cs index 6a3927a2..a364f41c 100644 --- a/MP.Stats/Pages/Controlli.razor.cs +++ b/MP.Stats/Pages/Controlli.razor.cs @@ -123,7 +123,7 @@ namespace MP.Stats.Pages { isLoading = true; // salvo davvero! - await MP.Data.Utils.SaveToCsv(SearchRecords, fullPath, ';'); + await Egw.Core.Utils.SaveToCsv(SearchRecords, fullPath, ';'); isLoading = false; } diff --git a/MP.Stats/Pages/Diario.razor.cs b/MP.Stats/Pages/Diario.razor.cs index cc3babc7..d4979afc 100644 --- a/MP.Stats/Pages/Diario.razor.cs +++ b/MP.Stats/Pages/Diario.razor.cs @@ -100,7 +100,7 @@ namespace MP.Stats.Pages // recupero TUTTI i dati var allRecords = await StatService.StatDdbGetAllExport(currFilter, MessageService.SearchVal); // salvo davvero! - await MP.Data.Utils.SaveToCsv(allRecords, fullPath, ';'); + await Egw.Core.Utils.SaveToCsv(allRecords, fullPath, ';'); isLoading = false; } diff --git a/MP.Stats/Pages/Energy.razor.cs b/MP.Stats/Pages/Energy.razor.cs index 9e5fa476..0f4d58a2 100644 --- a/MP.Stats/Pages/Energy.razor.cs +++ b/MP.Stats/Pages/Energy.razor.cs @@ -92,7 +92,7 @@ namespace MP.Stats.Pages { isLoading = true; // salvo davvero! - await MP.Data.Utils.SaveToCsv(SearchRecords, fullPath, ';'); + await Egw.Core.Utils.SaveToCsv(SearchRecords, fullPath, ';'); isLoading = false; } diff --git a/MP.Stats/Pages/Oee.razor.cs b/MP.Stats/Pages/Oee.razor.cs index 7c898ea4..ce05045e 100644 --- a/MP.Stats/Pages/Oee.razor.cs +++ b/MP.Stats/Pages/Oee.razor.cs @@ -124,7 +124,7 @@ namespace MP.Stats.Pages isLoading = true; // calcolo nome file // salvo davvero! - await MP.Data.Utils.SaveToCsv(SearchRecords, fullPath, ';'); + await Egw.Core.Utils.SaveToCsv(SearchRecords, fullPath, ';'); isLoading = false; } diff --git a/MP.Stats/Pages/ReportODL.razor.cs b/MP.Stats/Pages/ReportODL.razor.cs index 0d6db954..606d216e 100644 --- a/MP.Stats/Pages/ReportODL.razor.cs +++ b/MP.Stats/Pages/ReportODL.razor.cs @@ -92,7 +92,7 @@ namespace MP.Stats.Pages { isLoading = true; // salvo davvero! - await MP.Data.Utils.SaveToCsv(SearchRecords, fullPath, ';'); + await Egw.Core.Utils.SaveToCsv(SearchRecords, fullPath, ';'); isLoading = false; } diff --git a/MP.Stats/Pages/Scarti.razor.cs b/MP.Stats/Pages/Scarti.razor.cs index ac7dd0e0..d41f90b8 100644 --- a/MP.Stats/Pages/Scarti.razor.cs +++ b/MP.Stats/Pages/Scarti.razor.cs @@ -123,7 +123,7 @@ namespace MP.Stats.Pages { isLoading = true; // salvo davvero! - await MP.Data.Utils.SaveToCsv(SearchRecords, fullPath, ';'); + await Egw.Core.Utils.SaveToCsv(SearchRecords, fullPath, ';'); isLoading = false; } diff --git a/MP.Stats/Pages/TaskScheduler.razor b/MP.Stats/Pages/TaskScheduler.razor index 14f307a3..be6d4b0a 100644 --- a/MP.Stats/Pages/TaskScheduler.razor +++ b/MP.Stats/Pages/TaskScheduler.razor @@ -19,7 +19,7 @@ } + @foreach (var option in Enum.GetValues(typeof(MP.TaskMan.Objects.Enums.Task2ExeType))) + { + + } + + + + + + +
    + @if (isLoading) + { + + + } + else if (ListRecords == null) + { + + } + else if (totalCount == 0) + { +
    Nessun record trovato
    + } + else + { +
    +
    + + + + + + + + @if (detRecord == null) + { + + } + + @if (detRecord == null) + { + + + + + } + + + + @foreach (var record in ListRecords) + { + + + + + + @if (detRecord == null) + { + + } + + @if (detRecord == null) + { + + + + + } + + @if (DetailTaskId != null && DetailTaskId.TaskId == record.TaskId) + { + + + + } + } + +
    + + OrdTaskTipoCommandSched.LastNextResult + +
    + + @if (detRecord == null) + { + @if (currRecord == null) + { + + + } + else + { + + } + } + + @if (detRecord == null) + { + @if (record.Ordinal == minOrdinal) + { + + } + else + { + + } + } + @record.Ordinal + @if (detRecord == null) + { + @if (record.Ordinal == maxOrdinal) + { + + } + else + { + + } + } + +
    @record.Name
    +
    @record.Descript
    +
    + @record.TType + +
    @TextReduce(record.Command, 32)
    +
    @TextReduce(record.Args, 40)
    +
    @record.Freq × @record.Cad +
    @($"{record.DtLastExec:yyyy-MM-dd}")
    +
    @($"{record.DtLastExec:ddd HH:mm:ss}")
    +
    +
    @($"{record.DtNextExec:yyyy-MM-dd}")
    +
    @($"{record.DtNextExec:ddd HH:mm:ss}")
    +
    + @($"{record.LastDuration:N3}") sec + + +
    +
    +
    +
    @record.LastResult
    +
    +
    +
    +
    +
    + } +
    + + + + @if (detRecord != null && !isLoading) + { +
    + +
    + } + + diff --git a/MP.TaskMan/TaskList.razor.cs b/MP.TaskMan/TaskList.razor.cs new file mode 100644 index 00000000..44cfa91e --- /dev/null +++ b/MP.TaskMan/TaskList.razor.cs @@ -0,0 +1,363 @@ +using Microsoft.AspNetCore.Components; +using Microsoft.JSInterop; +using MP.TaskMan.Models; +using MP.TaskMan.Services; +using static MP.TaskMan.Objects.Enums; + +namespace MP.TaskMan +{ + public partial class TaskList : ComponentBase + { + #region Public Methods + + public string checkSelect(int TaskId) + { + string answ = ""; + if (currRecord != null) + { + try + { + answ = (currRecord.TaskId == TaskId) ? "table-info" : ""; + } + catch + { } + } + else if (detRecord != null) + { + answ = (detRecord.TaskId == TaskId) ? "table-info" : ""; + } + return answ; + } + + #endregion Public Methods + + #region Protected Fields + + protected string fileName = "TaskList.csv"; + + #endregion Protected Fields + + #region Protected Properties + + [Inject] + protected IJSRuntime JSRuntime { get; set; } = null!; + + protected string mainCss + { + get => detRecord == null ? "col-12" : "col-6"; + } + + protected int maxOrdinal { get; set; } = 999; + protected int minOrdinal { get; set; } = 0; + protected int totalCount { get; set; } = 0; + + [Inject] + protected TaskService TService { get; set; } = null!; + + protected Task2ExeType TypeSel + { + get => typeSel; + set + { + if (typeSel != value) + { + typeSel = value; + var pUpd = Task.Run(async () => + { + await ReloadData(); + }); + pUpd.Wait(); + } + } + } + + #endregion Protected Properties + + #region Protected Methods + + protected async Task addNew() + { + currRecord = new TaskListModel() + { + Name = "Nuovo Task", + TType = TypeSel, + Descript = "Descrizione Task", + DtLastExec = DateTime.Today, + DtNextExec = DateTime.Today.AddDays(1) + }; + await ReloadData(); + } + + /// + /// Gestione display avanzamento step + /// + /// + protected async Task advStep(int currStep) + { + currVal = currStep; + nextVal = currVal + 1; + await InvokeAsync(StateHasChanged); + } + + protected string alCss(TaskListModel TaskRec) + { + return TaskRec.LastIsError ? "alert-danger" : "alert-success"; + } + + protected string btnCss(TaskListModel TaskRec) + { + string answ = DetailTaskId != null && DetailTaskId.TaskId == TaskRec.TaskId ? "btn-" : "btn-outline-"; + answ += TaskRec.LastIsError ? "danger" : "success"; + return answ; + } + + protected async Task doCancel() + { + currRecord = null; + detRecord = null; + await ReloadData(); + } + + protected async Task doClone(TaskListModel selRec) + { + if (!await JSRuntime.InvokeAsync("confirm", $"Confermi di voler duplicare il record selezionato?")) + return; + currRecord = new TaskListModel() + { + Args = selRec.Args, + Name = $"Copia di {selRec.Name}", + Cad = selRec.Cad, + Command = selRec.Command, + Descript = $"Copia di {selRec.Descript}", + DtNextExec = DateTime.Today.AddDays(1), + DtLastExec = DateTime.Today.AddYears(-10), + Freq = selRec.Freq, + LastDuration = 0, + LastIsError = false, + LastResult = "", + TType = selRec.TType, + Ordinal = SearchRecords.Count + 1, + }; + await ReloadData(); + } + + protected async Task doEdit(TaskListModel selRec) + { + currRecord = selRec; + await ReloadData(); + } + + protected async Task doMove(TaskListModel currRec, bool goUp) + { + await TService.TaskListMove(currRec, goUp); + detRecord = null; + currRecord = null; + await ReloadData(); + } + + protected async Task doReset() + { + detRecord = null; + currRecord = null; + await TService.FlushCache(); + await ReloadData(); + } + + protected async Task doRun(TaskListModel selRec) + { + // SE non è ancora scaduto chiedo conferma + if (selRec.DtNextExec > DateTime.Now) + { + if (!await JSRuntime.InvokeAsync("confirm", $"Confermi esecuzione forzata task non scaduto?{Environment.NewLine}[{selRec.TaskId}]: {selRec.Name} - {selRec.Descript}{Environment.NewLine}Prossima schedulazione: {selRec.DtNextExec:yyyy-MM-dd HH:mm:ss}")) + return; + } + + // imposto tempo atteso esecuzione da ultimo... + isLoading = true; + MaxVal = 4; + int currStep = 0; + await advStep(currStep); + expTimeMsec = (int)(1000 * selRec.LastDuration) / 4; + detRecord = null; + await advStep(currStep++); + await Task.Delay(100); + await advStep(currStep++); + // chiama esecuzione task + var result = await TService.ExecuteTask(selRec, false); + await advStep(currStep++); + isLoading = false; + await Task.Delay(100); + await advStep(currStep++); + await ReloadData(); + } + + protected async Task doSelect(TaskListModel selRec) + { + detRecord = null; + currRecord = null; + DetailTaskId = null; + isLoading = true; + detRecord = selRec; + await ReloadData(); + isLoading = false; + } + + protected async Task forceAll() + { + if (!await JSRuntime.InvokeAsync("confirm", $"Confermi esecuzione forzata di tutti i task?")) + return; + + isLoading = true; + detRecord = null; + await Task.Delay(100); + foreach (var taskRec in SearchRecords) + { + var result = await TService.ExecuteTask(taskRec, false); + } + isLoading = false; + await Task.Delay(100); + await ReloadData(); + } + + protected async Task ForceReload(int newNum) + { + numRecord = newNum; + await ReloadData(); + } + + protected async Task ForceReloadPage(int newNum) + { + currPage = newNum; + await ReloadData(); + } + + protected async Task forceUpdate(bool doForce) + { + currRecord = null; + await ReloadData(); + } + + protected string iconCss(TaskListModel TaskRec) + { + return TaskRec.LastIsError ? "fa-thumbs-down" : "fa-thumbs-up"; + } + + protected override async Task OnInitializedAsync() + { + isLoading = true; + MaxVal = 2; + clearFile(); + await advStep(1); + numRecord = 10; + await ReloadData(); + await advStep(2); + isLoading = false; + } + + protected void ResetData() + { + clearFile(); + TService.rollBackEdit(currRecord); + currRecord = null; + } + + protected double righDiv(double num, double den) + { + if (den == 0) + { + den = 1; + } + double answ = num / den; + return answ; + } + + protected string TextReduce(string textOriginal, int maxChar) + { + string answ = textOriginal; + if (answ.Length > maxChar) + { + answ = $"{textOriginal.Substring(0, maxChar / 2)} ... {textOriginal.Substring(answ.Length - maxChar / 2)}"; + } + return answ; + } + + protected void ToggleDetail(TaskListModel TaskRec) + { + if (DetailTaskId == null) + { + DetailTaskId = TaskRec; + } + else + { + DetailTaskId = (DetailTaskId.TaskId == TaskRec.TaskId) ? null : TaskRec; + } + } + + #endregion Protected Methods + + #region Private Fields + + private double currVal = 0; + private TaskListModel? DetailTaskId = null; + private List ListRecords = new List(); + private int MaxVal = 10; + private double nextVal = 0; + private List SearchRecords = new List(); + + #endregion Private Fields + + #region Private Properties + + private int currPage { get; set; } = 1; + private TaskListModel? currRecord { get; set; } = null; + private TaskListModel? detRecord { get; set; } = null; + private int expTimeMsec { get; set; } = 30000; + + private string fullPath + { + get => $"{Directory.GetCurrentDirectory()}\\temp\\{fileName}"; + } + + private bool isLoading { get; set; } = false; + private int numRecord { get; set; } = 10; + private string SearchVal { get; set; } = ""; + private Task2ExeType typeSel { get; set; } = Task2ExeType.ND; + + #endregion Private Properties + + #region Private Methods + + private string btnRunCss(DateTime dtNextExe) + { + DateTime adesso = DateTime.Now; + string answ = dtNextExe < adesso ? "btn-success" : "btn-warning"; + return answ; + } + + private async void clearFile() + { + await Task.Run(() => File.Delete(fullPath)); + } + + private async Task ExportCsv() + { + isLoading = true; + // salvo davvero! + await Egw.Core.Utils.SaveToCsv(SearchRecords, fullPath, ';'); + isLoading = false; + } + + private async Task ReloadData() + { + SearchRecords = await TService.TaskListAll(TypeSel, SearchVal); + totalCount = SearchRecords.Count; + var firstRec = SearchRecords.OrderBy(x => x.Ordinal).FirstOrDefault(); + minOrdinal = firstRec != null ? firstRec.Ordinal : 0; + var lastRec = SearchRecords.OrderByDescending(x => x.Ordinal).FirstOrDefault(); + maxOrdinal = lastRec != null ? lastRec.Ordinal : 9999; + ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList(); + } + + #endregion Private Methods + } +} \ No newline at end of file diff --git a/MP.TaskMan/_Imports.razor b/MP.TaskMan/_Imports.razor index a97860ca..c52cb18e 100644 --- a/MP.TaskMan/_Imports.razor +++ b/MP.TaskMan/_Imports.razor @@ -1,2 +1,4 @@ @using Microsoft.AspNetCore.Components.Web -@using MP.TaskMan.Models \ No newline at end of file +@using MP.TaskMan.Models +@using EgwCoreLib.Razor +@using EgwCoreLib.Utils \ No newline at end of file From a2a63e283d68f35915ce89713ee6127694ce36ba Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Sat, 26 Oct 2024 12:53:07 +0200 Subject: [PATCH 5/7] Continuato cleanup nuget & co --- MP.AppAuth/MP.AppAuth.csproj | 6 +++--- MP.Land/Pages/UpdateManager.razor.cs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/MP.AppAuth/MP.AppAuth.csproj b/MP.AppAuth/MP.AppAuth.csproj index f5648765..831d95fa 100644 --- a/MP.AppAuth/MP.AppAuth.csproj +++ b/MP.AppAuth/MP.AppAuth.csproj @@ -6,13 +6,13 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/MP.Land/Pages/UpdateManager.razor.cs b/MP.Land/Pages/UpdateManager.razor.cs index f900506b..f7d3455a 100644 --- a/MP.Land/Pages/UpdateManager.razor.cs +++ b/MP.Land/Pages/UpdateManager.razor.cs @@ -19,7 +19,7 @@ using System.Threading.Tasks; namespace MP.Land.Pages { - public partial class UpdateManager : IDisposable + public partial class UpdateManager : ComponentBase, IDisposable { #region Public Methods From 1b6d28f2eb018241e1e3c62da2bc14fb8a881fd1 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Mon, 28 Oct 2024 10:03:03 +0100 Subject: [PATCH 6/7] FixTaskMan module - LAND - STATS --- MP-TAB3/MP-TAB3.csproj | 2 +- MP-TAB3/Resources/ChangeLog.html | 2 +- MP-TAB3/Resources/VersNum.txt | 2 +- MP-TAB3/Resources/manifest.xml | 2 +- MP-TAB3/appsettings.json | 41 ++- MP.Data/Services/TabDataService.cs | 4 +- MP.Land/Components/HomeLink.razor | 4 +- MP.Land/Data/AppAuthService.cs | 2 +- MP.Land/MP.Land.csproj | 2 +- MP.Land/Pages/Index.razor | 4 +- MP.Land/Resources/ChangeLog.html | 2 +- MP.Land/Resources/VersNum.txt | 2 +- MP.Land/Resources/manifest.xml | 2 +- MP.Land/Startup.cs | 2 +- MP.Land/appsettings.json | 10 +- MP.Stats/Components/TLResult.razor | 7 - MP.Stats/Components/TLResult.razor.cs | 56 ---- MP.Stats/Components/TaskEdit.razor | 101 ------- MP.Stats/Components/TaskEdit.razor.cs | 50 ---- MP.Stats/Components/TaskExeList.razor | 85 ------ MP.Stats/Components/TaskExeList.razor.cs | 113 -------- MP.Stats/Controllers/TaskController.cs | 60 ++-- MP.Stats/Data/MpStatsService.cs | 110 -------- MP.Stats/MP.Stats.csproj | 9 +- MP.Stats/Pages/TaskScheduler.razor | 165 +---------- MP.Stats/Pages/TaskScheduler.razor.cs | 331 +---------------------- MP.Stats/Resources/ChangeLog.html | 2 +- MP.Stats/Resources/VersNum.txt | 2 +- MP.Stats/Resources/manifest.xml | 2 +- MP.Stats/Startup.cs | 3 + MP.Stats/appsettings.json | 8 +- MP.TaskMan/Component1.razor | 3 - MP.TaskMan/Component1.razor.css | 6 - MP.TaskMan/Services/TaskService.cs | 7 +- MP.TaskMan/TaskContext.cs | 68 +++-- 35 files changed, 145 insertions(+), 1126 deletions(-) delete mode 100644 MP.Stats/Components/TLResult.razor delete mode 100644 MP.Stats/Components/TLResult.razor.cs delete mode 100644 MP.Stats/Components/TaskEdit.razor delete mode 100644 MP.Stats/Components/TaskEdit.razor.cs delete mode 100644 MP.Stats/Components/TaskExeList.razor delete mode 100644 MP.Stats/Components/TaskExeList.razor.cs delete mode 100644 MP.TaskMan/Component1.razor delete mode 100644 MP.TaskMan/Component1.razor.css diff --git a/MP-TAB3/MP-TAB3.csproj b/MP-TAB3/MP-TAB3.csproj index 82763f4c..412e59da 100644 --- a/MP-TAB3/MP-TAB3.csproj +++ b/MP-TAB3/MP-TAB3.csproj @@ -3,7 +3,7 @@ net6.0 enable - 6.16.2410.1815 + 6.16.2410.2809 enable MP_TAB3 diff --git a/MP-TAB3/Resources/ChangeLog.html b/MP-TAB3/Resources/ChangeLog.html index 415293f2..acde8931 100644 --- a/MP-TAB3/Resources/ChangeLog.html +++ b/MP-TAB3/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOSPEC -

    Versione: 6.16.2410.1815

    +

    Versione: 6.16.2410.2809


    Note di rilascio:
    • diff --git a/MP-TAB3/Resources/VersNum.txt b/MP-TAB3/Resources/VersNum.txt index aa74da27..c71112a4 100644 --- a/MP-TAB3/Resources/VersNum.txt +++ b/MP-TAB3/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2410.1815 +6.16.2410.2809 diff --git a/MP-TAB3/Resources/manifest.xml b/MP-TAB3/Resources/manifest.xml index 86f9ff87..afcf3514 100644 --- a/MP-TAB3/Resources/manifest.xml +++ b/MP-TAB3/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2410.1815 + 6.16.2410.2809 https://nexus.steamware.net/repository/SWS/MP-TAB3/stable/LAST/MP-TAB3.zip https://nexus.steamware.net/repository/SWS/MP-TAB3/stable/LAST/ChangeLog.html false diff --git a/MP-TAB3/appsettings.json b/MP-TAB3/appsettings.json index 0272dcfd..6ff54a58 100644 --- a/MP-TAB3/appsettings.json +++ b/MP-TAB3/appsettings.json @@ -58,19 +58,6 @@ } ] }, - "OptConf": { - "msRefresh": "1100", - "CodModulo": "MP-TAB3", - "CodModuloParam": "MoonPro" - }, - "ServerConf": { - "BaseAddr": "https://localhost:7295/MP/TAB3/", - "BasePathDisegni": "\\\\iis01\\W$\\Files\\Disegni", - "BaseUrlTab": "/MP/TAB3", - "ImgBasePath": "https://iis01.egalware.com/MP/macchine/small/", - "MpIoNS": "MoonPro:SQL2016DEV:MoonPro", - "maxChar4Scroll": 21 - }, "AlarmDest": "samuele.locatelli@egalware.com, ceo@steamware.net", "MailKitMailSettings": { "DisplayName": "MAPO EgalWare Email BOT", @@ -81,17 +68,21 @@ "UserName": "steamwarebot@outlook.it", "UseSSL": false, "UseStartTls": true + }, + "OptConf": { + "msRefresh": "1001" + }, + "ServerConf": { + "BaseAddr": "https://localhost:7295/MP/TAB3/", + "BasePathDisegni": "\\\\iis01\\W$\\Files\\Disegni", + "BaseUrlTab": "/MP/TAB3", + "ImgBasePath": "https://iis01.egalware.com/MP/macchine/small/", + "MpIoNS": "MoonPro:SQL2016DEV:MoonPro", + "maxChar4Scroll": 21 + }, + "SpecialConf": { + "CodApp": "MP-LAND", + "CodModulo": "MP-TAB3", + "CodModuloParam": "MoonPro" } - //"ExternalProviders": { - // "MailKit": { - // "SMTP": { - // "Address": "smtp.gmail.com", - // "Port": "465", - // "Account": "steamwarebot@gmail.com", - // "Password": "drmfsls16", - // "SenderEmail": "steamwarebot@gmail.com", - // "SenderName": "Steamware Email BOT" - // } - // } - //} } diff --git a/MP.Data/Services/TabDataService.cs b/MP.Data/Services/TabDataService.cs index 43d32609..d83589ae 100644 --- a/MP.Data/Services/TabDataService.cs +++ b/MP.Data/Services/TabDataService.cs @@ -53,8 +53,8 @@ namespace MP.Data.Services sb.AppendLine($"TabDataService | MpInveController OK"); Log.Info(sb.ToString()); // sistemo i parametri x redHas... - CodModulo = _configuration.GetValue("OptConf:CodModulo"); - CodModuloParam = _configuration.GetValue("OptConf:CodModuloParam"); + CodModulo = _configuration.GetValue("SpecialConf:CodModulo"); + CodModuloParam = _configuration.GetValue("SpecialConf:CodModuloParam"); MpIoNS = _configuration.GetValue("ServerConf:MpIoNS"); var cstringArray = ConnStr.Split(";"); foreach (var item in cstringArray) diff --git a/MP.Land/Components/HomeLink.razor b/MP.Land/Components/HomeLink.razor index 81bca325..dce5fb65 100644 --- a/MP.Land/Components/HomeLink.razor +++ b/MP.Land/Components/HomeLink.razor @@ -7,7 +7,7 @@ @inject MessageService MService @inject LicenseService LicServ -@if (authOk()) // disegno box cliccabile e programma attivato +@if (authOk()) {
      @@ -32,7 +32,7 @@
      } -else // disegno box cliccabile e licenza ASSISTENZA mancante +else {
      diff --git a/MP.Land/Data/AppAuthService.cs b/MP.Land/Data/AppAuthService.cs index 5537e19b..26fec59b 100644 --- a/MP.Land/Data/AppAuthService.cs +++ b/MP.Land/Data/AppAuthService.cs @@ -34,7 +34,7 @@ namespace MP.Land.Data _configuration = configuration; // cod app - CodApp = _configuration.GetValue("ServerConf:CodApp"); + CodApp = _configuration.GetValue("SpecialConf:CodApp"); Modulo = _configuration.GetValue("ServerConf:Modulo"); // Conf cache diff --git a/MP.Land/MP.Land.csproj b/MP.Land/MP.Land.csproj index 68981098..ebfd1507 100644 --- a/MP.Land/MP.Land.csproj +++ b/MP.Land/MP.Land.csproj @@ -3,7 +3,7 @@ net6.0 MP.Land - 6.16.2410.2612 + 6.16.2410.2809 Debug;Release;Debug_LiManDebug diff --git a/MP.Land/Pages/Index.razor b/MP.Land/Pages/Index.razor index baa68c22..56b770a5 100644 --- a/MP.Land/Pages/Index.razor +++ b/MP.Land/Pages/Index.razor @@ -25,7 +25,7 @@
      -
      +
      @if (ListRecords == null) { @@ -39,7 +39,7 @@
      @foreach (var item in ListRecords) { -
      +
      } diff --git a/MP.Land/Resources/ChangeLog.html b/MP.Land/Resources/ChangeLog.html index f1632ace..d0a1bee4 100644 --- a/MP.Land/Resources/ChangeLog.html +++ b/MP.Land/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo Tablet MAPO - DotNet6 -

      Versione: 6.16.2410.2612

      +

      Versione: 6.16.2410.2809


      Note di rilascio:
        diff --git a/MP.Land/Resources/VersNum.txt b/MP.Land/Resources/VersNum.txt index e9c2ab4a..c71112a4 100644 --- a/MP.Land/Resources/VersNum.txt +++ b/MP.Land/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2410.2612 +6.16.2410.2809 diff --git a/MP.Land/Resources/manifest.xml b/MP.Land/Resources/manifest.xml index 5f1e8470..05b025ad 100644 --- a/MP.Land/Resources/manifest.xml +++ b/MP.Land/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2410.2612 + 6.16.2410.2809 https://nexus.steamware.net/repository/SWS/MP-LAND/stable/LAST/MP.Land.zip https://nexus.steamware.net/repository/SWS/MP-LAND/stable/LAST/ChangeLog.html false diff --git a/MP.Land/Startup.cs b/MP.Land/Startup.cs index 02d7fbab..a9642742 100644 --- a/MP.Land/Startup.cs +++ b/MP.Land/Startup.cs @@ -137,9 +137,9 @@ namespace MP.Land services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); + services.AddSingleton(); services.AddScoped(); - services.AddScoped(); services.AddScoped(); services.AddSingleton(redisMultiplexer); diff --git a/MP.Land/appsettings.json b/MP.Land/appsettings.json index 1140ab43..b64a1d90 100644 --- a/MP.Land/appsettings.json +++ b/MP.Land/appsettings.json @@ -60,7 +60,6 @@ "MP.All": "Server=SQL2016DEV;Database=MoonPro;User ID=sa;Password=keyhammer16;integrated security=False;MultipleActiveResultSets=True;App=MP.Land;", "MP.Land": "Server=SQL2016DEV;Database=MoonPro;User ID=sa;Password=keyhammer16;integrated security=False;MultipleActiveResultSets=True;App=MP.Land;", "MP.Land.Auth": "Server=SQL2016DEV;Database=MoonPro_Anagrafica;User ID=sa;Password=keyhammer16;integrated security=False;MultipleActiveResultSets=True;App=MP.Land;", - //"MP.Land": "Server=SQL2016DEV;Database=MoonPro_ONE;User ID=sa;Password=keyhammer16;integrated security=False;MultipleActiveResultSets=True;App=MP.Land;", "Redis": "localhost:26379, serviceName=devel, defaultDatabase=1, keepAlive=180, connectTimeout=5000, syncTimeout=5000, asyncTimeout=5000, abortConnect=false, ssl=false, allowAdmin=true" }, "Application": { @@ -68,11 +67,14 @@ }, "ServerConf": { "BaseUrl": "https://localhost:44309/", - "CodApp": "MP-LAND", - "CodModulo": "MP-LAND", + "downloadPath": "C:\\Steamware\\installers\\MP", "IobUploadPath": "C:\\inetpub\\wwwroot\\MP\\fileUpload", "Modulo": "MoonPro", - "downloadPath": "C:\\Steamware\\installers\\MP", "Prog.ApiUrl": "https://office.egalware.com/MP/PROG" + }, + "SpecialConf": { + "TaskManConn": "MP.Land", + "CodApp": "MP-LAND", + "CodModulo": "MP-LAND" } } \ No newline at end of file diff --git a/MP.Stats/Components/TLResult.razor b/MP.Stats/Components/TLResult.razor deleted file mode 100644 index fe4d9b04..00000000 --- a/MP.Stats/Components/TLResult.razor +++ /dev/null @@ -1,7 +0,0 @@ -
        - @($"{CurrRecord.LastDuration:N3}") sec -
        -@if (showDetail) -{ -
        @CurrRecord.LastResult
        -} diff --git a/MP.Stats/Components/TLResult.razor.cs b/MP.Stats/Components/TLResult.razor.cs deleted file mode 100644 index 60fff6f3..00000000 --- a/MP.Stats/Components/TLResult.razor.cs +++ /dev/null @@ -1,56 +0,0 @@ -using Microsoft.AspNetCore.Components; -using MP.Data.DatabaseModels; -using System.Threading.Tasks; - -namespace MP.Stats.Components -{ - public partial class TLResult - { - #region Public Properties - - [Parameter] - public TaskListModel CurrRecord { get; set; } = null!; - - #endregion Public Properties - - #region Protected Properties - - protected string alCss - { - get => CurrRecord.LastIsError ? "alert-danger" : "alert-success"; - } - - protected string btnCss - { - get - { - string answ = showDetail ? "btn-" : "btn-outline-"; - answ += CurrRecord.LastIsError ? "danger" : "success"; - return answ; - } - } - - protected string iconCss - { - get => CurrRecord.LastIsError ? "fa-thumbs-down" : "fa-thumbs-up"; - } - - #endregion Protected Properties - - #region Protected Methods - - protected async Task toggleDetail() - { - showDetail = !showDetail; - await InvokeAsync(StateHasChanged); - } - - #endregion Protected Methods - - #region Private Properties - - private bool showDetail { get; set; } = false; - - #endregion Private Properties - } -} \ No newline at end of file diff --git a/MP.Stats/Components/TaskEdit.razor b/MP.Stats/Components/TaskEdit.razor deleted file mode 100644 index 19d84aa3..00000000 --- a/MP.Stats/Components/TaskEdit.razor +++ /dev/null @@ -1,101 +0,0 @@ -@if (CurrRecord != null) -{ -
        -
        -
        -
        - - -
        -
        -
        -
        - - -
        -
        -
        -
        - - -
        -
        - @*
        -
        - - -
        -
        -
        -
        - - -
        -
        *@ -
        -
        -
        -
        - - -
        -
        -
        -
        - - -
        -
        -
        -
        -
        -
        - - -
        -
        -
        -
        - - -
        -
        -
        -
        - - -
        -
        -
        -
        - - -
        -
        -
        - -
        -
        -} - diff --git a/MP.Stats/Components/TaskEdit.razor.cs b/MP.Stats/Components/TaskEdit.razor.cs deleted file mode 100644 index aa518899..00000000 --- a/MP.Stats/Components/TaskEdit.razor.cs +++ /dev/null @@ -1,50 +0,0 @@ -using DnsClient.Protocol; -using Microsoft.AspNetCore.Components; -using MP.Data.DatabaseModels; -using MP.Stats.Data; -using System.Threading.Tasks; - -namespace MP.Stats.Components -{ - public partial class TaskEdit - { - #region Public Properties - - [Parameter] - public TaskListModel? CurrRecord { get; set; } = null; - - [Parameter] - public EventCallback EC_update { get; set; } - - #endregion Public Properties - - #region Protected Properties - - [Inject] - protected MpStatsService StatService { get; set; } - - #endregion Protected Properties - - #region Protected Methods - - protected async Task doCancel() - { - await EC_update.InvokeAsync(false); - } - - protected async Task doSave() - { - bool fatto = false; - await Task.Delay(1); - if (CurrRecord != null) - { - //var nextDt = StatService.CalcNextExe(CurrRecord); - //CurrRecord.DtNextExec = nextDt; - fatto = await StatService.TaskListUpsert(CurrRecord); - } - await EC_update.InvokeAsync(fatto); - } - - #endregion Protected Methods - } -} \ No newline at end of file diff --git a/MP.Stats/Components/TaskExeList.razor b/MP.Stats/Components/TaskExeList.razor deleted file mode 100644 index b74c56a3..00000000 --- a/MP.Stats/Components/TaskExeList.razor +++ /dev/null @@ -1,85 +0,0 @@ - -
        -
        -
        -
        - History -
        -
        -
        - -
        -
        -
        -
        -
        - @if (ListRecords == null) - { - - } - else if (totalCount == 0) - { -
        Nessun record trovato
        - } - else - { -
        -
        - - - - - - - - - - - @foreach (var record in ListRecords) - { - - - - - - - } - -
        #InizioFineEsito
        - @record.TaskExecId - - @($"{record.DtStart:HH:mm:ss.fff}") -
        @($"{record.DtStart:yyyy-MM.dd ddd}")
        -
        - @($"{record.DtEnd:HH:mm:ss.fff}") -
        @($"{record.DtEnd:yyyy-MM.dd ddd}")
        -
        -
        -
        - @if (@record.IsError) - { - - } - else - { - - } -
        -
        - @($"{record.Duration:N3}") sec -
        -
        -
        @record.Result
        -
        -
        -
        - } -
        - -
        \ No newline at end of file diff --git a/MP.Stats/Components/TaskExeList.razor.cs b/MP.Stats/Components/TaskExeList.razor.cs deleted file mode 100644 index ca28f3fa..00000000 --- a/MP.Stats/Components/TaskExeList.razor.cs +++ /dev/null @@ -1,113 +0,0 @@ -using Microsoft.AspNetCore.Components; -using MP.Data.DatabaseModels; -using MP.Stats.Data; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace MP.Stats.Components -{ - public partial class TaskExeList - { - #region Public Properties - - [Parameter] - public TaskListModel? CurrRecord { get; set; } = null; - - #endregion Public Properties - - #region Protected Fields - - protected bool isLoading = false; - - #endregion Protected Fields - - #region Protected Properties - - [Inject] - protected NavigationManager NavManager { get; set; } - - /// - /// Show error mode: 0 = tutti 1 = solo errori 2 = solo ok - /// - protected int ShowErrorMode - { - get => showErrorMode; - set - { - if (showErrorMode != value) - { - showErrorMode = value; - var pUpd = Task.Run(async () => await ReloadData()); - pUpd.Wait(); - } - } - } - - [Inject] - protected MpStatsService StatService { get; set; } - - protected int totalCount { get; set; } = 0; - - #endregion Protected Properties - - #region Protected Methods - - protected async Task ForceReload(int newNum) - { - numRecord = newNum; - await ReloadData(); - } - - protected async Task ForceReloadPage(int newNum) - { - currPage = newNum; - await ReloadData(); - } - - protected override async Task OnInitializedAsync() - { - await ReloadData(); - } - - #endregion Protected Methods - - #region Private Fields - - private List ListRecords; - private List SearchRecords; - - #endregion Private Fields - - #region Private Properties - - private int currPage { get; set; } = 1; - private int numRecord { get; set; } = 10; - private int showErrorMode { get; set; } = 0; - - #endregion Private Properties - - #region Private Methods - - private async Task ReloadData() - { - SearchRecords = await StatService.TaskExecGetFilt(CurrRecord.TaskId, 1000, ""); - // se non tutti filtro... - if (ShowErrorMode != 0) - { - if (ShowErrorMode == 1) - { - SearchRecords = SearchRecords.FindAll(x => x.IsError); - } - else if (ShowErrorMode == 2) - { - SearchRecords = SearchRecords.FindAll(x => !x.IsError); - } - } - totalCount = SearchRecords.Count; - ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList(); - } - - #endregion Private Methods - } -} \ No newline at end of file diff --git a/MP.Stats/Controllers/TaskController.cs b/MP.Stats/Controllers/TaskController.cs index efa3b047..a89bdd59 100644 --- a/MP.Stats/Controllers/TaskController.cs +++ b/MP.Stats/Controllers/TaskController.cs @@ -1,10 +1,8 @@ -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Configuration; -using MP.Data.DatabaseModels; -using MP.Stats.Data; +using MP.TaskMan.Models; +using MP.TaskMan.Services; using NLog; -using NLog.Fluent; using System; using System.Collections.Generic; using System.Linq; @@ -16,7 +14,9 @@ namespace MP.Stats.Controllers [ApiController] public class TaskController : ControllerBase { - public TaskController(IConfiguration configuration, MpStatsService DataService) + #region Public Constructors + + public TaskController(IConfiguration configuration, TaskService DataService) { Log.Trace("Starting TaskController"); _configuration = configuration; @@ -24,16 +24,9 @@ namespace MP.Stats.Controllers Log.Trace("Avviato TaskController"); } - /// - /// List of available task and last execution data - /// - /// - [HttpGet("GetList")] - public async Task> GetList() - { - List answ = await DService.TaskListAll(MP.Data.Objects.Enums.Task2ExeType.ND, ""); - return answ; - } + #endregion Public Constructors + + #region Public Methods /// /// Call for execution of due task and report state @@ -43,26 +36,47 @@ namespace MP.Stats.Controllers public async Task> ExecuteAndReturnGet() { List answ = new List(); - List listTask = await DService.TaskListAll(MP.Data.Objects.Enums.Task2ExeType.ND, ""); + List listTask = await DService.TaskListAll(TaskMan.Objects.Enums.Task2ExeType.ND, ""); // verifico SE ci siano task in scadenza... DateTime adesso = DateTime.Now; var task2exe = listTask.Where(x => x.DtNextExec <= adesso).ToList(); foreach (var taskRec in task2exe) { - TaskResultModel result = await DService.ExecuteTask(taskRec.TaskId, true); + TaskResultModel result = await DService.ExecuteTask(taskRec, true); answ.Add(result); } // resituisco return answ; } + /// + /// List of available task and last execution data + /// + /// + [HttpGet("GetList")] + public async Task> GetList() + { + List answ = await DService.TaskListAll(TaskMan.Objects.Enums.Task2ExeType.ND, ""); + return answ; + } + + #endregion Public Methods + + #region Protected Properties + + /// + /// Dataservice x accesso DB + /// + protected TaskService DService { get; set; } + + #endregion Protected Properties + + #region Private Fields private static IConfiguration _configuration = null!; private static Logger Log = LogManager.GetCurrentClassLogger(); - /// - /// Dataservice x accesso DB - /// - protected MpStatsService DService { get; set; } + + #endregion Private Fields } -} +} \ No newline at end of file diff --git a/MP.Stats/Data/MpStatsService.cs b/MP.Stats/Data/MpStatsService.cs index ba7a00f0..a652db58 100644 --- a/MP.Stats/Data/MpStatsService.cs +++ b/MP.Stats/Data/MpStatsService.cs @@ -563,116 +563,6 @@ namespace MP.Stats.Data return result; } -#if false - /// - /// Ricerca task dato tipo + num max (desc) - /// - /// TaskId da cui deriva - /// - public async Task> TaskExecGetFilt(int TaskId, int maxRec, string searchVal) - { - // setup parametri costanti - string source = "DB"; - Stopwatch sw = new Stopwatch(); - sw.Start(); - List result = new List(); - // cerco in redis... - DateTime adesso = DateTime.Now; - string currKey = $"{redisBaseKey}:Task:ExecList:{TaskId}:{adesso:yyMMdd}:{adesso:HHmm}:{maxRec}"; - RedisValue rawData = await redisDb.StringGetAsync(currKey); - if (rawData.HasValue) - { - result = JsonConvert.DeserializeObject>($"{rawData}"); - source = "REDIS"; - } - else - { - result = dbController.TaskExecGetFilt(TaskId, maxRec); - // serializzp e salvo... - rawData = JsonConvert.SerializeObject(result); - await redisDb.StringSetAsync(currKey, rawData, FastCache); - } - if (result == null) - { - result = new List(); - } - sw.Stop(); - _logger.LogDebug($"TaskExecGetFilt | {source} | {sw.Elapsed.TotalMilliseconds}ms"); - return result; - } - - /// - /// Elenco TaskList gestiti - /// - /// - /// - /// - public async Task> TaskListAll(Task2ExeType TType, string searchVal = "") - { - // setup parametri costanti - string source = "DB"; - Stopwatch sw = new Stopwatch(); - sw.Start(); - List result = new List(); - // cerco in redis... - DateTime adesso = DateTime.Now; - string currKey = $"{redisBaseKey}:Task:List:{TType}"; - RedisValue rawData = await redisDb.StringGetAsync(currKey); - if (rawData.HasValue) - { - result = JsonConvert.DeserializeObject>($"{rawData}"); - source = "REDIS"; - } - else - { - result = dbController.TaskListGetAll(TType); - // serializzp e salvo... - rawData = JsonConvert.SerializeObject(result); - await redisDb.StringSetAsync(currKey, rawData, FastCache); - } - if (result == null) - { - result = new List(); - } - // se necessario filtro.. - if (!string.IsNullOrEmpty(searchVal)) - { - result = result - .Where(x => x.Name.Contains(searchVal, StringComparison.InvariantCultureIgnoreCase) - || x.Descript.Contains(searchVal, StringComparison.InvariantCultureIgnoreCase)) - .ToList(); - } - sw.Stop(); - _logger.LogDebug($"TaskListAll | {source} | {sw.Elapsed.TotalMilliseconds}ms"); - return result; - } - - /// - /// Update ordinamento task - /// - /// Record da spostare x priorità - /// - public async Task TaskListMove(TaskListModel rec2upd, bool moveUp) - { - bool dbResult = dbController.TaskListMove(rec2upd, moveUp); - // svuoto cache! - await FlushCache("Task"); - return await Task.FromResult(dbResult); - } - - /// - /// Update/Insert record TaskList - /// - /// - /// - public async Task TaskListUpsert(TaskListModel rec2upd) - { - bool dbResult = dbController.TaskListUpsert(rec2upd); - // svuoto cache! - await FlushCache("Task"); - return await Task.FromResult(dbResult); - } -#endif #endregion Public Methods diff --git a/MP.Stats/MP.Stats.csproj b/MP.Stats/MP.Stats.csproj index 9957de5d..c4724fd6 100644 --- a/MP.Stats/MP.Stats.csproj +++ b/MP.Stats/MP.Stats.csproj @@ -4,8 +4,8 @@ net6.0 MP.Stats 826e877c-ba70-4253-84cb-d0b1cafd4440 - 6.16.2410.2612 - 6.16.2410.2612 + 6.16.2410.2809 + 6.16.2410.2809 true $(NoWarn);1591 @@ -14,7 +14,6 @@ - @@ -224,10 +223,6 @@ Always - - - - diff --git a/MP.Stats/Pages/TaskScheduler.razor b/MP.Stats/Pages/TaskScheduler.razor index be6d4b0a..26339b36 100644 --- a/MP.Stats/Pages/TaskScheduler.razor +++ b/MP.Stats/Pages/TaskScheduler.razor @@ -1,166 +1,3 @@ @page "/TaskScheduler" -
        -
        -
        -
        -
        -
        - TaskList -
        -
        -
        - @if (currRecord == null) - { - - } - else - { - - } - -
        -
        -
        - -
        -
        - @if (isLoading) - { - - - } - else if (ListRecords == null) - { - - } - else if (totalCount == 0) - { -
        Nessun record trovato
        - } - else - { -
        -
        - - - - - - - - - - @if (detRecord == null) - { - - - - - } - - - - @foreach (var record in ListRecords) - { - - - - - - - - @if (detRecord == null) - { - - - - - } - - } - -
        - - OrdTaskTipoCommandSched.LastNextResult - -
        - - @if (detRecord == null) - { - @if (currRecord == null) - { - - - } - else - { - - } - } - - @if (detRecord == null) - { - @if (record.Ordinal == minOrdinal) - { - - } - else - { - - } - } - @record.Ordinal - @if (detRecord == null) - { - @if (record.Ordinal == maxOrdinal) - { - - } - else - { - - } - } - -
        @record.Name
        -
        @record.Descript
        -
        - @record.TType - -
        @record.Command
        -
        @record.Args
        -
        @record.Freq × @record.Cad -
        @($"{record.DtLastExec:yyyy-MM-dd}")
        -
        @($"{record.DtLastExec:ddd HH:mm:ss}")
        -
        -
        @($"{record.DtNextExec:yyyy-MM-dd}")
        -
        @($"{record.DtNextExec:ddd HH:mm:ss}")
        -
        - - - -
        -
        -
        - } -
        - -
        -
        - @if (detRecord != null && !isLoading) - { -
        - -
        - } -
        \ No newline at end of file + \ No newline at end of file diff --git a/MP.Stats/Pages/TaskScheduler.razor.cs b/MP.Stats/Pages/TaskScheduler.razor.cs index 45d9fef3..dd299819 100644 --- a/MP.Stats/Pages/TaskScheduler.razor.cs +++ b/MP.Stats/Pages/TaskScheduler.razor.cs @@ -14,345 +14,26 @@ using static MP.TaskMan.Objects.Enums; namespace MP.Stats.Pages { - public partial class TaskScheduler : ComponentBase, IDisposable + public partial class TaskScheduler : ComponentBase { - #region Public Methods - - public string checkSelect(int TaskId) - { - string answ = ""; - if (currRecord != null) - { - try - { - answ = (currRecord.TaskId == TaskId) ? "table-info" : ""; - } - catch - { } - } - else if (detRecord != null) - { - answ = (detRecord.TaskId == TaskId) ? "table-info" : ""; - } - return answ; - } - - public void Dispose() - { - MessageService.EA_SearchUpdated -= OnSeachUpdated; - } - - public async void OnSeachUpdated() - { - await InvokeAsync(() => - { - Task task = ReloadData(); - StateHasChanged(); - }); - } - - #endregion Public Methods - - #region Protected Fields - - protected string fileName = "TaskList.csv"; - - #endregion Protected Fields - #region Protected Properties - [Inject] - protected IJSRuntime JSRuntime { get; set; } - - protected string mainCss - { - get => detRecord == null ? "col-12" : "col-6"; - } - - protected int maxOrdinal { get; set; } = 999; - - [Inject] - protected MessageService MessageService { get; set; } - protected int minOrdinal { get; set; } = 0; [Inject] - protected NavigationManager NavManager { get; set; } - - [Inject] - protected MP.TaskMan.Services.TaskService StatService { get; set; } - - protected int totalCount { get; set; } = 0; - - protected Task2ExeType TypeSel - { - get => typeSel; - set - { - if (typeSel != value) - { - typeSel = value; - var pUpd = Task.Run(async () => - { - await ReloadData(); - }); - pUpd.Wait(); - } - } - } + protected MessageService MServ { get; set; } = null!; #endregion Protected Properties #region Protected Methods - protected async Task addNew() + protected override void OnInitialized() { - currRecord = new TaskListModel() { Name = "Nuovo Task", Descript = "Descrizione", DtLastExec = DateTime.Today, DtNextExec = DateTime.Today.AddDays(1) }; - await ReloadData(); - } - - /// - /// Gestione display avanzamento step - /// - /// - protected async Task advStep(int currStep) - { - currVal = currStep; - nextVal = currVal + 1; - await InvokeAsync(StateHasChanged); - } - - protected async Task doCancel() - { - currRecord = null; - detRecord = null; - await ReloadData(); - } - - protected async Task doEdit(TaskListModel selRec) - { - currRecord = selRec; - await ReloadData(); - } - - protected async Task doClone(TaskListModel selRec) - { - if (!await JSRuntime.InvokeAsync("confirm", $"Confermi di voler duplicare il record selezionato?")) - return; - currRecord = new TaskListModel() - { - Args = selRec.Args, - Name = $"Copia di {selRec.Name}", - Cad = selRec.Cad, - Command = selRec.Command, - Descript = $"Copia di {selRec.Descript}", - DtNextExec = DateTime.Today.AddDays(1), - DtLastExec = DateTime.MinValue, - Freq = selRec.Freq, - LastDuration = 0, - LastIsError = false, - LastResult = "", - TType = selRec.TType, - Ordinal = SearchRecords.Count + 1, - }; - await ReloadData(); - } - - - protected async Task doMove(TaskListModel currRec, bool goUp) - { - await StatService.TaskListMove(currRec, goUp); - detRecord = null; - currRecord = null; - await ReloadData(); - } - - protected async Task doReset() - { - detRecord = null; - currRecord = null; - await StatService.FlushCache(); - await ReloadData(); - } - - protected async Task doRun(TaskListModel selRec) - { - // SE non è ancora scaduto chiedo conferma - if (selRec.DtNextExec > DateTime.Now) - { - if (!await JSRuntime.InvokeAsync("confirm", $"Confermi esecuzione forzata task non scaduto?{Environment.NewLine}[{selRec.TaskId}]: {selRec.Name} - {selRec.Descript}{Environment.NewLine}Prossima schedulazione: {selRec.DtNextExec:yyyy-MM-dd HH:mm:ss}")) - return; - } - - // imposto tempo atteso esecuzione da ultimo... - isLoading = true; - MaxVal = 4; - int currStep = 0; - await advStep(currStep); - expTimeMsec = (int)(1000 * selRec.LastDuration) / 4; - detRecord = null; - await advStep(currStep++); - await Task.Delay(100); - await advStep(currStep++); - // chiama esecuzione task - var result = await StatService.ExecuteTask(selRec, false); - await advStep(currStep++); - isLoading = false; - await Task.Delay(100); - await advStep(currStep++); - await ReloadData(); - } - - protected async Task doSelect(TaskListModel selRec) - { - detRecord = null; - currRecord = null; - isLoading = true; - detRecord = selRec; - await ReloadData(); - isLoading = false; - } - - protected async Task forceAll() - { - if (!await JSRuntime.InvokeAsync("confirm", $"Confermi esecuzione forzata di tutti i task?")) - return; - - isLoading = true; - detRecord = null; - await Task.Delay(100); - foreach (var taskRec in SearchRecords) - { - var result = await StatService.ExecuteTask(taskRec, false); - } - isLoading = false; - await Task.Delay(100); - await ReloadData(); - } - - protected async Task ForceReload(int newNum) - { - numRecord = newNum; - await ReloadData(); - } - - protected async Task ForceReloadPage(int newNum) - { - currPage = newNum; - await ReloadData(); - } - - protected async Task forceUpdate(bool doForce) - { - currRecord = null; - await ReloadData(); - } - - protected override async Task OnInitializedAsync() - { - clearFile(); - numRecord = 10; - MessageService.ShowSearch = false; - MessageService.PageName = "Task Scheduler"; - MessageService.PageIcon = "oi oi-clock"; - MessageService.EA_SearchUpdated += OnSeachUpdated; - await ReloadData(); - } - - protected void ResetData() - { - clearFile(); - StatService.rollBackEdit(currRecord); - currRecord = null; - } - - protected async Task ResetFilter(SelectData newFilter) - { - clearFile(); - detRecord = null; - currRecord = null; - SearchRecords = null; - ListRecords = null; - await ReloadData(); - } - - protected double righDiv(double num, double den) - { - if (den == 0) - { - den = 1; - } - double answ = num / den; - return answ; + MServ.ShowSearch = true; + MServ.PageName = "Task Scheduler"; + MServ.PageIcon = "oi oi-clock"; } #endregion Protected Methods - - #region Private Fields - - private double currVal = 0; - private List ListRecords; - private int MaxVal = 10; - private double nextVal = 0; - private List SearchRecords; - - #endregion Private Fields - - #region Private Properties - - private int currPage { get; set; } = 1; - - private TaskListModel currRecord { get; set; } = null; - - private TaskListModel detRecord { get; set; } = null; - - private int expTimeMsec { get; set; } = 30000; - - private string fullPath - { - get => $"{Directory.GetCurrentDirectory()}\\temp\\{fileName}"; - } - - private bool isLoading { get; set; } = false; - private int numRecord { get; set; } = 10; - - private Task2ExeType typeSel { get; set; } = Task2ExeType.ND; - - #endregion Private Properties - - #region Private Methods - - private string btnRunCss(DateTime dtNextExe) - { - DateTime adesso = DateTime.Now; - string answ = dtNextExe < adesso ? "btn-success" : "btn-warning"; - return answ; - } - - private async void clearFile() - { - await Task.Run(() => File.Delete(fullPath)); - } - - private async Task ExportCsv() - { - isLoading = true; - // salvo davvero! - await Egw.Core.Utils.SaveToCsv(SearchRecords, fullPath, ';'); - isLoading = false; - } - - private async Task ReloadData() - { - SearchRecords = await StatService.TaskListAll(TypeSel, ""); - totalCount = SearchRecords.Count; - var firstRec = SearchRecords.OrderBy(x => x.Ordinal).FirstOrDefault(); - minOrdinal = firstRec != null ? firstRec.Ordinal : 0; - var lastRec = SearchRecords.OrderByDescending(x => x.Ordinal).FirstOrDefault(); - maxOrdinal = lastRec != null ? lastRec.Ordinal : 9999; - ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList(); - } - - #endregion Private Methods } } \ No newline at end of file diff --git a/MP.Stats/Resources/ChangeLog.html b/MP.Stats/Resources/ChangeLog.html index c6c5e0eb..241b3faa 100644 --- a/MP.Stats/Resources/ChangeLog.html +++ b/MP.Stats/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo statistiche MAPO -

        Versione: 6.16.2410.2612

        +

        Versione: 6.16.2410.2809


        Note di rilascio:
          diff --git a/MP.Stats/Resources/VersNum.txt b/MP.Stats/Resources/VersNum.txt index e9c2ab4a..c71112a4 100644 --- a/MP.Stats/Resources/VersNum.txt +++ b/MP.Stats/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2410.2612 +6.16.2410.2809 diff --git a/MP.Stats/Resources/manifest.xml b/MP.Stats/Resources/manifest.xml index 8e83098f..ffc5d1d8 100644 --- a/MP.Stats/Resources/manifest.xml +++ b/MP.Stats/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2410.2612 + 6.16.2410.2809 https://nexus.steamware.net/repository/SWS/MP-STATS/stable/LAST/MP.Stats.zip https://nexus.steamware.net/repository/SWS/MP-STATS/stable/LAST/ChangeLog.html false diff --git a/MP.Stats/Startup.cs b/MP.Stats/Startup.cs index 8c3393dc..784cb9ee 100644 --- a/MP.Stats/Startup.cs +++ b/MP.Stats/Startup.cs @@ -7,6 +7,7 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Microsoft.OpenApi.Models; using MP.Stats.Data; +using MP.TaskMan.Services; using StackExchange.Redis; using System; using System.Globalization; @@ -142,6 +143,8 @@ namespace MP.Stats services.AddSingleton(Configuration); services.AddSingleton(); + services.AddSingleton(); + services.AddScoped(); } diff --git a/MP.Stats/appsettings.json b/MP.Stats/appsettings.json index b12244ca..a77c3f43 100644 --- a/MP.Stats/appsettings.json +++ b/MP.Stats/appsettings.json @@ -55,5 +55,11 @@ "DefaultConnection": "Server=SQL2016DEV;Database=MoonPro_STATS;Trusted_Connection=True;MultipleActiveResultSets=true", "MP.Stats": "Server=SQL2016DEV;Database=MoonPro_STATS;User ID=sa;Password=keyhammer16;integrated security=False;MultipleActiveResultSets=True;App=MP.STATS;" }, - "FormatDur": "HH:mm.ss.ff" + "FormatDur": "HH:mm.ss.ff", + "SpecialConf": { + "TaskManConn": "MP.Stats" + }, + "ServerConf": { + "Prog.ApiUrl": "https://localhost/MP/STATS" + } } \ No newline at end of file diff --git a/MP.TaskMan/Component1.razor b/MP.TaskMan/Component1.razor deleted file mode 100644 index 7558f967..00000000 --- a/MP.TaskMan/Component1.razor +++ /dev/null @@ -1,3 +0,0 @@ -
          - This component is defined in the MP.TaskMan library. -
          diff --git a/MP.TaskMan/Component1.razor.css b/MP.TaskMan/Component1.razor.css deleted file mode 100644 index c6afca40..00000000 --- a/MP.TaskMan/Component1.razor.css +++ /dev/null @@ -1,6 +0,0 @@ -.my-component { - border: 2px dashed red; - padding: 1em; - margin: 1em 0; - background-image: url('background.png'); -} diff --git a/MP.TaskMan/Services/TaskService.cs b/MP.TaskMan/Services/TaskService.cs index da95109e..00aaa8e7 100644 --- a/MP.TaskMan/Services/TaskService.cs +++ b/MP.TaskMan/Services/TaskService.cs @@ -31,8 +31,9 @@ namespace MP.TaskMan.Services redisConn = ConnectionMultiplexer.Connect(_configuration.GetConnectionString("Redis")); redisDb = redisConn.GetDatabase(); - // conf DB - ConnStr = _configuration.GetConnectionString("MP.All"); + // ConnString del DB x gestione task + string taskDbCS = _configuration.GetValue("SpecialConf:TaskManConn"); + ConnStr = _configuration.GetConnectionString(taskDbCS); if (string.IsNullOrEmpty(ConnStr)) { Log.Error("ConnString empty!"); @@ -44,7 +45,7 @@ namespace MP.TaskMan.Services sb.AppendLine($"TaskService | MpTaskController OK"); Log.Info(sb.ToString()); // sistemo i parametri x redHas... - CodModulo = _configuration.GetValue("ServerConf:CodModulo"); + CodModulo = _configuration.GetValue("SpecialConf:CodModulo"); var cstringArray = ConnStr.Split(";"); foreach (var item in cstringArray) { diff --git a/MP.TaskMan/TaskContext.cs b/MP.TaskMan/TaskContext.cs index 30da736c..23222716 100644 --- a/MP.TaskMan/TaskContext.cs +++ b/MP.TaskMan/TaskContext.cs @@ -58,33 +58,53 @@ namespace MP.TaskMan { if (!optionsBuilder.IsConfigured) { - string connString = _configuration.GetConnectionString("MP.TaskMan"); - if (string.IsNullOrEmpty(connString)) - { - connString = _configuration.GetConnectionString("MP.All"); - } - if (string.IsNullOrEmpty(connString)) - { - connString = _configuration.GetConnectionString("MP.Data"); - } - if (string.IsNullOrEmpty(connString)) - { - connString = _configuration.GetConnectionString("MP.Mon"); - } - if (string.IsNullOrEmpty(connString)) - { - connString = _configuration.GetConnectionString("MP.STATS"); - } - if (string.IsNullOrEmpty(connString)) - { - connString = _configuration.GetConnectionString("MP.Land"); - } - + // recupero la connString tra i candidati... + string connString = ConnStringGetFirst(); + // avvio con stringa connessione trovata optionsBuilder.UseSqlServer(connString); - //optionsBuilder.UseSqlServer("Server=SQL2016DEV;Database=MoonPro;Trusted_Connection=True;"); + //optionsBuilder.UseSqlServer("Server=SQL2016DEV; Database=MoonPro; Trusted_Connection=True;"); } } + /// + /// Cerca la connString del DB usato da stats basandosi sull'elenco dei nomi delle chaivi da cercare, dalle + specifiche alle più generiche + /// + /// + private string ConnStringGetFirst() + { + // in primis cerco se c'è la conf di quale connString usare per il programma specifico + string scTaskConn = _configuration.GetValue("SpecialConf:TaskManConn"); + string connString = _configuration.GetConnectionString(scTaskConn); + + // altrimenti ciclo tra le conf alternative standard la + specifica + if (string.IsNullOrEmpty(connString)) + { + foreach (var keyName in ConnStringList) + { + connString = _configuration.GetConnectionString(keyName); + if (!string.IsNullOrEmpty(connString)) + { + break; + } + } + } + return connString; + } + + /// + /// Elenco dei nomi delle connString da provare x il DB di riferimento qualora non specificato in conf + /// + protected List ConnStringList { get; set; } = new List() + { + "MP.TaskMan", + "MP.STATS", + "MP.SPEC", + "MP.Land", + "MP.Mon", + "MP.Data", + "MP.All" + }; + protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.HasAnnotation("Relational:Collation", "SQL_Latin1_General_CP1_CI_AS"); @@ -107,7 +127,7 @@ namespace MP.TaskMan .HasColumnName("valoreStd") .HasComment("Valore di default/riferimento per la variabile"); }); - + OnModelCreatingPartial(modelBuilder); } From f44c32d5017603dbb27b299123b9b88419205efe Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Mon, 28 Oct 2024 11:10:36 +0100 Subject: [PATCH 7/7] Fix log TAB3 Fix PROG gestione TaskMan --- MP-PROG.sln | 12 ++ MP-TAB3/MP-TAB3.csproj | 2 +- MP-TAB3/Resources/ChangeLog.html | 2 +- MP-TAB3/Resources/VersNum.txt | 2 +- MP-TAB3/Resources/manifest.xml | 2 +- MP.FileData/MP.FileData.csproj | 2 +- MP.Land/MP.Land.csproj | 2 +- MP.Land/Pages/TaskScheduler.razor.cs | 12 -- MP.Land/Resources/ChangeLog.html | 2 +- MP.Land/Resources/VersNum.txt | 2 +- MP.Land/Resources/manifest.xml | 2 +- MP.Prog/MP.Prog.csproj | 9 +- MP.Prog/Pages/TaskScheduler.razor | 3 + MP.Prog/Pages/TaskScheduler.razor.cs | 25 ++++ MP.Prog/Program.cs | 4 +- MP.Prog/Resources/ChangeLog.html | 2 +- MP.Prog/Resources/VersNum.txt | 2 +- MP.Prog/Resources/manifest.xml | 2 +- MP.Prog/Shared/NavMenu.razor | 6 + MP.Prog/Startup.cs | 6 +- MP.Prog/_Imports.razor | 1 + MP.Prog/appsettings.Development.json | 17 ++- MP.Prog/appsettings.Production-install.json | 29 +++-- MP.Prog/appsettings.Production-office.json | 23 ++-- MP.Prog/appsettings.Production.json | 29 +++-- MP.Prog/appsettings.json | 8 +- MP.Stats/MP.Stats.csproj | 4 +- MP.Stats/Program.cs | 6 +- MP.Stats/Resources/ChangeLog.html | 2 +- MP.Stats/Resources/VersNum.txt | 2 +- MP.Stats/Resources/manifest.xml | 2 +- MP.TaskMan/Controllers/MpTaskController.cs | 18 --- MP.TaskMan/MP.TaskMan.csproj | 2 +- .../20241028095512_InitTaskMan.Designer.cs | 123 ++++++++++++++++++ .../Migrations/20241028095512_InitTaskMan.cs | 75 +++++++++++ .../Migrations/TaskContextModelSnapshot.cs | 121 +++++++++++++++++ MP.TaskMan/Models/ConfigModel.cs | 22 ---- MP.TaskMan/TaskContext.cs | 47 ++++--- MP.TaskMan/TaskList.razor.cs | 11 +- 39 files changed, 493 insertions(+), 150 deletions(-) create mode 100644 MP.Prog/Pages/TaskScheduler.razor create mode 100644 MP.Prog/Pages/TaskScheduler.razor.cs create mode 100644 MP.TaskMan/Migrations/20241028095512_InitTaskMan.Designer.cs create mode 100644 MP.TaskMan/Migrations/20241028095512_InitTaskMan.cs create mode 100644 MP.TaskMan/Migrations/TaskContextModelSnapshot.cs delete mode 100644 MP.TaskMan/Models/ConfigModel.cs diff --git a/MP-PROG.sln b/MP-PROG.sln index 461319fe..fa58adaf 100644 --- a/MP-PROG.sln +++ b/MP-PROG.sln @@ -7,6 +7,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MP.Prog", "MP.Prog\MP.Prog. EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MP.FileData", "MP.FileData\MP.FileData.csproj", "{48693321-1FA6-4DBB-A730-B8EF3E0B68D2}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MP.TaskMan", "MP.TaskMan\MP.TaskMan.csproj", "{EF0CF5FC-2451-4184-AAA4-B17236DEE41B}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Egw.Core", "Egw.Core\Egw.Core.csproj", "{3EE72B27-C44F-40F5-B4E8-E43ECA6F39B1}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -21,6 +25,14 @@ Global {48693321-1FA6-4DBB-A730-B8EF3E0B68D2}.Debug|Any CPU.Build.0 = Debug|Any CPU {48693321-1FA6-4DBB-A730-B8EF3E0B68D2}.Release|Any CPU.ActiveCfg = Release|Any CPU {48693321-1FA6-4DBB-A730-B8EF3E0B68D2}.Release|Any CPU.Build.0 = Release|Any CPU + {EF0CF5FC-2451-4184-AAA4-B17236DEE41B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EF0CF5FC-2451-4184-AAA4-B17236DEE41B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EF0CF5FC-2451-4184-AAA4-B17236DEE41B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EF0CF5FC-2451-4184-AAA4-B17236DEE41B}.Release|Any CPU.Build.0 = Release|Any CPU + {3EE72B27-C44F-40F5-B4E8-E43ECA6F39B1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3EE72B27-C44F-40F5-B4E8-E43ECA6F39B1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3EE72B27-C44F-40F5-B4E8-E43ECA6F39B1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3EE72B27-C44F-40F5-B4E8-E43ECA6F39B1}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/MP-TAB3/MP-TAB3.csproj b/MP-TAB3/MP-TAB3.csproj index 412e59da..5884f0b9 100644 --- a/MP-TAB3/MP-TAB3.csproj +++ b/MP-TAB3/MP-TAB3.csproj @@ -3,7 +3,7 @@ net6.0 enable - 6.16.2410.2809 + 6.16.2410.2810 enable MP_TAB3 diff --git a/MP-TAB3/Resources/ChangeLog.html b/MP-TAB3/Resources/ChangeLog.html index acde8931..d16345a8 100644 --- a/MP-TAB3/Resources/ChangeLog.html +++ b/MP-TAB3/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo MAPOSPEC -

          Versione: 6.16.2410.2809

          +

          Versione: 6.16.2410.2810


          Note di rilascio:
          • diff --git a/MP-TAB3/Resources/VersNum.txt b/MP-TAB3/Resources/VersNum.txt index c71112a4..20d6919c 100644 --- a/MP-TAB3/Resources/VersNum.txt +++ b/MP-TAB3/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2410.2809 +6.16.2410.2810 diff --git a/MP-TAB3/Resources/manifest.xml b/MP-TAB3/Resources/manifest.xml index afcf3514..10ea38d1 100644 --- a/MP-TAB3/Resources/manifest.xml +++ b/MP-TAB3/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2410.2809 + 6.16.2410.2810 https://nexus.steamware.net/repository/SWS/MP-TAB3/stable/LAST/MP-TAB3.zip https://nexus.steamware.net/repository/SWS/MP-TAB3/stable/LAST/ChangeLog.html false diff --git a/MP.FileData/MP.FileData.csproj b/MP.FileData/MP.FileData.csproj index 2b9b560a..b52cf743 100644 --- a/MP.FileData/MP.FileData.csproj +++ b/MP.FileData/MP.FileData.csproj @@ -18,7 +18,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/MP.Land/MP.Land.csproj b/MP.Land/MP.Land.csproj index ebfd1507..544dbe59 100644 --- a/MP.Land/MP.Land.csproj +++ b/MP.Land/MP.Land.csproj @@ -3,7 +3,7 @@ net6.0 MP.Land - 6.16.2410.2809 + 6.16.2410.2810 Debug;Release;Debug_LiManDebug diff --git a/MP.Land/Pages/TaskScheduler.razor.cs b/MP.Land/Pages/TaskScheduler.razor.cs index dff3c10a..67403068 100644 --- a/MP.Land/Pages/TaskScheduler.razor.cs +++ b/MP.Land/Pages/TaskScheduler.razor.cs @@ -1,16 +1,4 @@ using Microsoft.AspNetCore.Components; -using Microsoft.JSInterop; -using MP.TaskMan.Models; -using MP.Land.Data; -using static MP.TaskMan.Objects.Enums; -using System.Collections.Generic; -using System.IO; -using System.Threading.Tasks; -using System; -using System.Linq; -using MP.Data.Services; -using DnsClient.Protocol; -using MP.TaskMan.Services; namespace MP.Land.Pages { diff --git a/MP.Land/Resources/ChangeLog.html b/MP.Land/Resources/ChangeLog.html index d0a1bee4..7c8405fa 100644 --- a/MP.Land/Resources/ChangeLog.html +++ b/MP.Land/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo Tablet MAPO - DotNet6 -

            Versione: 6.16.2410.2809

            +

            Versione: 6.16.2410.2810


            Note di rilascio:
              diff --git a/MP.Land/Resources/VersNum.txt b/MP.Land/Resources/VersNum.txt index c71112a4..20d6919c 100644 --- a/MP.Land/Resources/VersNum.txt +++ b/MP.Land/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2410.2809 +6.16.2410.2810 diff --git a/MP.Land/Resources/manifest.xml b/MP.Land/Resources/manifest.xml index 05b025ad..47303698 100644 --- a/MP.Land/Resources/manifest.xml +++ b/MP.Land/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2410.2809 + 6.16.2410.2810 https://nexus.steamware.net/repository/SWS/MP-LAND/stable/LAST/MP.Land.zip https://nexus.steamware.net/repository/SWS/MP-LAND/stable/LAST/ChangeLog.html false diff --git a/MP.Prog/MP.Prog.csproj b/MP.Prog/MP.Prog.csproj index 5bf46fe1..7fc9b19b 100644 --- a/MP.Prog/MP.Prog.csproj +++ b/MP.Prog/MP.Prog.csproj @@ -3,7 +3,7 @@ net6.0 MP.Prog - 6.16.2410.2318 + 6.16.2410.2811 True @@ -19,15 +19,15 @@ - + - + - + @@ -35,6 +35,7 @@ + diff --git a/MP.Prog/Pages/TaskScheduler.razor b/MP.Prog/Pages/TaskScheduler.razor new file mode 100644 index 00000000..26339b36 --- /dev/null +++ b/MP.Prog/Pages/TaskScheduler.razor @@ -0,0 +1,3 @@ +@page "/TaskScheduler" + + \ No newline at end of file diff --git a/MP.Prog/Pages/TaskScheduler.razor.cs b/MP.Prog/Pages/TaskScheduler.razor.cs new file mode 100644 index 00000000..6cb49a51 --- /dev/null +++ b/MP.Prog/Pages/TaskScheduler.razor.cs @@ -0,0 +1,25 @@ +using Microsoft.AspNetCore.Components; + +namespace MP.Prog.Pages +{ + public partial class TaskScheduler : ComponentBase + { + #region Protected Properties + + [Inject] + protected Data.MessageService MServ { get; set; } = null!; + + #endregion Protected Properties + + #region Protected Methods + + protected override void OnInitialized() + { + MServ.ShowSearch = true; + MServ.PageName = "Task Scheduler"; + MServ.PageIcon = "oi oi-clock"; + } + + #endregion Protected Methods + } +} \ No newline at end of file diff --git a/MP.Prog/Program.cs b/MP.Prog/Program.cs index 592ac919..a81ebcb9 100644 --- a/MP.Prog/Program.cs +++ b/MP.Prog/Program.cs @@ -27,7 +27,7 @@ namespace MP.Prog logging.ClearProviders(); logging.SetMinimumLevel(Microsoft.Extensions.Logging.LogLevel.Error); }) - // importante per eseguire la conf regike logging + // importante per eseguire la conf logging .UseNLog(new NLogAspNetCoreOptions() { RemoveLoggerFactoryFilter = false }); //.UseNLog(); @@ -49,7 +49,7 @@ namespace MP.Prog } finally { - NLog.LogManager.Shutdown(); + LogManager.Shutdown(); } } diff --git a/MP.Prog/Resources/ChangeLog.html b/MP.Prog/Resources/ChangeLog.html index 16ff1099..48532fa6 100644 --- a/MP.Prog/Resources/ChangeLog.html +++ b/MP.Prog/Resources/ChangeLog.html @@ -1,6 +1,6 @@ Modulo gestione Programmi MAPO -

              Versione: 6.16.2410.2318

              +

              Versione: 6.16.2410.2811


              Note di rilascio:
                diff --git a/MP.Prog/Resources/VersNum.txt b/MP.Prog/Resources/VersNum.txt index 608cd781..02a9b1b9 100644 --- a/MP.Prog/Resources/VersNum.txt +++ b/MP.Prog/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2410.2318 +6.16.2410.2811 diff --git a/MP.Prog/Resources/manifest.xml b/MP.Prog/Resources/manifest.xml index d54cba42..d6489eed 100644 --- a/MP.Prog/Resources/manifest.xml +++ b/MP.Prog/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2410.2318 + 6.16.2410.2811 https://nexus.steamware.net/repository/SWS/MP-PROG/stable/LAST/MP.Prog.zip https://nexus.steamware.net/repository/SWS/MP-PROG/stable/LAST/ChangeLog.html false diff --git a/MP.Prog/Shared/NavMenu.razor b/MP.Prog/Shared/NavMenu.razor index 99e8e3d9..8b1df867 100644 --- a/MP.Prog/Shared/NavMenu.razor +++ b/MP.Prog/Shared/NavMenu.razor @@ -22,6 +22,12 @@ Setup + +