add event_date column to event_knowledge and event_predictions tables; update related logic in admin panel and augorWorker

This commit is contained in:
ImBenji
2026-04-23 16:41:29 +01:00
parent 8d259eb4d1
commit e2e39f2836
2 changed files with 37 additions and 18 deletions
+23 -16
View File
@@ -1427,19 +1427,30 @@ function renderIntelGraph() {
.attr('stroke-opacity', d => 0.2 + (d.count / maxCount) * 0.7)
.attr('marker-end', 'url(#ig-arrow)');
// edge labels — only on edges where count >= median, to avoid hub clutter
const sortedCounts = linksCopy.map(l => l.count).sort((a, b) => a - b);
const medianCount = sortedCounts[Math.floor(sortedCounts.length / 2)] || 1;
// hover label — one floating text element that follows mouse
const hoverLabel = svg.append('text')
.attr('font-size', 11)
.attr('fill', '#94a3b8')
.attr('pointer-events', 'none')
.attr('opacity', 0);
const linkLabels = linkG.selectAll('text')
.data(linksCopy.filter(l => l.count >= medianCount))
.join('text')
.text(d => d.type)
.attr('text-anchor', 'middle')
.attr('font-size', d => 8 + Math.round((d.count / maxCount) * 3))
.attr('fill', '#475569')
.attr('opacity', d => 0.45 + (d.count / maxCount) * 0.45)
.attr('pointer-events', 'none');
linkLines
.on('mouseenter', function(ev, d) {
d3.select(this).attr('stroke', '#60a5fa').attr('stroke-opacity', 1);
hoverLabel.text(`${d.type} ×${d.count}`).attr('opacity', 1);
})
.on('mousemove', function(ev) {
const [mx, my] = d3.pointer(ev, svgEl);
hoverLabel.attr('x', mx + 10).attr('y', my - 6);
})
.on('mouseleave', function(ev, d) {
d3.select(this)
.attr('stroke', '#334155')
.attr('stroke-opacity', 0.2 + (d.count / maxCount) * 0.7);
hoverLabel.attr('opacity', 0);
});
const linkLabels = { attr: () => {} }; // no-op so tick handler doesnt break
// nodes
@@ -1535,10 +1546,6 @@ function renderIntelGraph() {
.attr('x2', d => d.target.x)
.attr('y2', d => d.target.y);
linkLabels
.attr('x', d => (d.source.x + d.target.x) / 2)
.attr('y', d => (d.source.y + d.target.y) / 2 - 3);
nodeGroups.attr('transform', d => `translate(${d.x},${d.y})`);
});