Pulizia moduli inutilizzati

This commit is contained in:
Samuele Locatelli
2021-09-20 16:23:40 +02:00
parent f95d426953
commit d4b8116fc1
7 changed files with 0 additions and 712 deletions
-99
View File
@@ -1,99 +0,0 @@
<div class="row">
<div class="col-4">
<button id="btnForceCheck" class="btn btn-primary btn-sm btn-block" @onclick="() => ForceCheck(0)" title="Forza verifica archivio (totale)">
<i class="fas fa-sync-alt"></i> Update Completo Archivio <i class="far fa-folder-open"></i>
</button>
</div>
<div class="col-8 py-2">
@if (showProgress)
{
<div class="progress">
<div class="progress-bar progress-bar-striped progress-bar-animated" style="width:@percLoading%;"></div>
</div>
}
</div>
<div class="col-12 mt-2">
@if (ListRecords == null)
{
<div class="row">
<div class="col-4">
@if (showProgress)
{
<div class="col-12 mt-2">
<div class="alert alert-primary">
@if (setupMessages.Count > 0)
{
<ul>
@foreach (var item in setupMessages)
{
<li>@item</li>
}
</ul>
}
</div>
</div>
}
</div>
<div class="col-8">
<LoadingData></LoadingData>
</div>
</div>
}
else if (totalCount == 0)
{
<div class="alert alert-warning text-center display-4">Nessun record trovato</div>
}
else
{
<table class="table table-sm table-striped table-responsive-lg">
<thead>
<tr>
<th></th>
<th>Macchina</th>
<th>Path</th>
<th class="text-right">Tags</th>
<th class="text-right">Senza Tag</th>
<th class="text-right">Modificati</th>
<th class="text-right">Tot File</th>
</tr>
</thead>
<tbody>
@foreach (var record in ListRecords)
{
<tr>
<td>
@if (!string.IsNullOrEmpty(record.BasePath))
{
<button id="btnForceCheck" class="btn btn-warning btn-sm" @onclick="() => ForceCheckMacchina(record.IdxMacchina)" title="Forza verifica Archivio singola macchina">
<i class="fas fa-sync-alt"></i>
</button>
}
</td>
<td>
@record.Nome
</td>
<td>
<div class="small">@record.BasePath</div>
</td>
<td class="text-right">
@record.TotalTags
</td>
<td class="text-right">
@record.NoTags
</td>
<td class="text-right">
@record.NumChanged
</td>
<td class="text-right">
<b>
@record.TotFile
</b>
</td>
</tr>
}
</tbody>
</table>
}
</div>
</div>
-133
View File
@@ -1,133 +0,0 @@
using Microsoft.AspNetCore.Components;
using MP.FileData.DTO;
using MP.Land.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace MP.Land.Components
{
public partial class ArchiveStatus
{
#region Private Fields
private List<ArchiveStatusDTO> ListRecords;
private int numChecks = 0;
private int totalCount = 0;
#endregion Private Fields
#region Private Properties
private List<string> setupMessages { get; set; } = new List<string>();
#endregion Private Properties
#region Protected Properties
[Inject]
protected FileArchDataService DataService { get; set; }
protected int percLoading { get; set; } = 0;
protected bool showProgress { get; set; } = false;
#endregion Protected Properties
#region Private Methods
private async Task verificaSingola(string idxMacchina, int numDays, int numMacchine)
{
// recupero elenco macchine
percLoading += 100 / numMacchine;
numChecks = await DataService.updateMachineArchive(idxMacchina, numDays, true, false);
await Task.Delay(1);
setupMessages.Add($"{idxMacchina}: {numChecks} files");
StateHasChanged();
await Task.Delay(1);
}
private async Task verificaTutte(int numDays)
{
// recupero elenco macchine
var listaMacchine = await DataService.MacchineGetAll();
int numMacchine = listaMacchine.Count();
foreach (var item in listaMacchine.Where(x => !string.IsNullOrEmpty(x.BasePath)).ToList())
{
await verificaSingola(item.IdxMacchina, numDays, numMacchine);
}
}
#endregion Private Methods
#region Protected Methods
protected async Task ArchiveCheck(int maxHour)
{
showProgress = true;
percLoading = 0;
await verificaTutte(maxHour);
setupMessages.Add($"Effettuata verifica e rilettura di {numChecks} files!");
await ReloadData();
}
protected async Task ArchiveSingleCheck(string idxMacchina, int maxHour)
{
showProgress = true;
percLoading = 0;
await verificaSingola(idxMacchina, maxHour, 2);
setupMessages.Add($"Effettuata verifica e rilettura di {numChecks} files!");
await ReloadData();
}
protected async Task ClearMessage()
{
await Task.Delay(10);
setupMessages = new List<string>();
}
protected async Task ForceCheck(int maxHour)
{
setupMessages.Add("Inizio Analisi Archivio...");
ListRecords = null;
await Task.Delay(1);
await ArchiveCheck(maxHour);
await ClearMessage();
await ReloadData();
}
protected async Task ForceCheckMacchina(string idxMacchina)
{
setupMessages.Add("Inizio Analisi Archivio...");
ListRecords = null;
await Task.Delay(1);
await ArchiveSingleCheck(idxMacchina, 0);
await ClearMessage();
await ReloadData();
}
protected override async Task OnInitializedAsync()
{
ListRecords = null;
await ReloadData();
}
protected async Task ReloadData()
{
await Task.Delay(1);
numChecks = 0;
ListRecords = await DataService.GetArchiveStatus();
totalCount = ListRecords.Count;
await Task.Delay(1);
setupMessages = new List<string>();
showProgress = false;
percLoading = 0;
}
#endregion Protected Methods
}
}
-110
View File
@@ -1,110 +0,0 @@
@using MP.FileData.DatabaseModels
@using MP.Prog.Data
@inject FileArchDataService DataService
@inject MessageService AppMService
@if (ArtList == null)
{
<LoadingData></LoadingData>
}
else
{
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text">
<span class="fas fa-search" aria-hidden="true"></span>
</span>
</div>
<input type="text" class="form-control form-control-sm" placeholder="Ricerca Articolo" @bind-value="@SearchArt" />
<select @bind="@SelCodArt" class="form-control form-control-sm">
@if (ArtList != null)
{
foreach (var item in ArtList)
{
<option value="@item.CodArticolo">@item.Disegno | @item.DescArticolo [@item.CodArticolo]</option>
}
}
</select>
<div class="input-group-append">
<button id="searchReset" class="btn btn-sm btn-secondary" @onclick="() => ResetSearchArt()" title="Reset ricerca articolo"><i class="fas fa-ban"></i></button>
</div>
</div>
}
@code {
[Parameter]
public EventCallback<string> searchUpdated { get; set; }
[Parameter]
public string SelCodArt
{
get
{
string answ = "";
if (AppMService.File_Filter != null)
{
answ = AppMService.File_Filter.CodArticolo;
}
return answ;
}
set
{
if (!AppMService.File_Filter.CodArticolo.Equals(value))
{
AppMService.File_Filter.CodArticolo = value;
}
reportChange();
}
}
private void reportChange()
{
searchUpdated.InvokeAsync(SelCodArt);
}
protected string _SearchArt;
protected string defCodArt = "";
protected List<ArticoloModel> ArtList;
protected string SearchArt
{
get
{
return _SearchArt;
}
set
{
_SearchArt = value;
// se son > 3 char... debounce...
if (string.IsNullOrEmpty(value))
{
_SearchArt = defCodArt;
}
if (value.Length >= defCodArt.Length)
{
var pUpd = Task.Run(async () =>
{
ArtList = await DataService.ArticoliGetFilt(SearchArt);
});
pUpd.Wait();
}
}
}
protected override async Task OnInitializedAsync()
{
await ReloadAllData();
_SearchArt = defCodArt;
}
protected async Task ReloadAllData()
{
SelCodArt = defCodArt;
ArtList = await DataService.ArticoliGetFilt(SearchArt);
}
protected void ResetSearchArt()
{
SearchArt = defCodArt;
}
}
-31
View File
@@ -1,31 +0,0 @@
<div class="card">
<div class="card-header bg-secondary text-light">
<div class="row">
<div class="col-4">
<h5>Dettaglio modifiche</h5>
</div>
<div class="col-4">
@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>
}
</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>
</div>
</div>
</div>
<div class="card-body small py-1">
<MP.Land.Components.DiffView oldText="@_currItem.FileStringContent" newText="@(CurrFileContent(_currItem.Path))"></MP.Land.Components.DiffView>
</div>
</div>
-161
View File
@@ -1,161 +0,0 @@
using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
using MP.FileData.DatabaseModels;
using MP.Land.Data;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
namespace MP.Land.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]
public FileModel currItem
{
get
{
return _currItem = null;
}
set
{
_currItem = value;
}
}
[Parameter]
public EventCallback<int> DataReset { get; set; }
[Parameter]
public EventCallback<int> DataUpdated { get; set; }
[Parameter]
public List<MacchinaModel> MacList { get; set; }
[Parameter]
public List<TagModel> TagList { get; set; }
#endregion Public Properties
#region Private Methods
private async Task ApproveChange()
{
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Sicuro di voler asccettare la modifica del file selezionato generando una nuova revisione?"))
return;
if (_currItem != null)
{
await DataService.FileApprove(_currItem);
await DataUpdated.InvokeAsync(1);
}
else
{
Console.WriteLine("File null!");
}
}
private async Task cancelUpdate()
{
await DataReset.InvokeAsync(0);
}
private async Task deleteRecord()
{
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Sicuro di voler eliminare il file selezionato??"))
return;
if (_currItem != null)
{
await DataService.FileDelete(_currItem);
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?"))
return;
if (_currItem != null)
{
await DataService.FileReject(_currItem);
await DataUpdated.InvokeAsync(1);
}
else
{
Console.WriteLine("File null!");
}
}
private async Task saveUpdate()
{
if (_currItem != null)
{
await DataService.FileUpdate(_currItem);
await DataUpdated.InvokeAsync(1);
}
else
{
Console.WriteLine("File null!");
}
}
#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
}
}
-36
View File
@@ -1,36 +0,0 @@
<div class="modal fade show" id="myModal" style="display:block; background-color: rgba(10,10,10,.8);"
aria-modal="true" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">@Title</h4>
<button type="button" class="close" @onclick="@ModalCancel">&times;</button>
</div>
<div class="modal-body">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text">
<span class="fas fa-search" aria-hidden="true"></span>
</span>
</div>
<input type="text" class="form-control form-control-sm" placeholder="Ricerca Tag" @bind-value="@SearchTag" />
<select @bind="@SelTag" class="form-control form-control-sm">
@if (TagList != null)
{
foreach (var item in TagList)
{
<option value="@item.ValueField">@item.LabelField</option>
}
}
</select>
<div class="input-group-append">
<button id="searchReset" class="btn btn-sm btn-secondary" @onclick="() => ResetSearchTag()" title="Reset ricerca articolo"><i class="fas fa-ban"></i></button>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" @onclick=@ModalOk>OK</button>
</div>
</div>
</div>
</div>
-142
View File
@@ -1,142 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
using MP.FileData.DatabaseModels;
using MP.Land;
using MP.Land.Data;
namespace MP.Land.Components
{
public partial class TagSearch
{
#region Protected Fields
protected string _SearchTag;
protected string defTag = "###";
protected string LastSelTag = "";
#endregion Protected Fields
#region Protected Properties
[Inject]
protected MessageService AppMService { get; set; }
[Inject]
protected FileArchDataService DataService { get; set; }
protected string SearchTag
{
get
{
return _SearchTag;
}
set
{
_SearchTag = value;
// se son > 3 char... debounce...
if (string.IsNullOrEmpty(value))
{
_SearchTag = defTag;
}
if (value.Length >= defTag.Length)
{
var pUpd = Task.Run(async () =>
{
TagList = await DataService.TagGetSearch(_SearchTag, 50);
});
pUpd.Wait();
}
}
}
protected List<AutocompleteModel> TagList { get; set; } = new List<AutocompleteModel>();
#endregion Protected Properties
#region Public Properties
[Parameter]
public EventCallback<bool> OnClose { get; set; }
[Parameter]
public EventCallback<string> searchUpdated { get; set; }
[Parameter]
public 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;
}
reportChange();
}
}
[Parameter]
public string Text { get; set; }
[Parameter]
public string Title { get; set; }
#endregion Public Properties
#region Private Methods
private Task ModalCancel()
{
// resetto ricerca
SelTag = LastSelTag;
return OnClose.InvokeAsync(false);
}
private Task ModalOk()
{
return OnClose.InvokeAsync(true);
}
private void reportChange()
{
searchUpdated.InvokeAsync(SelTag);
}
#endregion Private Methods
#region Protected Methods
protected override async Task OnInitializedAsync()
{
LastSelTag = SelTag;
await ReloadAllData();
_SearchTag = defTag;
}
protected async Task ReloadAllData()
{
SelTag = defTag;
TagList = await DataService.TagGetSearch(SearchTag, 20);
}
protected async Task ResetSearchTag()
{
SearchTag = defTag;
await Task.Delay(1);
}
#endregion Protected Methods
}
}