+
+ @UserName
+
@PageName
diff --git a/MP.Prog/Components/CmpTop.razor.cs b/MP.Prog/Components/CmpTop.razor.cs
index 454a0a5b..cff8ad1d 100644
--- a/MP.Prog/Components/CmpTop.razor.cs
+++ b/MP.Prog/Components/CmpTop.razor.cs
@@ -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
diff --git a/MP.Prog/Components/FileEditor.razor.cs b/MP.Prog/Components/FileEditor.razor.cs
index 5abe2ba4..20f5e634 100644
--- a/MP.Prog/Components/FileEditor.razor.cs
+++ b/MP.Prog/Components/FileEditor.razor.cs
@@ -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
}
}
\ No newline at end of file
diff --git a/MP.Prog/Components/LoadingData.razor b/MP.Prog/Components/LoadingData.razor
deleted file mode 100644
index 2aa17997..00000000
--- a/MP.Prog/Components/LoadingData.razor
+++ /dev/null
@@ -1,7 +0,0 @@
-@*
Working
*@
-
\ No newline at end of file
diff --git a/MP.Prog/Data/FileArchDataService.cs b/MP.Prog/Data/FileArchDataService.cs
index 48e00d90..e5a352af 100644
--- a/MP.Prog/Data/FileArchDataService.cs
+++ b/MP.Prog/Data/FileArchDataService.cs
@@ -72,15 +72,6 @@ namespace MP.Prog.Data
await ResetArchiveCache();
return fatto;
}
- ///
- /// Reset della cache dati ArchivioMacchine in redis
- ///
- ///
- private async Task ResetArchiveCache()
- {
- await ExecFlushRedisPattern($"{redisBaseAddr}:ArchMacc:*");
- await ExecFlushRedisPattern($"{redisBaseAddr}:ArchStatus:*");
- }
public async Task
> ArchMaccGetAll()
{
@@ -267,17 +258,17 @@ namespace MP.Prog.Data
///
/// Aggiorna intero archivio scansionando dati x tutte le macchine che hanno un path valido
///
- ///
- /// Numero giorni x ricerca all'indietro da data corrente / 0 = nessun limite
- ///
+ /// Numero giorni x ricerca all'indietro da data corrente / 0 = nessun limite
+ /// Indica se forzare il tag
+ /// Utente attivo
///
- public async Task UpdateAllArchive(int numDayPre, bool forceTag)
+ public async Task 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
///
/// Forza la riverifica dei tags (x update da setup)
/// Scrittura log verboso macchina
+ /// Utente attivo
///
- public async Task UpdateMachineArchive(string idxMacchina, int numDayPre, bool forceTag, bool fullLog)
+ public async Task 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)
+ ///
+ /// Approvazione modifica file
+ ///
+ ///
+ ///
+ ///
+ internal async Task 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)
+ ///
+ /// Eliminazione file (x rifiuto modifica)
+ ///
+ ///
+ ///
+ internal async Task 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 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 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 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 _logger;
+
private static List ElencoMacchine = new List();
+
private static JsonSerializerSettings? JSSettings;
+
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
///
@@ -508,6 +531,16 @@ namespace MP.Prog.Data
return answ;
}
+ ///
+ /// Reset della cache dati ArchivioMacchine in redis
+ ///
+ ///
+ private async Task ResetArchiveCache()
+ {
+ await ExecFlushRedisPattern($"{redisBaseAddr}:ArchMacc:*");
+ await ExecFlushRedisPattern($"{redisBaseAddr}:ArchStatus:*");
+ }
+
#endregion Private Methods
}
}
\ No newline at end of file
diff --git a/MP.Prog/Data/MessageService.cs b/MP.Prog/Data/MessageService.cs
index bd9fc0cc..cea111cc 100644
--- a/MP.Prog/Data/MessageService.cs
+++ b/MP.Prog/Data/MessageService.cs
@@ -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
}
}
\ No newline at end of file
diff --git a/MP.Prog/MP.Prog.csproj b/MP.Prog/MP.Prog.csproj
index 1bde64d9..5c77f33a 100644
--- a/MP.Prog/MP.Prog.csproj
+++ b/MP.Prog/MP.Prog.csproj
@@ -3,7 +3,7 @@
net6.0
MP.Prog
- 6.16.2410.2210
+ 6.16.2410.2211
@@ -20,6 +20,8 @@
+
+
diff --git a/MP.Prog/Pages/Archive.razor b/MP.Prog/Pages/Archive.razor
index a38313e0..2039d0c7 100644
--- a/MP.Prog/Pages/Archive.razor
+++ b/MP.Prog/Pages/Archive.razor
@@ -95,7 +95,7 @@
}
@if (ListRecords == null)
{
-
+
}
else if (totalCount == 0)
{
@@ -110,9 +110,7 @@
|
File |
- Rev |
- Size |
- State |
+ Rev / State / Size |
Macchina |
Tags |
Modificato |
@@ -147,17 +145,26 @@
- @record.Rev
- |
-
- @CalcSize(record.Size)
- |
-
+
+
+ @record.Rev
+
+
@record.DiskStatus
+
+
+ @CalcSize(record.Size)
+
+
+
+
|
@record.Macchina.Nome
diff --git a/MP.Prog/Pages/Archive.razor.cs b/MP.Prog/Pages/Archive.razor.cs
index affad72a..e79a7898 100644
--- a/MP.Prog/Pages/Archive.razor.cs
+++ b/MP.Prog/Pages/Archive.razor.cs
@@ -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 ListRecords;
- private List MacList;
- private List 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
+ ///
+ /// Restituisce size calcolata
+ ///
+ ///
+ ///
+ protected string CalcSize(long origSize)
+ {
+ return MeasureUtils.SizeSuffix(origSize, 1);
+ }
+
+ protected async Task Edit(FileModel selRecord)
+ {
+ if (!selRecord.Active)
+ {
+ if (!await JSRuntime.InvokeAsync("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 ListRecords;
+ private List MacList;
+ private List 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("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;
- }
-
- ///
- /// Restituisce size calcolata
- ///
- ///
- ///
- 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
}
}
\ No newline at end of file
diff --git a/MP.Prog/Properties/launchSettings.json b/MP.Prog/Properties/launchSettings.json
index 9f3861d2..00384491 100644
--- a/MP.Prog/Properties/launchSettings.json
+++ b/MP.Prog/Properties/launchSettings.json
@@ -1,7 +1,7 @@
{
"iisSettings": {
- "windowsAuthentication": false,
- "anonymousAuthentication": true,
+ "windowsAuthentication": true,
+ "anonymousAuthentication": false,
"iisExpress": {
"applicationUrl": "http://localhost:7312",
"sslPort": 44309
diff --git a/MP.Prog/Resources/ChangeLog.html b/MP.Prog/Resources/ChangeLog.html
index bbb1bb4e..b2c82f16 100644
--- a/MP.Prog/Resources/ChangeLog.html
+++ b/MP.Prog/Resources/ChangeLog.html
@@ -1,6 +1,6 @@
Modulo gestione Programmi MAPO
- Versione: 6.16.2410.2210
+ Versione: 6.16.2410.2211
Note di rilascio:
diff --git a/MP.Prog/Resources/VersNum.txt b/MP.Prog/Resources/VersNum.txt
index ce5039c4..608c2973 100644
--- a/MP.Prog/Resources/VersNum.txt
+++ b/MP.Prog/Resources/VersNum.txt
@@ -1 +1 @@
-6.16.2410.2210
+6.16.2410.2211
diff --git a/MP.Prog/Resources/manifest.xml b/MP.Prog/Resources/manifest.xml
index 08d26d10..bfe55f7a 100644
--- a/MP.Prog/Resources/manifest.xml
+++ b/MP.Prog/Resources/manifest.xml
@@ -1,6 +1,6 @@
-
- 6.16.2410.2210
+ 6.16.2410.2211
https://nexus.steamware.net/repository/SWS/MP-PROG/stable/LAST/MP.Prog.zip
https://nexus.steamware.net/repository/SWS/MP-PROG/stable/LAST/ChangeLog.html
false
diff --git a/MP.Prog/Startup.cs b/MP.Prog/Startup.cs
index a1cb43b6..fc459f4f 100644
--- a/MP.Prog/Startup.cs
+++ b/MP.Prog/Startup.cs
@@ -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 =>
|