MCPcopy
hub / github.com/PatchMon/PatchMon / Hosts

Method Hosts

server-source-code/internal/handler/dashboard.go:41–60  ·  view source on GitHub ↗

Hosts handles GET /dashboard/hosts.

(w http.ResponseWriter, r *http.Request)

Source from the content-addressed store, hash-verified

39
40// Hosts handles GET /dashboard/hosts.
41func (h *DashboardHandler) Hosts(w http.ResponseWriter, r *http.Request) {
42 q := r.URL.Query()
43 search := q.Get("search")
44 if len(search) > 200 {
45 search = search[:200]
46 }
47 params := store.HostsListParams{
48 Search: search,
49 Group: q.Get("group"),
50 Status: q.Get("status"),
51 OS: q.Get("os"),
52 OSVersion: q.Get("osVersion"),
53 }
54 hosts, err := h.dashboard.GetHostsWithCounts(r.Context(), params)
55 if err != nil {
56 Error(w, http.StatusInternalServerError, "Failed to load hosts")
57 return
58 }
59 JSON(w, http.StatusOK, hosts)
60}
61
62// HostDetail handles GET /dashboard/hosts/:hostId.
63func (h *DashboardHandler) HostDetail(w http.ResponseWriter, r *http.Request) {

Callers

nothing calls this directly

Calls 5

ErrorFunction · 0.85
QueryMethod · 0.80
JSONFunction · 0.70
GetHostsWithCountsMethod · 0.65
GetMethod · 0.45

Tested by

no test coverage detected