lecoffre_node/web/status/index.html

218 lines
6.8 KiB
HTML

<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>LeCoffre Node - Status</title>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: #333;
min-height: 100vh;
}
.container {
max-width: 1200px;
margin: 0 auto;
padding: 20px;
}
.header {
text-align: center;
color: white;
margin-bottom: 30px;
}
.header h1 {
font-size: 2.5em;
margin-bottom: 10px;
text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}
.header p {
font-size: 1.2em;
opacity: 0.9;
}
.services-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: 20px;
margin-bottom: 30px;
}
.service-card {
background: white;
border-radius: 10px;
padding: 20px;
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
transition: transform 0.3s ease;
}
.service-card:hover {
transform: translateY(-5px);
}
.service-header {
display: flex;
align-items: center;
margin-bottom: 15px;
}
.status-indicator {
width: 12px;
height: 12px;
border-radius: 50%;
margin-right: 10px;
}
.status-up { background-color: #4CAF50; }
.status-down { background-color: #f44336; }
.status-warning { background-color: #ff9800; }
.service-title {
font-size: 1.3em;
font-weight: bold;
color: #2c3e50;
}
.service-description {
color: #7f8c8d;
margin-bottom: 15px;
}
.service-url {
color: #3498db;
text-decoration: none;
font-weight: 500;
}
.service-url:hover {
text-decoration: underline;
}
.footer {
text-align: center;
color: white;
margin-top: 30px;
opacity: 0.8;
}
.refresh-btn {
background: #3498db;
color: white;
border: none;
padding: 10px 20px;
border-radius: 5px;
cursor: pointer;
margin: 20px 0;
font-size: 1em;
}
.refresh-btn:hover {
background: #2980b9;
}
.timestamp {
color: #95a5a6;
font-size: 0.9em;
}
</style>
</head>
<body>
<div class="container">
<div class="header">
<h1>🚀 LeCoffre Node</h1>
<p>Architecture Autonome - Tableau de Bord des Services</p>
</div>
<div style="text-align: center;">
<button class="refresh-btn" onclick="refreshStatus()">🔄 Actualiser</button>
<div class="timestamp" id="timestamp"></div>
</div>
<div class="services-grid" id="services-grid">
<!-- Les services seront chargés dynamiquement -->
</div>
<div class="footer">
<p>LeCoffre Node - Architecture Autonome Complète</p>
<p>Monitoring et logs disponibles via Grafana</p>
</div>
</div>
<script>
const services = [
{
name: "Status API",
description: "API de surveillance des services",
url: "/status/api/health",
endpoint: "/api/health"
},
{
name: "Grafana",
description: "Interface de monitoring et logs",
url: "/grafana/",
endpoint: "/grafana/"
},
{
name: "LeCoffre Frontend",
description: "Application principale LeCoffre",
url: "/lecoffre/",
endpoint: "/lecoffre/"
},
{
name: "IHM Client",
description: "Interface client 4NK",
url: "/",
endpoint: "/"
},
{
name: "API Backend",
description: "API REST LeCoffre",
url: "/api/v1/health",
endpoint: "/api/v1/health"
},
{
name: "WebSocket Relay",
description: "Communication temps réel",
url: "/ws/",
endpoint: "/ws/"
}
];
async function checkServiceStatus(service) {
try {
const response = await fetch(service.endpoint, {
method: 'HEAD',
timeout: 5000
});
return response.ok ? 'up' : 'down';
} catch (error) {
return 'down';
}
}
async function refreshStatus() {
const grid = document.getElementById('services-grid');
grid.innerHTML = '<div style="text-align: center; color: white;">Chargement...</div>';
const serviceCards = await Promise.all(services.map(async (service) => {
const status = await checkServiceStatus(service);
const statusClass = `status-${status}`;
const statusText = status === 'up' ? 'En ligne' : 'Hors ligne';
return `
<div class="service-card">
<div class="service-header">
<div class="status-indicator ${statusClass}"></div>
<div class="service-title">${service.name}</div>
</div>
<div class="service-description">${service.description}</div>
<div>
<a href="${service.url}" class="service-url" target="_blank">
Accéder au service →
</a>
</div>
<div style="margin-top: 10px; font-size: 0.9em; color: #7f8c8d;">
Statut: ${statusText}
</div>
</div>
`;
}));
grid.innerHTML = serviceCards.join('');
document.getElementById('timestamp').textContent =
`Dernière mise à jour: ${new Date().toLocaleString('fr-FR')}`;
}
// Actualisation automatique toutes les 30 secondes
refreshStatus();
setInterval(refreshStatus, 30000);
</script>
</body>
</html>