func GetRequestRequestGroup(w http.ResponseWriter, r *http.Request) { vars := mux.Vars(r) uuid := vars["uuid"] req := model.GetRequest(uuid) if req == nil || req.GroupUuid == "" { w.WriteHeader(http.StatusNotFound) return } rg := model.GetRequestGroup(req.GroupUuid) if req == nil { w.WriteHeader(http.StatusInternalServerError) return } result := struct { Requests []*model.Request `json:"requests"` ParentsIndex []int `json:"parents_index"` }{} result.ParentsIndex = rg.ParentsIndex result.Requests = rg.DetailRequests() json.NewEncoder(w).Encode(result) }
func GetRequestInvokeChain(w http.ResponseWriter, r *http.Request) { vars := mux.Vars(r) uuid := vars["uuid"] req := model.GetRequest(uuid) if req == nil || req.GroupUuid == "" { w.WriteHeader(http.StatusNotFound) return } rg := model.GetRequestGroup(req.GroupUuid) if req == nil { w.WriteHeader(http.StatusInternalServerError) return } ic := model.GetInvokeChain(rg.InvokeChainId) if ic == nil { w.WriteHeader(http.StatusInternalServerError) return } json.NewEncoder(w).Encode(ic) }