Update modalità display edit setup

This commit is contained in:
Samuele Locatelli
2024-09-23 14:17:24 +02:00
parent ab211bc75c
commit bfab8d3ef6
5 changed files with 138 additions and 95 deletions
-4
View File
@@ -194,10 +194,6 @@ namespace EgwControlCenter.App
{
// fix icon!
notifyIcon1.Text = $"EgalWare's AppControlCenter | {CurrAssembly.Version}";
//Assembly assembly = Assembly.GetExecutingAssembly();
//string startDir = Path.GetDirectoryName(assembly.Location)!;
//string icoPath = Path.Combine(startDir, "favicon.ico");
//notifyIcon1.Icon = new Icon(icoPath);
}
private void timerCheck_Tick(object sender, EventArgs e)
@@ -55,7 +55,10 @@
[Parameter]
public bool OnlyUpdate { get; set; } = false;
public bool OnlyUpdate { get; set; } = false;
[Parameter]
public EventCallback<bool> EC_GotoSetup { get; set; }
private List<VersStatusDTO>? ListRecords { get; set; } = null;
@@ -2,69 +2,102 @@
@using EgwControlCenter.Core.Models
@inject AppControlService ACService
@if (PwdOk)
{
<div class="row">
<div class="col-2">
<button class="btn btn-warning btn-lg w-100 shadow" @onclick="DoCancel"><i class="fa-solid fa-ban"></i></button>
</div>
<div class="col-4">
<div class="form-floating">
<input type="number" class="form-control fs-5 text-end" @bind="@RefreshPeriod">
<label>Refresh Period <small>(1..3600 sec)</small></label>
<div class="card shadow">
<div class="card-header">
<div class="d-flex justify-content-between">
<div class="p-0">
<h5>Configuration Setup</h5>
</div>
</div>
<div class="col-4">
<div class="form-floating">
<input type="number" class="form-control fs-4 text-end" @bind="@VetoCheck">
<label>Veto Check <small>(1..14'400 minutes)</small></label>
</div>
</div>
<div class="col-2">
<button class="btn btn-success btn-lg w-100 shadow" @onclick="DoSave"><i class="fa-regular fa-floppy-disk"></i></button>
</div>
<div class="col-12 my-2">
<table class="table table-striped table-sm text-start shadow border">
<thead>
<tr class="bg-dark bg-gradient text-light">
<th class="text-center" style="width: 2rem;">
<button class="btn btn-primary btn-sm" @onclick="DoCancel"><i class="fa-solid fa-rotate"></i></button>
</th>
<th>Tipo</th>
<th>Path</th>
<th class="text-end" style="width: 3rem;">Enabled</th>
</tr>
</thead>
<tbody>
@foreach (var item in ListRecords)
<div class="p-0 d-flex">
<div class="px-1">
@if (PwdOk)
{
<tr>
<td class="text-center">@item.Idx</td>
<td>@item.ApplicationType</td>
<td>
<input type="text" class="form-control form-control-sm" @bind="@item.BasePath" />
</td>
<td class="text-end">
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" @bind="@item.IsEnabled">
</div>
</td>
</tr>
<div class="input-group">
<button class="btn btn-outline-success shadow" @onclick="DoSave" title="Salva Modifiche"><i class="fa-regular fa-floppy-disk"></i> Save</button>
<button class="btn btn-outline-secondary shadow" @onclick="DoCancel" title="Annulla Modifiche"><i class="fa-solid fa-rotate"></i> Reset</button>
<button class="btn btn-outline-dark" @onclick="ToggleSetup" title="Chiudi Setup Controlli"><i class="fa-solid fa-angles-right"></i></button>
</div>
}
</tbody>
</table>
else
{
<div class="px-1">
<button class="btn btn-outline-dark w-100" @onclick="ToggleSetup" title="Chiudi Setup Controlli"><i class="fa-solid fa-angles-right"></i></button>
</div>
}
</div>
</div>
</div>
</div>
}
else
{
<div class="input-group flex-nowrap">
<span class="input-group-text" id="addon-wrapping">Verify Auth Password</span>
<input type="password" class="form-control" @bind="@SetupPwd">
<div class="card-body px-2">
@if (PwdOk)
{
<div class="row py-0">
@* <div class="col-2">
<button class="btn btn-warning btn-lg w-100 shadow" @onclick="DoCancel"><i class="fa-solid fa-ban"></i></button>
</div> *@
<div class="col-6">
<div class="input-group input-group-sm">
<label class="input-group-text small">Refresh Period <small>(1..3600 sec)</small></label>
<input type="number" class="form-control text-end" @bind="@RefreshPeriod">
</div>
</div>
<div class="col-6">
<div class="input-group input-group-sm">
<label class="input-group-text small">Veto Check <small>(1..14'400 minutes)</small></label>
<input type="number" class="form-control text-end" @bind="@VetoCheck">
</div>
</div>
@* <div class="col-2">
<button class="btn btn-success btn-lg w-100 shadow" @onclick="DoSave"><i class="fa-regular fa-floppy-disk"></i></button>
</div> *@
<div class="col-12 mt-1 mb-0">
<table class="table table-striped table-sm text-start shadow border">
<thead>
<tr class="bg-dark bg-gradient text-light">
<th class="text-center" style="width: 2rem;">
@* <button class="btn btn-primary btn-sm" @onclick="DoCancel"><i class="fa-solid fa-rotate"></i></button> *@
</th>
<th>Tipo</th>
<th>Path</th>
<th class="text-end" style="width: 3rem;">Enabled</th>
</tr>
</thead>
<tbody>
@foreach (var item in ListRecords)
{
<tr>
<td class="text-center">@item.Idx</td>
<td>@item.ApplicationType</td>
<td>
<input type="text" class="form-control form-control-sm" @bind="@item.BasePath" />
</td>
<td class="text-end">
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" @bind="@item.IsEnabled">
</div>
</td>
</tr>
}
</tbody>
</table>
</div>
</div>
}
else
{
<div class="input-group flex-nowrap">
<span class="input-group-text" id="addon-wrapping">Verify Auth Password</span>
<input type="password" class="form-control" @bind="@SetupPwd">
</div>
}
</div>
}
</div>
@code {
[Parameter]
public EventCallback<bool> EC_GotoSetup { get; set; }
protected int RefreshPeriod
{
get => ACService.RefreshPeriod;
@@ -100,4 +133,11 @@ else
set => ACService.TargetList = value;
}
protected async void ToggleSetup()
{
ReqSetup = !ReqSetup;
await EC_GotoSetup.InvokeAsync(ReqSetup);
}
private bool ReqSetup = true;
}
@@ -4,42 +4,42 @@
@page "/Nav01"
<div class="card shadow">
<div class="card-header">
<div class="d-flex justify-content-between">
<div class="p-0">
<h5>App Control Center</h5>
@* <h1><b>EgalWare's</b> App Control Center</h1> *@
<div class="form-check form-switch">
<label class="form-check-label">@ShowUpdateText</label>
<input class="form-check-input" type="checkbox" @bind="@ShowOnlyUpdate">
</div>
</div>
<div class="p-0 d-flex">
<div class="px-1">
<button class="btn btn-outline-success w-100" @onclick="ForceCheck">Check Now <i class="fa-solid fa-rotate"></i></button>
@if (ReqSetup)
{
<TargetSetup EC_GotoSetup="SetupMode"></TargetSetup>
}
else
{
<div class="card shadow">
<div class="card-header">
<div class="d-flex justify-content-between">
<div class="p-0">
<h5>App Control Center</h5>
@if (!ReqSetup)
{
}
</div>
<div class="px-1">
<button class="btn @SetupBtnClass w-100" @onclick="ToggleSetup"><i class="fa-solid fa-screwdriver-wrench"></i></button>
<div class="p-0 d-flex">
@if (!ReqSetup)
{
<div class="px-1 input-group">
<span class="input-group-text">
<span class="form-check form-switch">
<label class="form-check-label">@ShowUpdateText</label>
<input class="form-check-input" type="checkbox" @bind="@ShowOnlyUpdate">
</span>
</span>
<button class="btn btn-outline-success" @onclick="ForceCheck" title="Forza Verifica Immediata">Check Now <i class="fa-solid fa-rotate"></i></button>
</div>
}
<div class="px-1">
<button class="btn @SetupBtnClass w-100" @onclick="ToggleSetup" title="Setup Controlli"><i class="fa-solid fa-angles-left"></i></button>
</div>
</div>
</div>
</div>
</div>
<div class="card-body px-2">
@if (ReqSetup)
{
<TargetSetup></TargetSetup>
}
else
{
<div class="card-body px-2">
<ApplicationCheck OnlyUpdate="@ShowOnlyUpdate"></ApplicationCheck>
}
</div>
</div>
@* <div class="card-footer">
@if (CurrAssembly != null)
{
<small>@CurrAssembly.Name | @CurrAssembly.Version</small>
}
</div> *@
</div>
}
@@ -38,14 +38,18 @@ namespace EgwControlCenter.App.Components.Pages
private string SetupBtnClass
{
get => ReqSetup ? "btn-info" : "btn-primary";
get => ReqSetup ? "btn-outline-info" : "btn-outline-primary";
}
private string ShowUpdateText
{
get => ShowOnlyUpdate ? "Aggiornamenti" : "Mostra Tutti";
}
protected void SetupMode(bool reqSetup)
{
ReqSetup = reqSetup;
}
#endregion Private Properties
}