package incident import ( "log" "net/http" laravel "go.laravel.com" "go.laravel.com/inertia" "go.laravel.com/web" "app/services" ) type view struct { Available bool `json:"available"` Message string `json:"message"` Incident services.IncidentSnapshot `json:"incident"` } func Show(request *web.Request) *web.Response { scope := request.PathValue("scope") target := request.PathValue("target") if !services.ValidDoctorTarget(scope, target) { return web.Abort(http.StatusNotFound) } result := view{Message: "Focused Doctor evidence is temporarily unavailable."} incident, err := services.From(request.Context()).Jeannie.Doctor(request.Context(), scope, target) if err != nil { log.Printf("OpsProof could not collect Doctor evidence for %s/%s: %v", scope, target, err) } else { result.Available = true result.Message = "Read-only evidence collected by the focused Jeannie Doctor." result.Incident = incident } return inertia.Render("Incident", inertia.Props{ "laravelVersion": laravel.Version, "view": result, }) }