144 lines
5.6 KiB
Plaintext
144 lines
5.6 KiB
Plaintext
@using EgwControlCenter.Core
|
|
@using EgwControlCenter.Core.Models
|
|
@inject AppControlService ACService
|
|
|
|
<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 class="p-0 d-flex">
|
|
<div class="px-1">
|
|
@if (PwdOk)
|
|
{
|
|
<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>
|
|
}
|
|
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>
|
|
<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;
|
|
set => ACService.RefreshPeriod = value;
|
|
}
|
|
|
|
protected void DoCancel()
|
|
{
|
|
ACService.DoReloadConfig();
|
|
}
|
|
|
|
protected void DoSave()
|
|
{
|
|
ACService.DoSaveConfig();
|
|
}
|
|
|
|
|
|
private string SetupPwd { get; set; } = "";
|
|
private int VetoCheck
|
|
{
|
|
get => ACService.VetoCheck;
|
|
set => ACService.VetoCheck = value;
|
|
}
|
|
|
|
private bool PwdOk
|
|
{
|
|
get => !string.IsNullOrEmpty(SetupPwd) && SetupPwd == EgwControlCenter.Core.Const.EditPwd;
|
|
}
|
|
|
|
private List<ControlTarget> ListRecords
|
|
{
|
|
get => ACService.TargetList;
|
|
set => ACService.TargetList = value;
|
|
}
|
|
|
|
protected async void ToggleSetup()
|
|
{
|
|
ReqSetup = !ReqSetup;
|
|
await EC_GotoSetup.InvokeAsync(ReqSetup);
|
|
}
|
|
|
|
private bool ReqSetup = true;
|
|
}
|