- Fix gestione paginazione x elenco files
- Fix reload
This commit is contained in:
Samuele Locatelli
2024-10-15 11:27:28 +02:00
parent e6179601fb
commit 6806f7ffe5
9 changed files with 60 additions and 43 deletions
+6 -5
View File
@@ -8,7 +8,7 @@
</tr>
</thead>
<tbody>
@if (ListFiles == null || ListFiles.Count == 0)
@if (ListRecords == null || ListRecords.Count == 0)
{
<tr>
<td colspan="3">
@@ -18,17 +18,18 @@
}
else
{
@foreach (var record in ListFiles)
@foreach (var record in ListRecords)
{
<tr>
<td>
<a href="@FileLink(record.Name)" target="_blank" class="" title="Download File">@record.Name</a>
</td>
</td>
<td class="text-end">@record.Extension</td>
<td class="text-end">@CalcSize(record.Length)</td>
</tr>
}
}
</tbody>
</table>
</table>
<DataPager PageSize="@numRecord" currPage="@currPage" numRecordChanged="SetNumRec" numPageChanged="SetPage" totalCount="@totalCount" showLoading="@isLoading" />
+35 -2
View File
@@ -41,6 +41,11 @@ namespace MP.SPEC.Components
/// </summary>
/// <returns></returns>
protected override void OnParametersSet()
{
ReloadData();
}
private void ReloadData()
{
// calcolo phisical path...
string BasePathOdlReturn = ConfMan.GetValue<string>("ServerConf:BasePathOdlReturn") ?? ConfMan.GetValue<string>("OptConf:BasePathOdlReturn") ?? "";
@@ -50,17 +55,45 @@ namespace MP.SPEC.Components
{
// recupero come DirectoryInfo x avere tutte le informazioni su nome, tipo, size...
DirectoryInfo dirInfo = new DirectoryInfo(PhysicalPath);
ListFiles = dirInfo.GetFiles().ToList();
SearchRecords = dirInfo.GetFiles().ToList();
}
totalCount = SearchRecords.Count;
// filtro x display
ListRecords = SearchRecords
.Skip(numRecord * (currPage - 1))
.Take(numRecord)
.ToList();
}
private int totalCount { get; set; } = 0;
#endregion Protected Methods
#region Private Properties
private List<FileInfo> ListFiles { get; set; } = new List<FileInfo>();
private List<FileInfo> ListRecords { get; set; } = new List<FileInfo>();
private List<FileInfo> SearchRecords { get; set; } = new List<FileInfo>();
private string PhysicalPath { get; set; } = "";
#endregion Private Properties
private int currPage { get; set; } = 1;
private bool isLoading { get; set; } = false;
private int numRecord { get; set; } = 10;
protected async Task SetNumRec(int newNum)
{
numRecord = newNum;
currPage = 1;
ReloadData();
await InvokeAsync(ReloadData);
}
protected async Task SetPage(int newNum)
{
ReloadData();
currPage = newNum;
await InvokeAsync(ReloadData);
}
}
}
+1 -2
View File
@@ -68,7 +68,6 @@ else
{
<div class="mt-1">
<button class="btn btn-info btn-sm" @onclick="() => selBrowseRecord(record)" title="Show Folder" data-bs-toggle="modal" data-bs-target="#odlDirModal"><i class="fa-regular fa-folder-open"></i></button>
@* <a href="@OdlLink(record.IdxOdl)" target="_blank" class="btn btn-info btn-sm py-1" title="Show Folder"><i class="fa-regular fa-folder-open"></i></a> *@
</div>
}
}
@@ -156,7 +155,7 @@ else
</td>
<td>
<div>
<button class="btn btn-sm btn-primary py-1 px-2" type="button" @onclick="() => selectStatRecord(record)" data-bs-toggle="modal" data-bs-target="#statsModal" title="Mostra statistiche">
<button class="btn btn-sm btn-primary py-1 px-2" type="button" @onclick="() => selStatRecord(record)" data-bs-toggle="modal" data-bs-target="#statsModal" title="Mostra statistiche">
<div>
<b>@record.DurataMinuti</b>
</div>
+14 -26
View File
@@ -215,8 +215,18 @@ namespace MP.SPEC.Components
await reloadData();
}
protected async Task selectStatRecord(ODLExpModel? currRec)
protected async Task selBrowseRecord(ODLExpModel? currRec)
{
browseRecord = null;
showBrowse = true;
showStats = false;
await Task.Delay(1);
browseRecord = currRec;
}
protected async Task selStatRecord(ODLExpModel? currRec)
{
browseRecord = null;
showBrowse = false;
showStats = true;
await Task.Delay(1);
@@ -231,28 +241,11 @@ namespace MP.SPEC.Components
ListOdlStats = null;
}
}
protected async Task selBrowseRecord(ODLExpModel? currRec)
{
showBrowse = true;
showStats = false;
await Task.Delay(1);
browseRecord = currRec;
#if false
if (currRec != null)
{
await reloadStatsData(currRec);
}
else
{
showBrowse = false;
ListOdlStats = null;
}
#endif
}
protected async Task selRecord(ODLExpModel? currRec)
{
await Task.Delay(1);
browseRecord = null;
selDtFine = DateTime.Now;
currRecord = currRec;
showStats = false;
@@ -282,6 +275,7 @@ namespace MP.SPEC.Components
private static Logger Log = LogManager.GetCurrentClassLogger();
private ODLExpModel? browseRecord = null;
private ODLExpModel? currRecord = null;
/// <summary>
@@ -289,11 +283,6 @@ namespace MP.SPEC.Components
/// </summary>
private string KeyFolderMan = "OP_ODL_FOLDER";
protected string OdlLink(int idxOdl)
{
return $"RET_DATA/ODL{idxOdl:00000000}";
}
private List<StatODLModel>? ListOdlStats;
private List<StatODLModel>? ListOdlStatsNetto;
@@ -305,7 +294,6 @@ namespace MP.SPEC.Components
private List<ODLExpModel>? SearchRecords;
private ODLExpModel? statRecord = null;
private ODLExpModel? browseRecord = null;
#endregion Private Fields
@@ -397,8 +385,8 @@ namespace MP.SPEC.Components
private DateTime selDtFine { get; set; } = DateTime.Now;
private bool showStats { get; set; } = false;
private bool showBrowse { get; set; } = false;
private bool showStats { get; set; } = false;
private int totalCount
{
+1 -1
View File
@@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>MP.SPEC</RootNamespace>
<Version>6.16.2410.1509</Version>
<Version>6.16.2410.1511</Version>
<UserSecretsId>1800a78a-6ff1-40f9-b490-87fb8bfc1394</UserSecretsId>
</PropertyGroup>
-4
View File
@@ -249,10 +249,6 @@ namespace MP.SPEC.Pages
private int _currPage { get; set; } = 1;
private int _numRecord { get; set; } = 10;
#if false
private List<ConfigModel>? configData { get; set; } = null;
#endif
private int currPage
{
get => _currPage;
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MAPOSPEC </i>
<h4>Versione: 6.16.2410.1509</h4>
<h4>Versione: 6.16.2410.1511</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
6.16.2410.1509
6.16.2410.1511
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2410.1509</version>
<version>6.16.2410.1511</version>
<url>https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/MP.SPEC.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>