From 7ce8735c049e6663195741bfd6d455348bde873f Mon Sep 17 00:00:00 2001 From: Jonas Pacheco Date: Thu, 2 Apr 2026 14:46:36 -0300 Subject: [PATCH] feat(kernel): adiciona dashboard HTML visual MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Adiciona interface web dark theme com cards de estatísticas - Lista de serviços com status, health e ações (start/stop/restart) - Console de logs em tempo real com filtro por serviço - WebSocket para atualizações em tempo real - Auto-refresh a cada 5 segundos Refs: Dashboard Arcadia Kernel --- server/kernel/dashboard/DashboardServer.ts | 35 +- server/kernel/dashboard/public/index.html | 727 +++++++++++++++++++++ 2 files changed, 752 insertions(+), 10 deletions(-) create mode 100644 server/kernel/dashboard/public/index.html diff --git a/server/kernel/dashboard/DashboardServer.ts b/server/kernel/dashboard/DashboardServer.ts index 2eb4aff..9e0d34b 100644 --- a/server/kernel/dashboard/DashboardServer.ts +++ b/server/kernel/dashboard/DashboardServer.ts @@ -5,6 +5,9 @@ import express, { Application, Request, Response } from 'express'; import { createServer, Server } from 'http'; +import { readFileSync } from 'fs'; +import { join, dirname } from 'path'; +import { fileURLToPath } from 'url'; import { ProcessManager } from '../core/ProcessManager'; import { HealthMonitor } from '../core/HealthMonitor'; import { LogAggregator } from '../core/LogAggregator'; @@ -101,17 +104,29 @@ export class DashboardServer { ); this.app.use('/api/kernel', kernelRoutes); + // Serve dashboard HTML + const __filename = fileURLToPath(import.meta.url); + const __dirname = dirname(__filename); + const publicPath = join(__dirname, 'public'); + this.app.get('/', (req: Request, res: Response) => { - res.json({ - name: 'Arcadia Kernel Dashboard', - version: '1.0.0', - endpoints: { - dashboard: '/', - health: '/health', - api: '/api/kernel', - websocket: '/ws/kernel', - } - }); + try { + const indexPath = join(publicPath, 'index.html'); + const html = readFileSync(indexPath, 'utf-8'); + res.setHeader('Content-Type', 'text/html'); + res.send(html); + } catch (error) { + res.json({ + name: 'Arcadia Kernel Dashboard', + version: '1.0.0', + error: 'Dashboard HTML not found', + endpoints: { + health: '/health', + api: '/api/kernel', + websocket: '/ws/kernel', + } + }); + } }); } } diff --git a/server/kernel/dashboard/public/index.html b/server/kernel/dashboard/public/index.html new file mode 100644 index 0000000..88e8375 --- /dev/null +++ b/server/kernel/dashboard/public/index.html @@ -0,0 +1,727 @@ + + + + + + Arcadia Kernel Dashboard + + + +
+ +
+ + Online +
+
+ +
+ +
+
+
+
📦
+
Total de Serviços
+
+
-
+
+
+
+
🚀
+
Rodando
+
+
-
+
+
+
+
❤️
+
Healthy
+
+
-
+
+
+
+
📝
+
Total de Logs
+
+
-
+
+
+ + +
+
+
+ 🔧 Serviços +
+
+ + + +
+
+
+
+
+
+
+
+ + +
+
+
+ 📜 Logs Recentes +
+
+ + +
+
+
+
Carregando logs...
+
+
+
+ +
+ + WebSocket: Conectando... +
+ + + +