Files
mapo-core/MP.RIOC/Pages/Index.cshtml
T
Samuele Locatelli facd8c0856 Fix solution MP.RIOC
2026-05-08 12:13:12 +02:00

97 lines
4.0 KiB
Plaintext

@page
@using MP.RIOC.Services
@inject RouteStatsManager StatsManager
@{
Layout = null;
var rawData = StatsManager.Snapshot();
var metrics = rawData.OrderByDescending(x => x.Value.Count).Take(10);
}
<!DOCTYPE html>
<html>
<head>
<title>MP.RIOC Dashboard</title>
<style>
body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background: #f0f2f5; padding: 30px; color: #333; }
.card { background: white; padding: 25px; border-radius: 12px; box-shadow: 0 4px 15px rgba(0,0,0,0.1); max-width: 900px; margin: auto; }
h1 { color: #0056b3; margin-top: 0; }
table { width: 100%; border-collapse: collapse; margin-top: 20px; }
th, td { text-align: left; padding: 12px; border-bottom: 1px solid #eee; }
th { background-color: #f8f9fa; color: #666; text-transform: uppercase; font-size: 0.85em; }
.tag { padding: 4px 8px; border-radius: 4px; font-size: 0.8em; font-weight: bold; }
.tag-ioc { background: #e3f2fd; color: #0d47a1; }
.tag-io { background: #fff3e0; color: #e65100; }
.latency { font-family: monospace; font-weight: bold; }
.d-flex { display: flex !important; }
.justify-content-between { justify-content: space-between !important; }
.align-items-center { align-items: center !important; }
.flex-column { flex-direction: column !important; }
.text-end { text-align: right !important; }
.px-0 { padding-left: 0 !important; padding-right: 0 !important; }
/* Miglioramento per l'intestazione custom */
.header-container {
border-bottom: 2px solid #0056b3;
margin-bottom: 20px;
padding-bottom: 10px;
}
h1 { margin: 0; font-size: 2.5em; color: #0056b3; line-height: 1; }
h2 { margin: 0; font-size: 1.8em; color: #333; line-height: 1; }
h3 { margin: 5px 0 0 0; font-size: 1em; color: #666; font-weight: normal; }
</style>
</head>
<body>
<div class="card">
<div class="d-flex justify-content-between align-items-center header-container">
<div class="px-0">
<h1>MAPO MES</h1>
<div>Live Dashboard</div>
</div>
<div class="px-0 text-end">
<h2>MP-RIOC</h2>
<h3>Router I/O Controller</h3>
</div>
</div>
<div class="d-flex justify-content-between align-items-center">
<div class="px-0">
Stato: <span style="color:green">● Online</span>
</div>
<div class="px-0 text-end">
Versione: @System.Reflection.Assembly.GetExecutingAssembly().GetName().Version
</div>
</div>
<table>
<thead>
<tr>
<th>Target | Metodo | ID</th>
<th class="text-end">Chiamate</th>
<th class="text-end">Latenza Media</th>
</tr>
</thead>
<tbody>
@foreach (var stat in metrics)
{
<tr>
<td>
@if(stat.Key.StartsWith("IOC")) { <span class="tag tag-ioc">NEW</span> }
else { <span class="tag tag-io">OLD</span> }
@stat.Key
</td>
<td class="text-end">@stat.Value.Count</td>
<td class="latency text-end">@(stat.Value.AvgDuration)ms</td>
</tr>
}
@if (!metrics.Any())
{
<tr>
<td colspan="3" style="text-align:center; padding: 40px; color: #999;">Nessun dato raccolto al momento.</td>
</tr>
}
</tbody>
</table>
<div class="text-end" style="margin-top: 20px; font-size: 0.8em; color: #999;">
Ultimo aggiornamento: @DateTime.Now.ToString("HH:mm:ss")
</p>
</div>
</body>
</html>