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:
@@ -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