@@ -1,5 +1,10 @@
|
||||
import { useMemo } from "react";
|
||||
import { Graph, type GraphData, type GraphNode, type GraphLink } from "@/modules/graph";
|
||||
import {
|
||||
Graph,
|
||||
type GraphData,
|
||||
type GraphNode,
|
||||
type GraphLink,
|
||||
} from "@/modules/graph";
|
||||
import { useAgentStore } from "@/app/providers/layout/store/agent.store";
|
||||
|
||||
const buildGraphFromAgents = (): GraphData => {
|
||||
@@ -10,26 +15,26 @@ const buildGraphFromAgents = (): GraphData => {
|
||||
agents.forEach((agent) => {
|
||||
// Агент как узел
|
||||
nodes.push({
|
||||
id: agent.name,
|
||||
name: agent.name,
|
||||
id: agent.label,
|
||||
name: agent.label,
|
||||
type: "agent",
|
||||
val: 8,
|
||||
description: `Агент: ${agent.name}`,
|
||||
description: `Агент: ${agent.label}`,
|
||||
});
|
||||
|
||||
// Сервисы агента как узлы + связи
|
||||
agent.services.forEach((service) => {
|
||||
const serviceId = `${agent.name}-${service.name}`;
|
||||
const serviceId = `${agent.label}-${service}`;
|
||||
nodes.push({
|
||||
id: serviceId,
|
||||
name: service.name,
|
||||
name: service,
|
||||
type: "service",
|
||||
val: 12,
|
||||
description: `Сервис: ${service.name} (${service.status})`,
|
||||
description: `Сервис: ${service}`,
|
||||
});
|
||||
|
||||
links.push({
|
||||
source: agent.name,
|
||||
source: agent.label,
|
||||
target: serviceId,
|
||||
type: "hosts",
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user