Bozza gestione release applicativi

This commit is contained in:
Samuele Locatelli
2024-08-07 17:34:12 +02:00
parent 5274068c09
commit 2c1919c290
17 changed files with 337 additions and 60 deletions
+4 -4
View File
@@ -100,10 +100,10 @@ namespace LiMan.APi.Data
List<ReleaseDTO> dbResult = new List<ReleaseDTO>();
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
dbResult = dbController.ReleaseGetByApp(CodApp);
dbResult = dbController.ReleaseDtoGetByApp(CodApp);
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"Effettuata lettura da DB per ReleaseGetByApp | {CodApp} | {ts.TotalMilliseconds} ms");
Log.Trace($"Effettuata lettura da DB per ReleaseDtoGetByApp | {CodApp} | {ts.TotalMilliseconds} ms");
return dbResult;
}
/// <summary>
@@ -118,10 +118,10 @@ namespace LiMan.APi.Data
List<ReleaseDTO> dbResult = new List<ReleaseDTO>();
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
dbResult = dbController.ReleaseGetByAppVers(CodApp, VersMin);
dbResult = dbController.ReleaseDtoGetByAppVers(CodApp, VersMin);
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"Effettuata lettura da DB per ReleaseGetByAppVers | {CodApp} | vers >= {VersMin} | {ts.TotalMilliseconds} ms");
Log.Trace($"Effettuata lettura da DB per ReleaseDtoGetByAppVers | {CodApp} | vers >= {VersMin} | {ts.TotalMilliseconds} ms");
return dbResult;
}
+47 -18
View File
@@ -1167,9 +1167,9 @@ namespace LiMan.DB.Controllers
/// </summary>
/// <param name="CodApp">Codice applicativo</param>
/// <returns></returns>
public List<ReleaseDTO> ReleaseGetByApp(string CodApp)
public List<ReleaseModel> ReleaseGetByApp(string CodApp)
{
List<ReleaseDTO> dbResult = new List<ReleaseDTO>();
List<ReleaseModel> dbResult = new List<ReleaseModel>();
using (LMDbContext localDbCtx = new LMDbContext(_configuration))
{
// calcolo DTO applicativi
@@ -1177,13 +1177,6 @@ namespace LiMan.DB.Controllers
.DbSetReleases
.Where(x => (x.CodApp.ToLower() == CodApp.ToLower()))
.OrderBy(o => o.ReleaseDate)
.Select(x => new ReleaseDTO()
{
CodApp = x.CodApp,
ReleaseDate = x.ReleaseDate,
VersNum = x.VersNum,
VersText = x.VersText
})
.ToList();
}
return dbResult;
@@ -1195,9 +1188,9 @@ namespace LiMan.DB.Controllers
/// <param name="CodApp">Codice applicativo</param>
/// <param name="VersMin">Versione minima richiesta</param>
/// <returns></returns>
public List<ReleaseDTO> ReleaseGetByAppVers(string CodApp, string MinVers)
public List<ReleaseModel> ReleaseGetByAppVers(string CodApp, string MinVers)
{
List<ReleaseDTO> dbResult = new List<ReleaseDTO>();
List<ReleaseModel> dbResult = new List<ReleaseModel>();
using (LMDbContext localDbCtx = new LMDbContext(_configuration))
{
// calcolo DTO applicativi
@@ -1205,18 +1198,54 @@ namespace LiMan.DB.Controllers
.DbSetReleases
.Where(x => (x.CodApp.ToLower() == CodApp.ToLower()) && x.VersNum.CompareTo(MinVers) > 0)
.OrderBy(o => o.ReleaseDate)
.Select(x => new ReleaseDTO()
{
CodApp = x.CodApp,
ReleaseDate = x.ReleaseDate,
VersNum = x.VersNum,
VersText = x.VersText
})
.ToList();
}
return dbResult;
}
/// <summary>
/// Elenco release (completo) dato un applicativo applicativi
/// </summary>
/// <param name="CodApp">Codice applicativo</param>
/// <returns></returns>
public List<ReleaseDTO> ReleaseDtoGetByApp(string CodApp)
{
List<ReleaseDTO> dbResult = new List<ReleaseDTO>();
var rawData = ReleaseGetByApp(CodApp);
dbResult = rawData
.Select(x => new ReleaseDTO()
{
CodApp = x.CodApp,
ReleaseDate = x.ReleaseDate,
VersNum = x.VersNum,
VersText = x.VersText
}).
ToList();
return dbResult;
}
/// <summary>
/// Elenco release (completo) dato un applicativo applicativi
/// </summary>
/// <param name="CodApp">Codice applicativo</param>
/// <param name="VersMin">Versione minima richiesta</param>
/// <returns></returns>
public List<ReleaseDTO> ReleaseDtoGetByAppVers(string CodApp, string MinVers)
{
List<ReleaseDTO> dbResult = new List<ReleaseDTO>();
var rawData = ReleaseGetByAppVers(CodApp, MinVers);
dbResult = rawData
.Select(x => new ReleaseDTO()
{
CodApp = x.CodApp,
ReleaseDate = x.ReleaseDate,
VersNum = x.VersNum,
VersText = x.VersText
}).
ToList();
return dbResult;
}
/// <summary>
/// Annulla modifiche su una specifica entity (cancel update)
/// </summary>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>License Manager</i>
<h4>Versione: 1.1.2408.0619</h4>
<h4>Versione: 1.1.2408.0717</h4>
<br />
Note di rilascio:
<ul>
+1 -1
View File
@@ -1 +1 @@
1.1.2408.0619
1.1.2408.0717
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>1.1.2408.0619</version>
<version>1.1.2408.0717</version>
<url>https://nexus.steamware.net/repository/SWS/LiMan/stable/LAST/LiMan.Transfer.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/LiMan/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>
+24 -14
View File
@@ -12,9 +12,9 @@
</div>
</div>
<div class="card-body">
@if (currRecord != null)
@if (recordEdit != null)
{
<EditApplicazioni currItem="@currRecord" DataReset="ResetData" DataUpdated="UpdateData"></EditApplicazioni>
<EditApplicazioni currItem="@recordEdit" DataReset="ResetData" DataUpdated="UpdateData"></EditApplicazioni>
}
@if (ListRecords == null)
{
@@ -27,13 +27,16 @@
else
{
<div class="row">
<div class="col-12">
<div class="@mainCss">
<table class="table table-sm table-striped table-responsive-lg">
<thead>
<tr>
<th></th>
<th>Applicazione</th>
<th class="text-right">Descrizione</th>
@if (recordSel == null)
{
<th class="text-right">Descrizione</th>
}
</tr>
</thead>
<tbody>
@@ -41,33 +44,40 @@
{
<tr class="@checkSelect(record.CodApp)">
<td class="text-nowrap">
@if (currRecord == null)
@if (recordEdit == null)
{
if (@record.CodApp != "-")
{
<button class="btn btn-sm btn-info" @onclick="() => Edit(record)" title="Edit record">
<i class="oi oi-pencil"></i>
</button>
<button class="btn btn-sm btn-primary" @onclick="() => DoSelect(record)" title="Dettaglio Releases"><i class="fa fa-search"></i></button>
<button class="btn btn-sm btn-info" @onclick="() => DoEdit(record)" title="Edit record"><i class="oi oi-pencil"></i></button>
}
}
else
{
<button class="btn btn-sm btn-secondary disabled">
<i class="oi oi-pencil"></i>
</button>
<button class="btn btn-sm btn-secondary disabled"><i class="fa fa-search"></i></button>
<button class="btn btn-sm btn-secondary disabled"><i class="oi oi-pencil"></i></button>
}
</td>
<td>
<b>@record.CodApp</b>
</td>
<td class="text-right">
<div>@record.Descrizione</div>
</td>
@if (recordSel == null)
{
<td class="text-right">
<div>@record.Descrizione</div>
</td>
}
</tr>
}
</tbody>
</table>
</div>
@if (recordSel != null)
{
<div class="@detCss">
<ListReleases CurrRecord="@recordSel" DataReset="ResetData"></ListReleases>
</div>
}
</div>
}
</div>
+21 -7
View File
@@ -13,7 +13,8 @@ namespace LiMan.UI.Components
{
#region Private Fields
private ApplicativoModel currRecord = null;
private ApplicativoModel recordEdit = null;
private ApplicativoModel recordSel = null;
private List<ApplicativoModel> ListRecords;
private List<ApplicativoModel> SearchRecords;
@@ -77,7 +78,8 @@ namespace LiMan.UI.Components
private async Task fullReload()
{
currRecord = null;
recordEdit = null;
recordSel = null;
await DataService.InvalidateAllCache();
await ReloadAllData();
}
@@ -99,16 +101,28 @@ namespace LiMan.UI.Components
protected void AddNew()
{
currRecord = new ApplicativoModel()
recordEdit = new ApplicativoModel()
{
CodApp = $"CodApp_{DateTime.Now:yyyyMMdd_HHmmss}",
Descrizione = "Descrizione Nuovo Applicativo"
};
}
protected void Edit(ApplicativoModel selRecord)
protected string mainCss
{
currRecord = selRecord;
get => recordSel != null ? "col-4" : "col-12";
}
protected string detCss = "col-8";
protected void DoEdit(ApplicativoModel selRecord)
{
recordEdit = selRecord;
recordSel = null;
}
protected void DoSelect(ApplicativoModel selRecord)
{
recordEdit = null;
recordSel = selRecord;
}
protected override async Task OnInitializedAsync()
@@ -147,11 +161,11 @@ namespace LiMan.UI.Components
public string checkSelect(string CodApp)
{
string answ = "";
if (currRecord != null)
if (recordEdit != null)
{
try
{
answ = (currRecord.CodApp == CodApp) ? "table-info" : "";
answ = (recordEdit.CodApp == CodApp) ? "table-info" : "";
}
catch
{ }
+68
View File
@@ -0,0 +1,68 @@
<div class="card shadow">
<div class="card-header">
<div class="row">
<div class="col-8">
<h5>Elenco Releases Applicativo <b>@CurrRecord.CodApp</b></h5>
</div>
<div class="col-4">
<button type="button" class="btn btn-warning w-100" @onclick="DoClose">Close <i class="fas fa-ban"></i></button>
</div>
</div>
</div>
<div class="card-body">
@if (ListRecords == null)
{
<LoadingData></LoadingData>
}
else if (totalCount == 0)
{
<div class="alert alert-warning text-center display-4">Nessun record trovato</div>
}
else
{
<table class="table table-sm table-striped table-responsive-lg">
<thead>
<tr>
<th></th>
<th>Applicazione</th>
<th class="text-lect">Rilascio</th>
<th class="text-right">Vers. Num</th>
<th class="text-right">Vers. Text</th>
</tr>
</thead>
<tbody>
@foreach (var record in ListRecords)
{
<tr class="@checkSelect(record.IdxRel)">
<td class="text-nowrap">
@if (recordEdit == null)
{
<button class="btn btn-sm btn-info" @onclick="() => DoEdit(record)" title="Edit record"><i class="oi oi-pencil"></i></button>
}
else
{
<button class="btn btn-sm btn-secondary disabled"><i class="oi oi-pencil"></i></button>
}
</td>
<td>
<b>@record.CodApp</b>
</td>
<td class="text-right">
@($"{record.ReleaseDate:yyyy.MM.dd}")
</td>
<td class="text-right">
@record.VersNum
</td>
<td class="text-right">
@record.VersText
</td>
</tr>
}
</tbody>
</table>
}
</div>
<div class="card-footer">
<DataPager PageSize="numRecord" currPage="currPage" numRecordChanged="PagerReloadNum" numPageChanged="PagerReloadPage" totalCount="totalCount" showLoading="isLoading" />
</div>
</div>
+116
View File
@@ -0,0 +1,116 @@
using LiMan.DB.DBModels;
using LiMan.UI.Data;
using Microsoft.AspNetCore.Components;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace LiMan.UI.Components
{
public partial class ListReleases
{
#region Public Properties
[Parameter]
public ApplicativoModel CurrRecord { get; set; }
[Parameter]
public EventCallback<int> DataReset { get; set; }
#endregion Public Properties
#region Public Methods
public string checkSelect(int idxRel)
{
string answ = "";
if (recordEdit != null)
{
try
{
answ = (recordEdit.IdxRel == idxRel) ? "table-info" : "";
}
catch
{ }
}
return answ;
}
#endregion Public Methods
#region Protected Properties
[Inject]
protected LiManDataService DataService { get; set; }
#endregion Protected Properties
#region Protected Methods
protected void DoEdit(ReleaseModel selRecord)
{
recordEdit = selRecord;
}
protected override async Task OnParametersSetAsync()
{
await ReloadAllData();
}
protected async Task PagerReloadNum(int newNum)
{
numRecord = newNum;
await ReloadAllData();
isLoading = false;
}
protected async Task PagerReloadPage(int newNum)
{
currPage = newNum;
await ReloadAllData();
isLoading = false;
}
#endregion Protected Methods
#region Private Fields
private List<ReleaseModel> ListRecords;
private ReleaseModel recordEdit = null;
private List<ReleaseModel> SearchRecords;
#endregion Private Fields
#region Private Properties
private int currPage { get; set; } = 1;
private bool isLoading { get; set; } = false;
private int numRecord { get; set; } = 10;
private int totalCount { get; set; } = 0;
#endregion Private Properties
#region Private Methods
private async Task DoClose()
{
await DataReset.InvokeAsync(0);
}
private async Task ReloadAllData()
{
isLoading = true;
SearchRecords = await DataService.ReleaseGetByApp(CurrRecord.CodApp);
totalCount = SearchRecords.Count();
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
isLoading = false;
}
#endregion Private Methods
}
}
+37
View File
@@ -3,6 +3,7 @@ using Core.DTO;
using Liman.CadCam.DbModel;
using LiMan.DB.Controllers;
using LiMan.DB.DBModels;
using LiMan.DB.DTO;
using Microsoft.AspNetCore.Identity.UI.Services;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Caching.Distributed;
@@ -867,6 +868,42 @@ namespace LiMan.UI.Data
return await Task.FromResult(done);
}
/// <summary>
/// Elenco Release dato Applicativo
/// </summary>
/// <param name="CodApp">Codice Applicazione</param>
/// <returns></returns>
public async Task<List<ReleaseModel>> ReleaseGetByApp(string CodApp)
{
await Task.Delay(1);
List<ReleaseModel> dbResult = new List<ReleaseModel>();
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
dbResult = dbControllerNext.ReleaseGetByApp(CodApp);
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"Effettuata lettura da DB per ReleaseGetByApp | {CodApp} | {ts.TotalMilliseconds} ms");
return dbResult;
}
/// <summary>
/// Elenco Release dato Applicativo + versione minima
/// </summary>
/// <param name="CodApp">Codice Applicazione</param>
/// <param name="VersMin">Versione minima richiesta</param>
/// <returns></returns>
public async Task<List<ReleaseModel>> ReleaseGetByAppVers(string CodApp, string VersMin)
{
await Task.Delay(1);
List<ReleaseModel> dbResult = new List<ReleaseModel>();
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
dbResult = dbControllerNext.ReleaseGetByAppVers(CodApp, VersMin);
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"Effettuata lettura da DB per ReleaseGetByAppVers | {CodApp} | vers >= {VersMin} | {ts.TotalMilliseconds} ms");
return dbResult;
}
public void rollBackEditGLS(object item)
{
dbControllerGLS.rollBackEntity(item);
+1 -1
View File
@@ -2,7 +2,7 @@
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Version>1.1.2408.0619</Version>
<Version>1.1.2408.0717</Version>
<RootNamespace>LiMan.UI</RootNamespace>
<AssemblyName>LiMan.UI</AssemblyName>
</PropertyGroup>
-9
View File
@@ -7,12 +7,3 @@
@inject MessageService AppMService
<ListApplicazioni></ListApplicazioni>
@code {
protected override void OnInitialized()
{
AppMService.ShowSearch = false;
AppMService.PageName = "Elenco Applicazioni";
AppMService.PageIcon = "fas fa-store pr-1";
}
}
+12
View File
@@ -0,0 +1,12 @@
namespace LiMan.UI.Pages
{
public partial class Applicazioni
{
protected override void OnInitialized()
{
AppMService.ShowSearch = false;
AppMService.PageName = "Elenco Applicazioni";
AppMService.PageIcon = "fas fa-store pr-1";
}
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>License Manager</i>
<h4>Versione: 1.1.2408.0619</h4>
<h4>Versione: 1.1.2408.0717</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
1.1.2408.0619
1.1.2408.0717
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>1.1.2408.0619</version>
<version>1.1.2408.0717</version>
<url>https://nexus.steamware.net/repository/SWS/LiMan/stable/LAST/LiMan.UI.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/LiMan/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>
+1 -1
View File
@@ -22,7 +22,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Liman.CadCam", "Liman.CadCam\Liman.CadCam.csproj", "{06E8F9A8-9CBE-4207-A65A-A507E38319F6}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LiMan.DbSync", "LiMan.DbSync\LiMan.DbSync.csproj", "{AD302CBB-60F9-440E-A4C3-4D9C9DD7FA8E}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LiMan.DbSync", "LiMan.DbSync\LiMan.DbSync.csproj", "{AD302CBB-60F9-440E-A4C3-4D9C9DD7FA8E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution