mirror of
https://github.com/selfhosters-cc/container-census.git
synced 2026-01-25 07:59:35 -06:00
- 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>
24 lines
642 B
Go
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
|
|
}
|
|
}
|