This commit is contained in:
Samuele Locatelli
2023-06-07 12:09:40 +02:00
3 changed files with 77 additions and 61 deletions
@@ -2578,7 +2578,9 @@ namespace WebDoorCreator.Data.Services
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
fatto = await dbController.VocLemmaInsert();
fatto = await dbController.VocLemmaInsert();
RedisValue pattern = new RedisValue($"{Constants.rKeyVocLemma}");
bool answ = await ExecFlushRedisPattern(pattern);
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Debug($"VocLemmaInsert in: {ts.TotalMilliseconds} ms");
@@ -1,69 +1,80 @@
<button class="btn btn-info" @onclick="()=>refreshVoc()">VOCABULARY REFRESH</button>
<div class="d-flex justify-content-between mb-2">
<div>
<input @bind-value="@defaultPath" />
<button class="btn btn-info" @onclick="()=>refreshVoc()">VOCABULARY REFRESH</button>
@if (showList)
{
@if (vocLemmas2Dict != null && vocLemmasTEMP2Dict != null)
<input @bind-value="@defaultPath" />
</div>
@if (vocLemmas2Dict.Count > 0 && vocLemmasTEMP2Dict.Count > 0)
{
<button class="btn btn-sm btn-success" @onclick="()=>saveVoc()">SAVE</button>
@result
<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)
{
<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>
@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>
}
<th class="text-end">Old text</th>
<th>New text</th>
<th></th>
</tr>
}
</tbody>
</table>
</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>
}
}
}
@@ -19,6 +19,7 @@ namespace WebDoorCreator.UI.Components.FilesMan
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();
@@ -53,6 +54,7 @@ namespace WebDoorCreator.UI.Components.FilesMan
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}");
@@ -75,6 +77,7 @@ namespace WebDoorCreator.UI.Components.FilesMan
}
}
}
isLoading = false;
showList = true;
}
List<VocabularyTempModel> list2Mod = new List<VocabularyTempModel>();