PROG:
- Aggiunta preliminare gestione UserName - verifica gestione auth windows - update in prod
This commit is contained in:
@@ -114,8 +114,9 @@ namespace MP.FileData.Controllers
|
||||
/// <param name="searchPattern">pattern di ricerca (*.*)</param>
|
||||
/// <param name="forceTag">Forza il controllo dei Tags</param>
|
||||
/// <param name="currRule">Regole di ricerca applicate</param>
|
||||
/// <param name="UserName">Utente connesso x approvazione</param>
|
||||
/// <returns></returns>
|
||||
public int CheckFileArchived(string idxMacchina, string path, int numDayPre, string searchPattern, bool forceTag, SearchRules currRule)
|
||||
public int CheckFileArchived(string idxMacchina, string path, int numDayPre, string searchPattern, bool forceTag, SearchRules currRule, string UserName)
|
||||
{
|
||||
Log.Info($"CheckFileArchived S00 | macchina: {idxMacchina} | path: {path} | pattern: {searchPattern} | # ExcludedFileExt: {currRule.ExcludedFileExt.Count()}");
|
||||
int checkDone = 0;
|
||||
@@ -212,7 +213,7 @@ namespace MP.FileData.Controllers
|
||||
if (fileNew != null && fileNew.Count > 0)
|
||||
{
|
||||
checkDone += fileNew.Count;
|
||||
FileInsert(idxMacchina, path, fileNew, 0, currRule);
|
||||
FileInsert(idxMacchina, path, fileNew, UserName, 0, currRule);
|
||||
Log.Trace($"CheckFileArchived S03 | insert {fileNew.Count} files");
|
||||
}
|
||||
// aggiorno i file modificati
|
||||
@@ -388,10 +389,11 @@ namespace MP.FileData.Controllers
|
||||
/// <param name="idxMacchina">Macchina</param>
|
||||
/// <param name="basePath">Path base macchina</param>
|
||||
/// <param name="newFiles">Elenco files</param>
|
||||
/// <param name="UserName">Utente che ha approvato la modifica, "" = NON confermata/eliminabile</param>
|
||||
/// <param name="rev">rev da usare x creazione</param>
|
||||
/// <param name="currRule">Configuraizone ricerca</param>
|
||||
/// <returns></returns>
|
||||
public bool FileInsert(string idxMacchina, string basePath, List<FileInfo> newFiles, int rev, SearchRules currRule)
|
||||
public bool FileInsert(string idxMacchina, string basePath, List<FileInfo> newFiles, string UserName, int rev, SearchRules currRule)
|
||||
{
|
||||
// fare: lettura conf x macchina
|
||||
Log.Info($"FileInsert S01 per macchina {idxMacchina}: {newFiles.Count} files da valutare");
|
||||
@@ -410,6 +412,7 @@ namespace MP.FileData.Controllers
|
||||
IdxMacchina = idxMacchina,
|
||||
LastCheck = adesso,
|
||||
LastMod = o.LastWriteTime,
|
||||
UserAppr = UserName,
|
||||
MimeType = o.Extension,
|
||||
Name = o.Name,
|
||||
Path = o.FullName,
|
||||
@@ -493,7 +496,13 @@ namespace MP.FileData.Controllers
|
||||
return answ;
|
||||
}
|
||||
|
||||
public bool FileModApprove(FileModel currFile)
|
||||
/// <summary>
|
||||
/// Approvazione modifica File
|
||||
/// </summary>
|
||||
/// <param name="currFile"></param>
|
||||
/// <param name="UserName"></param>
|
||||
/// <returns></returns>
|
||||
public bool FileModApprove(FileModel currFile, string UserName)
|
||||
{
|
||||
bool done = false;
|
||||
// recupero file regole json da macchina..
|
||||
@@ -526,7 +535,7 @@ namespace MP.FileData.Controllers
|
||||
if (currRule.Name != "ND")
|
||||
{
|
||||
// inserisco come REVISIONE
|
||||
FileInsert(currFile.IdxMacchina, currMacchina.BasePath, listUpdate, currFile.Rev + 1, currRule);
|
||||
FileInsert(currFile.IdxMacchina, currMacchina.BasePath, listUpdate, UserName, currFile.Rev + 1, currRule);
|
||||
|
||||
// archivio vecchio file
|
||||
currFile.Active = false;
|
||||
|
||||
@@ -93,7 +93,16 @@ namespace MP.FileData
|
||||
{
|
||||
modelBuilder.HasAnnotation("Relational:Collation", "SQL_Latin1_General_CP1_CI_AS");
|
||||
|
||||
//
|
||||
// fix valori default
|
||||
modelBuilder.Entity<FileModel>(entity =>
|
||||
{
|
||||
entity.Property(e => e.UserAppr)
|
||||
.HasMaxLength(250)
|
||||
.IsRequired()
|
||||
.HasDefaultValueSql("('')");
|
||||
});
|
||||
|
||||
|
||||
modelBuilder.Seed();
|
||||
|
||||
OnModelCreatingPartial(modelBuilder);
|
||||
|
||||
+14
-10
@@ -1,10 +1,14 @@
|
||||
<Router AppAssembly="@typeof(Program).Assembly" PreferExactMatches="@true">
|
||||
<Found Context="routeData">
|
||||
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
|
||||
</Found>
|
||||
<NotFound>
|
||||
<LayoutView Layout="@typeof(MainLayout)">
|
||||
<p>Sorry, there's nothing at this address.</p>
|
||||
</LayoutView>
|
||||
</NotFound>
|
||||
</Router>
|
||||
<CascadingAuthenticationState>
|
||||
<Router AppAssembly="@typeof(Program).Assembly" PreferExactMatches="@true">
|
||||
<Found Context="routeData">
|
||||
<AuthorizeRouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
|
||||
<FocusOnNavigate RouteData="@routeData" Selector="h1" />
|
||||
@* <RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" /> *@
|
||||
</Found>
|
||||
<NotFound>
|
||||
<LayoutView Layout="@typeof(MainLayout)">
|
||||
<p>Sorry, there's nothing at this address.</p>
|
||||
</LayoutView>
|
||||
</NotFound>
|
||||
</Router>
|
||||
</CascadingAuthenticationState>
|
||||
@@ -47,7 +47,7 @@
|
||||
}
|
||||
</div>
|
||||
<div class="col-8">
|
||||
<LoadingData></LoadingData>
|
||||
<EgwCoreLib.Razor.LoadingData></EgwCoreLib.Razor.LoadingData>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
@@ -32,6 +32,9 @@ namespace MP.Prog.Components
|
||||
[Inject]
|
||||
protected FileArchDataService FDService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected MessageService MServ { get; set; }
|
||||
|
||||
protected int percLoading { get; set; } = 0;
|
||||
protected bool showProgress { get; set; } = false;
|
||||
|
||||
@@ -159,7 +162,7 @@ namespace MP.Prog.Components
|
||||
sw.Restart();
|
||||
// recupero elenco macchine
|
||||
percLoading += 100 / numMacchine;
|
||||
numChecks = await FDService.UpdateMachineArchive(idxMacchina, numDays, true, false);
|
||||
numChecks = await FDService.UpdateMachineArchive(idxMacchina, numDays, true, false, MServ.UserName);
|
||||
await Task.Delay(1);
|
||||
setupMessages.Add($"{idxMacchina}: {numChecks} files");
|
||||
await InvokeAsync(StateHasChanged);
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
|
||||
|
||||
<div class="d-flex justify-content-between pt-3">
|
||||
<div class="px-2">
|
||||
<i class="fas fa-user-alt"></i> <b>@UserName</b>
|
||||
</div>
|
||||
<div class="px-2 d-none d-lg-block text-center h4 text-truncate">
|
||||
<span class="@PageIcon" aria-hidden="true"></span> @PageName
|
||||
</div>
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
//using MP.Prog.Components;
|
||||
//using System.Security.Claims;
|
||||
|
||||
//using Microsoft.AspNetCore.Components.Authorization;
|
||||
using MP.Prog.Data;
|
||||
using System;
|
||||
using Microsoft.AspNetCore.Components.Authorization;
|
||||
|
||||
namespace MP.Prog.Components
|
||||
{
|
||||
@@ -14,15 +17,13 @@ namespace MP.Prog.Components
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
AppMessages.EA_PageUpdated -= OnPageUpdate;
|
||||
MServ.EA_PageUpdated -= OnPageUpdate;
|
||||
}
|
||||
|
||||
//[Inject]
|
||||
//protected AuthenticationStateProvider AuthenticationStateProvider { get; set; }
|
||||
public void OnPageUpdate()
|
||||
{
|
||||
PageName = AppMessages.PageName;
|
||||
PageIcon = AppMessages.PageIcon;
|
||||
PageName = MServ.PageName;
|
||||
PageIcon = MServ.PageIcon;
|
||||
InvokeAsync(() =>
|
||||
{
|
||||
StateHasChanged();
|
||||
@@ -34,30 +35,23 @@ namespace MP.Prog.Components
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected MessageService AppMessages { get; set; }
|
||||
protected AuthenticationStateProvider AuthenticationStateProvider { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected MessageService MServ { get; set; }
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
AppMessages.EA_PageUpdated += OnPageUpdate;
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
MServ.EA_PageUpdated += OnPageUpdate;
|
||||
await forceReload();
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private string userName = "";
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private string PageIcon { get; set; }
|
||||
@@ -67,14 +61,28 @@ namespace MP.Prog.Components
|
||||
[CascadingParameter(Name = "ShowSearch")]
|
||||
private bool ShowSearch { get; set; }
|
||||
|
||||
private string UserName
|
||||
{
|
||||
get => MServ.UserName;
|
||||
set => MServ.UserName = value;
|
||||
}
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private async Task forceReload()
|
||||
{
|
||||
userName = "N.A.";
|
||||
await Task.Delay(1);
|
||||
var authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
|
||||
var user = authState.User;
|
||||
if (user.Identity != null && user.Identity.IsAuthenticated)
|
||||
{
|
||||
UserName = $"{user.Identity.Name}";
|
||||
}
|
||||
else
|
||||
{
|
||||
UserName = "";
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
@@ -12,28 +12,12 @@ namespace MP.Prog.Components
|
||||
{
|
||||
public partial class FileEditor : ComponentBase
|
||||
{
|
||||
#region Protected Fields
|
||||
|
||||
protected int numDiff = 0;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Public Fields
|
||||
|
||||
public FileModel _currItem = new FileModel();
|
||||
|
||||
#endregion Public Fields
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected FileArchDataService DataService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; }
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
@@ -63,6 +47,56 @@ namespace MP.Prog.Components
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public string CurrFileContent(string fullPath)
|
||||
{
|
||||
string answ = "";
|
||||
if (File.Exists(fullPath))
|
||||
{
|
||||
answ = File.ReadAllText(fullPath);
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected int numDiff = 0;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected FileArchDataService FDService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected MessageService MServ { get; set; }
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected void diffDoneHandler(int numChanges)
|
||||
{
|
||||
#if false
|
||||
numDiff = numChanges;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
//private string userName = "";
|
||||
//protected override void OnInitialized()
|
||||
//{
|
||||
// userName = MServ.UserName;
|
||||
//}
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private async Task ApproveChange()
|
||||
@@ -72,7 +106,7 @@ namespace MP.Prog.Components
|
||||
|
||||
if (_currItem != null)
|
||||
{
|
||||
await DataService.FileApprove(_currItem);
|
||||
await FDService.FileApprove(_currItem, MServ.UserName);
|
||||
await DataUpdated.InvokeAsync(1);
|
||||
}
|
||||
else
|
||||
@@ -93,7 +127,7 @@ namespace MP.Prog.Components
|
||||
|
||||
if (_currItem != null)
|
||||
{
|
||||
await DataService.FileDelete(_currItem);
|
||||
await FDService.FileDelete(_currItem);
|
||||
await DataUpdated.InvokeAsync(1);
|
||||
}
|
||||
else
|
||||
@@ -114,9 +148,9 @@ namespace MP.Prog.Components
|
||||
if (_currItem != null)
|
||||
{
|
||||
await DataReset.InvokeAsync(0);
|
||||
await DataService.FileExport(_currItem);
|
||||
await FDService.FileExport(_currItem);
|
||||
await DataReset.InvokeAsync(0);
|
||||
await DataService.UpdateMachineArchive(_currItem.IdxMacchina, 1, false, false);
|
||||
await FDService.UpdateMachineArchive(_currItem.IdxMacchina, 1, false, false,MServ.UserName);
|
||||
await DataUpdated.InvokeAsync(1);
|
||||
}
|
||||
else
|
||||
@@ -132,7 +166,7 @@ namespace MP.Prog.Components
|
||||
|
||||
if (_currItem != null)
|
||||
{
|
||||
await DataService.FileReject(_currItem);
|
||||
await FDService.FileReject(_currItem);
|
||||
await DataUpdated.InvokeAsync(1);
|
||||
}
|
||||
else
|
||||
@@ -145,7 +179,7 @@ namespace MP.Prog.Components
|
||||
{
|
||||
if (_currItem != null)
|
||||
{
|
||||
await DataService.FileUpdate(_currItem);
|
||||
await FDService.FileUpdate(_currItem);
|
||||
await DataUpdated.InvokeAsync(1);
|
||||
}
|
||||
else
|
||||
@@ -155,30 +189,5 @@ namespace MP.Prog.Components
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected void diffDoneHandler(int numChanges)
|
||||
{
|
||||
#if false
|
||||
numDiff = numChanges;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public string CurrFileContent(string fullPath)
|
||||
{
|
||||
string answ = "";
|
||||
if (File.Exists(fullPath))
|
||||
{
|
||||
answ = File.ReadAllText(fullPath);
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
@*<h1 class="alert alert-info">Working</h1>*@
|
||||
<div class="row">
|
||||
<div class="col-12 text-center mt-5 py-5 alert alert-primary">
|
||||
<h3>loading data</h3>
|
||||
<i class="fas fa-spinner fa-spin fa-5x"></i>
|
||||
</div>
|
||||
</div>
|
||||
@@ -72,15 +72,6 @@ namespace MP.Prog.Data
|
||||
await ResetArchiveCache();
|
||||
return fatto;
|
||||
}
|
||||
/// <summary>
|
||||
/// Reset della cache dati ArchivioMacchine in redis
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private async Task ResetArchiveCache()
|
||||
{
|
||||
await ExecFlushRedisPattern($"{redisBaseAddr}:ArchMacc:*");
|
||||
await ExecFlushRedisPattern($"{redisBaseAddr}:ArchStatus:*");
|
||||
}
|
||||
|
||||
public async Task<List<ArchMaccModel>> ArchMaccGetAll()
|
||||
{
|
||||
@@ -267,17 +258,17 @@ namespace MP.Prog.Data
|
||||
/// <summary>
|
||||
/// Aggiorna intero archivio scansionando dati x tutte le macchine che hanno un path valido
|
||||
/// </summary>
|
||||
/// <param name="numDayPre">
|
||||
/// Numero giorni x ricerca all'indietro da data corrente / 0 = nessun limite
|
||||
/// </param>
|
||||
/// <param name="numDayPre">Numero giorni x ricerca all'indietro da data corrente / 0 = nessun limite</param>
|
||||
/// <param name="forceTag">Indica se forzare il tag</param>
|
||||
/// <param name="UserName">Utente attivo</param>
|
||||
/// <returns></returns>
|
||||
public async Task<int> UpdateAllArchive(int numDayPre, bool forceTag)
|
||||
public async Task<int> UpdateAllArchive(int numDayPre, bool forceTag, string UserName)
|
||||
{
|
||||
int checkDone = 0;
|
||||
var listaMacchine = await ArchMaccGetAll();
|
||||
foreach (var item in listaMacchine.Where(x => !string.IsNullOrEmpty(x.BasePath)).ToList())
|
||||
{
|
||||
checkDone += await UpdateMachineArchive(item.IdxMacchina, numDayPre, forceTag, false);
|
||||
checkDone += await UpdateMachineArchive(item.IdxMacchina, numDayPre, forceTag, false, UserName);
|
||||
}
|
||||
|
||||
return await Task.FromResult(checkDone);
|
||||
@@ -292,8 +283,9 @@ namespace MP.Prog.Data
|
||||
/// </param>
|
||||
/// <param name="forceTag">Forza la riverifica dei tags (x update da setup)</param>
|
||||
/// <param name="fullLog">Scrittura log verboso macchina</param>
|
||||
/// <param name="UserName">Utente attivo</param>
|
||||
/// <returns></returns>
|
||||
public async Task<int> UpdateMachineArchive(string idxMacchina, int numDayPre, bool forceTag, bool fullLog)
|
||||
public async Task<int> UpdateMachineArchive(string idxMacchina, int numDayPre, bool forceTag, bool fullLog, string UserName)
|
||||
{
|
||||
int checkDone = 0;
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
@@ -353,7 +345,7 @@ namespace MP.Prog.Data
|
||||
Log.Trace($"Conf rule generato:{Environment.NewLine}{rawRule}");
|
||||
}
|
||||
}
|
||||
checkDone = dbController.CheckFileArchived(macchina.IdxMacchina, macchina.BasePath, numDayPre, "*.*", forceTag, currRule);
|
||||
checkDone = dbController.CheckFileArchived(macchina.IdxMacchina, macchina.BasePath, numDayPre, "*.*", forceTag, currRule, UserName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -375,29 +367,55 @@ namespace MP.Prog.Data
|
||||
|
||||
#region Internal Methods
|
||||
|
||||
internal Task FileApprove(FileModel currItem)
|
||||
/// <summary>
|
||||
/// Approvazione modifica file
|
||||
/// </summary>
|
||||
/// <param name="currItem"></param>
|
||||
/// <param name="UserName"></param>
|
||||
/// <returns></returns>
|
||||
internal async Task<bool> FileApprove(FileModel currItem, string UserName)
|
||||
{
|
||||
return Task.FromResult(dbController.FileModApprove(currItem));
|
||||
bool answ = dbController.FileModApprove(currItem, UserName);
|
||||
// svuoto cache!
|
||||
await ResetArchiveCache();
|
||||
return answ;
|
||||
}
|
||||
|
||||
internal Task FileDelete(FileModel currItem)
|
||||
/// <summary>
|
||||
/// Eliminazione file (x rifiuto modifica)
|
||||
/// </summary>
|
||||
/// <param name="currItem"></param>
|
||||
/// <returns></returns>
|
||||
internal async Task<bool> FileDelete(FileModel currItem)
|
||||
{
|
||||
return Task.FromResult(dbController.FileDelete(currItem));
|
||||
bool answ = dbController.FileDelete(currItem);
|
||||
// svuoto cache!
|
||||
await ResetArchiveCache();
|
||||
return answ;
|
||||
}
|
||||
|
||||
internal Task FileExport(FileModel currItem)
|
||||
internal async Task<bool> FileExport(FileModel currItem)
|
||||
{
|
||||
return Task.FromResult(dbController.FileExport(currItem));
|
||||
bool answ = dbController.FileExport(currItem);
|
||||
// svuoto cache!
|
||||
await ResetArchiveCache();
|
||||
return answ;
|
||||
}
|
||||
|
||||
internal Task FileReject(FileModel currItem)
|
||||
internal async Task<bool> FileReject(FileModel currItem)
|
||||
{
|
||||
return Task.FromResult(dbController.FileModReject(currItem));
|
||||
bool answ = dbController.FileModReject(currItem);
|
||||
// svuoto cache!
|
||||
await ResetArchiveCache();
|
||||
return answ;
|
||||
}
|
||||
|
||||
internal Task FileUpdate(FileModel updItem)
|
||||
internal async Task<bool> FileUpdate(FileModel updItem)
|
||||
{
|
||||
return Task.FromResult(dbController.FileUpdate(updItem));
|
||||
bool answ = dbController.FileUpdate(updItem);
|
||||
// svuoto cache!
|
||||
await ResetArchiveCache();
|
||||
return answ;
|
||||
}
|
||||
|
||||
internal void ResetController()
|
||||
@@ -410,6 +428,7 @@ namespace MP.Prog.Data
|
||||
#region Protected Fields
|
||||
|
||||
protected static string connStringBBM = "";
|
||||
|
||||
protected static string connStringFatt = "";
|
||||
|
||||
#endregion Protected Fields
|
||||
@@ -422,9 +441,13 @@ namespace MP.Prog.Data
|
||||
private const string redisBaseAddr = "MP:PROG";
|
||||
|
||||
private static IConfiguration _configuration;
|
||||
|
||||
private static ILogger<FileArchDataService> _logger;
|
||||
|
||||
private static List<ArchMaccModel> ElencoMacchine = new List<ArchMaccModel>();
|
||||
|
||||
private static JsonSerializerSettings? JSSettings;
|
||||
|
||||
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
/// <summary>
|
||||
@@ -508,6 +531,16 @@ namespace MP.Prog.Data
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reset della cache dati ArchivioMacchine in redis
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private async Task ResetArchiveCache()
|
||||
{
|
||||
await ExecFlushRedisPattern($"{redisBaseAddr}:ArchMacc:*");
|
||||
await ExecFlushRedisPattern($"{redisBaseAddr}:ArchStatus:*");
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -8,16 +8,6 @@ namespace MP.Prog.Data
|
||||
{
|
||||
public class MessageService
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
private SelectData _fileFilter = SelectData.Init(5, 15);
|
||||
private string _pageIcon;
|
||||
private string _pageName;
|
||||
private string _searchVal = "";
|
||||
private bool showSearch;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Public Events
|
||||
|
||||
public event Action EA_FilterUpdated;
|
||||
@@ -30,6 +20,8 @@ namespace MP.Prog.Data
|
||||
|
||||
public event Action EA_ShowSearch;
|
||||
|
||||
public event Action EA_UserUpdated;
|
||||
|
||||
#endregion Public Events
|
||||
|
||||
#region Public Properties
|
||||
@@ -106,8 +98,32 @@ namespace MP.Prog.Data
|
||||
}
|
||||
}
|
||||
|
||||
public string UserName
|
||||
{
|
||||
get => _userName;
|
||||
set
|
||||
{
|
||||
if (_userName != value)
|
||||
{
|
||||
_userName = value;
|
||||
ReportUserUpd();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private SelectData _fileFilter = SelectData.Init(5, 15);
|
||||
private string _pageIcon;
|
||||
private string _pageName;
|
||||
private string _searchVal = "";
|
||||
private string _userName = "";
|
||||
private bool showSearch;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private void ReportFilter()
|
||||
@@ -150,6 +166,14 @@ namespace MP.Prog.Data
|
||||
}
|
||||
}
|
||||
|
||||
private void ReportUserUpd()
|
||||
{
|
||||
if (EA_UserUpdated != null)
|
||||
{
|
||||
EA_UserUpdated?.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<RootNamespace>MP.Prog</RootNamespace>
|
||||
<Version>6.16.2410.2210</Version>
|
||||
<Version>6.16.2410.2211</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -20,6 +20,8 @@
|
||||
<PackageReference Include="EgwCoreLib.Razor" Version="1.5.2409.2607" />
|
||||
<PackageReference Include="EgwCoreLib.Utils" Version="1.5.2402.2411" />
|
||||
<PackageReference Include="Majorsoft.Blazor.Components.Debounce" Version="1.5.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.Negotiate" Version="6.0.35" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authorization" Version="6.0.35" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="6.0.17" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="NLog" Version="5.3.3" />
|
||||
|
||||
+17
-10
@@ -95,7 +95,7 @@
|
||||
}
|
||||
@if (ListRecords == null)
|
||||
{
|
||||
<LoadingData></LoadingData>
|
||||
<EgwCoreLib.Razor.LoadingData></EgwCoreLib.Razor.LoadingData>
|
||||
}
|
||||
else if (totalCount == 0)
|
||||
{
|
||||
@@ -110,9 +110,7 @@
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>File</th>
|
||||
<th>Rev</th>
|
||||
<th>Size</th>
|
||||
<th class="text-center">State</th>
|
||||
<th>Rev / State / Size</th>
|
||||
<th>Macchina</th>
|
||||
<th>Tags</th>
|
||||
<th class="text-end">Modificato</th>
|
||||
@@ -147,17 +145,26 @@
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div>@record.Rev</div>
|
||||
</td>
|
||||
<td>
|
||||
@CalcSize(record.Size)
|
||||
</td>
|
||||
<td class="text-center">
|
||||
<div class="d-flex justify-content-xl-between">
|
||||
<div class="px-0">
|
||||
@record.Rev
|
||||
</div>
|
||||
<div class="px-0">
|
||||
<span title="@record.DiskStatus | Ultimo controllo: @record.LastCheck.ToString("yyyy.MM.dd HH:mm:ss")">
|
||||
<span class="@(cssStatusByCod(record.DiskStatus))">
|
||||
@record.DiskStatus
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
<div class="px-0">
|
||||
@CalcSize(record.Size)
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="d-flex justify-content-xl-between small">
|
||||
<div class="px-0"><i class="fas fa-user-alt"></i></div>
|
||||
<div class="px-0">@record.UserAppr</div>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div>@record.Macchina.Nome</div>
|
||||
|
||||
+432
-436
@@ -8,247 +8,71 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
namespace MP.Prog.Pages
|
||||
{
|
||||
public partial class Archive : ComponentBase, IDisposable
|
||||
{
|
||||
#region Private Fields
|
||||
#region Public Properties
|
||||
|
||||
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
private FileModel currRecord = null;
|
||||
private List<FileModel> ListRecords;
|
||||
private List<ArchMaccModel> MacList;
|
||||
private List<TagModel> TagList;
|
||||
public bool DeleteDialogOpen { get; set; }
|
||||
|
||||
#endregion Private Fields
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public string checkSelect(int FileId)
|
||||
{
|
||||
string answ = "";
|
||||
if (currRecord != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
answ = (currRecord.FileId == FileId) ? "table-info" : "";
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
MServ.EA_SearchUpdated -= OnSeachUpdated;
|
||||
MServ.EA_FilterUpdated -= OnFilterUpdated;
|
||||
}
|
||||
|
||||
public async void OnFilterUpdated()
|
||||
{
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
public void OnSeachUpdated()
|
||||
{
|
||||
SearchVal = MServ.SearchVal;
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected string _SearchTag;
|
||||
|
||||
protected string defTag = "";
|
||||
|
||||
protected int totalCount = 0;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private int currPage
|
||||
{
|
||||
get
|
||||
{
|
||||
return AppMService.File_Filter.PageNum;
|
||||
}
|
||||
set
|
||||
{
|
||||
AppMService.File_Filter.PageNum = value;
|
||||
}
|
||||
}
|
||||
|
||||
private bool isLoading { get; set; } = false;
|
||||
|
||||
private int numRecord
|
||||
{
|
||||
get
|
||||
{
|
||||
return AppMService.File_Filter.PageSize;
|
||||
}
|
||||
set
|
||||
{
|
||||
AppMService.File_Filter.PageSize = value;
|
||||
}
|
||||
}
|
||||
|
||||
private bool OnlyActive
|
||||
{
|
||||
get
|
||||
{
|
||||
bool answ = false;
|
||||
if (AppMService.File_Filter != null)
|
||||
{
|
||||
answ = AppMService.File_Filter.OnlyActive;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!AppMService.File_Filter.OnlyActive.Equals(value))
|
||||
{
|
||||
AppMService.File_Filter.OnlyActive = value;
|
||||
var pUpd = Task.Run(async () =>
|
||||
{
|
||||
await AsyncReload();
|
||||
});
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool OnlyMod
|
||||
{
|
||||
get
|
||||
{
|
||||
bool answ = false;
|
||||
if (AppMService.File_Filter != null)
|
||||
{
|
||||
answ = AppMService.File_Filter.OnlyMod;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!AppMService.File_Filter.OnlyMod.Equals(value))
|
||||
{
|
||||
AppMService.File_Filter.OnlyMod = value;
|
||||
var pUpd = Task.Run(async () =>
|
||||
{
|
||||
await AsyncReload();
|
||||
});
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool OnlyNoTag
|
||||
{
|
||||
get
|
||||
{
|
||||
bool answ = false;
|
||||
if (AppMService.File_Filter != null)
|
||||
{
|
||||
answ = AppMService.File_Filter.OnlyNoTag;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!AppMService.File_Filter.OnlyNoTag.Equals(value))
|
||||
{
|
||||
AppMService.File_Filter.OnlyNoTag = value;
|
||||
var pUpd = Task.Run(async () =>
|
||||
{
|
||||
await AsyncReload();
|
||||
});
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private string SearchVal
|
||||
{
|
||||
get
|
||||
{
|
||||
string answ = "";
|
||||
if (AppMService.File_Filter != null)
|
||||
{
|
||||
answ = AppMService.File_Filter.SearchVal;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!AppMService.File_Filter.SearchVal.Equals(value))
|
||||
{
|
||||
AppMService.File_Filter.SearchVal = value;
|
||||
var pUpd = Task.Run(async () =>
|
||||
{
|
||||
await AsyncReload();
|
||||
});
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private string SelFileName
|
||||
{
|
||||
get
|
||||
{
|
||||
string answ = "";
|
||||
if (AppMService.File_Filter != null)
|
||||
{
|
||||
answ = AppMService.File_Filter.FileName;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!AppMService.File_Filter.FileName.Equals(value))
|
||||
{
|
||||
AppMService.File_Filter.FileName = value;
|
||||
var pUpd = Task.Run(async () =>
|
||||
{
|
||||
await AsyncReload();
|
||||
});
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private string SelIdxMacc
|
||||
{
|
||||
get
|
||||
{
|
||||
string answ = "";
|
||||
if (AppMService.File_Filter != null)
|
||||
{
|
||||
answ = AppMService.File_Filter.IdxMacchina;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!AppMService.File_Filter.IdxMacchina.Equals(value))
|
||||
{
|
||||
AppMService.File_Filter.IdxMacchina = value;
|
||||
var pUpd = Task.Run(async () =>
|
||||
{
|
||||
await AsyncReload();
|
||||
});
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private string SelTag
|
||||
{
|
||||
get
|
||||
{
|
||||
string answ = "";
|
||||
if (AppMService.File_Filter != null)
|
||||
{
|
||||
answ = AppMService.File_Filter.Tag;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!AppMService.File_Filter.Tag.Equals(value))
|
||||
{
|
||||
AppMService.File_Filter.Tag = value;
|
||||
var pUpd = Task.Run(async () =>
|
||||
{
|
||||
await AsyncReload();
|
||||
});
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected MessageService AppMService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected FileArchDataService DataService { get; set; }
|
||||
protected FileArchDataService FDService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected IJSRuntime JSRuntime { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected MessageService MServ { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected NavigationManager NavManager { get; set; }
|
||||
|
||||
@@ -270,7 +94,7 @@ namespace MP.Prog.Pages
|
||||
{
|
||||
var pUpd = Task.Run(async () =>
|
||||
{
|
||||
TagList = await DataService.TagGetFilt(SearchTag);
|
||||
TagList = await FDService.TagGetFilt(SearchTag);
|
||||
});
|
||||
pUpd.Wait();
|
||||
}
|
||||
@@ -280,11 +104,396 @@ namespace MP.Prog.Pages
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Public Properties
|
||||
#region Protected Methods
|
||||
|
||||
public bool DeleteDialogOpen { get; set; }
|
||||
protected async Task AsyncReload()
|
||||
{
|
||||
isLoading = true;
|
||||
currRecord = null;
|
||||
ListRecords = null;
|
||||
await ReloadData();
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
#endregion Public Properties
|
||||
/// <summary>
|
||||
/// Restituisce size calcolata
|
||||
/// </summary>
|
||||
/// <param name="origSize"></param>
|
||||
/// <returns></returns>
|
||||
protected string CalcSize(long origSize)
|
||||
{
|
||||
return MeasureUtils.SizeSuffix(origSize, 1);
|
||||
}
|
||||
|
||||
protected async Task Edit(FileModel selRecord)
|
||||
{
|
||||
if (!selRecord.Active)
|
||||
{
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Sicuro di voler confrontare una revisione vecchia/inattiva del programma??"))
|
||||
return;
|
||||
}
|
||||
|
||||
// rileggo dal DB il record corrente...
|
||||
currRecord = await FDService.FileGetByKey(selRecord.FileId);
|
||||
}
|
||||
|
||||
protected async Task FilterPath(string searchVal)
|
||||
{
|
||||
SelFileName = searchVal;
|
||||
OnlyActive = false;
|
||||
currPage = 1;
|
||||
await ReloadAllData();
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
protected async Task FilterTag(string searchVal)
|
||||
{
|
||||
SelTag = searchVal;
|
||||
currPage = 1;
|
||||
await ReloadData();
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
protected async Task ForceCheck(int numDays)
|
||||
{
|
||||
currRecord = null;
|
||||
ListRecords = null;
|
||||
// importante altrimenti NON mostra update UI
|
||||
await Task.Delay(1);
|
||||
//MServ.File_Filter = SelectData.Init(5, 10);
|
||||
var numCheck = await FDService.UpdateAllArchive(numDays, false, MServ.UserName);
|
||||
await ReloadAllData();
|
||||
await Task.Delay(1);
|
||||
await RefreshDisplayLoading();
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
SearchTag = defTag;
|
||||
MServ.ShowSearch = true;
|
||||
MServ.PageName = "Archivio File Programmi";
|
||||
MServ.PageIcon = "fas fa-folder pr-2";
|
||||
MServ.EA_SearchUpdated += OnSeachUpdated;
|
||||
MServ.EA_FilterUpdated += OnFilterUpdated;
|
||||
await ReloadAllData();
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
protected async Task PagerReloadNum(int newNum)
|
||||
{
|
||||
numRecord = newNum;
|
||||
await ReloadData();
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
protected async Task PagerReloadPage(int newNum)
|
||||
{
|
||||
currPage = newNum;
|
||||
await ReloadData();
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
protected async Task RefreshDisplayLoading()
|
||||
{
|
||||
await Task.Delay(1);
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
protected async Task ReloadAllData()
|
||||
{
|
||||
isLoading = true;
|
||||
MacList = await FDService.ArchMaccGetAll();
|
||||
SelIdxMacc = "0";
|
||||
SearchTag = defTag;
|
||||
TagList = await FDService.TagGetFilt(SearchTag);
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected async Task ReloadData()
|
||||
{
|
||||
isLoading = true;
|
||||
// importante altrimenti NON mostra update UI
|
||||
await Task.Delay(1);
|
||||
totalCount = await FDService.FileCountFilt(MServ.File_Filter);
|
||||
//SearchRecords = await FDService.FileGetFilt(MServ.File_Filter);
|
||||
//// faccio paginazione SOLO NELLA DECINA attuale... (quindi non tutte le pagine ma solo subset)
|
||||
//ListRecords = SearchRecords.Skip(numRecord * (currPage % 10 - 1)).Take(numRecord).ToList();
|
||||
|
||||
ListRecords = await FDService.FileGetFilt(MServ.File_Filter);
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
protected void ResetData()
|
||||
{
|
||||
FDService.rollBackEdit(currRecord);
|
||||
currRecord = null;
|
||||
}
|
||||
|
||||
protected async Task ResetFilter()
|
||||
{
|
||||
currRecord = null;
|
||||
ListRecords = null;
|
||||
currPage = 1;
|
||||
MServ.File_Filter = SelectData.Init(5, 10);
|
||||
MServ.SearchVal = "";
|
||||
SearchTag = defTag;
|
||||
await ReloadAllData();
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
protected void ResetSearchTag()
|
||||
{
|
||||
SearchTag = defTag;
|
||||
}
|
||||
|
||||
protected void ResetTag()
|
||||
{
|
||||
SelTag = "";
|
||||
currPage = 1;
|
||||
}
|
||||
|
||||
protected void Select(FileModel selRecord)
|
||||
{
|
||||
// applico filtro da selezione
|
||||
currRecord = selRecord;
|
||||
}
|
||||
|
||||
protected string TextReduce(string textOriginal, int maxChar)
|
||||
{
|
||||
string answ = textOriginal;
|
||||
if (answ.Length > maxChar)
|
||||
{
|
||||
answ = $"...{textOriginal.Substring(answ.Length - maxChar)}";
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
protected async Task UpdateData()
|
||||
{
|
||||
currRecord = null;
|
||||
ListRecords = null;
|
||||
FDService.ResetController();
|
||||
await ReloadData();
|
||||
await Task.Delay(1);
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
private FileModel currRecord = null;
|
||||
private List<FileModel> ListRecords;
|
||||
private List<ArchMaccModel> MacList;
|
||||
private List<TagModel> TagList;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private int currPage
|
||||
{
|
||||
get
|
||||
{
|
||||
return MServ.File_Filter.PageNum;
|
||||
}
|
||||
set
|
||||
{
|
||||
MServ.File_Filter.PageNum = value;
|
||||
}
|
||||
}
|
||||
|
||||
private bool isLoading { get; set; } = false;
|
||||
|
||||
private int numRecord
|
||||
{
|
||||
get
|
||||
{
|
||||
return MServ.File_Filter.PageSize;
|
||||
}
|
||||
set
|
||||
{
|
||||
MServ.File_Filter.PageSize = value;
|
||||
}
|
||||
}
|
||||
|
||||
private bool OnlyActive
|
||||
{
|
||||
get
|
||||
{
|
||||
bool answ = false;
|
||||
if (MServ.File_Filter != null)
|
||||
{
|
||||
answ = MServ.File_Filter.OnlyActive;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!MServ.File_Filter.OnlyActive.Equals(value))
|
||||
{
|
||||
MServ.File_Filter.OnlyActive = value;
|
||||
var pUpd = Task.Run(async () =>
|
||||
{
|
||||
await AsyncReload();
|
||||
});
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool OnlyMod
|
||||
{
|
||||
get
|
||||
{
|
||||
bool answ = false;
|
||||
if (MServ.File_Filter != null)
|
||||
{
|
||||
answ = MServ.File_Filter.OnlyMod;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!MServ.File_Filter.OnlyMod.Equals(value))
|
||||
{
|
||||
MServ.File_Filter.OnlyMod = value;
|
||||
var pUpd = Task.Run(async () =>
|
||||
{
|
||||
await AsyncReload();
|
||||
});
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool OnlyNoTag
|
||||
{
|
||||
get
|
||||
{
|
||||
bool answ = false;
|
||||
if (MServ.File_Filter != null)
|
||||
{
|
||||
answ = MServ.File_Filter.OnlyNoTag;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!MServ.File_Filter.OnlyNoTag.Equals(value))
|
||||
{
|
||||
MServ.File_Filter.OnlyNoTag = value;
|
||||
var pUpd = Task.Run(async () =>
|
||||
{
|
||||
await AsyncReload();
|
||||
});
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private string SearchVal
|
||||
{
|
||||
get
|
||||
{
|
||||
string answ = "";
|
||||
if (MServ.File_Filter != null)
|
||||
{
|
||||
answ = MServ.File_Filter.SearchVal;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!MServ.File_Filter.SearchVal.Equals(value))
|
||||
{
|
||||
MServ.File_Filter.SearchVal = value;
|
||||
var pUpd = Task.Run(async () =>
|
||||
{
|
||||
await AsyncReload();
|
||||
});
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private string SelFileName
|
||||
{
|
||||
get
|
||||
{
|
||||
string answ = "";
|
||||
if (MServ.File_Filter != null)
|
||||
{
|
||||
answ = MServ.File_Filter.FileName;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!MServ.File_Filter.FileName.Equals(value))
|
||||
{
|
||||
MServ.File_Filter.FileName = value;
|
||||
var pUpd = Task.Run(async () =>
|
||||
{
|
||||
await AsyncReload();
|
||||
});
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private string SelIdxMacc
|
||||
{
|
||||
get
|
||||
{
|
||||
string answ = "";
|
||||
if (MServ.File_Filter != null)
|
||||
{
|
||||
answ = MServ.File_Filter.IdxMacchina;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!MServ.File_Filter.IdxMacchina.Equals(value))
|
||||
{
|
||||
MServ.File_Filter.IdxMacchina = value;
|
||||
var pUpd = Task.Run(async () =>
|
||||
{
|
||||
await AsyncReload();
|
||||
});
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private string SelTag
|
||||
{
|
||||
get
|
||||
{
|
||||
string answ = "";
|
||||
if (MServ.File_Filter != null)
|
||||
{
|
||||
answ = MServ.File_Filter.Tag;
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!MServ.File_Filter.Tag.Equals(value))
|
||||
{
|
||||
MServ.File_Filter.Tag = value;
|
||||
var pUpd = Task.Run(async () =>
|
||||
{
|
||||
await AsyncReload();
|
||||
});
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
@@ -334,218 +543,5 @@ namespace MP.Prog.Pages
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected async Task AsyncReload()
|
||||
{
|
||||
isLoading = true;
|
||||
currRecord = null;
|
||||
ListRecords = null;
|
||||
await ReloadData();
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
protected async Task Edit(FileModel selRecord)
|
||||
{
|
||||
if (!selRecord.Active)
|
||||
{
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Sicuro di voler confrontare una revisione vecchia/inattiva del programma??"))
|
||||
return;
|
||||
}
|
||||
|
||||
// rileggo dal DB il record corrente...
|
||||
currRecord = await DataService.FileGetByKey(selRecord.FileId);
|
||||
}
|
||||
|
||||
protected async Task FilterPath(string searchVal)
|
||||
{
|
||||
SelFileName = searchVal;
|
||||
OnlyActive = false;
|
||||
currPage = 1;
|
||||
await ReloadAllData();
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restituisce size calcolata
|
||||
/// </summary>
|
||||
/// <param name="origSize"></param>
|
||||
/// <returns></returns>
|
||||
protected string CalcSize(long origSize)
|
||||
{
|
||||
return MeasureUtils.SizeSuffix(origSize, 1);
|
||||
}
|
||||
|
||||
protected async Task FilterTag(string searchVal)
|
||||
{
|
||||
SelTag = searchVal;
|
||||
currPage = 1;
|
||||
await ReloadData();
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
protected async Task ForceCheck(int numDays)
|
||||
{
|
||||
currRecord = null;
|
||||
ListRecords = null;
|
||||
// importante altrimenti NON mostra update UI
|
||||
await Task.Delay(1);
|
||||
//AppMService.File_Filter = SelectData.Init(5, 10);
|
||||
var numCheck = await DataService.UpdateAllArchive(numDays, false);
|
||||
await ReloadAllData();
|
||||
await Task.Delay(1);
|
||||
await RefreshDisplayLoading();
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
SearchTag = defTag;
|
||||
AppMService.ShowSearch = true;
|
||||
AppMService.PageName = "Archivio File Programmi";
|
||||
AppMService.PageIcon = "fas fa-folder pr-2";
|
||||
AppMService.EA_SearchUpdated += OnSeachUpdated;
|
||||
AppMService.EA_FilterUpdated += OnFilterUpdated;
|
||||
await ReloadAllData();
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
protected async Task PagerReloadNum(int newNum)
|
||||
{
|
||||
numRecord = newNum;
|
||||
await ReloadData();
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
protected async Task PagerReloadPage(int newNum)
|
||||
{
|
||||
currPage = newNum;
|
||||
await ReloadData();
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
protected async Task RefreshDisplayLoading()
|
||||
{
|
||||
await Task.Delay(1);
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
protected async Task ReloadAllData()
|
||||
{
|
||||
isLoading = true;
|
||||
MacList = await DataService.ArchMaccGetAll();
|
||||
SelIdxMacc = "0";
|
||||
SearchTag = defTag;
|
||||
TagList = await DataService.TagGetFilt(SearchTag);
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected async Task ReloadData()
|
||||
{
|
||||
isLoading = true;
|
||||
// importante altrimenti NON mostra update UI
|
||||
await Task.Delay(1);
|
||||
totalCount = await DataService.FileCountFilt(AppMService.File_Filter);
|
||||
//SearchRecords = await FDService.FileGetFilt(AppMService.File_Filter);
|
||||
//// faccio paginazione SOLO NELLA DECINA attuale... (quindi non tutte le pagine ma solo subset)
|
||||
//ListRecords = SearchRecords.Skip(numRecord * (currPage % 10 - 1)).Take(numRecord).ToList();
|
||||
|
||||
ListRecords = await DataService.FileGetFilt(AppMService.File_Filter);
|
||||
await Task.Delay(1);
|
||||
}
|
||||
|
||||
protected void ResetData()
|
||||
{
|
||||
DataService.rollBackEdit(currRecord);
|
||||
currRecord = null;
|
||||
}
|
||||
|
||||
protected async Task ResetFilter()
|
||||
{
|
||||
currRecord = null;
|
||||
ListRecords = null;
|
||||
currPage = 1;
|
||||
AppMService.File_Filter = SelectData.Init(5, 10);
|
||||
AppMService.SearchVal = "";
|
||||
SearchTag = defTag;
|
||||
await ReloadAllData();
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
protected void ResetSearchTag()
|
||||
{
|
||||
SearchTag = defTag;
|
||||
}
|
||||
|
||||
protected void ResetTag()
|
||||
{
|
||||
SelTag = "";
|
||||
currPage = 1;
|
||||
}
|
||||
|
||||
protected void Select(FileModel selRecord)
|
||||
{
|
||||
// applico filtro da selezione
|
||||
currRecord = selRecord;
|
||||
}
|
||||
|
||||
protected string TextReduce(string textOriginal, int maxChar)
|
||||
{
|
||||
string answ = textOriginal;
|
||||
if (answ.Length > maxChar)
|
||||
{
|
||||
answ = $"...{textOriginal.Substring(answ.Length - maxChar)}";
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
protected async Task UpdateData()
|
||||
{
|
||||
currRecord = null;
|
||||
ListRecords = null;
|
||||
DataService.ResetController();
|
||||
await ReloadData();
|
||||
await Task.Delay(1);
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public string checkSelect(int FileId)
|
||||
{
|
||||
string answ = "";
|
||||
if (currRecord != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
answ = (currRecord.FileId == FileId) ? "table-info" : "";
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
AppMService.EA_SearchUpdated -= OnSeachUpdated;
|
||||
AppMService.EA_FilterUpdated -= OnFilterUpdated;
|
||||
}
|
||||
|
||||
public async void OnFilterUpdated()
|
||||
{
|
||||
await ReloadData();
|
||||
//StateHasChanged();
|
||||
}
|
||||
|
||||
public void OnSeachUpdated()
|
||||
{
|
||||
SearchVal = AppMService.SearchVal;
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"windowsAuthentication": true,
|
||||
"anonymousAuthentication": false,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:7312",
|
||||
"sslPort": 44309
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo gestione Programmi MAPO</i>
|
||||
<h4>Versione: 6.16.2410.2210</h4>
|
||||
<h4>Versione: 6.16.2410.2211</h4>
|
||||
<br />
|
||||
Note di rilascio:
|
||||
<ul>
|
||||
|
||||
@@ -1 +1 @@
|
||||
6.16.2410.2210
|
||||
6.16.2410.2211
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>6.16.2410.2210</version>
|
||||
<version>6.16.2410.2211</version>
|
||||
<url>https://nexus.steamware.net/repository/SWS/MP-PROG/stable/LAST/MP.Prog.zip</url>
|
||||
<changelog>https://nexus.steamware.net/repository/SWS/MP-PROG/stable/LAST/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
+14
-2
@@ -1,3 +1,4 @@
|
||||
using Microsoft.AspNetCore.Authentication.Negotiate;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
@@ -8,6 +9,7 @@ using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using MP.Prog.Data;
|
||||
using NLog;
|
||||
using StackExchange.Redis;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -84,8 +86,8 @@ namespace MP.Prog
|
||||
|
||||
app.UseRouting();
|
||||
|
||||
//app.UseAuthentication();
|
||||
//app.UseAuthorization();
|
||||
app.UseAuthentication();
|
||||
app.UseAuthorization();
|
||||
|
||||
app.UseEndpoints(endpoints =>
|
||||
{
|
||||
@@ -105,6 +107,16 @@ namespace MP.Prog
|
||||
// For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
// Aggiunta auth windows
|
||||
services.AddAuthentication(NegotiateDefaults.AuthenticationScheme)
|
||||
.AddNegotiate();
|
||||
|
||||
services.AddAuthorization(options =>
|
||||
{
|
||||
// By default, all incoming requests will be authorized according to the default policy.
|
||||
options.FallbackPolicy = options.DefaultPolicy;
|
||||
});
|
||||
|
||||
|
||||
// cookie applicazione da 14 gg (defaul) a 30
|
||||
services.ConfigureApplicationCookie(o =>
|
||||
|
||||
Reference in New Issue
Block a user