Pulizia pagine inutilizzate

This commit is contained in:
Samuele Locatelli
2021-09-20 16:53:36 +02:00
parent 661d2580bc
commit 5cdb0e077d
4 changed files with 0 additions and 769 deletions
-208
View File
@@ -1,208 +0,0 @@
@page "/Archive"
@using MP.Land.Components
<div class="card">
<div class="card-header table-primary">
<div class="row">
<div class="col-12 col-lg-4">
<div class="d-flex">
<div class="px-2">
<h3>Elenco Programmi</h3>
</div>
<div class="px-2">
<div class="form-group mb-0">
<button id="btnForceCheck" class="btn btn-warning btn-sm" @onclick="() => ForceCheck(30)" title="Analisi Modifiche ultimi 30gg">
<i class="fas fa-sync-alt"></i> Update (30gg) <i class="far fa-folder-open"></i>
</button>
</div>
</div>
</div>
</div>
<div class="col-12 col-lg-8 text-right">
<div class="d-flex flex-row-reverse">
<div class="px-2">
<div class="form-group mb-0">
<button id="btnReset" class="btn btn-info btn-sm" @onclick="() => ResetFilter()" title="Reset Filter"><span class="oi oi-loop-circular"></span></button>
</div>
</div>
<div class="px-2">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text">
<span class="fas fa-industry" aria-hidden="true"></span>
</span>
</div>
<select @bind="@SelIdxMacc" class="form-control form-control-sm">
@if (MacList != null)
{
foreach (var item in MacList)
{
<option value="@item.IdxMacchina">@item.Descrizione (@item.RuleName)</option>
}
}
</select>
</div>
</div>
<div class="px-2">
<div class="input-group input-group-sm">
<div class="custom-control custom-switch">
<input type="checkbox" class="custom-control-input" id="togModificati" title="Solo Aperti / Mostra tutti" @bind-value="@OnlyMod" checked="@OnlyMod" />
<label class="custom-control-label" for="togModificati"><sub>Mod</sub></label>
</div>
</div>
</div>
<div class="px-2">
<div class="input-group input-group-sm">
<div class="custom-control custom-switch">
<input type="checkbox" class="custom-control-input" id="togAttivi" title="Solo Attivi / Mostra tutti" @bind-value="@OnlyActive" checked="@OnlyActive" />
<label class="custom-control-label" for="togAttivi"><sub>Attivi</sub></label>
</div>
</div>
</div>
<div class="px-2">
<div class="input-group input-group-sm">
<div class="custom-control custom-switch">
<input type="checkbox" class="custom-control-input" id="togNoTag" title="Solo senza Tag / Mostra tutti" @bind-value="@OnlyNoTag" checked="@OnlyNoTag" />
<label class="custom-control-label" for="togNoTag"><sub>No Tag</sub></label>
</div>
</div>
</div>
<div class="px-2">
@if (!string.IsNullOrEmpty(SelFileName))
{
<span class="badge badge-secondary">@SelFileName</span>
}
</div>
<div class="px-2">
<div class="input-group input-group-sm">
<div class="input-group-prepend">
<button type="button" class="btn btn-sm btn-primary" @onclick="() => OpenDialog()" title="Aggiunta Tag">
<i class="fas fa-search"></i>
</button>
<span class="input-group-text">Tags</span>
</div>
<div class="form-control form-control-sm">
@if (!string.IsNullOrEmpty(SelTag))
{
<span class="badge badge-info">@SelTag</span>
}
else
{
<span> &nbsp; ... &nbsp; </span>
}
</div>
<div class="input-group-append">
<button type="button" class="btn btn-sm btn-secondary" @onclick="() => ResetTag()" title="Reset Tag">
<i class="fas fa-sync"></i>
</button>
</div>
</div>
@if (DeleteDialogOpen)
{
<MP.Land.Components.TagSearch Title="Ricerca Tag" OnClose="@OnDialogClose"></MP.Land.Components.TagSearch>
}
</div>
</div>
</div>
</div>
</div>
<div class="card-body p-1">
@if (currRecord != null)
{
<FileEditor currItem="@currRecord" DataReset="ResetData" DataUpdated="UpdateData" TagList="@TagList" MacList="@MacList"></FileEditor>
}
@if (ListRecords == null)
{
<LoadingData></LoadingData>
}
else if (totalCount == 0)
{
<div class="alert alert-warning text-center display-4">Nessun record trovato</div>
}
else
{
<div class="row">
<div class="col-12">
<table class="table table-sm table-striped table-responsive-lg">
<thead>
<tr>
<th></th>
<th>File</th>
<th>Rev</th>
<th>Size</th>
<th class="text-center">State</th>
<th>Macchina</th>
<th>Tags</th>
<th class="text-right">Modificato</th>
@*<th>Controllo</th>*@
<th></th>
</tr>
</thead>
<tbody>
@foreach (var record in ListRecords)
{
<tr class="@checkSelect(record.FileId)">
<td class="text-nowrap">
@if (currRecord == null && record.Active)
{
<button class="btn btn-sm btn-info" @onclick="() => Edit(record)" title="Edit record #@record.FileId">
<i class="oi oi-pencil"></i>
</button>
}
else
{
<button class="btn btn-sm btn-secondary disabled">
<i class="oi oi-pencil"></i>
</button>
}
</td>
<td>
<div class="@(cssActive(record.Active))">
<div>@record.Name</div>
<button class="btn btn-sm btn-outline-secondary px-1 py-0" @onclick="() => FilterPath(record.Path)" title="Filtra per FilePath">
<div class="small">@record.Path</div>
</button>
</div>
</td>
<td>
<div>@record.Rev</div>
</td>
<td>
<div>@((((double)record.Size)/1024).ToString("N2")) k</div>
</td>
<td class="text-center">
<span title="@record.DiskStatus | Ultimo controllo: @record.LastCheck.ToString(" yyyy.MM.dd HH:mm:ss")">
<span class="@(cssStatusByCod(record.DiskStatus))">
@record.DiskStatus
</span>
</span>
</td>
<td>
<div>@record.Macchina.Nome</div>
<div class="small">@record.Macchina.Descrizione</div>
</td>
<td>
@foreach (var item in record.Tags)
{
<button class="btn btn-sm btn-outline-info px-1 py-0 mr-1" @onclick="() => FilterTag(item.TagId)" title="Filtra Tag">
<div class="small">@item.TagId</div>
</button>
}
</td>
<td class="text-right">
<div>@record.LastMod.ToString("yyyy.MM.dd")</div>
<div class="small">@record.LastMod.ToString("ddd HH:mm.ss")</div>
</td>
</tr>
}
</tbody>
</table>
</div>
</div>
}
</div>
<div class="card-footer p-1">
<DataPager PageSize="numRecord" currPage="currPage" numRecordChanged="PagerReloadNum" numPageChanged="PagerReloadPage" totalCount="totalCount" showLoading="isLoading" />
</div>
</div>
-523
View File
@@ -1,523 +0,0 @@
using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
using MP.FileData.DatabaseModels;
using MP.Land.Data;
using NLog;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace MP.Land.Pages
{
public partial class Archive : ComponentBase, IDisposable
{
#region Private Fields
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
private FileModel currRecord = null;
private List<FileModel> ListRecords;
private List<MacchinaModel> MacList;
private List<TagModel> TagList;
#endregion Private Fields
#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; }
[Inject]
protected IJSRuntime JSRuntime { get; set; }
[Inject]
protected NavigationManager NavManager { 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.TagGetFilt(SearchTag);
});
pUpd.Wait();
}
isLoading = false;
}
}
#endregion Protected Properties
#region Public Properties
public bool DeleteDialogOpen { get; set; }
#endregion Public Properties
#region Private Methods
private string cssActive(bool active)
{
string answ = active ? "text-dark" : "text-secondary textStriked";
return answ;
}
private string cssStatusByCod(FileData.FileState currStatus)
{
string answ = "badge";
switch (currStatus)
{
case FileData.FileState.Changed:
answ += " badge-warning";
break;
case FileData.FileState.Deleted:
answ += " badge-danger";
break;
case FileData.FileState.Ok:
answ += " badge-success";
break;
case FileData.FileState.ND:
default:
answ += " badge-light";
break;
}
return answ;
}
private async Task OnDialogClose(bool accepted)
{
DeleteDialogOpen = false;
currPage = 1;
await AsyncReload();
//StateHasChanged();
}
private void OpenDialog()
{
DeleteDialogOpen = true;
StateHasChanged();
}
#endregion Private Methods
#region Protected Methods
protected async Task AsyncReload()
{
isLoading = true;
currRecord = null;
ListRecords = null;
await ReloadData();
isLoading = false;
}
protected void Edit(FileModel selRecord)
{
// rileggo dal DB il record corrente...
var pUpd = Task.Run(async () => currRecord = await DataService.FileGetByKey(selRecord.FileId));
pUpd.Wait();
}
protected async Task FilterPath(string searchVal)
{
SelFileName = searchVal;
OnlyActive = false;
await ReloadAllData();
isLoading = false;
}
protected async Task FilterTag(string searchVal)
{
SelTag = searchVal;
await ReloadAllData();
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.MacchineGetAll();
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 DataService.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;
AppMService.File_Filter = SelectData.Init(5, 10);
AppMService.SearchVal = "";
SearchTag = defTag;
await ReloadAllData();
isLoading = false;
}
protected void ResetSearchTag()
{
SearchTag = defTag;
}
protected void Select(FileModel selRecord)
{
// applico filtro da selezione
currRecord = selRecord;
}
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 async void OnSeachUpdated()
{
SearchVal = AppMService.SearchVal;
//await ReloadData();
StateHasChanged();
}
public void ResetTag()
{
SelTag = "";
}
#endregion Public Methods
}
}
-17
View File
@@ -1,17 +0,0 @@
@page "/Setup"
@using MP.Land.Data
@using System.Text
@using DiffMatchPatch
@inject MessageService AppMService
<div class="card">
<div class="card-header">
<h4>Setup</h4>
</div>
<div class="card-body">
<MP.Land.Components.ArchiveStatus></MP.Land.Components.ArchiveStatus>
</div>
@*<div class="card-footer">Footer</div>*@
</div>
-21
View File
@@ -1,21 +0,0 @@
using Microsoft.AspNetCore.Components;
using MP.Land.Data;
using System;
using System.Threading.Tasks;
namespace MP.Land.Pages
{
public partial class Setup : ComponentBase
{
#region Protected Methods
protected override void OnInitialized()
{
AppMService.ShowSearch = false;
AppMService.PageName = "Setup";
AppMService.PageIcon = "fas fa-wrench pr-2";
}
#endregion Protected Methods
}
}