diff --git a/MP.FileData/Controllers/FileController.cs b/MP.FileData/Controllers/FileController.cs index 3fc400be..578c7b07 100644 --- a/MP.FileData/Controllers/FileController.cs +++ b/MP.FileData/Controllers/FileController.cs @@ -1076,7 +1076,6 @@ namespace MP.FileData.Controllers { DateTime adesso = DateTime.Now; currRec.UserAppr = UserName; - currRec.LastMod = adesso; currRec.LastCheck = adesso; //currFile.DiskStatus = FileState.Ok; localDbCtx.Entry(currRec).State = EntityState.Modified; diff --git a/MP.Prog/Components/FileEditor.razor.cs b/MP.Prog/Components/FileEditor.razor.cs index f24b5b28..0d00faf1 100644 --- a/MP.Prog/Components/FileEditor.razor.cs +++ b/MP.Prog/Components/FileEditor.razor.cs @@ -2,6 +2,7 @@ using Microsoft.JSInterop; using MP.FileData.DatabaseModels; using MP.Prog.Data; +using NLog; using System; using System.Collections.Generic; using System.IO; @@ -12,14 +13,11 @@ namespace MP.Prog.Components { public partial class FileEditor : ComponentBase { - #region Public Fields - - public FileModel _currItem = new FileModel(); - - #endregion Public Fields - #region Public Properties + /// + /// Item richiesto x display + /// [Parameter] public FileModel currItem { @@ -31,9 +29,12 @@ namespace MP.Prog.Components { _currItem = value; CompareRev = false; + LoadRevision(); + FixTitles(); } } + private static Logger Log = LogManager.GetCurrentClassLogger(); [Parameter] public EventCallback DataReset { get; set; } @@ -43,82 +44,32 @@ namespace MP.Prog.Components [Parameter] public List MacList { get; set; } + /// + /// Rev richiesta (x confronto) + /// + [Parameter] + public int ReqRev + { + get => SelRevDx; + set + { + if (value > 0) + { + CompareRev = true; + SelRevDx = value; + } + else + { + CompareRev = false; + } + } + } + [Parameter] public List TagList { get; set; } #endregion Public Properties - private bool CompareRev = false; - protected int SelRevSx - { - get => _selRevSx; - set - { - if (_selRevSx != value) - { - _selRevSx = value; - // ricarico file SX - LoadRevision(); - FixTitles(); - } - } - } - protected int SelRevDx - { - get => _selRevDx; - set - { - if (_selRevDx != value) - { - _selRevDx = value; - LoadRevision(); - FixTitles(); - } - } - } - private int _selRevSx = 0; - private int _selRevDx = 0; - - private List ListRevSx - { - get - { - List answ = new List() { 0 }; - for (int i = 1; i < SelRevDx; i++) - { - answ.Add(i); - } - return answ; - } - } - private List ListRevDx - { - get - { - List answ = new List(); - for (int i = 0; i <= _currItem.Rev; i++) - { - answ.Add(i); - } - return answ; - } - } - - - private void DoCompare() - { - CompareRev = !CompareRev; - LoadRevision(); - FixTitles(); - } - - private void FixTitles() - { - // sistemo titoli - TitleSx = CompareRev ? $"Rev. {SelRevSx}" : "Archivio"; - TitleDx = CompareRev ? $"Rev. {SelRevDx}" : "Attuale"; - } - #region Public Methods public string CurrFileContent(string fullPath) @@ -150,19 +101,93 @@ namespace MP.Prog.Components [Inject] protected MessageService MServ { get; set; } + protected int SelRevDx + { + get => _selRevDx; + set + { + if (_selRevDx != value) + { + _selRevDx = value; + LoadRevision(); + FixTitles(); + } + } + } + + protected int SelRevSx + { + get => _selRevSx; + set + { + if (_selRevSx != value) + { + _selRevSx = value; + // ricarico file SX + LoadRevision(); + FixTitles(); + } + } + } + #endregion Protected Properties #region Protected Methods - protected void diffDoneHandler(int numChanges) + protected override void OnParametersSet() { -#if false - numDiff = numChanges; -#endif + LoadRevision(); } #endregion Protected Methods + #region Private Fields + + private FileModel _currItem = new FileModel(); + private int _selRevDx = 0; + private int _selRevSx = 0; + + #endregion Private Fields + + #region Private Properties + + private bool CompareRev { get; set; } = false; + private string FileContDx { get; set; } = ""; + + private string FileContSx { get; set; } = ""; + + private List ListRevDx + { + get + { + List answ = new List(); + for (int i = 0; i <= _currItem.Rev; i++) + { + answ.Add(i); + } + return answ; + } + } + + private List ListRevSx + { + get + { + List answ = new List() { 0 }; + for (int i = 1; i < SelRevDx; i++) + { + answ.Add(i); + } + return answ; + } + } + + private string TitleDx { get; set; } = "Attuale"; + + private string TitleSx { get; set; } = "Archivio"; + + #endregion Private Properties + #region Private Methods private async Task ApproveChange() @@ -177,7 +202,7 @@ namespace MP.Prog.Components } else { - Console.WriteLine("File null!"); + Log.Error("_currItem null!"); } } @@ -198,10 +223,21 @@ namespace MP.Prog.Components } else { - Console.WriteLine("File null!"); + Log.Error("_currItem null!"); } } + private void DoCompare() + { + CompareRev = !CompareRev; + if (CompareRev) + { + SelRevDx = _currItem.Rev; + } + LoadRevision(); + FixTitles(); + } + /// /// Esporta da archivio a filesystem /// @@ -221,52 +257,15 @@ namespace MP.Prog.Components } else { - Console.WriteLine("File null!"); + Log.Error("_currItem null!"); } } - private async Task RejectChange() + private void FixTitles() { - if (!await JSRuntime.InvokeAsync("confirm", "Sicuro di voler eliminare la modifica del file selezionato e sovrascrivere la versione in rete?")) - return; - - if (_currItem != null) - { - await FDService.FileReject(_currItem); - await DataUpdated.InvokeAsync(1); - } - else - { - Console.WriteLine("File null!"); - } - } - - private async Task saveUpdate() - { - if (_currItem != null) - { - await FDService.FileUpdate(_currItem); - await DataUpdated.InvokeAsync(1); - } - else - { - Console.WriteLine("File null!"); - } - } - - private string FileContSx { get; set; } = ""; - private string FileContDx { get; set; } = ""; - - private string TitleSx { get; set; } = "Archivio"; - private string TitleDx { get; set; } = "Attuale"; - - - protected override void OnParametersSet() - { - FileContSx = _currItem.FileStringContent; - FileContDx = CurrFileContent(_currItem.Path); - SelRevDx = _currItem.Rev; - FixTitles(); + // sistemo titoli + TitleSx = CompareRev ? $"Rev. {SelRevSx}" : "Archivio"; + TitleDx = CompareRev ? $"Rev. {SelRevDx}" : "Attuale"; } private void LoadRevision() @@ -286,6 +285,35 @@ namespace MP.Prog.Components FixTitles(); } + private async Task RejectChange() + { + if (!await JSRuntime.InvokeAsync("confirm", "Sicuro di voler eliminare la modifica del file selezionato e sovrascrivere la versione in rete?")) + return; + + if (_currItem != null) + { + await FDService.FileReject(_currItem); + await DataUpdated.InvokeAsync(1); + } + else + { + Log.Error("_currItem null!"); + } + } + + private async Task saveUpdate() + { + if (_currItem != null) + { + await FDService.FileUpdate(_currItem); + await DataUpdated.InvokeAsync(1); + } + else + { + Log.Error("_currItem null!"); + } + } + #endregion Private Methods } } \ No newline at end of file diff --git a/MP.Prog/Components/RevList.razor b/MP.Prog/Components/RevList.razor index a7ef9f87..86d06067 100644 --- a/MP.Prog/Components/RevList.razor +++ b/MP.Prog/Components/RevList.razor @@ -10,7 +10,9 @@ { +
@@ -26,10 +28,10 @@
@if (!string.IsNullOrEmpty(record.UserAppr)) { - + @record.UserAppr +
} else { @@ -42,6 +44,17 @@ }
+ +
@record.LastMod.ToString("yyyy.MM.dd")
+
@record.LastMod.ToString("ddd HH:mm.ss")
+ + + + @if (string.IsNullOrEmpty(record.UserAppr)) + { + + } + } diff --git a/MP.Prog/Components/RevList.razor.cs b/MP.Prog/Components/RevList.razor.cs index edfcaa85..ba0c0d33 100644 --- a/MP.Prog/Components/RevList.razor.cs +++ b/MP.Prog/Components/RevList.razor.cs @@ -15,6 +15,24 @@ namespace MP.Prog.Components [Parameter] public FileModel CurrRec { get; set; } + /// + /// Evento selezione rev x confronto, valore = rev + /// + [Parameter] + public EventCallback EC_selRev { get; set; } + + /// + /// Evento richiesta approvazione versione, valore = record + /// + [Parameter] + public EventCallback EC_reqAppr { get; set; } + + /// + /// Evento richeista eliminazione da DB del File + /// + [Parameter] + public EventCallback EC_reqDelete { get; set; } + #endregion Public Properties #region Protected Properties @@ -43,31 +61,39 @@ namespace MP.Prog.Components } /// - /// forza approvazione utente corrente + /// Forza approvazione utente corrente /// /// protected async Task FileSetUserApp(FileModel CurrRec) { - if (!await JSRuntime.InvokeAsync("confirm", "Sicuro di voler approvare il salvataggio automatico della nuova revisione?")) - return; - - await FDService.FileSetUserApp(CurrRec, MServ.UserName); + await EC_reqAppr.InvokeAsync(CurrRec); + await Task.Delay(100); await ReloadData(); } /// - /// Imposta filtro x utente + /// Selezione Rev x display confronto /// - /// /// - protected async Task FilterUserName(string userName) + protected async Task SelRev(FileModel CurrRec) { - //SelUserName = userName; - //currPage = 1; - await Task.Delay(1); - //isLoading = false; + await EC_selRev.InvokeAsync(CurrRec.Rev); + await ReloadData(); } + + /// + /// Elimina record (non approvato) corrente e riattiva precedente + /// + /// + protected async Task DeleteRec(FileModel CurrRec) + { + await EC_reqDelete.InvokeAsync(CurrRec); + await Task.Delay(100); + await ReloadData(); + } + + protected override async Task OnParametersSetAsync() { await ReloadData(); diff --git a/MP.Prog/MP.Prog.csproj b/MP.Prog/MP.Prog.csproj index e675d567..fc51295a 100644 --- a/MP.Prog/MP.Prog.csproj +++ b/MP.Prog/MP.Prog.csproj @@ -3,7 +3,7 @@ net6.0 MP.Prog - 6.16.2410.2820 + 6.16.2410.2909 True diff --git a/MP.Prog/Pages/Archive.razor b/MP.Prog/Pages/Archive.razor index 2b5fe7cf..65523610 100644 --- a/MP.Prog/Pages/Archive.razor +++ b/MP.Prog/Pages/Archive.razor @@ -97,7 +97,7 @@
@if (currRecord != null) { - + } @if (ListRecords == null) { @@ -124,11 +124,17 @@ File Rev - Size / User + @if (currRecord == null || currRecord.Rev == 0) + { + Size / User + } Macchina Tags - Modificato - + @if (currRecord == null || currRecord.Rev == 0) + { + Modificato + + } @@ -157,29 +163,32 @@
- -
- @CalcSize(record.Size) -
-
- @if (!string.IsNullOrEmpty(record.UserAppr)) - { - - } - else - { + @if (currRecord == null || currRecord.Rev == 0) + { + +
+ @CalcSize(record.Size) +
+
+ @if (!string.IsNullOrEmpty(record.UserAppr)) + { + + } + else + { - - } -
- + + } +
+ + }
@record.Macchina.Nome
@record.Macchina.Descrizione
@@ -192,17 +201,20 @@ } - -
@record.LastMod.ToString("yyyy.MM.dd")
-
@record.LastMod.ToString("ddd HH:mm.ss")
+ @if (currRecord == null || currRecord.Rev == 0) + { + +
@record.LastMod.ToString("yyyy.MM.dd")
+
@record.LastMod.ToString("ddd HH:mm.ss")
- - - @if (string.IsNullOrEmpty(record.UserAppr)) - { - - } - + + + @if (string.IsNullOrEmpty(record.UserAppr)) + { + + } + + } } @@ -210,8 +222,8 @@ @if (currRecord != null && currRecord.Rev > 0) { -
- +
+
}
diff --git a/MP.Prog/Pages/Archive.razor.cs b/MP.Prog/Pages/Archive.razor.cs index dcef5e47..564530c8 100644 --- a/MP.Prog/Pages/Archive.razor.cs +++ b/MP.Prog/Pages/Archive.razor.cs @@ -147,14 +147,10 @@ namespace MP.Prog.Pages } // rileggo dal DB il record corrente... + ReqRevDx = 0; currRecord = FDService.FileGetByKey(selRecord.FileId); } - private string mainCol - { - get => currRecord == null || currRecord.Rev == 0 ? "col-12" : "col-10"; - } - /// /// forza approvazione utente corrente /// @@ -356,6 +352,15 @@ namespace MP.Prog.Pages currRecord = selRecord; } + /// + /// imposta revisione richiesta + /// + /// + protected void SelRev(int reqRev) + { + ReqRevDx = reqRev; + } + /// /// Imposta pagina corrente /// @@ -405,9 +410,18 @@ namespace MP.Prog.Pages #region Private Fields private static NLog.Logger Log = LogManager.GetCurrentClassLogger(); + private FileModel currRecord = null; + private List ListRecords; + private List MacList; + + /// + /// Revisione richiesta a dx + /// + private int ReqRevDx = 0; + private List TagList; #endregion Private Fields @@ -428,6 +442,11 @@ namespace MP.Prog.Pages private bool isLoading { get; set; } = false; + private string mainCol + { + get => currRecord == null || currRecord.Rev == 0 ? "col-12" : "col-9"; + } + private int numRecord { get diff --git a/MP.Prog/Resources/ChangeLog.html b/MP.Prog/Resources/ChangeLog.html index 7e4d7231..338cd6ab 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.2820

+

Versione: 6.16.2410.2909


Note di rilascio:
    diff --git a/MP.Prog/Resources/VersNum.txt b/MP.Prog/Resources/VersNum.txt index e1fd2aa3..db88b9d2 100644 --- a/MP.Prog/Resources/VersNum.txt +++ b/MP.Prog/Resources/VersNum.txt @@ -1 +1 @@ -6.16.2410.2820 +6.16.2410.2909 diff --git a/MP.Prog/Resources/manifest.xml b/MP.Prog/Resources/manifest.xml index f7085958..45021f1f 100644 --- a/MP.Prog/Resources/manifest.xml +++ b/MP.Prog/Resources/manifest.xml @@ -1,6 +1,6 @@ - 6.16.2410.2820 + 6.16.2410.2909 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