ok check dir e cmpFooter con versione

This commit is contained in:
zaccaria.majid
2023-07-25 10:07:28 +02:00
parent e58ee47832
commit c1e7970eec
14 changed files with 150 additions and 19 deletions
+9
View File
@@ -0,0 +1,9 @@
<div class="row bg-dark text-light">
<div class="col-5 pe-0 text-left">
<b>SMGen @(DateTime.Today.Year)</b> | <span class="small">v.@version</span>
</div>
<div class="col-7 ps-0 text-end">
<span class="small">@($"{DateTime.Now:HH:mm:ss}")</span> | <a class="text-light" href="https://www.egalware.com/" target="_blank"><img class="img-fluid" width="16" src="images/LogoEgw.png" /> Egalware </a>
</div>
</div>
+59
View File
@@ -0,0 +1,59 @@
using NLog;
namespace SMGen.Components
{
public partial class CmpFooter : IDisposable
{
#region Public Methods
public void Dispose()
{
if (aTimer != null)
{
aTimer.Elapsed -= ElapsedTimer;
aTimer.Stop();
aTimer.Dispose();
}
}
public void ElapsedTimer(object? source, System.Timers.ElapsedEventArgs e)
{
var pUpd = Task.Run(async () =>
{
await Task.Delay(1);
await InvokeAsync(() => StateHasChanged());
});
pUpd.Wait();
}
public void StartTimer()
{
int tOutPeriod = 5000;
//int.TryParse(Configuration["ReloadStatusTimer"], out tOutPeriod);
aTimer = new System.Timers.Timer(tOutPeriod);
aTimer.Elapsed += ElapsedTimer;
aTimer.Enabled = true;
aTimer.Start();
}
#endregion Public Methods
#region Protected Methods
protected override void OnInitialized()
{
var rawVers = typeof(Program).Assembly.GetName().Version; ;
version = rawVers != null ? rawVers : new Version("0.0.0.0");
}
#endregion Protected Methods
#region Private Fields
private System.Timers.Timer aTimer = null!;
private static Logger Log = LogManager.GetCurrentClassLogger();
private Version version = null!;
#endregion Private Fields
}
}
+18 -7
View File
@@ -14,13 +14,24 @@
Vista in preview si può poi inserire in prod se confermato
</p>
<InputFile OnChange="@LoadFiles" multiple/>
<div class="d-flex justify-content-between">
<div>
<InputFile OnChange="@LoadFiles" multiple />
</div>
<div>
@if (files2Read.Count > 0)
{
<button @onclick="()=>Read_rule_file_transitions()">Process</button>
}
</div>
</div>
<button @onclick="()=>Read_rule_file_transitions()">Process</button>
<span class="fs-1">@sz_file2Read</span>
<div class="p-2">
@foreach (var item in files2Read)
{
<span>@item.Key</span>
<br />
}
</div>
@*@foreach (var item in bits)
{
<span>@item</span>
}*@
+37 -4
View File
@@ -29,6 +29,14 @@ namespace SMGen.Pages
[Inject]
protected IWebHostEnvironment env { get; set; } = null!;
[Inject]
protected IConfiguration conf { get; set; } = null!;
protected string procRootDir
{
get => conf.GetValue<string>("ServerConf:ProcCsvRootPath");
}
protected string sz_file2Write { get; set; } = "prova.csv";
//protected string sz_file2Read { get; set; } = "D:\\Repo\\Mapo-IOB\\StateMachine\\_DEFAULT\\60_STD_MACHINE.rul";
protected string sz_file2Read { get; set; } = "";
@@ -52,8 +60,6 @@ namespace SMGen.Pages
List<IBrowserFile> loadedFiles = new();
long maxFileSize = 1024 * 15;
int maxAllowedFiles = 150;
bool isLoading;
isLoading = true;
loadedFiles.Clear();
foreach (var file in e.GetMultipleFiles(maxAllowedFiles))
@@ -99,7 +105,6 @@ namespace SMGen.Pages
}
}
isLoading = false;
}
/// <summary>
@@ -180,7 +185,11 @@ namespace SMGen.Pages
case "$DO":
b_rules_definition = false;
evaluate_transitions($"C:\\Temp\\Rules\\PROCESSED\\{item.Key.Split(".")[0]}.csv");
var isOk = checkDirExist(procRootDir);
if (isOk)
{
evaluate_transitions($"{procRootDir}\\{item.Key.Split(".")[0]}.csv");
}
break;
default:
@@ -206,6 +215,30 @@ namespace SMGen.Pages
}
}
protected bool checkDirExist(string dir)
{
bool answ = false;
var dirEx = Directory.Exists(dir);
if (dirEx)
{
answ = true;
}
else
{
var dirCreate = Directory.CreateDirectory(dir);
if (dirCreate != null)
{
answ = true;
}
else
{
answ = false;
}
}
return answ;
}
protected void evaluate_transitions(string sz_file2Write)
{
using (StreamWriter sw = new StreamWriter(sz_file2Write))
+1
View File
@@ -0,0 +1 @@

+2
View File
@@ -0,0 +1,2 @@
body {
}
+1
View File
@@ -0,0 +1 @@

+4
View File
@@ -14,4 +14,8 @@
<None Include="compilerconfig.json" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="NLog" Version="5.2.2" />
</ItemGroup>
</Project>
+3
View File
@@ -17,3 +17,6 @@
</article>
</main>
</div>
<div class="fixed-bottom">
<CmpFooter></CmpFooter>
</div>
+1 -1
View File
@@ -9,7 +9,7 @@ main {
}
.sidebar {
background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%);
background-image: linear-gradient(180deg, rgb(5, 39, 103) 20%, #3aa6ff 90%);
}
.top-row {
+7 -7
View File
@@ -1,6 +1,6 @@
<div class="top-row ps-3 navbar navbar-dark">
<div class="top-row ps-3 navbar navbar-light">
<div class="container-fluid">
<a class="navbar-brand" href="">SMGen</a>
<a class="navbar-brand text-light" href="">SMGen</a>
<button title="Navigation menu" class="navbar-toggler" @onclick="ToggleNavMenu">
<span class="navbar-toggler-icon"></span>
</button>
@@ -10,27 +10,27 @@
<div class="@NavMenuCssClass" @onclick="ToggleNavMenu">
<nav class="flex-column">
<div class="nav-item px-3">
<NavLink class="nav-link" href="" Match="NavLinkMatch.All">
<NavLink class="nav-link p-2" href="" Match="NavLinkMatch.All">
<span class="oi oi-home" aria-hidden="true"></span> Home
</NavLink>
</div>
<div class="nav-item px-3">
<NavLink class="nav-link" href="FamIngressi">
<NavLink class="nav-link p-2" href="FamIngressi">
<span class="oi oi-list-rich" aria-hidden="true"></span> Anag Fam.Ingressi
</NavLink>
</div>
<div class="nav-item px-3">
<NavLink class="nav-link" href="FamMacchine">
<NavLink class="nav-link p-2" href="FamMacchine">
<span class="oi oi-list-rich" aria-hidden="true"></span> Anag Fam.Macchine
</NavLink>
</div>
<div class="nav-item px-3">
<NavLink class="nav-link" href="SMIn2Event">
<NavLink class="nav-link p-2" href="SMIn2Event">
<span class="oi oi-plus" aria-hidden="true"></span> Gen. SM Ingressi
</NavLink>
</div>
<div class="nav-item px-3">
<NavLink class="nav-link" href="SMEvent2State">
<NavLink class="nav-link p-2" href="SMEvent2State">
<span class="oi oi-plus" aria-hidden="true"></span> Gen. SM Stati
</NavLink>
</div>
+1
View File
@@ -8,3 +8,4 @@
@using Microsoft.JSInterop
@using SMGen
@using SMGen.Shared
@using SMGen.Components
+3
View File
@@ -5,5 +5,8 @@
"Microsoft.AspNetCore": "Warning"
}
},
"ServerConf": {
"ProcCsvRootPath": "C:\\Temp\\Rules\\PROCESSED"
},
"AllowedHosts": "*"
}
+4
View File
@@ -2,5 +2,9 @@
{
"outputFile": "wwwroot/css/site.css",
"inputFile": "wwwroot/css/site.less"
},
{
"outputFile": "Pages/SMIn2Event.razor.css",
"inputFile": "Pages/SMIn2Event.razor.less"
}
]