Files
limanapp/EgwControlCenter.App/Components/Compo/ApplicationCheck.razor
T
Samuele Locatelli c8b049be4f Update display aggiornamenti
- maca gestione timer autorefresh componente
- manca testing finale
- manca clickonce finale
2024-09-21 12:44:06 +02:00

88 lines
2.4 KiB
Plaintext

@using EgwControlCenter.Core
@using EgwControlCenter.Core.Models
@inject AppControlService ACService
<table class="table table-striped table-sm text-start shadow border">
<thead>
<tr class="bg-dark bg-gradient text-light">
@* <th class="text-center" style="width: 2rem;">
<button class="btn btn-primary btn-sm" @onclick="DoCancel"><i class="fa-solid fa-rotate"></i></button>
</th> *@
<th>Applicazione</th>
<th>Installed</th>
<th>Available</th>
<th class="text-center">Update</th>
<th class="text-end">Note</th>
</tr>
</thead>
<tbody>
@if (ListRecords == null || ListRecords.Count == 0)
{
<tr>
<td colspan="5">
<div class="alert alert-warning">Nessun aggiornamento disponibile!</div>
</td>
</tr>
}
else
{
@foreach (var item in ListRecords)
{
<tr>
<td>@item.CodApp</td>
<td>@item.VersNumCurr</td>
<td>@item.VersNumLast</td>
<td class="text-center">
@if (item.HasUpdate)
{
<i class="fa-solid fa-bell text-success"></i>
}
</td>
<td>@item.RelTagsLast</td>
</tr>
}
}
</tbody>
</table>
@code {
[Parameter]
public bool OnlyUpdate { get; set; } = false;
private List<VersStatusDTO>? ListRecords { get; set; } = null;
private List<VersStatusDTO> CurrRecords
{
get => ACService.ListAppStatus;
// set => ACService.ListAppStatus = value;
}
protected override void OnParametersSet()
{
// fix parametro visualizzazione solo update
ForceReload();
}
protected override void OnInitialized()
{
ACService.EA_StatusUpdated += ACService_EA_StatusUpdated;
}
private void ACService_EA_StatusUpdated()
{
// fermo il timer e lo riavvio...
ForceReload();
}
private void ForceReload()
{
// ListRecords = null;
ListRecords = CurrRecords
.Where(x => x.HasUpdate || !OnlyUpdate)
.ToList();
StateHasChanged();
}
}