@using GWMS.Data
@using GWMS.UI.Data
@using GWMS.UI.Components
@inject GWMSDataService DataService
@inject MessageService AppMService
@inject IJSRuntime JSRuntime
@if (!DbAllOk)
{
DB Init
@if (!DbUserOk)
{
}
else if (!DbIdentity)
{
}
}
@code {
[Parameter]
public EventCallback evRefresh { get; set; }
[Parameter]
public EventCallback evProcessing { get; set; }
protected async Task initDb()
{
if (!await JSRuntime.InvokeAsync("confirm", "Sicuro di voler effettuare inizializzazione/migrazione DB?"))
return;
reportProcess();
await DbAdmin.migrateDbMain();
await ReloadData();
reportChange();
}
protected async Task initIdent()
{
if (!await JSRuntime.InvokeAsync("confirm", "Sicuro di voler effettuare inizializzazione/migrazione servizi Identity?"))
return;
reportProcess();
await DbAdmin.migrateDbIdentity();
await ReloadData();
reportChange();
}
protected bool DbUserOk { get; set; } = false;
protected bool DbIdentity { get; set; } = false;
protected bool DbAllOk { get; set; } = false;
protected override async Task OnInitializedAsync()
{
await ReloadData();
}
protected async Task ReloadData()
{
var resultIden = await Health.Checks.DbIdentity(DbConfig.DATABASE_NAME);
DbIdentity = (resultIden.Status == HealthStatus.Healthy);
DbAllOk = (DbIdentity);
}
private void reportChange()
{
evRefresh.InvokeAsync(1);
}
private void reportProcess()
{
evProcessing.InvokeAsync(1);
}
}