MP-STATS
- schedulazione manuale non rischedula - aggiunto duplica - fix filtro esecuzioni - vari fix grafici
This commit is contained in:
@@ -144,8 +144,9 @@ namespace MP.Data.Controllers
|
||||
/// Chiamata esecuzione di un singolo task programmato
|
||||
/// </summary>
|
||||
/// <param name="TaskId"></param>
|
||||
/// <param name="SchedNext">Se true rischedula successiva chiamata</param>
|
||||
/// <returns></returns>
|
||||
public TaskResultModel ExecuteTask(int TaskId)
|
||||
public TaskResultModel ExecuteTask(int TaskId, bool SchedNext)
|
||||
{
|
||||
TaskResultModel callRes = new TaskResultModel();
|
||||
using (var dbCtx = new MoonPro_STATSContext(_configuration))
|
||||
@@ -190,10 +191,14 @@ namespace MP.Data.Controllers
|
||||
// aggiorno record chiamata...
|
||||
currRec.DtLastExec = dtStart;
|
||||
currRec.LastResult = resRec.Result;
|
||||
currRec.LastIsError=resRec.IsError;
|
||||
currRec.LastIsError = resRec.IsError;
|
||||
currRec.LastDuration = dtEnd.Subtract(dtStart).TotalSeconds;
|
||||
// calcolo prossima esecuzione...
|
||||
currRec.DtNextExec = CalcNextExe(currRec);
|
||||
// solo se richiesto rischedulazione ricalcola chiamata
|
||||
if (SchedNext)
|
||||
{
|
||||
// calcolo prossima esecuzione...
|
||||
currRec.DtNextExec = CalcNextExe(currRec);
|
||||
}
|
||||
// segno modificato
|
||||
dbCtx.Entry(currRec).State = EntityState.Modified;
|
||||
|
||||
|
||||
@@ -30,7 +30,19 @@ namespace MP.Stats.Components
|
||||
/// <summary>
|
||||
/// Show error mode: 0 = tutti 1 = solo errori 2 = solo ok
|
||||
/// </summary>
|
||||
protected int ShowErrorMode { get; set; } = 0;
|
||||
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; }
|
||||
@@ -70,8 +82,8 @@ namespace MP.Stats.Components
|
||||
#region Private Properties
|
||||
|
||||
private int currPage { get; set; } = 1;
|
||||
|
||||
private int numRecord { get; set; } = 10;
|
||||
private int showErrorMode { get; set; } = 0;
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
@@ -80,6 +92,18 @@ namespace MP.Stats.Components
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ namespace MP.Stats.Controllers
|
||||
var task2exe = listTask.Where(x => x.DtNextExec <= adesso).ToList();
|
||||
foreach (var taskRec in task2exe)
|
||||
{
|
||||
TaskResultModel result = await DService.ExecuteTask(taskRec.TaskId);
|
||||
TaskResultModel result = await DService.ExecuteTask(taskRec.TaskId, true);
|
||||
answ.Add(result);
|
||||
}
|
||||
// resituisco
|
||||
|
||||
@@ -166,10 +166,11 @@ namespace MP.Stats.Data
|
||||
/// Chiamata esecuzione di un singolo task programmato
|
||||
/// </summary>
|
||||
/// <param name="TaskId"></param>
|
||||
/// <param name="SchedNext">Se true rischedula successiva chiamata</param>
|
||||
/// <returns></returns>
|
||||
public async Task<TaskResultModel> ExecuteTask(int TaskId)
|
||||
public async Task<TaskResultModel> ExecuteTask(int TaskId, bool SchedNext)
|
||||
{
|
||||
TaskResultModel dbResult = dbController.ExecuteTask(TaskId);
|
||||
TaskResultModel dbResult = dbController.ExecuteTask(TaskId, SchedNext);
|
||||
// svuoto cache!
|
||||
await FlushCache("Task");
|
||||
return await Task.FromResult(dbResult);
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<RootNamespace>MP.Stats</RootNamespace>
|
||||
<UserSecretsId>826e877c-ba70-4253-84cb-d0b1cafd4440</UserSecretsId>
|
||||
<Version>6.16.2404.0312</Version>
|
||||
<Version>6.16.2404.0312</Version>
|
||||
<Version>6.16.2404.0510</Version>
|
||||
<Version>6.16.2404.0510</Version>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<NoWarn>$(NoWarn);1591</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -59,16 +59,16 @@
|
||||
<th>Task</th>
|
||||
<th>Tipo</th>
|
||||
<th>Command</th>
|
||||
<th>Schedulazione</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>
|
||||
}
|
||||
<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>
|
||||
@@ -76,33 +76,43 @@
|
||||
{
|
||||
<tr class="@checkSelect(@record.TaskId)">
|
||||
<td class="text-nowrap">
|
||||
<button class="btn btn-sm btn-info me-1" @onclick="()=>doSelect(record)" title="Select"><i class="fas fa-search"></i></button>
|
||||
@if (currRecord == null)
|
||||
<button class="btn btn-sm btn-info" @onclick="()=>doSelect(record)" title="Select"><i class="fas fa-search"></i></button>
|
||||
@if (detRecord == null)
|
||||
{
|
||||
<button class="btn btn-sm btn-primary me-1" @onclick="()=>doEdit(record)" title="Edit"><i class="fas fa-pencil-alt"></i></button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button class="btn btn-sm btn-secondary" @onclick="()=>doCancel()" title="Cancel"><i class="fas fa-undo"></i></button>
|
||||
@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 (record.Ordinal == minOrdinal)
|
||||
@if (detRecord == null)
|
||||
{
|
||||
<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>
|
||||
@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 (record.Ordinal == maxOrdinal)
|
||||
@if (detRecord == null)
|
||||
{
|
||||
<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>
|
||||
@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">
|
||||
@@ -114,7 +124,7 @@
|
||||
</td>
|
||||
<td>
|
||||
<div>@record.Command</div>
|
||||
<div class="small">@record.Args</div>
|
||||
<div class="small text-break">@record.Args</div>
|
||||
</td>
|
||||
<td>@record.Freq × @record.Cad</td>
|
||||
@if (detRecord == null)
|
||||
@@ -130,10 +140,10 @@
|
||||
<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>
|
||||
}
|
||||
<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>
|
||||
|
||||
@@ -134,6 +134,30 @@ namespace MP.Stats.Pages
|
||||
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);
|
||||
@@ -170,7 +194,7 @@ namespace MP.Stats.Pages
|
||||
await Task.Delay(100);
|
||||
await advStep(currStep++);
|
||||
// chiama esecuzione task
|
||||
var result = await StatService.ExecuteTask(selRec.TaskId);
|
||||
var result = await StatService.ExecuteTask(selRec.TaskId, false);
|
||||
await advStep(currStep++);
|
||||
isLoading = false;
|
||||
await Task.Delay(100);
|
||||
@@ -198,7 +222,7 @@ namespace MP.Stats.Pages
|
||||
await Task.Delay(100);
|
||||
foreach (var taskRec in SearchRecords)
|
||||
{
|
||||
var result = await StatService.ExecuteTask(taskRec.TaskId);
|
||||
var result = await StatService.ExecuteTask(taskRec.TaskId, false);
|
||||
}
|
||||
isLoading = false;
|
||||
await Task.Delay(100);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo statistiche MAPO</i>
|
||||
<h4>Versione: 6.16.2404.0312</h4>
|
||||
<h4>Versione: 6.16.2404.0510</h4>
|
||||
<br />
|
||||
Note di rilascio:
|
||||
<ul>
|
||||
|
||||
@@ -1 +1 @@
|
||||
6.16.2404.0312
|
||||
6.16.2404.0510
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>6.16.2404.0312</version>
|
||||
<version>6.16.2404.0510</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>
|
||||
|
||||
Reference in New Issue
Block a user