列表正文改为按需读取;保留完整导出、版本隔离和有效标签筛选。 验证:前端全量、Go全量及隔离PG全mirror竞态通过;覆盖首批回调、续载失败与筛选分页。
This commit is contained in:
@@ -82,7 +82,10 @@ func listQAOpsRecords(w http.ResponseWriter, r *http.Request, config Config) {
|
||||
return
|
||||
}
|
||||
values := r.URL.Query()
|
||||
allowed := map[string]bool{"start": true, "end": true, "keyword": true, "cursor": true, "limit": true}
|
||||
allowed := map[string]bool{"start": true, "end": true, "keyword": true, "cursor": true, "limit": true, "projection": true}
|
||||
for _, key := range dobotaiops.QualityFilterKeys {
|
||||
allowed[key] = true
|
||||
}
|
||||
for key, items := range values {
|
||||
if !allowed[key] || len(items) != 1 {
|
||||
qaOpsError(w, dobotaiops.ErrInvalidQuery)
|
||||
@@ -102,12 +105,27 @@ func listQAOpsRecords(w http.ResponseWriter, r *http.Request, config Config) {
|
||||
return
|
||||
}
|
||||
}
|
||||
filters := map[string]string{}
|
||||
for _, key := range dobotaiops.QualityFilterKeys {
|
||||
if value := values.Get(key); value != "" {
|
||||
filters[key] = value
|
||||
}
|
||||
}
|
||||
if !dobotaiops.ValidQualityFilters(filters) {
|
||||
qaOpsError(w, dobotaiops.ErrInvalidQuery)
|
||||
return
|
||||
}
|
||||
mode := values.Get("projection")
|
||||
if mode != "" && mode != "summary" && mode != "full" {
|
||||
qaOpsError(w, dobotaiops.ErrInvalidQuery)
|
||||
return
|
||||
}
|
||||
projection, err := recordAttribution(r.Context(), config)
|
||||
if err != nil {
|
||||
qaOpsError(w, err)
|
||||
return
|
||||
}
|
||||
page, err := config.QAOps.ListRecords(r.Context(), dobotaiops.RecordQuery{Window: window, Keyword: values.Get("keyword"), Cursor: values.Get("cursor"), Limit: limit})
|
||||
page, err := config.QAOps.ListRecords(r.Context(), dobotaiops.RecordQuery{Window: window, Keyword: values.Get("keyword"), Cursor: values.Get("cursor"), Limit: limit, Summary: mode == "summary", Filters: filters})
|
||||
if err != nil {
|
||||
qaOpsError(w, err)
|
||||
return
|
||||
@@ -117,6 +135,11 @@ func listQAOpsRecords(w http.ResponseWriter, r *http.Request, config Config) {
|
||||
writeQualityError(w, err)
|
||||
return
|
||||
}
|
||||
if mode == "summary" {
|
||||
for i := range page.Items {
|
||||
page.Items[i] = qaRecordPreview(page.Items[i])
|
||||
}
|
||||
}
|
||||
writeJSON(w, http.StatusOK, map[string]any{"data": page})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user