Modifica x gestione file inattivi (vecchie rev) + fix selezioni
This commit is contained in:
@@ -234,6 +234,18 @@ namespace MP.FileData.Controllers
|
||||
return done;
|
||||
}
|
||||
|
||||
public bool FileExport(FileModel currFile)
|
||||
{
|
||||
bool done = false;
|
||||
using (MoonPro_ProgContext localDbCtx = new MoonPro_ProgContext(_configuration))
|
||||
{
|
||||
// sovrascrivo il file su disco
|
||||
File.WriteAllBytes(currFile.Path, currFile.FileContent);
|
||||
done = true;
|
||||
}
|
||||
return done;
|
||||
}
|
||||
|
||||
public FileModel FileGetByKey(int FileId)
|
||||
{
|
||||
FileModel thisFile = null;
|
||||
@@ -450,10 +462,10 @@ namespace MP.FileData.Controllers
|
||||
|
||||
// rileggo file...
|
||||
var newFileInfo = new FileInfo(currFile.Path);
|
||||
currFile.LastMod = newFileInfo.LastWriteTime;
|
||||
|
||||
// aggiorno stato del file a unchanged e data mod ad ora...
|
||||
currFile.DiskStatus = FileState.Ok;
|
||||
currFile.LastMod = newFileInfo.LastWriteTime;
|
||||
localDbCtx.Entry(currFile).State = EntityState.Modified;
|
||||
|
||||
// salvo DB
|
||||
|
||||
@@ -5,20 +5,32 @@
|
||||
<h5>Dettaglio modifiche</h5>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
@if (_currItem.DiskStatus != FileData.FileState.Ok)
|
||||
@if (_currItem.Active)
|
||||
{
|
||||
@if (_currItem.DiskStatus != FileData.FileState.Ok)
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<button type="button" class="btn btn-success btn-block" value="Cancel" @onclick="RejectChange">Mantieni Archivio <i class="fas fa-file-download"></i></button>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<button type="button" class="btn btn-danger btn-block" value="Cancel" @onclick="ApproveChange">Accetta Attuale <i class="fas fa-file-upload"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<button type="button" class="btn btn-success btn-block" value="Cancel" @onclick="RejectChange">Mantieni Archivio <i class="fas fa-file-download"></i></button>
|
||||
<button type="button" class="btn btn-success btn-block" value="" @onclick="ExportArchive">Sostituisci da Archivio <i class="fas fa-file-download"></i></button>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<button type="button" class="btn btn-danger btn-block" value="Cancel" @onclick="ApproveChange">Accetta Attuale <i class="fas fa-file-upload"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<div class="col-2">
|
||||
@numDiff
|
||||
</div>
|
||||
<div class="col-2 text-right">
|
||||
<button type="button" class="btn btn-primary btn-block" value="Cancel" @onclick="cancelUpdate" title="Chiudi">Chiudi <i class="fas fa-window-close"></i></button>
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace MP.Prog.Components
|
||||
|
||||
private async Task ApproveChange()
|
||||
{
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Sicuro di voler asccettare la modifica del file selezionato generando una nuova revisione?"))
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Sicuro di voler accettare la modifica del file selezionato generando una nuova revisione?"))
|
||||
return;
|
||||
|
||||
if (_currItem != null)
|
||||
@@ -102,6 +102,29 @@ namespace MP.Prog.Components
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Esporta da archivio a filesystem
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private async Task ExportArchive()
|
||||
{
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Sicuro di voler sovrascrivere il programma salvato in rete con la versione (inattiva) selezionata?"))
|
||||
return;
|
||||
|
||||
if (_currItem != null)
|
||||
{
|
||||
await DataReset.InvokeAsync(0);
|
||||
await DataService.FileExport(_currItem);
|
||||
await DataReset.InvokeAsync(0);
|
||||
await DataService.updateMachineArchive(_currItem.IdxMacchina, 1, false, false);
|
||||
await DataUpdated.InvokeAsync(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("File null!");
|
||||
}
|
||||
}
|
||||
|
||||
private async Task RejectChange()
|
||||
{
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Sicuro di voler eliminare la modifica del file selezionato e sovrascrivere la versione in rete?"))
|
||||
|
||||
@@ -116,6 +116,11 @@ namespace MP.Prog.Data
|
||||
return Task.FromResult(dbController.FileDelete(currItem));
|
||||
}
|
||||
|
||||
internal Task FileExport(FileData.DatabaseModels.FileModel currItem)
|
||||
{
|
||||
return Task.FromResult(dbController.FileExport(currItem));
|
||||
}
|
||||
|
||||
internal Task FileReject(FileData.DatabaseModels.FileModel currItem)
|
||||
{
|
||||
return Task.FromResult(dbController.FileModReject(currItem));
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<RootNamespace>MP.Prog</RootNamespace>
|
||||
<Version>6.14.2109.2215</Version>
|
||||
<Version>6.14.2109.2815</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -68,10 +68,10 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="px-2">
|
||||
<div class="px-2 text-truncate">
|
||||
@if (!string.IsNullOrEmpty(SelFileName))
|
||||
{
|
||||
<span class="badge badge-secondary">@SelFileName</span>
|
||||
<span class="badge badge-secondary" title="@SelFileName">@TextReduce(SelFileName, 20)</span>
|
||||
}
|
||||
</div>
|
||||
<div class="px-2">
|
||||
@@ -144,7 +144,7 @@
|
||||
{
|
||||
<tr class="@checkSelect(record.FileId)">
|
||||
<td class="text-nowrap">
|
||||
@if (currRecord == null && record.Active)
|
||||
@if (currRecord == null)
|
||||
{
|
||||
<button class="btn btn-sm btn-info" @onclick="() => Edit(record)" title="Edit record #@record.FileId">
|
||||
<i class="oi oi-pencil"></i>
|
||||
|
||||
@@ -346,17 +346,23 @@ namespace MP.Prog.Pages
|
||||
isLoading = false;
|
||||
}
|
||||
|
||||
protected void Edit(FileModel selRecord)
|
||||
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...
|
||||
var pUpd = Task.Run(async () => currRecord = await DataService.FileGetByKey(selRecord.FileId));
|
||||
pUpd.Wait();
|
||||
currRecord = await DataService.FileGetByKey(selRecord.FileId);
|
||||
}
|
||||
|
||||
protected async Task FilterPath(string searchVal)
|
||||
{
|
||||
SelFileName = searchVal;
|
||||
OnlyActive = false;
|
||||
currPage = 1;
|
||||
await ReloadAllData();
|
||||
isLoading = false;
|
||||
}
|
||||
@@ -364,6 +370,7 @@ namespace MP.Prog.Pages
|
||||
protected async Task FilterTag(string searchVal)
|
||||
{
|
||||
SelTag = searchVal;
|
||||
currPage = 1;
|
||||
await ReloadAllData();
|
||||
isLoading = false;
|
||||
}
|
||||
@@ -447,6 +454,7 @@ namespace MP.Prog.Pages
|
||||
{
|
||||
currRecord = null;
|
||||
ListRecords = null;
|
||||
currPage = 1;
|
||||
AppMService.File_Filter = SelectData.Init(5, 10);
|
||||
AppMService.SearchVal = "";
|
||||
SearchTag = defTag;
|
||||
@@ -459,12 +467,28 @@ namespace MP.Prog.Pages
|
||||
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;
|
||||
@@ -506,18 +530,12 @@ namespace MP.Prog.Pages
|
||||
//StateHasChanged();
|
||||
}
|
||||
|
||||
public async void OnSeachUpdated()
|
||||
public void OnSeachUpdated()
|
||||
{
|
||||
SearchVal = AppMService.SearchVal;
|
||||
//await ReloadData();
|
||||
StateHasChanged();
|
||||
}
|
||||
|
||||
public void ResetTag()
|
||||
{
|
||||
SelTag = "";
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,15 @@
|
||||
<div>Actual value: @_debounceInputValue</div>
|
||||
<input type="button" class="btn btn-primary" value="Read out actual value" @onclick="(_ => { _debounceInputValue = input1.Value; })" />
|
||||
|
||||
@*<div class="row" style="font-size: 4em;">
|
||||
<div class="col-12 text-center">
|
||||
<b>30</b> km - <b>4.41</b>/km
|
||||
</div>
|
||||
<div class="col-12 text-center small">
|
||||
Real Time: 2:20:50
|
||||
</div>
|
||||
</div>*@
|
||||
|
||||
@code {
|
||||
//DebounceInput
|
||||
private string _debounceInputValue = "";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo gestione Programmi MAPO</i>
|
||||
<h4>Versione: 6.14.2109.2215</h4>
|
||||
<h4>Versione: 6.14.2109.2815</h4>
|
||||
<br />
|
||||
Note di rilascio:
|
||||
<ul>
|
||||
|
||||
@@ -1 +1 @@
|
||||
6.14.2109.2215
|
||||
6.14.2109.2815
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>6.14.2109.2215</version>
|
||||
<version>6.14.2109.2815</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>
|
||||
|
||||
Reference in New Issue
Block a user