fix(nodes): Fix Swapper Service and DAGI Router display in node cabinets
- Move swapper-service from 'up' to 'healthy' list for NODE1 - Add dagi-router to healthy containers for NODE2 - Fix port parsing to handle 'host_port:container_port' format - Improve service name formatting (swapper-service -> Swapper Service) - Update statistics to reflect correct container counts
This commit is contained in:
@@ -163,8 +163,8 @@ function getNode1RealInventory(nodeId: string): NodeInventory {
|
||||
node_name: 'НОДА1',
|
||||
statistics: {
|
||||
containers_total: 22,
|
||||
containers_healthy: 13,
|
||||
containers_up: 4,
|
||||
containers_healthy: 14,
|
||||
containers_up: 3,
|
||||
containers_problematic: 5,
|
||||
bots_total: 10,
|
||||
bots_active: 8,
|
||||
@@ -178,6 +178,7 @@ function getNode1RealInventory(nodeId: string): NodeInventory {
|
||||
docker_containers: {
|
||||
healthy: [
|
||||
{ id: 'dagi-router', name: 'dagi-router', image: 'dagi-router:latest', status: 'Healthy (30 min)', ports: ['9102:9102'], created: '2025-01-01T00:00:00Z', state: 'healthy', uptime: '30 min', purpose: 'Core routing service' },
|
||||
{ id: 'swapper-service', name: 'swapper-service', image: 'swapper-service:latest', status: 'Healthy (16 hours)', ports: ['8890:8890'], created: '2025-01-01T00:00:00Z', state: 'healthy', uptime: '16 hours', purpose: 'Dynamic LLM loading/unloading' },
|
||||
{ id: 'dagi-gateway', name: 'dagi-gateway', image: 'dagi-gateway:latest', status: 'Healthy (8 hours)', ports: ['9300:9300'], created: '2025-01-01T00:00:00Z', state: 'healthy', uptime: '8 hours', purpose: 'Telegram bots gateway' },
|
||||
{ id: 'dagi-devtools', name: 'dagi-devtools', image: 'dagi-devtools:latest', status: 'Healthy (2 days)', ports: ['8008:8008'], created: '2025-01-01T00:00:00Z', state: 'healthy', uptime: '2 days', purpose: 'Development tools backend' },
|
||||
{ id: 'dagi-crewai', name: 'dagi-crewai', image: 'dagi-crewai:latest', status: 'Healthy (2 days)', ports: ['9010:9010'], created: '2025-01-01T00:00:00Z', state: 'healthy', uptime: '2 days', purpose: 'CrewAI orchestrator' },
|
||||
@@ -192,7 +193,6 @@ function getNode1RealInventory(nodeId: string): NodeInventory {
|
||||
{ id: 'dagi-qdrant', name: 'dagi-qdrant', image: 'qdrant/qdrant:latest', status: 'Up (2 days)', ports: ['6333:6333', '6334:6334'], created: '2025-01-01T00:00:00Z', state: 'running', uptime: '2 days', purpose: 'Vector database' },
|
||||
],
|
||||
up: [
|
||||
{ id: 'swapper-service', name: 'swapper-service', image: 'swapper-service:latest', status: 'Up (16 hours)', ports: ['8890:8890'], created: '2025-01-01T00:00:00Z', state: 'running', uptime: '16 hours', purpose: 'Dynamic LLM loading/unloading' },
|
||||
{ id: 'telegram-gateway', name: 'telegram-gateway', image: 'telegram-gateway:latest', status: 'Up (47 hours)', ports: ['8000:8000'], created: '2025-01-01T00:00:00Z', state: 'running', uptime: '47 hours', purpose: 'Telegram gateway' },
|
||||
{ id: 'telegram-bot-api', name: 'telegram-bot-api', image: 'aiogram/telegram-bot-api:latest', status: 'Up (4 days)', ports: ['8081:8081'], created: '2025-01-01T00:00:00Z', state: 'running', uptime: '4 days', purpose: 'Telegram Bot API' },
|
||||
{ id: 'nginx-gateway', name: 'nginx-gateway', image: 'nginx:latest', status: 'Up (5 days)', ports: ['80:80', '443:443'], created: '2025-01-01T00:00:00Z', state: 'running', uptime: '5 days', purpose: 'HTTPS gateway (Let\'s Encrypt)' },
|
||||
@@ -306,8 +306,8 @@ function getMockInventory(nodeId: string): NodeInventory {
|
||||
node_id: nodeId,
|
||||
node_name: 'НОДА2',
|
||||
statistics: {
|
||||
containers_total: 0,
|
||||
containers_healthy: 0,
|
||||
containers_total: 1,
|
||||
containers_healthy: 1,
|
||||
containers_up: 0,
|
||||
containers_problematic: 0,
|
||||
bots_total: 0,
|
||||
@@ -317,10 +317,12 @@ function getMockInventory(nodeId: string): NodeInventory {
|
||||
databases_total: 0,
|
||||
ollama_models_installed: 0,
|
||||
ollama_models_needed: 0,
|
||||
services_total: 0,
|
||||
services_total: 1,
|
||||
},
|
||||
docker_containers: {
|
||||
healthy: [],
|
||||
healthy: [
|
||||
{ id: 'dagi-router', name: 'dagi-router', image: 'dagi-router:latest', status: 'Healthy', ports: ['9102:9102'], created: '2025-01-01T00:00:00Z', state: 'healthy', uptime: '1 day', purpose: 'Core routing service' },
|
||||
],
|
||||
up: [],
|
||||
problematic: [],
|
||||
},
|
||||
|
||||
@@ -146,40 +146,47 @@ export function NodeCabinetPage() {
|
||||
if (inv) {
|
||||
// Healthy сервіси
|
||||
inv.docker_containers.healthy.forEach(container => {
|
||||
const port = container.ports?.[0]?.split(':')[0] || '';
|
||||
// Формат портів: "host_port:container_port" або просто "port"
|
||||
const portStr = container.ports?.[0] || '';
|
||||
const port = portStr.includes(':') ? portStr.split(':')[0] : portStr;
|
||||
const portNum = parseInt(port) || 0;
|
||||
services.push({
|
||||
name: container.name.replace('dagi-', '').replace('-', ' '),
|
||||
name: container.name.replace('dagi-', '').replace('swapper-service', 'Swapper Service').replace(/-/g, ' '),
|
||||
status: 'running',
|
||||
port: parseInt(port) || 0,
|
||||
port: portNum,
|
||||
url: isNode1
|
||||
? `http://144.76.224.179:${port}`
|
||||
: `http://192.168.1.244:${port}`,
|
||||
? `http://144.76.224.179:${portNum}`
|
||||
: `http://192.168.1.244:${portNum}`,
|
||||
});
|
||||
});
|
||||
|
||||
// Running сервіси
|
||||
inv.docker_containers.up.forEach(container => {
|
||||
const port = container.ports?.[0]?.split(':')[0] || '';
|
||||
const portStr = container.ports?.[0] || '';
|
||||
const port = portStr.includes(':') ? portStr.split(':')[0] : portStr;
|
||||
const portNum = parseInt(port) || 0;
|
||||
services.push({
|
||||
name: container.name.replace('dagi-', '').replace('-', ' '),
|
||||
name: container.name.replace('dagi-', '').replace(/-/g, ' '),
|
||||
status: 'running',
|
||||
port: parseInt(port) || 0,
|
||||
port: portNum,
|
||||
url: isNode1
|
||||
? `http://144.76.224.179:${port}`
|
||||
: `http://192.168.1.244:${port}`,
|
||||
? `http://144.76.224.179:${portNum}`
|
||||
: `http://192.168.1.244:${portNum}`,
|
||||
});
|
||||
});
|
||||
|
||||
// Problematic сервіси
|
||||
inv.docker_containers.problematic.forEach(container => {
|
||||
const port = container.ports?.[0]?.split(':')[0] || '';
|
||||
const portStr = container.ports?.[0] || '';
|
||||
const port = portStr.includes(':') ? portStr.split(':')[0] : portStr;
|
||||
const portNum = parseInt(port) || 0;
|
||||
services.push({
|
||||
name: container.name.replace('dagi-', '').replace('-', ' '),
|
||||
name: container.name.replace('dagi-', '').replace(/-/g, ' '),
|
||||
status: container.state === 'restarting' ? 'restarting' : 'unhealthy',
|
||||
port: parseInt(port) || 0,
|
||||
port: portNum,
|
||||
url: isNode1
|
||||
? `http://144.76.224.179:${port}`
|
||||
: `http://192.168.1.244:${port}`,
|
||||
? `http://144.76.224.179:${portNum}`
|
||||
: `http://192.168.1.244:${portNum}`,
|
||||
});
|
||||
});
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user