From 5cdb0e077da367a9f92253e29e11c8b5b3337dc4 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Mon, 20 Sep 2021 16:53:36 +0200 Subject: [PATCH] Pulizia pagine inutilizzate --- MP.Land/Pages/Archive.razor | 208 ------------- MP.Land/Pages/Archive.razor.cs | 523 --------------------------------- MP.Land/Pages/Setup.razor | 17 -- MP.Land/Pages/Setup.razor.cs | 21 -- 4 files changed, 769 deletions(-) delete mode 100644 MP.Land/Pages/Archive.razor delete mode 100644 MP.Land/Pages/Archive.razor.cs delete mode 100644 MP.Land/Pages/Setup.razor delete mode 100644 MP.Land/Pages/Setup.razor.cs diff --git a/MP.Land/Pages/Archive.razor b/MP.Land/Pages/Archive.razor deleted file mode 100644 index 94eb73e3..00000000 --- a/MP.Land/Pages/Archive.razor +++ /dev/null @@ -1,208 +0,0 @@ -@page "/Archive" - -@using MP.Land.Components - -
-
-
-
-
-
-

Elenco Programmi

-
-
-
- -
-
-
-
-
-
-
-
- -
-
-
-
-
- - - -
- -
-
-
-
-
- - -
-
-
-
-
-
- - -
-
-
-
-
-
- - -
-
-
-
- @if (!string.IsNullOrEmpty(SelFileName)) - { - @SelFileName - } -
-
-
-
- - Tags -
-
- @if (!string.IsNullOrEmpty(SelTag)) - { - @SelTag - } - else - { -   ...   - } -
-
- -
-
- @if (DeleteDialogOpen) - { - - } -
-
-
-
-
-
- @if (currRecord != null) - { - - } - @if (ListRecords == null) - { - - } - else if (totalCount == 0) - { -
Nessun record trovato
- } - else - { -
-
- - - - - - - - - - - - @**@ - - - - - @foreach (var record in ListRecords) - { - - - - - - - - - - - } - -
FileRevSizeStateMacchinaTagsModificatoControllo
- @if (currRecord == null && record.Active) - { - - } - else - { - - } - -
-
@record.Name
- -
-
-
@record.Rev
-
-
@((((double)record.Size)/1024).ToString("N2")) k
-
- - - @record.DiskStatus - - - -
@record.Macchina.Nome
-
@record.Macchina.Descrizione
-
- @foreach (var item in record.Tags) - { - - } - -
@record.LastMod.ToString("yyyy.MM.dd")
-
@record.LastMod.ToString("ddd HH:mm.ss")
-
-
-
- } -
- -
\ No newline at end of file diff --git a/MP.Land/Pages/Archive.razor.cs b/MP.Land/Pages/Archive.razor.cs deleted file mode 100644 index 229dd856..00000000 --- a/MP.Land/Pages/Archive.razor.cs +++ /dev/null @@ -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 ListRecords; - private List MacList; - private List 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 - } -} \ No newline at end of file diff --git a/MP.Land/Pages/Setup.razor b/MP.Land/Pages/Setup.razor deleted file mode 100644 index aba9003d..00000000 --- a/MP.Land/Pages/Setup.razor +++ /dev/null @@ -1,17 +0,0 @@ -@page "/Setup" - -@using MP.Land.Data -@using System.Text -@using DiffMatchPatch - -@inject MessageService AppMService - -
-
-

Setup

-
-
- -
- @**@ -
\ No newline at end of file diff --git a/MP.Land/Pages/Setup.razor.cs b/MP.Land/Pages/Setup.razor.cs deleted file mode 100644 index 7f2d52b3..00000000 --- a/MP.Land/Pages/Setup.razor.cs +++ /dev/null @@ -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 - } -} \ No newline at end of file