| 234 | } |
| 235 | |
| 236 | func handleGraphMermaid(dp *DataProvider) http.HandlerFunc { |
| 237 | return func(w http.ResponseWriter, r *http.Request) { |
| 238 | dp := effectiveDP(r, dp) |
| 239 | tasks, err := getFilteredTasks(dp, r) |
| 240 | if err != nil { |
| 241 | http.Error(w, err.Error(), http.StatusInternalServerError) |
| 242 | return |
| 243 | } |
| 244 | |
| 245 | g := graph.NewGraph(tasks) |
| 246 | w.Header().Set("Content-Type", "text/plain") |
| 247 | w.Write([]byte(g.ToMermaid(""))) //nolint:errcheck |
| 248 | } |
| 249 | } |
| 250 | |
| 251 | func handleStats(dp *DataProvider) http.HandlerFunc { |
| 252 | return func(w http.ResponseWriter, r *http.Request) { |