FixTaskMan module
- LAND - STATS
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<Version>6.16.2410.1815</Version>
|
||||
<Version>6.16.2410.2809</Version>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<RootNamespace>MP_TAB3</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo MAPOSPEC </i>
|
||||
<h4>Versione: 6.16.2410.1815</h4>
|
||||
<h4>Versione: 6.16.2410.2809</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
6.16.2410.1815
|
||||
6.16.2410.2809
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>6.16.2410.1815</version>
|
||||
<version>6.16.2410.2809</version>
|
||||
<url>https://nexus.steamware.net/repository/SWS/MP-TAB3/stable/LAST/MP-TAB3.zip</url>
|
||||
<changelog>https://nexus.steamware.net/repository/SWS/MP-TAB3/stable/LAST/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
+16
-25
@@ -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"
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
@@ -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<string>("OptConf:CodModulo");
|
||||
CodModuloParam = _configuration.GetValue<string>("OptConf:CodModuloParam");
|
||||
CodModulo = _configuration.GetValue<string>("SpecialConf:CodModulo");
|
||||
CodModuloParam = _configuration.GetValue<string>("SpecialConf:CodModuloParam");
|
||||
MpIoNS = _configuration.GetValue<string>("ServerConf:MpIoNS");
|
||||
var cstringArray = ConnStr.Split(";");
|
||||
foreach (var item in cstringArray)
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
@inject MessageService MService
|
||||
@inject LicenseService LicServ
|
||||
|
||||
@if (authOk()) // disegno box cliccabile e programma attivato
|
||||
@if (authOk())
|
||||
{
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
@@ -32,7 +32,7 @@
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
else // disegno box cliccabile e licenza ASSISTENZA mancante
|
||||
else
|
||||
{
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace MP.Land.Data
|
||||
_configuration = configuration;
|
||||
|
||||
// cod app
|
||||
CodApp = _configuration.GetValue<string>("ServerConf:CodApp");
|
||||
CodApp = _configuration.GetValue<string>("SpecialConf:CodApp");
|
||||
Modulo = _configuration.GetValue<string>("ServerConf:Modulo");
|
||||
|
||||
// Conf cache
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<RootNamespace>MP.Land</RootNamespace>
|
||||
<Version>6.16.2410.2612</Version>
|
||||
<Version>6.16.2410.2809</Version>
|
||||
<Configurations>Debug;Release;Debug_LiManDebug</Configurations>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
</div>
|
||||
|
||||
<div class="card shadow">
|
||||
<div class="card-body">
|
||||
<div class="card-body py-2">
|
||||
@if (ListRecords == null)
|
||||
{
|
||||
<LoadingData></LoadingData>
|
||||
@@ -39,7 +39,7 @@
|
||||
<div class="row">
|
||||
@foreach (var item in ListRecords)
|
||||
{
|
||||
<div class="col-12 col-sm-6 col-lg-4 col-xl-3 my-1">
|
||||
<div class="col-12 col-sm-6 col-lg-4 col-xl-3 px-1 my-0">
|
||||
<HomeLink CurrItem="@item"></HomeLink>
|
||||
</div>
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo Tablet MAPO - DotNet6</i>
|
||||
<h4>Versione: 6.16.2410.2612</h4>
|
||||
<h4>Versione: 6.16.2410.2809</h4>
|
||||
<br />
|
||||
Note di rilascio:
|
||||
<ul>
|
||||
|
||||
@@ -1 +1 @@
|
||||
6.16.2410.2612
|
||||
6.16.2410.2809
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>6.16.2410.2612</version>
|
||||
<version>6.16.2410.2809</version>
|
||||
<url>https://nexus.steamware.net/repository/SWS/MP-LAND/stable/LAST/MP.Land.zip</url>
|
||||
<changelog>https://nexus.steamware.net/repository/SWS/MP-LAND/stable/LAST/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
+1
-1
@@ -137,9 +137,9 @@ namespace MP.Land
|
||||
services.AddSingleton<LicenseService>();
|
||||
services.AddSingleton<SyncService>();
|
||||
services.AddSingleton<RestCallService>();
|
||||
services.AddSingleton<TaskService>();
|
||||
|
||||
services.AddScoped<AppAuthService>();
|
||||
services.AddScoped<TaskService>();
|
||||
services.AddScoped<Data.MessageService>();
|
||||
services.AddSingleton<IConnectionMultiplexer>(redisMultiplexer);
|
||||
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
<div class="text-end">
|
||||
<b>@($"{CurrRecord.LastDuration:N3}")</b> <sub>sec</sub> <button class="btn btn-sm @btnCss" @onclick="toggleDetail" title="Ultima esecuzione"><i class="far @iconCss"></i></button>
|
||||
</div>
|
||||
@if (showDetail)
|
||||
{
|
||||
<div class="small alert @alCss py-1">@CurrRecord.LastResult</div>
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -1,101 +0,0 @@
|
||||
@if (CurrRecord != null)
|
||||
{
|
||||
<hr />
|
||||
<div class="row g-1">
|
||||
<div class="col-md-2">
|
||||
<div class="form-floating">
|
||||
<input type="text" class="form-control" @bind="@CurrRecord.Name">
|
||||
<label class="small">Nome Task</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div class="form-floating">
|
||||
<select class="form-select" @bind="@CurrRecord.TType">
|
||||
@foreach (var option in Enum.GetValues(typeof(MP.Data.Objects.Enums.Task2ExeType)))
|
||||
{
|
||||
<option value="@option">
|
||||
@option
|
||||
</option>
|
||||
}
|
||||
</select>
|
||||
<label class="small">Tipo Task</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<div class="form-floating">
|
||||
<input type="text" class="form-control" @bind="@CurrRecord.Descript">
|
||||
<label class="small">Descrizione Task</label>
|
||||
</div>
|
||||
</div>
|
||||
@* <div class="col-md-2">
|
||||
<div class="form-floating">
|
||||
<select class="form-select" @bind="@CurrRecord.Freq">
|
||||
@foreach (var option in Enum.GetValues(typeof(MP.Data.Objects.Enums.TaskFreqType)))
|
||||
{
|
||||
<option value="@option">
|
||||
@option
|
||||
</option>
|
||||
}
|
||||
</select>
|
||||
<label class="small">Frequenza</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-1">
|
||||
<div class="form-floating">
|
||||
<input type="number" class="form-control" @bind="@CurrRecord.Cad">
|
||||
<label class="small">Cadenza</label>
|
||||
</div>
|
||||
</div> *@
|
||||
</div>
|
||||
<div class="row g-1">
|
||||
<div class="col-md-4">
|
||||
<div class="form-floating">
|
||||
<input type="text" class="form-control" @bind="@CurrRecord.Command">
|
||||
<label class="small">Comando</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<div class="form-floating">
|
||||
<input type="text" class="form-control" @bind="@CurrRecord.Args">
|
||||
<label class="small">Parametri</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row g-1">
|
||||
<div class="col-md-3">
|
||||
<div class="form-floating">
|
||||
<input type="number" class="form-control" @bind="@CurrRecord.Ordinal">
|
||||
<label class="small">Ordine Esecuzione</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="form-floating">
|
||||
<input type="datetime-local" class="form-control" @bind="@CurrRecord.DtNextExec">
|
||||
<label class="small">Prossima Esecuzione</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div class="form-floating">
|
||||
<select class="form-select" @bind="@CurrRecord.Freq">
|
||||
@foreach (var option in Enum.GetValues(typeof(MP.Data.Objects.Enums.TaskFreqType)))
|
||||
{
|
||||
<option value="@option">
|
||||
@option
|
||||
</option>
|
||||
}
|
||||
</select>
|
||||
<label class="small">Frequenza</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div class="form-floating">
|
||||
<input type="number" class="form-control" @bind="@CurrRecord.Cad">
|
||||
<label class="small">Cadenza</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2 pt-2">
|
||||
<button class="btn btn-lg w-100 btn-success" @onclick="()=>doSave()" title="Save"><i class="far fa-save"></i> Save</button>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
@@ -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<bool> 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
|
||||
}
|
||||
}
|
||||
@@ -1,85 +0,0 @@
|
||||
|
||||
<div class="card text-bg-light shadow">
|
||||
<div class="card-header table-primary p-1">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-2">
|
||||
<b class="fs-4">History</b>
|
||||
</div>
|
||||
<div class="px-2">
|
||||
<div class="input-group">
|
||||
<select class="form-select" @bind="@ShowErrorMode">
|
||||
<option value="0">--- ALL ---</option>
|
||||
<option value="1">Solo Errori</option>
|
||||
<option value="2">Solo OK</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body py-0 px-1">
|
||||
@if (ListRecords == null)
|
||||
{
|
||||
<LoadingData></LoadingData>
|
||||
}
|
||||
else if (totalCount == 0)
|
||||
{
|
||||
<div class="alert alert-warning text-center display-6">Nessun record trovato</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<table class="table table-sm table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>Inizio</th>
|
||||
<th>Fine</th>
|
||||
<th class="text-right">Esito</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var record in ListRecords)
|
||||
{
|
||||
<tr>
|
||||
<td>
|
||||
@record.TaskExecId
|
||||
</td>
|
||||
<td>
|
||||
@($"{record.DtStart:HH:mm:ss.fff}")
|
||||
<div class="small">@($"{record.DtStart:yyyy-MM.dd ddd}")</div>
|
||||
</td>
|
||||
<td>
|
||||
@($"{record.DtEnd:HH:mm:ss.fff}")
|
||||
<div class="small">@($"{record.DtEnd:yyyy-MM.dd ddd}")</div>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-0">
|
||||
@if (@record.IsError)
|
||||
{
|
||||
<i class="far fa-thumbs-down text-danger"></i>
|
||||
}
|
||||
else
|
||||
{
|
||||
<i class="far fa-thumbs-up text-success"></i>
|
||||
}
|
||||
</div>
|
||||
<div class="px-0">
|
||||
<b>@($"{record.Duration:N3}")</b> <sub>sec</sub>
|
||||
</div>
|
||||
</div>
|
||||
<div class="small">@record.Result</div>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<div class="card-footer py-1">
|
||||
<DataPager PageSize="numRecord" currPage="currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" exportEnabled="false" totalCount="totalCount" showLoading="isLoading" />
|
||||
</div>
|
||||
</div>
|
||||
@@ -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; }
|
||||
|
||||
/// <summary>
|
||||
/// Show error mode: 0 = tutti 1 = solo errori 2 = solo ok
|
||||
/// </summary>
|
||||
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<TaskExecModel> ListRecords;
|
||||
private List<TaskExecModel> 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
|
||||
}
|
||||
}
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// List of available task and last execution data
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("GetList")]
|
||||
public async Task<List<TaskListModel>> GetList()
|
||||
{
|
||||
List<TaskListModel> answ = await DService.TaskListAll(MP.Data.Objects.Enums.Task2ExeType.ND, "");
|
||||
return answ;
|
||||
}
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Call for execution of due task and report state
|
||||
@@ -43,26 +36,47 @@ namespace MP.Stats.Controllers
|
||||
public async Task<List<TaskResultModel>> ExecuteAndReturnGet()
|
||||
{
|
||||
List<TaskResultModel> answ = new List<TaskResultModel>();
|
||||
List<TaskListModel> listTask = await DService.TaskListAll(MP.Data.Objects.Enums.Task2ExeType.ND, "");
|
||||
List<TaskListModel> 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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// List of available task and last execution data
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("GetList")]
|
||||
public async Task<List<TaskListModel>> GetList()
|
||||
{
|
||||
List<TaskListModel> answ = await DService.TaskListAll(TaskMan.Objects.Enums.Task2ExeType.ND, "");
|
||||
return answ;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
/// <summary>
|
||||
/// Dataservice x accesso DB
|
||||
/// </summary>
|
||||
protected TaskService DService { get; set; }
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private static IConfiguration _configuration = null!;
|
||||
|
||||
private static Logger Log = LogManager.GetCurrentClassLogger();
|
||||
/// <summary>
|
||||
/// Dataservice x accesso DB
|
||||
/// </summary>
|
||||
protected MpStatsService DService { get; set; }
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -563,116 +563,6 @@ namespace MP.Stats.Data
|
||||
return result;
|
||||
}
|
||||
|
||||
#if false
|
||||
/// <summary>
|
||||
/// Ricerca task dato tipo + num max (desc)
|
||||
/// </summary>
|
||||
/// <param name="TaskId">TaskId da cui deriva</param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<TaskExecModel>> TaskExecGetFilt(int TaskId, int maxRec, string searchVal)
|
||||
{
|
||||
// setup parametri costanti
|
||||
string source = "DB";
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
List<TaskExecModel> result = new List<TaskExecModel>();
|
||||
// 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<List<TaskExecModel>>($"{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<TaskExecModel>();
|
||||
}
|
||||
sw.Stop();
|
||||
_logger.LogDebug($"TaskExecGetFilt | {source} | {sw.Elapsed.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco TaskList gestiti
|
||||
/// </summary>
|
||||
/// <param name="CurrFilter"></param>
|
||||
/// <param name="searchVal"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<TaskListModel>> TaskListAll(Task2ExeType TType, string searchVal = "")
|
||||
{
|
||||
// setup parametri costanti
|
||||
string source = "DB";
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
List<TaskListModel> result = new List<TaskListModel>();
|
||||
// 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<List<TaskListModel>>($"{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<TaskListModel>();
|
||||
}
|
||||
// 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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update ordinamento task
|
||||
/// </summary>
|
||||
/// <param name="rec2upd">Record da spostare x priorità</param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> TaskListMove(TaskListModel rec2upd, bool moveUp)
|
||||
{
|
||||
bool dbResult = dbController.TaskListMove(rec2upd, moveUp);
|
||||
// svuoto cache!
|
||||
await FlushCache("Task");
|
||||
return await Task.FromResult(dbResult);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update/Insert record TaskList
|
||||
/// </summary>
|
||||
/// <param name="rec2upd"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> TaskListUpsert(TaskListModel rec2upd)
|
||||
{
|
||||
bool dbResult = dbController.TaskListUpsert(rec2upd);
|
||||
// svuoto cache!
|
||||
await FlushCache("Task");
|
||||
return await Task.FromResult(dbResult);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<RootNamespace>MP.Stats</RootNamespace>
|
||||
<UserSecretsId>826e877c-ba70-4253-84cb-d0b1cafd4440</UserSecretsId>
|
||||
<Version>6.16.2410.2612</Version>
|
||||
<Version>6.16.2410.2612</Version>
|
||||
<Version>6.16.2410.2809</Version>
|
||||
<Version>6.16.2410.2809</Version>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<NoWarn>$(NoWarn);1591</NoWarn>
|
||||
</PropertyGroup>
|
||||
@@ -14,7 +14,6 @@
|
||||
<Compile Remove="Components\TaskEdit.razor.cs" />
|
||||
<Compile Remove="Components\TaskExeList.razor.cs" />
|
||||
<Compile Remove="Components\TLResult.razor.cs" />
|
||||
<Compile Remove="Controllers\TaskController.cs" />
|
||||
<Compile Remove="Pages\UserDecl.razor.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -224,10 +223,6 @@
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Controllers\" />
|
||||
</ItemGroup>
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||
<Exec Command="powershell.exe -ExecutionPolicy Unrestricted -NoProfile -NonInteractive -File $(ProjectDir)\post-build.ps1 -ProjectDir $(ProjectDir) -ProjectPath $(ProjectPath)" />
|
||||
</Target>
|
||||
|
||||
@@ -1,166 +1,3 @@
|
||||
@page "/TaskScheduler"
|
||||
|
||||
<div class="row">
|
||||
<div class="@mainCss">
|
||||
<div class="card shadow">
|
||||
<div class="card-header table-primary p-1">
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-2">
|
||||
<b class="fs-4">TaskList</b>
|
||||
</div>
|
||||
<div class="px-2">
|
||||
<div class="input-group">
|
||||
@if (currRecord == null)
|
||||
{
|
||||
<button class="btn btn-success" @onclick="addNew" title="Add New"><i class="fas fa-plus"></i> Add New</button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button class="btn btn-secondary" @onclick="doCancel" title="Cancel"><i class="fas fa-undo"></i> Cancel</button>
|
||||
}
|
||||
<select class="form-select" @bind="@TypeSel">
|
||||
@foreach (var option in Enum.GetValues(typeof(MP.TaskMan.Objects.Enums.Task2ExeType)))
|
||||
{
|
||||
<option value="@option">
|
||||
@option
|
||||
</option>
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<TaskEdit CurrRecord="@currRecord" EC_update="forceUpdate"></TaskEdit>
|
||||
</div>
|
||||
<div class="card-body py-0 px-1">
|
||||
@if (isLoading)
|
||||
{
|
||||
<ProgressDisplay DisplaySize="ProgressDisplay.ModalSize.Medium" ExpTimeMSec="@expTimeMsec" CurrVal="@currVal" NextVal="@nextVal" MaxVal="@MaxVal" Title="Task Processing" RefreshInterval="200"></ProgressDisplay>
|
||||
<LoadingData Title="Elaborazione..." DisplayMode="LoadingData.SpinMode.BounceLine" DisplaySize="LoadingData.CtrlSize.Large"></LoadingData>
|
||||
}
|
||||
else if (ListRecords == null)
|
||||
{
|
||||
<LoadingData></LoadingData>
|
||||
}
|
||||
else if (totalCount == 0)
|
||||
{
|
||||
<div class="alert alert-warning text-center display-4">Nessun record trovato</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<table class="table table-sm table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<button class="btn btn-sm btn-info" @onclick="doReset" title="Reset"><i class="fas fa-sync"></i></button>
|
||||
</th>
|
||||
<th>Ord</th>
|
||||
<th>Task</th>
|
||||
<th>Tipo</th>
|
||||
<th>Command</th>
|
||||
<th>Sched.</th>
|
||||
@if (detRecord == null)
|
||||
{
|
||||
<th class="text-end">Last</th>
|
||||
<th class="text-end">Next</th>
|
||||
<th class="text-end">Result</th>
|
||||
<th>
|
||||
<button class="btn btn-sm btn-danger me-1" @onclick="forceAll" title="Force All"><i class="fas fa-play"></i></button>
|
||||
</th>
|
||||
}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var record in ListRecords)
|
||||
{
|
||||
<tr class="@checkSelect(@record.TaskId)">
|
||||
<td class="text-nowrap">
|
||||
<button class="btn btn-sm btn-info" @onclick="()=>doSelect(record)" title="Select"><i class="fas fa-search"></i></button>
|
||||
@if (detRecord == null)
|
||||
{
|
||||
@if (currRecord == null)
|
||||
{
|
||||
<button class="btn btn-sm btn-primary ms-1" @onclick="()=>doEdit(record)" title="Edit"><i class="fas fa-pencil-alt"></i></button>
|
||||
<button class="btn btn-sm btn-success" @onclick="()=>doClone(record)" title="Clona"><i class="fas fa-magic"></i></button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button class="btn btn-sm btn-secondary ms-1" @onclick="()=>doCancel()" title="Cancel"><i class="fas fa-undo"></i></button>
|
||||
}
|
||||
}
|
||||
</td>
|
||||
<td class="text-nowrap">
|
||||
@if (detRecord == null)
|
||||
{
|
||||
@if (record.Ordinal == minOrdinal)
|
||||
{
|
||||
<button class="btn btn-sm btn-outline-secondary mx-1" disabled title="Cannot Move"><i class="fas fa-caret-up"></i></button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button class="btn btn-sm btn-outline-primary mx-1" @onclick="()=>doMove(record, true)" title="Move Up"><i class="fas fa-caret-up"></i></button>
|
||||
}
|
||||
}
|
||||
@record.Ordinal
|
||||
@if (detRecord == null)
|
||||
{
|
||||
@if (record.Ordinal == maxOrdinal)
|
||||
{
|
||||
<button class="btn btn-sm btn-outline-secondary mx-1" disabled title="Cannot Move"><i class="fas fa-caret-down"></i></button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button class="btn btn-sm btn-outline-primary mx-1" @onclick="()=>doMove(record, false)" title="Move Down"><i class="fas fa-caret-down"></i></button>
|
||||
}
|
||||
}
|
||||
</td>
|
||||
<td class="text-nowrap">
|
||||
<div>@record.Name</div>
|
||||
<div class="small">@record.Descript</div>
|
||||
</td>
|
||||
<td>
|
||||
@record.TType
|
||||
</td>
|
||||
<td>
|
||||
<div>@record.Command</div>
|
||||
<div class="small text-break">@record.Args</div>
|
||||
</td>
|
||||
<td>@record.Freq × @record.Cad</td>
|
||||
@if (detRecord == null)
|
||||
{
|
||||
<td class="text-end text-nowrap">
|
||||
<div>@($"{record.DtLastExec:yyyy-MM-dd}")</div>
|
||||
<div class="small">@($"{record.DtLastExec:ddd HH:mm:ss}")</div>
|
||||
</td>
|
||||
<td class="text-end text-nowrap">
|
||||
<div>@($"{record.DtNextExec:yyyy-MM-dd}")</div>
|
||||
<div class="small">@($"{record.DtNextExec:ddd HH:mm:ss}")</div>
|
||||
</td>
|
||||
<td>
|
||||
<TLResult CurrRecord="@record"></TLResult>
|
||||
</td>
|
||||
<td>
|
||||
<button class="btn btn-sm @btnRunCss(record.DtNextExec) me-1" @onclick="()=>doRun(record)" title="Run Now"><i class="fas fa-play"></i></button>
|
||||
</td>
|
||||
}
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<div class="card-footer py-1">
|
||||
<DataPager PageSize="numRecord" currPage="currPage" numRecordChanged="ForceReload" numPageChanged="ForceReloadPage" exportEnabled="false" exportRequested="ExportCsv" fileName="@fileName" totalCount="totalCount" showLoading="isLoading" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@if (detRecord != null && !isLoading)
|
||||
{
|
||||
<div class="col-6">
|
||||
<TaskExeList CurrRecord="detRecord"></TaskExeList>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<TaskList></TaskList>
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gestione display avanzamento step
|
||||
/// </summary>
|
||||
/// <param name="currStep"></param>
|
||||
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<bool>("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<bool>("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<bool>("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<TaskListModel> ListRecords;
|
||||
private int MaxVal = 10;
|
||||
private double nextVal = 0;
|
||||
private List<TaskListModel> 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
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo statistiche MAPO</i>
|
||||
<h4>Versione: 6.16.2410.2612</h4>
|
||||
<h4>Versione: 6.16.2410.2809</h4>
|
||||
<br />
|
||||
Note di rilascio:
|
||||
<ul>
|
||||
|
||||
@@ -1 +1 @@
|
||||
6.16.2410.2612
|
||||
6.16.2410.2809
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>6.16.2410.2612</version>
|
||||
<version>6.16.2410.2809</version>
|
||||
<url>https://nexus.steamware.net/repository/SWS/MP-STATS/stable/LAST/MP.Stats.zip</url>
|
||||
<changelog>https://nexus.steamware.net/repository/SWS/MP-STATS/stable/LAST/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
@@ -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<IConfiguration>(Configuration);
|
||||
|
||||
services.AddSingleton<MpStatsService>();
|
||||
services.AddSingleton<TaskService>();
|
||||
|
||||
services.AddScoped<MessageService>();
|
||||
}
|
||||
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
<div class="my-component">
|
||||
This component is defined in the <strong>MP.TaskMan</strong> library.
|
||||
</div>
|
||||
@@ -1,6 +0,0 @@
|
||||
.my-component {
|
||||
border: 2px dashed red;
|
||||
padding: 1em;
|
||||
margin: 1em 0;
|
||||
background-image: url('background.png');
|
||||
}
|
||||
@@ -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<string>("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<string>("ServerConf:CodModulo");
|
||||
CodModulo = _configuration.GetValue<string>("SpecialConf:CodModulo");
|
||||
var cstringArray = ConnStr.Split(";");
|
||||
foreach (var item in cstringArray)
|
||||
{
|
||||
|
||||
+44
-24
@@ -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;");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Cerca la connString del DB usato da stats basandosi sull'elenco dei nomi delle chaivi da cercare, dalle + specifiche alle più generiche
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private string ConnStringGetFirst()
|
||||
{
|
||||
// in primis cerco se c'è la conf di quale connString usare per il programma specifico
|
||||
string scTaskConn = _configuration.GetValue<string>("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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco dei nomi delle connString da provare x il DB di riferimento qualora non specificato in conf
|
||||
/// </summary>
|
||||
protected List<string> ConnStringList { get; set; } = new List<string>()
|
||||
{
|
||||
"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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user