120 lines
4.9 KiB
Plaintext
120 lines
4.9 KiB
Plaintext
@page "/"
|
|
@attribute [Authorize]
|
|
@using ScadaLink.Commons.Interfaces.Repositories
|
|
@inject ISiteRepository SiteRepository
|
|
@inject ITemplateEngineRepository TemplateEngineRepository
|
|
@inject IInboundApiRepository InboundApiRepository
|
|
|
|
<div class="container-fluid mt-3">
|
|
<div class="d-flex justify-content-between align-items-center mb-3">
|
|
<h4 class="mb-0">Welcome to ScadaLink</h4>
|
|
<AuthorizeView>
|
|
<Authorized>
|
|
<span class="text-muted small">
|
|
@* CentralUI-024: claim type resolved via JwtTokenService. *@
|
|
Signed in as <strong>@context.User.GetDisplayName()</strong>
|
|
</span>
|
|
</Authorized>
|
|
</AuthorizeView>
|
|
</div>
|
|
<p class="text-muted">Central management console for the ScadaLink SCADA system.</p>
|
|
|
|
@* KPI row *@
|
|
<div class="row g-3 mb-4">
|
|
<div class="col-lg-3 col-md-6 col-12">
|
|
<div class="card h-100">
|
|
<div class="card-body text-center">
|
|
<div class="fs-2 fw-bold">@(_loaded ? _siteCount.ToString() : "—")</div>
|
|
<div class="text-muted small">Sites configured</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-lg-3 col-md-6 col-12">
|
|
<div class="card h-100">
|
|
<div class="card-body text-center">
|
|
<div class="fs-2 fw-bold">@(_loaded ? _dataConnectionCount.ToString() : "—")</div>
|
|
<div class="text-muted small">Data connections configured</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-lg-3 col-md-6 col-12">
|
|
<div class="card h-100">
|
|
<div class="card-body text-center">
|
|
<div class="fs-2 fw-bold">@(_loaded ? _templateCount.ToString() : "—")</div>
|
|
<div class="text-muted small">Templates</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-lg-3 col-md-6 col-12">
|
|
<div class="card h-100">
|
|
<div class="card-body text-center">
|
|
<div class="fs-2 fw-bold">@(_loaded ? _apiKeyCount.ToString() : "—")</div>
|
|
<div class="text-muted small">API keys</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
@* Quick actions *@
|
|
<h6 class="text-muted text-uppercase small mb-2">Quick actions</h6>
|
|
<div class="row g-3">
|
|
<div class="col-lg-4 col-md-6 col-12">
|
|
<a class="card h-100 text-decoration-none text-reset" href="/monitoring/health">
|
|
<div class="card-body">
|
|
<div class="d-flex justify-content-between align-items-start">
|
|
<h6 class="mb-1">Health Dashboard</h6>
|
|
<span class="text-muted">→</span>
|
|
</div>
|
|
<p class="text-muted small mb-0">Live cluster, data connection, and queue health per site.</p>
|
|
</div>
|
|
</a>
|
|
</div>
|
|
<div class="col-lg-4 col-md-6 col-12">
|
|
<a class="card h-100 text-decoration-none text-reset" href="/monitoring/audit-log">
|
|
<div class="card-body">
|
|
<div class="d-flex justify-content-between align-items-start">
|
|
<h6 class="mb-1">Recent Audit Log</h6>
|
|
<span class="text-muted">→</span>
|
|
</div>
|
|
<p class="text-muted small mb-0">Browse changes to configuration and deployments.</p>
|
|
</div>
|
|
</a>
|
|
</div>
|
|
<div class="col-lg-4 col-md-6 col-12">
|
|
<a class="card h-100 text-decoration-none text-reset" href="/design/templates">
|
|
<div class="card-body">
|
|
<div class="d-flex justify-content-between align-items-start">
|
|
<h6 class="mb-1">Templates</h6>
|
|
<span class="text-muted">→</span>
|
|
</div>
|
|
<p class="text-muted small mb-0">Design templates, shared scripts, and external systems.</p>
|
|
</div>
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
@code {
|
|
private bool _loaded;
|
|
private int _siteCount;
|
|
private int _dataConnectionCount;
|
|
private int _templateCount;
|
|
private int _apiKeyCount;
|
|
|
|
protected override async Task OnInitializedAsync()
|
|
{
|
|
try
|
|
{
|
|
_siteCount = (await SiteRepository.GetAllSitesAsync()).Count;
|
|
_dataConnectionCount = (await SiteRepository.GetAllDataConnectionsAsync()).Count;
|
|
_templateCount = (await TemplateEngineRepository.GetAllTemplatesAsync()).Count;
|
|
_apiKeyCount = (await InboundApiRepository.GetAllApiKeysAsync()).Count;
|
|
}
|
|
catch
|
|
{
|
|
// Non-fatal — leave counts at zero with the placeholder rendering.
|
|
}
|
|
_loaded = true;
|
|
}
|
|
}
|