continuo gestione hwMan

This commit is contained in:
zaccaria.majid
2023-06-07 12:15:30 +02:00
parent 59029ee106
commit 950ffdfefb
11 changed files with 141 additions and 244 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>WebDoorCreator - Egalware</i>
<h4>Version: 0.9.2306.0617</h4>
<h4>Version: 0.9.2306.0710</h4>
<br /> Release note:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
0.9.2306.0617
0.9.2306.0710
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>0.9.2306.0617</version>
<version>0.9.2306.0710</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>
@@ -1,80 +0,0 @@
<div class="d-flex justify-content-between mb-2">
<div>
<button class="btn btn-info" @onclick="()=>refreshVoc()">VOCABULARY REFRESH</button>
<input @bind-value="@defaultPath" />
</div>
@if (vocLemmas2Dict.Count > 0 && vocLemmasTEMP2Dict.Count > 0)
{
<div class="text-end">
<button class="btn btn-sm btn-success" @onclick="()=>saveVoc()">SAVE</button>
</div>
}
</div>
@if (isLoading)
{
<LoadingDataSmall></LoadingDataSmall>
}
else
{
@if (showList)
{
@if (vocLemmas2Dict != null && vocLemmasTEMP2Dict != null)
{
<table class="table table-striped table-bordered border-dark">
<thead>
<tr>
<th class="text-end">Old text</th>
<th>New text</th>
<th></th>
</tr>
</thead>
<tbody>
@foreach (var item in vocLemmasTEMP2Dict)
{
<tr>
@if (!vocLemmas2Dict.ContainsKey(item.Key))
{
<td>
</td>
<td class="text-start text-success">
@($"{item.Key} --> {vocLemmasTEMP2Dict[item.Key]}")
</td>
<td>
</td>
}
else if (item.Value != vocLemmas2Dict[item.Key])
{
<td class="col-5 text-end text-danger text-decoration-line-through">
@($"{item.Key} --> {vocLemmas2Dict[item.Key]}")
</td>
<td class="col-5 text-start text-success">
@($"{item.Key} --> {item.Value}")
</td>
<td class="col-1 text-center">
<div class="form-check">
@if (isReady2Save(item.Key))
{
<input class="form-check-input" type="checkbox" value="" id="flexCheckChecked" checked @onclick="()=>setConf(item.Key, false)">
}
else
{
<input class="form-check-input" type="checkbox" value="" id="flexCheckChecked" @onclick="()=>setConf(item.Key, true)">
}
</div>
</td>
}
</tr>
}
</tbody>
</table>
}
}
}
@@ -1,120 +0,0 @@
using Microsoft.AspNetCore.Components;
using Microsoft.CodeAnalysis.VisualBasic.Syntax;
using WebDoorCreator.Data.DbModels;
using WebDoorCreator.Data.Services;
namespace WebDoorCreator.UI.Components.FilesMan
{
public partial class FilesRefresh
{
[Inject]
protected WebDoorCreatorService WDCService { get; set; } = null!;
[Parameter]
public string lang { get; set; } = "";
protected Dictionary<string, Dictionary<string, string>>? vocLemmas { get; set; } = null;
protected Dictionary<string, string> vocLemmas2Dict { get; set; } = new Dictionary<string, string>();
protected Dictionary<string, Dictionary<string, string>>? vocLemmasTEMP { get; set; } = null;
protected Dictionary<string, string> vocLemmasTEMP2Dict { get; set; } = new Dictionary<string, string>();
protected bool showList { get; set; } = false;
protected bool isLoading { get; set; } = false;
protected async override Task OnParametersSetAsync()
{
var rawVoc = await WDCService.VocLemmaGetAll();
if (rawVoc != null)
{
vocLemmas = rawVoc.Where(x => x.Key == lang).ToDictionary(x => x.Key, x => x.Value);
if (vocLemmas != null)
{
foreach (var kvp in vocLemmas)
{
foreach (var item in kvp.Value)
{
vocLemmas2Dict.Add(item.Key, item.Value);
}
}
}
}
}
#if false
var s = dmp.diff_main(vocLemmas2Dict["11"], newText.Value);
dmp.diff_cleanupSemantic(s);
foreach (var diffes in s)
{
if (diffes.operation == Operation.DELETE)
{
diff.Add(diffes);
}
}
#endif
Dictionary<string, Dictionary<string, string>> listVocLemmaTemp = new Dictionary<string, Dictionary<string, string>>();
protected async Task refreshVoc()
{
isLoading = true;
vocLemmasTEMP = null;
await Task.Delay(1);
list2Mod = await WDCService.VocLemmaInsertPrepare(@$"{defaultPath}");
if (list2Mod != null)
{
//bool ok = await WDCService.VocLemmaInsert();
listVocLemmaTemp = await WDCService.VocLemmaTEMPGetAll();
if (listVocLemmaTemp != null)
{
vocLemmasTEMP = listVocLemmaTemp.Where(x => x.Key == lang).ToDictionary(x => x.Key, x => x.Value);
if (vocLemmasTEMP != null)
{
foreach (var kvp in vocLemmasTEMP)
{
foreach (var item in kvp.Value)
{
vocLemmasTEMP2Dict.Add(item.Key, item.Value);
}
}
}
}
}
isLoading = false;
showList = true;
}
List<VocabularyTempModel> list2Mod = new List<VocabularyTempModel>();
protected string result { get; set; } = "Not Done";
protected async Task saveVoc()
{
var done = await WDCService.VocLemmaInsert();
if (done)
{
result = "Done";
vocLemmas2Dict.Clear();
vocLemmasTEMP2Dict.Clear();
}
}
protected bool isReady2Save(string lemma)
{
bool isConf = false;
var tempModTerm = Task.Run(async () => await WDCService.VocLemmaFindByKeys(lang, lemma)).Result;
if (tempModTerm != null)
{
isConf = tempModTerm.IsConfSave;
}
return isConf;
}
protected async Task setConf(string lemma, bool isConf)
{
var tempModTerm = await WDCService.VocLemmaFindByKeys(lang, lemma);
if (tempModTerm != null)
{
var done = await WDCService.VocLemmaSetConf(tempModTerm.Lingua, tempModTerm.Lemma, isConf);
}
}
protected string defaultPath { get; set; } = "";
}
}
@@ -0,0 +1,46 @@
<h3>HwMan</h3>
<table class="table table-striped">
<thead>
<tr>
<th></th>
<th>Compo name</th>
<th>Description</th>
<th>Hardware Description</th>
<th>Valid from</th>
<th>Valid To</th>
</tr>
</thead>
<tbody>
@if (doorOpTypes != null)
{
@foreach (var item in doorOpTypes)
{
<tr>
<td><button class="btn btn-primary btn-sm" @onclick="()=>setCurrHw2Show(item)"><i class="fas fa-pen"></i></button></td>
<td>@GetCompoName(item.HwCode)</td>
<td>@item.Description</td>
<td>@item.HwDescription</td>
<td>@item.ValidFrom</td>
<td>@item.ValidUntil</td>
</tr>
}
}
</tbody>
</table>
<div class="modalHwDets">
<div class="modalHwDetsContent">
<div class="modal-header">
</div>
<div class="modal-body">
</div>
<div class="modal-footer">
</div>
</div>
</div>
@@ -34,29 +34,72 @@ using WebDoorCreator.UI.Shared;
using WebDoorCreator.Data.Services;
using WebDoorCreator.UI.Pages;
using System.Runtime.InteropServices;
using WebDoorCreator.UI.Data;
namespace WebDoorCreator.UI.Components.Hardware
namespace WebDoorCreator.UI.Components.FilesMan
{
public partial class HwMan
{
protected List<DoorOpTypeModel> doorOpTypes = new List<DoorOpTypeModel>();
protected List<ListValuesModel> hwList = new List<ListValuesModel>();
[Inject]
protected WebDoorCreatorService WDCService { get; set; } = null!;
[Inject]
protected WDCVocabularyService WDCVService { get; set; } = null!;
[Inject]
protected WDCUserService WDCUService { get; set; } = null!;
protected override async Task OnParametersSetAsync()
{
await ReloadData();
}
protected async Task ReloadData()
{
//var temp = await WDCService.DoorOpTypeGetByHwCode("*");
//if(temp != null)
//{
// //doorOpTypes = temp.Where(x=>x.);
//}
var temp = await WDCService.DoorOpTypeGetByHwCode("*", 0);
var tempHwList = await WDCService.ListValuesGetAll("*", "Hardware");
if (temp != null)
{
doorOpTypes = temp;
}
if(tempHwList != null)
{
hwList = tempHwList;
}
}
protected string translate(string lemma)
{
string answ = "";
answ = WDCVService.Traduci(WDCUService.currLanguage ?? "EN", lemma);
return answ;
}
protected DoorOpTypeModel? currHw2Show { get; set; } = null;
protected string GetCompoName(string hwCode)
{
string answ = "";
var listValHw2Search = hwList.Where(x => x.TableName == hwCode).FirstOrDefault();
if(listValHw2Search != null)
{
answ = translate(listValHw2Search.Label);
}
return answ;
}
protected async Task setCurrHw2Show(DoorOpTypeModel hw)
{
await Task.Delay(1);
currHw2Show = hw;
}
}
}
@@ -0,0 +1,38 @@
/* Background scuro del modale */
.modalHwDets {
position: fixed;
z-index: 9999;
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow: auto;
background-color: rgb(0,0,0);
background-color: rgba(0,0,0,0.4);
}
/* Modal Content/Box */
.modalHwDetsContent {
background-color: #fefefe;
margin: 3% auto;
padding: 20px;
border: 1px solid #888;
width: 50%;
border-radius: 1rem;
animation: slideDown .3s;
}
/* The Close Button */
.closeHwDets {
color: #aaa;
float: right;
font-size: 2.5rem;
font-weight: bold;
}
.closeHwDets:hover,
.closeHwDets:focus {
color: black;
text-decoration: none;
cursor: pointer;
}
@@ -1,30 +0,0 @@
<h3>HwMan</h3>
<table class="table table-striped">
<thead>
<tr>
<th>Code</th>
<th>Description</th>
<th>Hardware Description</th>
<th>Valid from</th>
<th>Valid To</th>
</tr>
</thead>
<tbody>
@if (doorOpTypes != null)
{
@foreach (var item in doorOpTypes)
{
<tr>
<th>@item.OpCode</th>
<th>@item.Description</th>
<th>@item.HwDescription</th>
<th>@item.ValidFrom</th>
<th>@item.ValidUntil</th>
</tr>
}
}
</tbody>
</table>
+4 -4
View File
@@ -16,11 +16,11 @@
@*<div>
<button class="btn btn-warning" @onclick="()=>refreshHw()">HARDWARE REFRESH</button>
@*<button class="btn btn-info" @onclick="()=>refreshVoc()">VOCABULARY REFRESH</button>
<button class="btn btn-info" @onclick="()=>refreshFiles()">FILES REFRESH</button>
</div>
</div>*@
<!--NON USO TYPE FILE PERCHE' NON PRENDE IL PATH DEL FILE MA RESTITUISCE C:\\fakepath-->
<input @bind-value="@defaultPath" />*@
<button class="btn btn-info" @onclick="()=>refreshFiles()">FILES REFRESH</button>
<input @bind-value="@defaultPath" />
</div>
<div class="listContainer">
<!-- Button trigger modal -->
@@ -43,7 +43,7 @@
}
else
{
<FilesRefresh lang="EN"></FilesRefresh>
<VocRefresh lang="EN"></VocRefresh>
}
</div>
</div>
+1 -1
View File
@@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<Version>0.9.2306.0617</Version>
<Version>0.9.2306.0710</Version>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>aspnet-WebDoorCreator.UI-dfe95fed-1398-4144-bd43-8b3a765d6608</UserSecretsId>
</PropertyGroup>