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
@@ -439,6 +439,12 @@ export const api = {
|
||||
get<{ count: number; total: number; assets: Asset[] }>(
|
||||
`/assets?task_id=${encodeURIComponent(taskId)}&type=${encodeURIComponent(type)}&limit=${limit}&offset=${offset}`,
|
||||
).then((r) => ({ assets: r?.assets ?? [], total: r?.total ?? r?.count ?? 0 })),
|
||||
// DSL search scoped to a task — the backend forces the task_id filter, so it
|
||||
// always stays within that task's assets (same DSL grammar as `searchAssets`).
|
||||
searchTaskAssets: (taskId: string, dsl: string, type = "", limit = 50, offset = 0) =>
|
||||
get<{ count: number; total: number; assets: Asset[] }>(
|
||||
`/assets?task_id=${encodeURIComponent(taskId)}&dsl=${encodeURIComponent(dsl)}&type=${encodeURIComponent(type)}&limit=${limit}&offset=${offset}`,
|
||||
).then((r) => ({ assets: r?.assets ?? [], total: r?.total ?? r?.count ?? 0 })),
|
||||
attachTaskAssets: (taskId: string, assetIds: number[], sourceSummary: string) =>
|
||||
post<TaskAssetMutation>(`/tasks/${taskId}/assets`, {
|
||||
asset_ids: assetIds,
|
||||
|
||||
Reference in new issue
Block a user