Files
container-census/internal/plugins/builtin/graph/handler.go
Self Hosters 45036ca19e Convert graph plugin to built-in and fix UI issues
- Convert graph-visualizer from external to built-in plugin
- Add webpack build process for graph plugin frontend
- Fix history modal: reverse timeline sort (newest first)
- Fix history modal: correct lifetime calculation
- Fix container cards: deduplicate port displays
- Update build scripts to compile graph plugin bundle
- Fix plugin bundle URL routing in Next.js

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-05 16:53:13 -05:00

24 lines
642 B
Go

package graph
import (
"encoding/json"
"net/http"
)
// handleGraphData returns the container graph data as JSON
func (p *GraphPlugin) handleGraphData(w http.ResponseWriter, r *http.Request) {
// Get all containers from the container provider
containers := p.deps.Containers.GetContainers()
// Build the graph
graph := buildContainerGraph(containers)
// Return as JSON
w.Header().Set("Content-Type", "application/json")
if err := json.NewEncoder(w).Encode(graph); err != nil {
p.deps.Logger.Error("Failed to encode graph data: %v", err)
http.Error(w, "Failed to encode response", http.StatusInternalServerError)
return
}
}