feat: 完成数据处理接口与前端接入
This commit is contained in:
@@ -6,10 +6,12 @@ import { parse as parseSfc } from '@vue/compiler-sfc'
|
||||
|
||||
const scriptDir = path.dirname(fileURLToPath(import.meta.url))
|
||||
const sourceRoot = path.resolve(scriptDir, '../src')
|
||||
const [detailSource, listSource, routerSource] = await Promise.all([
|
||||
const [detailSource, listSource, routerSource, apiSource, typesSource] = await Promise.all([
|
||||
readFile(path.join(sourceRoot, 'views/data-process/DataProcessDetailView.vue'), 'utf8'),
|
||||
readFile(path.join(sourceRoot, 'views/data-process/DataProcessListView.vue'), 'utf8'),
|
||||
readFile(path.join(sourceRoot, 'router/index.ts'), 'utf8'),
|
||||
readFile(path.join(sourceRoot, 'api/modules/dataProcess.ts'), 'utf8'),
|
||||
readFile(path.join(sourceRoot, 'types/dataProcess.ts'), 'utf8'),
|
||||
])
|
||||
|
||||
const { descriptor, errors } = parseSfc(detailSource, { filename: 'DataProcessDetailView.vue' })
|
||||
@@ -38,18 +40,41 @@ for (const requiredCopy of [
|
||||
assert.match(detailSource, new RegExp(requiredCopy), `详情页缺少必要信息:${requiredCopy}`)
|
||||
}
|
||||
|
||||
for (const status of ['completed', 'running', 'pending', 'failed']) {
|
||||
assert.match(detailSource, new RegExp(`status:\\s*['"]${status}['"]`), `详情 Mock 缺少 ${status} 状态`)
|
||||
}
|
||||
|
||||
assert.match(detailSource, /const completedResults:\s*ResultRow\[\]/, '完成任务缺少结果明细 Mock')
|
||||
assert.match(detailSource, /:data="paginatedResults"/, '结果表格未绑定分页后的处理结果')
|
||||
assert.match(typesSource, /export type DataProcessStatus = 'pending' \| 'running' \| 'completed' \| 'failed' \| 'stopped'/, '任务状态契约不完整')
|
||||
assert.match(detailSource, /getDataProcessTask\(taskId\.value\)/, '详情页没有通过真实 API 加载任务')
|
||||
assert.match(detailSource, /getDataProcessResults\(taskId\.value,\s*\{[\s\S]*?page:[\s\S]*?page_size:[\s\S]*?keyword:[\s\S]*?status:/, '结果列表没有接入服务端分页、搜索和状态筛选')
|
||||
assert.match(detailSource, /getDataProcessProgress\(taskId\.value\)/, '运行中任务没有查询真实进度')
|
||||
assert.match(detailSource, /usePolling\(refreshRuntime,\s*3000/, '运行中任务没有启用进度轮询')
|
||||
assert.match(detailSource, /:data="results"/, '结果表格未绑定服务端结果数据')
|
||||
assert.match(detailSource, /v-model="keyword"/, '结果明细缺少搜索能力')
|
||||
assert.match(detailSource, /v-model="statusFilter"/, '结果明细缺少状态筛选')
|
||||
assert.match(detailSource, /router\.push\(`\/dataset\/\$\{detail\.outputDatasetId\}\/preview`\)/, '输出数据集未接入预览入口')
|
||||
assert.match(detailSource, /未找到数据处理任务/, '未知任务 ID 缺少明确空状态')
|
||||
assert.match(detailSource, /updateDataProcessResult\(taskId\.value,[\s\S]*?expected_updated_at:/, '结果编辑没有携带并发版本时间')
|
||||
assert.match(detailSource, /restoreDataProcessResult\(taskId\.value,\s*result\.id\)/, '结果恢复没有调用真实 API')
|
||||
assert.match(detailSource, /publishDataProcess\(taskId\.value,/, '发布数据集没有调用真实 API')
|
||||
assert.match(detailSource, /router\.push\(`\/dataset\/\$\{datasetId\}\/preview`\)/, '发布成功后未进入数据集预览')
|
||||
assert.match(detailSource, /无法加载数据处理任务/, '未知任务或加载失败缺少明确错误状态')
|
||||
assert.match(detailSource, /结果明细加载失败/, '结果加载失败缺少明确错误状态')
|
||||
assert.match(detailSource, /width:\s*100%/, '详情页没有铺满内容区域')
|
||||
assert.doesNotMatch(detailSource, /^\s*max-width:\s*\d+px/m, '详情页不应使用固定最大宽度')
|
||||
assert.doesNotMatch(detailSource, /\b(?:password|secret|token)\b/i, '详情页不得展示敏感凭据字段')
|
||||
assert.match(detailSource, /!\/\(\?:password\|secret\|token\|api_key\)\/i\.test\(key\)/, '处理配置没有过滤敏感凭据字段')
|
||||
assert.doesNotMatch(detailSource, /const (?:detailMap|completedResults)\b|TODO: 接入真实接口/, '详情页仍包含本地 Mock 数据')
|
||||
|
||||
console.log('数据处理任务详情 UI 回归检查通过')
|
||||
for (const apiName of [
|
||||
'getDataProcessTask',
|
||||
'getDataProcessProgress',
|
||||
'getDataProcessResults',
|
||||
'updateDataProcessResult',
|
||||
'restoreDataProcessResult',
|
||||
'publishDataProcess',
|
||||
]) {
|
||||
assert.match(
|
||||
apiSource,
|
||||
new RegExp(`export (?:const|(?:async )?function) ${apiName}\\b`),
|
||||
`API 模块缺少 ${apiName}`,
|
||||
)
|
||||
}
|
||||
assert.match(apiSource, /keyword\?: string; status\?: string; split\?: string/, '结果列表 API 缺少服务端筛选参数')
|
||||
assert.match(apiSource, /\/results\/\$\{encodeURIComponent\(resultId\)\}/, '结果资源路径没有安全编码结果 ID')
|
||||
assert.match(apiSource, /`\/data-process\/\$\{encodeURIComponent\(taskId\)\}\/publish`/, '发布 API 路径不正确')
|
||||
|
||||
console.log('数据处理任务详情真实 API 回归检查通过')
|
||||
|
||||
Reference in New Issue
Block a user