fix grafici e inizio gestione azioni da compiere per ogni file

This commit is contained in:
zaccaria.majid
2023-08-31 10:04:55 +02:00
parent d6dad0211f
commit 90eb11e861
10 changed files with 164 additions and 105 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>WebDoorCreator - Egalware</i>
<h4>Version: 0.9.2308.3017</h4>
<h4>Version: 0.9.2308.3110</h4>
<br /> Release note:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
0.9.2308.3017
0.9.2308.3110
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>0.9.2308.3017</version>
<version>0.9.2308.3110</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>
@@ -2212,18 +2212,19 @@ namespace WebDoorCreator.Data.Services
return dbResult;
}
public async Task<List<DoorOpTypeModel>> ListValuesLuaNgeInsert(DoorOpTypeModel HwTpl)
public async Task<bool> ListValuesLuaNgeInsert(string defaultPath)
{
await Task.Delay(1);
List<ListValuesTempModel> values = new List<ListValuesTempModel>();
List<DoorOpTypeModel> doorOpTypesList = new List<DoorOpTypeModel>();
MD5 md5 = MD5.Create();
bool answ = false;
try
{
//ciclo nelle directories usando la colonna opcode
//foreach (var itemOld in HwsList)
string dir = HwTpl.OpCode;
string dir = defaultPath;
string compoCode = "";
string compoTempOrShape = "";
Stopwatch stopWatch = new Stopwatch();
@@ -2309,6 +2310,7 @@ namespace WebDoorCreator.Data.Services
var fileContent = File.ReadAllBytes(templateFile);
var hash = md5.ComputeHash(fileContent);
var oldMD5 = BitConverter.ToString(hash).Replace("-", "").ToLowerInvariant();
#if false
DoorOpTypeModel tempType = new DoorOpTypeModel()
{
ParentId = HwTpl.DoorOpTypId,
@@ -2321,7 +2323,8 @@ namespace WebDoorCreator.Data.Services
FileMD5 = oldMD5,
LastMod = fi.LastWriteTime
};
doorOpTypesList.Add(tempType);
doorOpTypesList.Add(tempType);
#endif
if (values.Where(x => x.TableName == temp.TableName && x.FieldName == temp.FieldName && x.Value == temp.Value).Count() == 0 && temp.TableName != null && temp.FieldName != null && temp.Value != null)
{
values.Add(temp);
@@ -2333,6 +2336,8 @@ namespace WebDoorCreator.Data.Services
}
}
}
answ = await dbController.ListValuesAdd(values);
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Debug($"ListValuesLuaNgeInsert in: {ts.TotalMilliseconds} ms");
@@ -2342,7 +2347,7 @@ namespace WebDoorCreator.Data.Services
Log.Error($"Exception during ListValuesLuaNgeInsert: {exc}{Environment.NewLine}");
}
return doorOpTypesList;
return answ;
}
/// <summary>
@@ -1,37 +1,68 @@
<button @onclick="()=>scanB()">Scan Dir New</button>
<button @onclick="()=>doSave()">Save</button>
<table class="table table-striped" style="min-height: 50rem;">
<thead>
<tr>
<th>New files</th>
<th class="d-flex justify-content-center">
<button class="btn btn-sm bnt-dark" @onclick="()=>selectAll()"><i class="fa-regular fa-square-check"></i></button>
<button class="btn btn-sm bnt-dark" @onclick="()=>unselectAll()"><i class="fa-solid fa-retweet"></i></button>
</th>
<th class="text-end">Old files</th>
</tr>
</thead>
<tbody>
@foreach (var item in files2Chk)
{
@if (files2Chk != null && files2Chk.Count() > 0)
{
<table class="table table-striped" style="min-height: 50rem;">
<thead>
<tr>
<td>
<th>New Hw type</th>
<th>New Tpl Folder</th>
<th>New Tpl Name</th>
<th class="text-center">
<input class="form-check-input mt-0" type="checkbox" value="" unchecked aria-label="Select or Unselect all" @bind="@selUns">
</th>
<th>Old Hw type</th>
<th>Old Tpl Folder</th>
<th>Old Tpl Name</th>
</tr>
</thead>
<tbody>
@foreach (var item in files2Chk)
{
<tr>
@if (item.Value.status == Core.Enum.fileStatus.add || item.Value.status == Core.Enum.fileStatus.mod)
{
@item.Key
<td>
@item.Key.Split("\\")[0]
</td>
<td>
@item.Key.Split("\\")[1]
</td>
<td>
@item.Key.Split("\\")[2]
</td>
}
</td>
<td class="text-center">
<button class="btn @btnCssClass(item.Value.status, item.Value.action)" @onclick="()=>changeDoAct(item)"><i class="@btnIcon(item.Value.status)"></i></button>
</td>
<td class="text-end">
else
{
<td></td>
<td></td>
<td></td>
}
<td class="text-center">
<button class="btn @btnCssClass(item.Value.status, item.Value.action)" @onclick="()=>changeDoAct(item)"><i class="@btnIcon(item.Value.status)"></i></button>
</td>
@if (item.Value.status == Core.Enum.fileStatus.rem || item.Value.status == Core.Enum.fileStatus.mod)
{
@item.Key
<td>
@item.Key.Split("\\")[0]
</td>
<td>
@item.Key.Split("\\")[1]
</td>
<td>
@item.Key.Split("\\")[2]
</td>
}
</td>
</tr>
}
</tbody>
</table>
else
{
<td></td>
<td></td>
<td></td>
}
</tr>
}
</tbody>
</table>
}
@@ -21,6 +21,16 @@ namespace WebDoorCreator.UI.Components.FilesMan
{
get => configuration.GetValue<string>("CompoBaseDirs:NewCompoDir");
}
private bool _selUns { get; set; } = false;
private bool selUns
{
get => _selUns;
set
{
_selUns = value;
selectAll(_selUns);
}
}
private string rootPathOld
{
@@ -67,28 +77,14 @@ namespace WebDoorCreator.UI.Components.FilesMan
return answ;
}
protected async Task selectAll()
protected void selectAll(bool selUnsel)
{
await Task.Delay(1);
foreach(var item in files2Chk)
{
item.Value.action = true;
}
}
protected async Task unselectAll()
{
await Task.Delay(1);
foreach (var item in files2Chk)
{
item.Value.action = false;
item.Value.action = selUnsel;
}
}
protected async Task save()
{
await WDCService.DoorOpTypeAddRange(tempDOT);
}
protected async Task scanB()
{
files2Chk = new Dictionary<string, FileDTO>();
@@ -113,7 +109,7 @@ namespace WebDoorCreator.UI.Components.FilesMan
{
item.Value.status = Core.Enum.fileStatus.add;
}
files2Chk.Add(item.Key, item.Value);
files2Chk.Add(item.Key, item.Value);
}
@@ -130,5 +126,30 @@ namespace WebDoorCreator.UI.Components.FilesMan
await Task.Delay(1);
files2Chk[currObj.Key].action = !files2Chk[currObj.Key].action;
}
protected async Task doSave()
{
await Task.Delay(1);
foreach (var item in files2Chk)
{
if (item.Value.status == Core.Enum.fileStatus.add)
{
File.Copy($"{rootPathNew}\\{item.Key}", $"{rootPathOld}\\{item.Key}");
}
else if (item.Value.status == Core.Enum.fileStatus.mod)
{
//await ReplaceFile($"{rootPathNew}{item.Key}", $"{rootPathOld}{item.Key}", $"R:\\WebDoor\\bck\\{item.Key}");
}
else if (item.Value.status == Core.Enum.fileStatus.rem)
{
File.Delete($"{rootPathOld}\\{item.Key}");
}
}
}
protected async Task ReplaceFile(string FileToMoveAndDelete, string FileToReplace, string BackupOfFileToReplace)
{
await Task.Delay(1);
File.Replace(FileToMoveAndDelete, FileToReplace, BackupOfFileToReplace, false);
}
}
}
File diff suppressed because one or more lines are too long
+52 -50
View File
@@ -13,65 +13,67 @@
<div class="cardShadow mt-2">
@if(CurrMode == AdminMode.Company)
{
<CompanyList E_currCompany="catchCurrComp"></CompanyList>
}
else if(CurrMode == AdminMode.Interface)
{
@if (CurrMode == AdminMode.Company)
{
<CompanyList E_currCompany="catchCurrComp"></CompanyList>
}
else if (CurrMode == AdminMode.Interface)
{
<VocRefresh lang="EN"></VocRefresh>
}
else if(CurrMode == AdminMode.Component)
else if (CurrMode == AdminMode.Component)
{
@*<HwMan></HwMan>*@
<CompoCompare></CompoCompare>
<div>
<CompoCompare></CompoCompare>
</div>
}
</div>
@*
@*
<div class="">
<div class="d-flex justify-content-between">
<div class="pb-0 d-flex justify-content-start">
<div class="fs-5 @selectedComp" @onclick="()=>doShowComp()">
Company management
</div>
<div class="fs-5 @selectedUser" @onclick="()=>doShowUser()">
Files management
</div>
</div>
@*<div>
<button class="btn btn-warning" @onclick="()=>refreshHw()">HARDWARE REFRESH</button>
@*<button class="btn btn-info" @onclick="()=>refreshVoc()">VOCABULARY REFRESH</button>
</div>
<div class="d-flex justify-content-between">
<div class="pb-0 d-flex justify-content-start">
<div class="fs-5 @selectedComp" @onclick="()=>doShowComp()">
Company management
</div>
<div class="fs-5 @selectedUser" @onclick="()=>doShowUser()">
Files management
</div>
</div>
@*<div>
<button class="btn btn-warning" @onclick="()=>refreshHw()">HARDWARE REFRESH</button>
@*<button class="btn btn-info" @onclick="()=>refreshVoc()">VOCABULARY REFRESH</button>
</div>
<!--NON USO TYPE FILE PERCHE' NON PRENDE IL PATH DEL FILE MA RESTITUISCE C:\\fakepath-->
<button class="btn btn-info" @onclick="()=>refreshFiles()">FILES REFRESH</button>
<input @bind-value="@defaultPath" />
</div>
<div class="listContainer">
<!-- Button trigger modal -->
<div class="d-flex justify-content-between mb-2">
@if (isCompShow)
{
<h5 class="">General Application company list</h5>
<button type="button" class="btn btn-sm btn-success" data-bs-toggle="modal" data-bs-target="#newCompModal">
<i class="fa-solid fa-plus"></i> Add new company
</button>
}
else
{
<h5 class="">General Application files management</h5>
}
</div>
@if (isCompShow)
{
<CompanyList E_currCompany="catchCurrComp"></CompanyList>
}
else
{
<VocRefresh lang="EN"></VocRefresh>
}
</div>
<!--NON USO TYPE FILE PERCHE' NON PRENDE IL PATH DEL FILE MA RESTITUISCE C:\\fakepath-->
<button class="btn btn-info" @onclick="()=>refreshFiles()">FILES REFRESH</button>
<input @bind-value="@defaultPath" />
</div>
<div class="listContainer">
<!-- Button trigger modal -->
<div class="d-flex justify-content-between mb-2">
@if (isCompShow)
{
<h5 class="">General Application company list</h5>
<button type="button" class="btn btn-sm btn-success" data-bs-toggle="modal" data-bs-target="#newCompModal">
<i class="fa-solid fa-plus"></i> Add new company
</button>
}
else
{
<h5 class="">General Application files management</h5>
}
</div>
@if (isCompShow)
{
<CompanyList E_currCompany="catchCurrComp"></CompanyList>
}
else
{
<VocRefresh lang="EN"></VocRefresh>
}
</div>
</div>*@
</Authorized>
</AuthorizeView>
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<Version>0.9.2308.3017</Version>
<Version>0.9.2308.3110</Version>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>aspnet-WebDoorCreator.UI-dfe95fed-1398-4144-bd43-8b3a765d6608</UserSecretsId>
</PropertyGroup>