feat(graph): nd() helper supports when+limits fields; showLegend renders them

This commit is contained in:
Дмитрий
2026-05-14 09:10:57 +03:00
parent 40b437ccb7
commit 1a7cd90c32
+17 -2
View File
@@ -325,8 +325,21 @@ const CATEGORY_LABELS = {
mcp: 'MCP-сервер', lefthook: 'Lefthook job', memory: 'Memory-файл'
};
function nd(desc, reportsTo, manages, together, conflicts) {
return { desc, reportsTo, manages, together, conflicts: conflicts || [] };
function nd(desc, when, limits, reportsTo, manages, together, conflicts) {
// Backward-compat: old 5-arg signature was nd(desc, reportsTo, manages, together, conflicts).
// If 2nd arg is an array, treat as old-style call and shift args.
if (Array.isArray(when)) {
return {
desc,
when: '',
limits: '',
reportsTo: when,
manages: limits,
together: reportsTo,
conflicts: (manages || []),
};
}
return { desc, when: when || '', limits: limits || '', reportsTo, manages, together, conflicts: conflicts || [] };
}
const NODE_DETAILS = {
@@ -918,6 +931,8 @@ function showLegend(nodeId) {
`<span style="color:${catColor}; font-weight:600;">● ${catLabel}</span>`;
document.getElementById('ld-desc').textContent = details.desc;
document.getElementById('ld-when').textContent = details.when || '—';
document.getElementById('ld-limits').textContent = details.limits || 'без особых ограничений';
const ldReports = document.getElementById('ld-reports');
ldReports.innerHTML = details.reportsTo.length