Fix display alert

This commit is contained in:
Samuele Locatelli
2024-04-03 12:07:22 +02:00
parent 0987a4f187
commit 9f06775afb
9 changed files with 84 additions and 16 deletions
+1
View File
@@ -190,6 +190,7 @@ namespace MP.Data.Controllers
// aggiorno record chiamata...
currRec.DtLastExec = dtStart;
currRec.LastResult = resRec.Result;
currRec.LastIsError=resRec.IsError;
currRec.LastDuration = dtEnd.Subtract(dtStart).TotalSeconds;
// calcolo prossima esecuzione...
currRec.DtNextExec = CalcNextExe(currRec);
+5
View File
@@ -72,6 +72,11 @@ namespace MP.Data.DatabaseModels
/// </summary>
public double LastDuration { get; set; } = 0;
/// <summary>
/// Esito ultima esecuzione in Errore
/// </summary>
public bool LastIsError { get; set; } = false;
/// <summary>
/// Ultimo risultato registrato
/// </summary>
+7
View File
@@ -0,0 +1,7 @@
<div class="text-end">
@CurrRecord.LastDuration.ToString("N3") sec <button class="btn btn-sm @btnCss" @onclick="toggleDetail"><i class="far @iconCss"></i></button>
</div>
@if (showDetail)
{
<div class="small alert @alCss py-1">@CurrRecord.LastResult</div>
}
+56
View File
@@ -0,0 +1,56 @@
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
}
}
+2 -2
View File
@@ -4,8 +4,8 @@
<TargetFramework>net6.0</TargetFramework>
<RootNamespace>MP.Stats</RootNamespace>
<UserSecretsId>826e877c-ba70-4253-84cb-d0b1cafd4440</UserSecretsId>
<Version>6.16.2404.0311</Version>
<Version>6.16.2404.0311</Version>
<Version>6.16.2404.0312</Version>
<Version>6.16.2404.0312</Version>
</PropertyGroup>
<ItemGroup>
+10 -11
View File
@@ -62,9 +62,9 @@
<th>Schedulazione</th>
@if (detRecord == null)
{
<th class="text-right">Last</th>
<th class="text-right">Next</th>
<th class="text-right">Result</th>
<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>
@@ -75,7 +75,7 @@
@foreach (var record in ListRecords)
{
<tr class="@checkSelect(@record.TaskId)">
<td>
<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)
{
@@ -86,7 +86,7 @@
<button class="btn btn-sm btn-secondary" @onclick="()=>doCancel()" title="Cancel"><i class="fas fa-undo"></i></button>
}
</td>
<td>
<td class="text-nowrap">
@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>
@@ -105,7 +105,7 @@
<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>
<td class="text-nowrap">
<div>@record.Name</div>
<div class="small">@record.Descript</div>
</td>
@@ -119,17 +119,16 @@
<td>@record.Freq &times; @record.Cad</td>
@if (detRecord == null)
{
<td class="text-right">
<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-right">
<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 class="text-right">
<div>@record.LastDuration.ToString("N3") sec</div>
<div class="small">@record.LastResult</div>
<td>
<TLResult CurrRecord="@record"></TLResult>
</td>
}
<td>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo statistiche MAPO</i>
<h4>Versione: 6.16.2404.0311</h4>
<h4>Versione: 6.16.2404.0312</h4>
<br />
Note di rilascio:
<ul>
+1 -1
View File
@@ -1 +1 @@
6.16.2404.0311
6.16.2404.0312
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2404.0311</version>
<version>6.16.2404.0312</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>