Completata gestione editing profili sul DB
This commit is contained in:
@@ -195,7 +195,7 @@ namespace EgwCoreLib.Lux.Data.Services
|
||||
// cerco in redis...
|
||||
string currKey = $"{redisBaseKey}:ConfProfile";
|
||||
RedisValue rawData = await redisDb.StringGetAsync(currKey);
|
||||
if (rawData.HasValue)
|
||||
if (rawData.HasValue && rawData.Length() > 2)
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<List<ProfileModel>>($"{rawData}");
|
||||
source = "REDIS";
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Version>1.1.2601.2118</Version>
|
||||
<Version>1.1.2601.2119</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -36,35 +36,12 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
@* <table class="table table-sm table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-nowrap">Cod.</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
@foreach (var item in ListRecords)
|
||||
{
|
||||
<tr>
|
||||
<td class="">@item</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
@if (totalCount >= numRecord)
|
||||
{
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="15">
|
||||
<EgwCoreLib.Razor.DataPager currPage="@currPage" PageSize="@numRecord" totalCount="@totalCount" numPageChanged="SavePage" numRecordChanged="SaveNumRec"></EgwCoreLib.Razor.DataPager>
|
||||
</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
}
|
||||
</table> *@
|
||||
<table class="table table-sm table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="text-nowrap text-center">
|
||||
<button class="btn btn-sm btn-primary" title="Reset selezione" @onclick="DoReset"><i class="fa-solid fa-arrow-rotate-right"></i></button>
|
||||
</th>
|
||||
<th class="text-nowrap">Cod.</th>
|
||||
<th class="text-nowrap">Descr.</th>
|
||||
<th class="text-nowrap text-end">Threshold</th>
|
||||
@@ -76,12 +53,47 @@
|
||||
|
||||
@foreach (var item in ListRecords)
|
||||
{
|
||||
<tr>
|
||||
<tr class="@checkSel(item)">
|
||||
<td class="text-nowrap text-center">
|
||||
@if (EditRecord != null && EditRecord.Code == item.Code)
|
||||
{
|
||||
<button class="btn btn-sm btn-success" @onclick="() => DoSave(item)"><i class="fa-solid fa-floppy-disk"></i></button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button class="btn btn-sm btn-info" @onclick="() => DoEdit(item)"><i class="fa-solid fa-pencil"></i></button>
|
||||
}
|
||||
</td>
|
||||
<td class="">@item.Code</td>
|
||||
<td class="">@item.Description</td>
|
||||
<td class="">
|
||||
@if (EditRecord != null && EditRecord.Code == item.Code)
|
||||
{
|
||||
<input type="text" class="form-control form-control-sm" @bind="@item.Description" />
|
||||
}
|
||||
else
|
||||
{
|
||||
@item.Description
|
||||
}
|
||||
</td>
|
||||
<td class="text-end"><button class="btn btn-sm btn-info" @onclick="() => ShowThresh(item)">@item.ThresholdList.Count <i class="fa-solid fa-up-right-from-square"></i></button></td>
|
||||
<td class="text-end"><button class="btn btn-sm btn-info" @onclick="() => ShowData(item)">@item.ProfileDataDict.Count <i class="fa-solid fa-up-right-from-square"></i></button></td>
|
||||
<td>del</td>
|
||||
<td>
|
||||
@if (EditRecord != null && EditRecord.Code == item.Code)
|
||||
{
|
||||
<button class="btn btn-sm btn-warning" @onclick="DoReset"><i class="fa-solid fa-ban"></i></button>
|
||||
}
|
||||
else
|
||||
{
|
||||
if(item.ThresholdList.Count==0 && item.ProfileDataDict.Count==0)
|
||||
{
|
||||
<button class="btn btn-sm btn-danger" @onclick="() => DoDelete(item)"><i class="fa-solid fa-trash"></i></button>
|
||||
}
|
||||
else
|
||||
{
|
||||
<button class="btn btn-sm btn-secondary disabled"><i class="fa-solid fa-trash"></i></button>
|
||||
}
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using EgwCoreLib.Lux.Core.RestPayload;
|
||||
using EgwCoreLib.Lux.Data.DbModel.Config;
|
||||
using EgwCoreLib.Lux.Data.DbModel.Utils;
|
||||
using EgwCoreLib.Lux.Data.Services;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Cors.Infrastructure;
|
||||
@@ -50,7 +51,7 @@ namespace Lux.UI.Components.Compo.Config
|
||||
if (searchVal != value)
|
||||
{
|
||||
searchVal = value;
|
||||
FullUpdate();
|
||||
_ = FullUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -59,6 +60,51 @@ namespace Lux.UI.Components.Compo.Config
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected void DoCloseDetail(bool args)
|
||||
{
|
||||
DetReq = "";
|
||||
currDispl = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Eliminazione record
|
||||
/// </summary>
|
||||
/// <param name="selRec"></param>
|
||||
protected async Task DoDelete(ProfileModel selRec)
|
||||
{
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", $"Sicuro di voler eliminare il record? Dettagli: {selRec.Code} | {selRec.Description}"))
|
||||
return;
|
||||
|
||||
isLoading = true;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
// esegue eliminazione del record...
|
||||
await DLService.ConfProfileDeleteAsync(selRec);
|
||||
|
||||
// segnalo update x reload
|
||||
await ReloadData();
|
||||
UpdateTable();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Edit record selezionato
|
||||
/// </summary>
|
||||
/// <param name="curRec"></param>
|
||||
protected void DoEdit(ProfileModel curRec)
|
||||
{
|
||||
EditRecord = curRec;
|
||||
}
|
||||
/// <summary>
|
||||
/// Salvataggio record
|
||||
/// </summary>
|
||||
/// <param name="curRec"></param>
|
||||
protected async Task DoSave(ProfileModel curRec)
|
||||
{
|
||||
await DLService.ConfProfileUpsertAsync(curRec);
|
||||
EditRecord = null;
|
||||
await ReloadData();
|
||||
UpdateTable();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Richiesta update elenco HW preferiti/configurati
|
||||
/// </summary>
|
||||
@@ -79,6 +125,14 @@ namespace Lux.UI.Components.Compo.Config
|
||||
await callRefreshProfThresh();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reset selezione
|
||||
/// </summary>
|
||||
protected void DoReset()
|
||||
{
|
||||
EditRecord = null;
|
||||
}
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
apiUrl = Config.GetValue<string>("ServerConf:Prog.ApiUrl") ?? "";
|
||||
@@ -147,6 +201,8 @@ namespace Lux.UI.Components.Compo.Config
|
||||
|
||||
private string DetReq = "";
|
||||
|
||||
private ProfileModel? EditRecord = null;
|
||||
|
||||
private string genericBasePath = "generic";
|
||||
|
||||
private bool isLoading = false;
|
||||
@@ -246,10 +302,14 @@ namespace Lux.UI.Components.Compo.Config
|
||||
}
|
||||
}
|
||||
|
||||
private void DoCloseDetail(bool args)
|
||||
private string checkSel(ProfileModel curRec)
|
||||
{
|
||||
DetReq = "";
|
||||
currDispl = null;
|
||||
string answ = "";
|
||||
if (EditRecord != null)
|
||||
{
|
||||
answ = curRec.Code == EditRecord.Code ? "table-info" : "";
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
private async Task FullUpdate()
|
||||
@@ -311,6 +371,7 @@ namespace Lux.UI.Components.Compo.Config
|
||||
.ToList();
|
||||
}
|
||||
totalCount = AllRecords.Count;
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -323,12 +384,6 @@ namespace Lux.UI.Components.Compo.Config
|
||||
.Skip(numRecord * (currPage - 1))
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
#if false
|
||||
ListRecords = AllRecordsRedis
|
||||
.Skip(numRecord * (currPage - 1))
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
#endif
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<UserSecretsId>aspnet-Lux.UI-a758c101-a2f4-4e38-977d-1c4887dbbd50</UserSecretsId>
|
||||
<Version>1.1.2601.2118</Version>
|
||||
<Version>1.1.2601.2119</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>LUX - Web Windows MES</i>
|
||||
<h4>Versione: 1.1.2601.2118</h4>
|
||||
<h4>Versione: 1.1.2601.2119</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
1.1.2601.2118
|
||||
1.1.2601.2119
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>1.1.2601.2118</version>
|
||||
<version>1.1.2601.2119</version>
|
||||
<url>http://nexus.steamware.net/repository/SWS/GPW/stable/GPW.UI.zip</url>
|
||||
<changelog>http://nexus.steamware.net/repository/SWS/GPW/stable/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
Reference in New Issue
Block a user