feat(assets): 任务测试资产支持 DSL 搜索
任务详情「测试资产」接口/服务多时不好找。复用资产管理页的 DSL 搜索(字段自动补全 + 分页),搜索始终限定在当前任务范围内。 - 抽出共享组件 asset-dsl-search.tsx,资产页与任务页复用,UI/交互一致 - QueryDSL/CountDSL 增加 taskID 参数,taskID>0 时强制 AND $N = ANY(task_ids) 并补 task 来源信息;即便 DSL 内写 task_id 也无法越出当前任务 - 任务资产 tab 接入搜索框:有 DSL 走 searchTaskAssets,否则走 taskAssets Closes #107
This commit is contained in:
1 parent
1f258837f5
commit
557317491b
8 files changed
+491
-393
No files matched your search
+5
-2
@@ -346,9 +346,12 @@ func (s *Server) listAssets(w http.ResponseWriter, r *http.Request) {
|
||||
writeErr(w, http.StatusBadRequest, err.Error())
|
||||
return
|
||||
}
|
||||
total, err = as.CountDSL(dsl, typ)
|
||||
// task_id scopes the DSL search to a task's assets (the task detail
|
||||
// "测试资产" search); 0 means the global asset view.
|
||||
taskID, _ := strconv.ParseInt(q.Get("task_id"), 10, 64)
|
||||
total, err = as.CountDSL(dsl, typ, taskID)
|
||||
if err == nil && offset < total {
|
||||
assets, err = as.QueryDSL(dsl, typ, limit, offset)
|
||||
assets, err = as.QueryDSL(dsl, typ, taskID, limit, offset)
|
||||
}
|
||||
} else {
|
||||
companyID, _ := strconv.ParseInt(q.Get("company_id"), 10, 64)
|
||||
|
||||
Reference in new issue
Block a user