Update filtro x type
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>WebDoorCreator - Egalware</i>
|
||||
<h4>Version: 0.9.2309.1110</h4>
|
||||
<h4>Version: 0.9.2309.1112</h4>
|
||||
<br /> Release note:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
0.9.2309.1110
|
||||
0.9.2309.1112
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>0.9.2309.1110</version>
|
||||
<version>0.9.2309.1112</version>
|
||||
<url>http://nexus.steamware.net/repository/SWS/WDC/stable/WDC.UI.zip</url>
|
||||
<changelog>http://nexus.steamware.net/repository/SWS/WDC/stable/ChangeLog.html</changelog>
|
||||
<mandatory>false</mandatory>
|
||||
|
||||
@@ -9,7 +9,7 @@ using static WebDoorCreator.Core.Enum;
|
||||
namespace WebDoorCreator.Data.DTO
|
||||
{
|
||||
/// <summary>
|
||||
/// COmpany data DTO
|
||||
/// File data DTO
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class FileDTO
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
<div class="d-flex justify-content-between my-2">
|
||||
<div class="col-4 text-center fw-bold border-bottom border-secondary fs-3">
|
||||
<div class="col-5 text-center fw-bold border-bottom border-secondary fs-3">
|
||||
<div class="row">
|
||||
<div class="col-3">
|
||||
@if (showBtnNew)
|
||||
@@ -19,21 +19,11 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4 text-center">
|
||||
<div class="col-2 text-center">
|
||||
@* <button class="btn btn-dark" @onclick="()=>doScan()">Scan Dir New</button> *@
|
||||
@if (searchRecords != null && searchRecords.Count() > 0)
|
||||
{
|
||||
<div class="text-nowrap">
|
||||
<div class="btn-group" role="group">
|
||||
<button type="button" class="btn btn-sm col-3 btn-secondary" disabled>FILTER BY: </button>
|
||||
<button type="button" class="btn btn-sm col-3 @filtBtnAddCss()" @onclick="()=>filtBtnSet(Core.Enum.fileStatus.add)">Add</button>
|
||||
<button type="button" class="btn btn-sm col-3 @filtBtnUpdCss()" @onclick="()=>filtBtnSet(Core.Enum.fileStatus.mod)">Update</button>
|
||||
<button type="button" class="btn btn-sm col-3 @filtBtnRemCss()" @onclick="()=>filtBtnSet(Core.Enum.fileStatus.rem)">Delete</button>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
</div>
|
||||
<div class="col-4 text-center fw-bold border-bottom border-secondary fs-3">
|
||||
<div class="col-5 text-center fw-bold border-bottom border-secondary fs-3">
|
||||
<div class="row">
|
||||
<div class="col-3">
|
||||
@if (showBtnCur)
|
||||
@@ -53,6 +43,36 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex justify-content-between my-2">
|
||||
<div class="col-4 text-center">
|
||||
@if (ListType != null)
|
||||
{
|
||||
<select @bind="@TypeSel" class="form-select">
|
||||
<option value="*">-- All Types --</option>
|
||||
@foreach (var item in ListType)
|
||||
{
|
||||
<option value="@item">@item</option>
|
||||
}
|
||||
</select>
|
||||
}
|
||||
</div>
|
||||
<div class="col-4 text-center">
|
||||
</div>
|
||||
<div class="col-4 text-end">
|
||||
@if (searchRecords != null && searchRecords.Count() > 0)
|
||||
{
|
||||
<div class="text-nowrap">
|
||||
<div class="btn-group" role="group">
|
||||
<button type="button" class="btn btn-sm col-3 btn-secondary" disabled>FILTER BY: </button>
|
||||
<button type="button" class="btn btn-sm col-3 @filtBtnAddCss()" @onclick="()=>filtBtnSet(Core.Enum.fileStatus.add)">Add</button>
|
||||
<button type="button" class="btn btn-sm col-3 @filtBtnUpdCss()" @onclick="()=>filtBtnSet(Core.Enum.fileStatus.mod)">Update</button>
|
||||
@* <button type="button" class="btn btn-sm col-3 @filtBtnRemCss()" @onclick="()=>filtBtnSet(Core.Enum.fileStatus.rem)">Delete</button> *@
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@if (isLoading)
|
||||
{
|
||||
<ProgressDisplay Title="@titleMsg" CurrVal="@sendDataVal" MaxVal="@sendDataMaxVal" ExpTimeMSec="8000"></ProgressDisplay>
|
||||
@@ -63,63 +83,72 @@ else if (files2Chk != null && files2Chk.Count() > 0)
|
||||
<thead>
|
||||
<tr class="row">
|
||||
<th class="col-1">Type</th>
|
||||
<th class="col-3">Folder/File</th>
|
||||
<th class="col-3 text-end">Folder/File</th>
|
||||
<th class="col-1 text-end">Size</th>
|
||||
<th class="col-2 text-center">
|
||||
<input class="form-check-input mt-0" type="checkbox" value="" id="selUns" aria-label="Select or Unselect all" @bind="@selUns">
|
||||
<label for="#selUns">Select/Unselect all</label>
|
||||
</th>
|
||||
<th class="col-1">Type</th>
|
||||
<th class="col-3">Folder/File</th>
|
||||
<th class="col-3 text-end">Folder/File</th>
|
||||
<th class="col-1 text-end">Size</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in files2Chk)
|
||||
@if (isDrawing)
|
||||
{
|
||||
<tr class="row" style="cursor: pointer;">
|
||||
@if (item.Value.status == Core.Enum.fileStatus.add || item.Value.status == Core.Enum.fileStatus.mod)
|
||||
{
|
||||
<td class="col-1" data-bs-toggle="modal" data-bs-target="#fileDiffModal" @onclick="()=>showDiff(item, item.Value.status)">
|
||||
<h5><b>@item.Key.Split("\\")[0]</b></h5>
|
||||
<LoadingData></LoadingData>
|
||||
}
|
||||
else
|
||||
{
|
||||
@foreach (var item in files2Chk)
|
||||
{
|
||||
<tr class="row" style="cursor: pointer;">
|
||||
@if (item.Value.status == Core.Enum.fileStatus.add || item.Value.status == Core.Enum.fileStatus.mod)
|
||||
{
|
||||
<td class="col-1" data-bs-toggle="modal" data-bs-target="#fileDiffModal" @onclick="()=>showDiff(item, item.Value.status)">
|
||||
<h5><b>@item.Key.Split("\\")[0]</b></h5>
|
||||
</td>
|
||||
<td class="col-3 text-end" data-bs-toggle="modal" data-bs-target="#fileDiffModal" @onclick="()=>showDiff(item, item.Value.status)">
|
||||
<b>@item.Key.Split("\\")[1]</b>
|
||||
<div class="small">
|
||||
@item.Value.FileRelPath
|
||||
@* @item.Key.Split("\\")[2] *@
|
||||
</div>
|
||||
</td>
|
||||
<td class="col-1 text-end" data-bs-toggle="modal" data-bs-target="#fileDiffModal" @onclick="()=>showDiff(item, item.Value.status)">
|
||||
@($"{item.Value.FileDim / 1024} kb")
|
||||
</td>
|
||||
}
|
||||
else
|
||||
{
|
||||
<td class="col-5" colspan="4" data-bs-toggle="modal" data-bs-target="#fileDiffModal" @onclick="()=>showDiff(item, item.Value.status)"></td>
|
||||
}
|
||||
<td class="col-2 text-center">
|
||||
<button class="btn @btnCssClass(item.Value.status, item.Value.action)" @onclick="()=>changeDoAct(item)" disabled="@(item.Value.status== Core.Enum.fileStatus.rem)">@btnTxt(item.Value.status) <i class="@btnIcon(item.Value.status)"></i></button>
|
||||
</td>
|
||||
<td class="col-3" data-bs-toggle="modal" data-bs-target="#fileDiffModal" @onclick="()=>showDiff(item, item.Value.status)">
|
||||
<b>@item.Key.Split("\\")[1]</b>
|
||||
<div class="small">
|
||||
@item.Key.Split("\\")[2]
|
||||
</div>
|
||||
</td>
|
||||
<td class="col-1 text-end" data-bs-toggle="modal" data-bs-target="#fileDiffModal" @onclick="()=>showDiff(item, item.Value.status)">
|
||||
@($"{item.Value.FileDim / 1024} kb")
|
||||
</td>
|
||||
}
|
||||
else
|
||||
{
|
||||
<td class="col-5" colspan="4" data-bs-toggle="modal" data-bs-target="#fileDiffModal" @onclick="()=>showDiff(item, item.Value.status)"></td>
|
||||
}
|
||||
<td class="col-2 text-center">
|
||||
<button class="btn @btnCssClass(item.Value.status, item.Value.action)" @onclick="()=>changeDoAct(item)" disabled="@(item.Value.status== Core.Enum.fileStatus.rem)">@btnTxt(item.Value.status) <i class="@btnIcon(item.Value.status)"></i></button>
|
||||
</td>
|
||||
@if (item.Value.status == Core.Enum.fileStatus.rem || item.Value.status == Core.Enum.fileStatus.mod)
|
||||
{
|
||||
<td class="col-1" data-bs-toggle="modal" data-bs-target="#fileDiffModal" @onclick="()=>showDiff(item, item.Value.status)">
|
||||
<h5><b>@item.Key.Split("\\")[0]</b></h5>
|
||||
</td>
|
||||
<td class="col-3" data-bs-toggle="modal" data-bs-target="#fileDiffModal" @onclick="()=>showDiff(item, item.Value.status)">
|
||||
<b>@item.Key.Split("\\")[1]</b>
|
||||
<div class="small">
|
||||
@item.Key.Split("\\")[2]
|
||||
</div>
|
||||
</td>
|
||||
<td class="col-1 text-end" data-bs-toggle="modal" data-bs-target="#fileDiffModal" @onclick="()=>showDiff(item, item.Value.status)">
|
||||
@($"{item.Value.FileDim / 1024} kb")
|
||||
</td>
|
||||
}
|
||||
else
|
||||
{
|
||||
<td class="col-5" colspan="4" data-bs-toggle="modal" data-bs-target="#fileDiffModal" @onclick="()=>showDiff(item, item.Value.status)"></td>
|
||||
}
|
||||
</tr>
|
||||
@if (item.Value.status == Core.Enum.fileStatus.rem || item.Value.status == Core.Enum.fileStatus.mod)
|
||||
{
|
||||
<td class="col-1" data-bs-toggle="modal" data-bs-target="#fileDiffModal" @onclick="()=>showDiff(item, item.Value.status)">
|
||||
<h5><b>@item.Key.Split("\\")[0]</b></h5>
|
||||
</td>
|
||||
<td class="col-3 text-end" data-bs-toggle="modal" data-bs-target="#fileDiffModal" @onclick="()=>showDiff(item, item.Value.status)">
|
||||
<b>@item.Key.Split("\\")[1]</b>
|
||||
<div class="small">
|
||||
@item.Value.FileRelPath
|
||||
@* @item.Key.Split("\\")[2] *@
|
||||
</div>
|
||||
</td>
|
||||
<td class="col-1 text-end" data-bs-toggle="modal" data-bs-target="#fileDiffModal" @onclick="()=>showDiff(item, item.Value.status)">
|
||||
@($"{item.Value.FileDim / 1024} kb")
|
||||
</td>
|
||||
}
|
||||
else
|
||||
{
|
||||
<td class="col-5" colspan="4" data-bs-toggle="modal" data-bs-target="#fileDiffModal" @onclick="()=>showDiff(item, item.Value.status)"></td>
|
||||
}
|
||||
</tr>
|
||||
}
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -43,6 +43,7 @@ namespace WebDoorCreator.UI.Components.FilesMan
|
||||
protected double expTime { get; set; } = 6;
|
||||
|
||||
protected bool isLoading { get; set; } = false;
|
||||
protected bool isDrawing { get; set; } = false;
|
||||
|
||||
protected int numSteps { get; set; } = 4;
|
||||
|
||||
@@ -209,6 +210,7 @@ namespace WebDoorCreator.UI.Components.FilesMan
|
||||
{
|
||||
files2Chk.Clear();
|
||||
searchRecords.Clear();
|
||||
ListType = new List<string>();
|
||||
Log.Info($"Component scan started by user {WDCUService.userId}");
|
||||
isLoading = true;
|
||||
sendDataVal = 0;
|
||||
@@ -236,12 +238,14 @@ namespace WebDoorCreator.UI.Components.FilesMan
|
||||
if (curFiles[item.Key].FileMD5 != item.Value.FileMD5)
|
||||
{
|
||||
item.Value.status = Core.Enum.fileStatus.mod;
|
||||
checkItemType(item);
|
||||
}
|
||||
curFiles.Remove(item.Key);
|
||||
}
|
||||
else
|
||||
{
|
||||
item.Value.status = Core.Enum.fileStatus.add;
|
||||
checkItemType(item);
|
||||
}
|
||||
searchRecords.Add(item.Key, item.Value);
|
||||
}
|
||||
@@ -267,6 +271,34 @@ namespace WebDoorCreator.UI.Components.FilesMan
|
||||
Log.Info($"Component scan COMPLETED");
|
||||
}
|
||||
|
||||
private void checkItemType(KeyValuePair<string, FileDTO> item)
|
||||
{
|
||||
string type = getType(item.Key);
|
||||
if (!ListType.Contains(type))
|
||||
{
|
||||
ListType.Add(type);
|
||||
}
|
||||
}
|
||||
|
||||
public static string getType(string key)
|
||||
{
|
||||
string answ = "";
|
||||
if (key.Contains("\\"))
|
||||
{
|
||||
answ = key.Split("\\")[0];
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
public static string getFolder(string key)
|
||||
{
|
||||
string answ = "";
|
||||
if (key.Contains("\\"))
|
||||
{
|
||||
answ = key.Split("\\")[1];
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
protected string filtBtnAddCss()
|
||||
{
|
||||
string answ = "";
|
||||
@@ -357,17 +389,38 @@ namespace WebDoorCreator.UI.Components.FilesMan
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
protected string TypeSel
|
||||
{
|
||||
get => _typeSel;
|
||||
set
|
||||
{
|
||||
if (_typeSel != value)
|
||||
{
|
||||
_typeSel = value;
|
||||
ReloadData().ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
private string _typeSel { get; set; } = "";
|
||||
|
||||
protected List<string> ListType { get; set; } = new List<string>();
|
||||
|
||||
protected async Task ReloadData()
|
||||
{
|
||||
isDrawing = true;
|
||||
await Task.Delay(1);
|
||||
|
||||
totalCount = searchRecords.Count;
|
||||
files2Chk = searchRecords
|
||||
.Where(x => stats2show.Contains(x.Value.status))
|
||||
.Skip(numRecord * (currPage - 1))
|
||||
.Take(numRecord)
|
||||
.ToDictionary(x => x.Key, x => x.Value);
|
||||
var filtData = searchRecords
|
||||
.Where(x => stats2show.Contains(x.Value.status) && (TypeSel == "*" || x.Key.StartsWith(TypeSel)))
|
||||
.ToList();
|
||||
totalCount = filtData.Count;
|
||||
|
||||
files2Chk = filtData
|
||||
.Skip(numRecord * (currPage - 1))
|
||||
.Take(numRecord)
|
||||
.ToDictionary(x => x.Key, x => x.Value);
|
||||
//await InvokeAsync(() => StateHasChanged());
|
||||
isDrawing = false;
|
||||
}
|
||||
|
||||
protected void ReplaceFile(string FileToMoveAndDelete, string FileToReplace)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<Version>0.9.2309.1110</Version>
|
||||
<Version>0.9.2309.1112</Version>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<UserSecretsId>aspnet-WebDoorCreator.UI-dfe95fed-1398-4144-bd43-8b3a765d6608</UserSecretsId>
|
||||
</PropertyGroup>
|
||||
|
||||
Reference in New Issue
Block a user