Update grafico componente auth enroll
This commit is contained in:
@@ -33,17 +33,31 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body p-2">
|
||||
<div class="row">
|
||||
<div class="col-12 fs-4 text-center">
|
||||
<div class="card-body p-2 bg-dark bg-gradient text-light">
|
||||
<div class="d-flex justify-content-around">
|
||||
<div class="px-2 fs-4 text-center text-warning">
|
||||
Auth Code
|
||||
</div>
|
||||
<div class="col-12 fs-1 text-center fw-bold">
|
||||
12345678
|
||||
</div>
|
||||
<div class="d-flex justify-content-around my-3">
|
||||
<div class="px-2 w-100 fs-1 text-center fw-bold bg-info bg-opacity-50 bg-gradient">
|
||||
@($"{passcode:00 00 00 00}")
|
||||
</div>
|
||||
@* <div class="col-12 fs-1 text-center fw-bold">
|
||||
@($"{passcode}")
|
||||
</div> *@
|
||||
</div>
|
||||
<div class="d-flex my-2">
|
||||
<div class="px-2">Istruzioni enroll: per autorizzare l'applicativo comunicare il codice di auth mostrato al personale EgalWare. Puoi farlovia telefono numero <b>035-460560</b> oppure via email all'indirizzo <a href="mailto:info@egalware.com">info@egalware.com</a></div>
|
||||
<div class="px-2">
|
||||
Istruzioni enroll: per autorizzare l'applicativo comunicare il codice di auth mostrato al personale EgalWare.<br />
|
||||
Puoi farlo tramite telefono al numero <b>035-460560</b> oppure via email all'indirizzo <a href="mailto:info@egalware.com">info@egalware.com</a>
|
||||
</div>
|
||||
@* <div class="px-2 w-25 text-center bg-dark">
|
||||
<CircleGaugeMulti Titolo="@($"{tCounter:00}")" Testo="expiry sec" maxVal="@startCounter" ListInner="@SegmTimer" ShowCircleBtn="true"></CircleGaugeMulti>
|
||||
</div> *@
|
||||
<div class="px-2 w-25">
|
||||
<CircleGauge Titolo="@($"{tCounter:00}")" Testo="" maxVal="@startCounter" currVal="@tCounter" StrokeColorVal="@bandColor" ShowCircleBtn="false"></CircleGauge>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,11 +1,32 @@
|
||||
using EgwControlCenter.Core.Models;
|
||||
using EgwControlCenter.Core;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using EgwCoreLib.Razor;
|
||||
|
||||
namespace EgwControlCenter.App.Components.Compo
|
||||
{
|
||||
public partial class AuthChallengeMan : IDisposable
|
||||
{
|
||||
#region Protected Fields
|
||||
|
||||
protected int tCounter = 0;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private string bandColor = "13FD13";
|
||||
private int passcode = 0;
|
||||
|
||||
private PeriodicTimer periodicTimer = new(TimeSpan.FromSeconds(1));
|
||||
private bool remoteCalling = false;
|
||||
|
||||
private bool ReqSetup = true;
|
||||
|
||||
private int startCounter = 20;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
@@ -13,16 +34,6 @@ namespace EgwControlCenter.App.Components.Compo
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
ACService.EA_ConfigUpdated -= ACService_EA_ConfigUpdated;
|
||||
ACService.EA_RemoteCalling -= ACService_EA_RemoteCalling;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
@@ -52,76 +63,35 @@ namespace EgwControlCenter.App.Components.Compo
|
||||
set => ACService.RefreshPeriod = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gestione evento chiamata verso server
|
||||
/// </summary>
|
||||
private async void ACService_EA_RemoteCalling()
|
||||
{
|
||||
RemoteCallActive = ACService.CloudCallActive;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
protected bool RemoteCallActive { get; set; } = false;
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected void DoCancel()
|
||||
{
|
||||
ACService.DoReloadConfig();
|
||||
}
|
||||
|
||||
protected void DoReset()
|
||||
{
|
||||
ACService.ResetConf();
|
||||
}
|
||||
|
||||
protected void DoSave()
|
||||
{
|
||||
ACService.DoSaveConfig();
|
||||
ACService.DoReloadConfig();
|
||||
}
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
ACService.EA_ConfigUpdated += ACService_EA_ConfigUpdated;
|
||||
ACService.EA_RemoteCalling += ACService_EA_RemoteCalling;
|
||||
}
|
||||
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
ForceReload();
|
||||
}
|
||||
|
||||
protected void SetNumRec(int newNum)
|
||||
{
|
||||
numRecord = newNum;
|
||||
currPage = 1;
|
||||
ForceReload();
|
||||
}
|
||||
|
||||
protected void SetPage(int newNum)
|
||||
{
|
||||
currPage = newNum;
|
||||
ForceReload();
|
||||
}
|
||||
|
||||
protected async void ToggleSetup()
|
||||
{
|
||||
ReqSetup = !ReqSetup;
|
||||
await EC_GotoSetup.InvokeAsync(ReqSetup);
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private bool ReqSetup = true;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private string btnSyncClass
|
||||
{
|
||||
get
|
||||
{
|
||||
string answ = "";
|
||||
if (remoteCalling)
|
||||
{
|
||||
answ = "btn-info";
|
||||
}
|
||||
else
|
||||
{
|
||||
answ = ChannelAuth ? "btn-outline-success" : "btn-warning";
|
||||
}
|
||||
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
private bool ChannelAuth
|
||||
{
|
||||
get => ACService.ChannelAuth;
|
||||
}
|
||||
|
||||
private int currPage { get; set; } = 1;
|
||||
|
||||
private bool isLoading { get; set; } = false;
|
||||
@@ -153,6 +123,72 @@ namespace EgwControlCenter.App.Components.Compo
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
periodicTimer?.Dispose();
|
||||
ACService.EA_ConfigUpdated -= ACService_EA_ConfigUpdated;
|
||||
ACService.EA_RemoteCalling -= ACService_EA_RemoteCalling;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected void DoCancel()
|
||||
{
|
||||
ACService.DoReloadConfig();
|
||||
}
|
||||
|
||||
protected void DoReset()
|
||||
{
|
||||
ACService.ResetConf();
|
||||
}
|
||||
|
||||
protected void DoSave()
|
||||
{
|
||||
ACService.DoSaveConfig();
|
||||
ACService.DoReloadConfig();
|
||||
}
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
// mi faccio staccare un codice di auth da remoto
|
||||
passcode = ACService.GetAuthPassocde();
|
||||
tCounter = startCounter;
|
||||
RunTimer();
|
||||
// aggancio gestione eventi
|
||||
ACService.EA_ConfigUpdated += ACService_EA_ConfigUpdated;
|
||||
ACService.EA_RemoteCalling += ACService_EA_RemoteCalling;
|
||||
}
|
||||
|
||||
protected override void OnParametersSet()
|
||||
{
|
||||
ForceReload();
|
||||
}
|
||||
|
||||
protected void SetNumRec(int newNum)
|
||||
{
|
||||
numRecord = newNum;
|
||||
currPage = 1;
|
||||
ForceReload();
|
||||
}
|
||||
|
||||
protected void SetPage(int newNum)
|
||||
{
|
||||
currPage = newNum;
|
||||
ForceReload();
|
||||
}
|
||||
|
||||
protected async void ToggleSetup()
|
||||
{
|
||||
ReqSetup = !ReqSetup;
|
||||
await EC_GotoSetup.InvokeAsync(ReqSetup);
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private void ACService_EA_ConfigUpdated()
|
||||
@@ -160,6 +196,15 @@ namespace EgwControlCenter.App.Components.Compo
|
||||
ForceReload();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gestione evento chiamata verso server
|
||||
/// </summary>
|
||||
private async void ACService_EA_RemoteCalling()
|
||||
{
|
||||
RemoteCallActive = ACService.CloudCallActive;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
|
||||
private void ForceReload()
|
||||
{
|
||||
totalCount = SearchRecords.Count;
|
||||
@@ -169,33 +214,36 @@ namespace EgwControlCenter.App.Components.Compo
|
||||
.ToList();
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
private string btnSyncClass
|
||||
private async void RunTimer()
|
||||
{
|
||||
get
|
||||
while (await periodicTimer.WaitForNextTickAsync())
|
||||
{
|
||||
string answ = "";
|
||||
if (remoteCalling)
|
||||
tCounter--;
|
||||
if (tCounter < 0)
|
||||
{
|
||||
answ = "btn-info";
|
||||
tCounter = startCounter;
|
||||
}
|
||||
// aggiungo colore secondo valore...
|
||||
if (tCounter > startCounter * 0.6)
|
||||
{
|
||||
bandColor = "#00FF00";
|
||||
}
|
||||
else if (tCounter > startCounter * 0.3)
|
||||
{
|
||||
bandColor = "#26ED26";
|
||||
}
|
||||
else if (tCounter > startCounter * 0.1)
|
||||
{
|
||||
bandColor = "#DCFD15";
|
||||
}
|
||||
else
|
||||
{
|
||||
answ = ChannelAuth ? "btn-outline-success" : "btn-warning";
|
||||
bandColor = "#DC2615";
|
||||
}
|
||||
|
||||
return answ;
|
||||
await InvokeAsync(StateHasChanged);
|
||||
}
|
||||
}
|
||||
|
||||
private bool ChannelAuth
|
||||
{
|
||||
get => ACService.ChannelAuth;
|
||||
}
|
||||
|
||||
private bool remoteCalling = false;
|
||||
|
||||
private async Task TrySync()
|
||||
{
|
||||
remoteCalling = true;
|
||||
@@ -215,5 +263,7 @@ namespace EgwControlCenter.App.Components.Compo
|
||||
await Task.Delay(10);
|
||||
remoteCalling = false;
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Version>1.1.2412.3011</Version>
|
||||
<Version>1.1.2412.3016</Version>
|
||||
<Configurations>Debug;Release;DEBUG_Local</Configurations>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
|
||||
@@ -4,8 +4,8 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<ApplicationRevision>3011</ApplicationRevision>
|
||||
<ApplicationVersion>1.1.2412.3011</ApplicationVersion>
|
||||
<ApplicationRevision>3016</ApplicationRevision>
|
||||
<ApplicationVersion>1.1.2412.3016</ApplicationVersion>
|
||||
<BootstrapperEnabled>True</BootstrapperEnabled>
|
||||
<Configuration>Release</Configuration>
|
||||
<CreateWebPageOnPublish>True</CreateWebPageOnPublish>
|
||||
|
||||
@@ -29,6 +29,10 @@ a,
|
||||
.btn-link {
|
||||
color: #0071c1;
|
||||
}
|
||||
.text-center {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
.btn-primary {
|
||||
color: #fff;
|
||||
background-color: #1b6ec2;
|
||||
|
||||
@@ -23,6 +23,11 @@ a, .btn-link {
|
||||
color: #0071c1;
|
||||
}
|
||||
|
||||
.text-center {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
color: #fff;
|
||||
background-color: #1b6ec2;
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
h1,h2,h3,h4,h5,h6,b,display-1,display-2,display-3,display-4{font-family:'Lato',sans-serif;}html,body{font-family:'Roboto Condensed',sans-serif;line-height:1.3;}h1:focus{outline:0;}a,.btn-link{color:#0071c1;}.btn-primary{color:#fff;background-color:#1b6ec2;border-color:#1861ac;}.valid.modified:not([type=checkbox]){outline:1px solid #26b050;}.invalid{outline:1px solid #f00;}.validation-message{color:#f00;}#blazor-error-ui{background:#ffffe0;bottom:0;box-shadow:0 -1px 2px rgba(0,0,0,.2);display:none;left:0;padding:.6rem 1.25rem .7rem 1.25rem;position:fixed;width:100%;z-index:1000;}#blazor-error-ui .dismiss{cursor:pointer;position:absolute;right:.75rem;top:.5rem;}.bottom-row{color:#dedede;background-color:#000;height:1.6rem;align-items:center;}@media(max-width:640px){body{font-size:.8em;line-height:1.1;}}@media(max-width:1650px){body{font-size:.9em;line-height:1.2;}}
|
||||
h1,h2,h3,h4,h5,h6,b,display-1,display-2,display-3,display-4{font-family:'Lato',sans-serif;}html,body{font-family:'Roboto Condensed',sans-serif;line-height:1.3;}h1:focus{outline:0;}a,.btn-link{color:#0071c1;}.text-center{display:flex;justify-content:center;}.btn-primary{color:#fff;background-color:#1b6ec2;border-color:#1861ac;}.valid.modified:not([type=checkbox]){outline:1px solid #26b050;}.invalid{outline:1px solid #f00;}.validation-message{color:#f00;}#blazor-error-ui{background:#ffffe0;bottom:0;box-shadow:0 -1px 2px rgba(0,0,0,.2);display:none;left:0;padding:.6rem 1.25rem .7rem 1.25rem;position:fixed;width:100%;z-index:1000;}#blazor-error-ui .dismiss{cursor:pointer;position:absolute;right:.75rem;top:.5rem;}.bottom-row{color:#dedede;background-color:#000;height:1.6rem;align-items:center;}@media(max-width:640px){body{font-size:.8em;line-height:1.1;}}@media(max-width:1650px){body{font-size:.9em;line-height:1.2;}}
|
||||
@@ -81,6 +81,19 @@ namespace EgwControlCenter.Core
|
||||
}
|
||||
}
|
||||
|
||||
private Random rnd = new Random();
|
||||
|
||||
/// <summary>
|
||||
/// Restituisce un codice di auth temporaneo da autorizzare
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public int GetAuthPassocde()
|
||||
{
|
||||
// fixme todo !!! implementare da lettura remota oppure gen locale...
|
||||
int tempCode = rnd.Next(10000000, 99999999);
|
||||
return tempCode;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// verifica autorizzazione al canale, ovvero
|
||||
/// - deve avere tutte le chiavi/registri di comunicazione
|
||||
|
||||
Reference in New Issue
Block a user