前端(任务卡进度条): 10 页接上实时进度,3 页没分母的显式写 null
后端已把心跳里的 current/total 透到 progress/light,但 TaskItemView.progress 是可空字段:
页面少写一行不会报错也不会红,界面上就是安静地没有进度条——11 类客户端任务里 7 类正是这样。
- 新增 src/shared/api/task-progress-live.ts:进度走独立通道,模块级缓存 + 60s 新鲜窗口
为什么不并进任务对象:各页 {...prev.task, ...detail.task} 合并里有 5 处带「变更签名」守卫
(rowsVersion|status|fileStatus|fileReady)。进度每轮都在动,而签名在「正在翻页、还没攒够一批
回传」的时段不变——照那条路走,进度条会一路停在上一次回传的数字上,看着像卡死
- 写入点挂在 light 出口(progress-light.ts)而不是聚合层:4 个页面直接调 getModuleProgressLight
不经过 getPollingProgressBatch,挂聚合层它们永远拿不到;命中缓存也要刷一遍读数,
否则进度会在缓存窗口里被自己的新鲜判定踢掉、凭空消失
- toBatchItems 与 LightPollingItem 补三字段:这里的键集是逐字段挑的,少挑一个就把后端给的数丢掉
- 10 页接 liveProgress:解决风控、跟价、定时匹配、状态查询、提款、巡店删除、商品管理采集等
- Convert/Dedupe/Split 三页写死 progress: null 并说明原因:它们卡列的是完成记录、没有可数的分母。
显式 null 与省略字段在代码里必须长得不一样,否则下一个人无法区分「没得画」和「忘了接」
- 新增 tests/task-progress-view-wiring.test.ts:适配器清单由文件系统给出、总数硬钉 16,
判据同时认 `progress:` 与 ES6 简写 `progress,`(只认冒号把 BrandBrandTab 误报成缺口,
而误报的尺子会被人当噪音绕过去);变异自证三处全 KILLED——抽掉跟价页的接线、
摘掉批次白名单的 progressTotal、去掉分母塌 0 时的旧读数清理,还原后字节哈希一致
- tests/task-progress-polling.test.ts 的整份形状断言同步加三字段(它本来就该在我改白名单时红)
This commit is contained in:
@@ -210,6 +210,8 @@ function toConvertTaskView(item: ConvertResultItem): TaskItemView {
|
||||
...(item.outputFilename ? [`压缩包文件:${item.outputFilename}`] : []),
|
||||
...(item.error ? [`错误信息:${userNotice(item.error)}`] : []),
|
||||
],
|
||||
// 显式给 null:这一类是点了就跑完的一次性操作,卡片列的是完成记录,没有可数的分母。写死 null 而不是省略字段,是为了让「没得画」和「忘了接」在代码里长得不一样(守卫:tests/task-progress-view-wiring.test.ts)。
|
||||
progress: null,
|
||||
source: item,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -234,6 +234,8 @@ function toDedupeTaskView(item: DedupeResultItem): TaskItemView {
|
||||
...(item.outputFilename ? [`输出文件:${item.outputFilename}`] : []),
|
||||
...(item.error ? [`错误信息:${userNotice(item.error)}`] : []),
|
||||
],
|
||||
// 显式给 null:这一类是点了就跑完的一次性操作,卡片列的是完成记录,没有可数的分母。写死 null 而不是省略字段,是为了让「没得画」和「忘了接」在代码里长得不一样(守卫:tests/task-progress-view-wiring.test.ts)。
|
||||
progress: null,
|
||||
source: item,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -297,6 +297,7 @@ import { isRecordMissingError } from '@/shared/utils/task-queue-state.ts'
|
||||
import { useTablePaging } from '@/shared/composables/useTablePaging.ts'
|
||||
import { getModuleProgressLight } from '@/shared/api/progress-light.ts'
|
||||
import { createRowsVersionTracker } from '@/shared/api/task-progress-polling.ts'
|
||||
import { liveProgress } from '@/shared/api/task-progress-live.ts'
|
||||
import { confirmTaskDeletion } from '@/shared/task-delete-confirm';
|
||||
import { TERMINAL_TASK_STATUSES, isTerminalTaskStatus, waitForTaskTerminal as waitForTaskTerminalShared } from '@/shared/utils/task-terminal'
|
||||
|
||||
@@ -397,6 +398,7 @@ function toPatrolTaskView(item: PatrolDeleteHistoryItem): TaskItemView {
|
||||
`模板: ${formatTemplateSummary(item)}`,
|
||||
...(formatTaskGroupErrors(item) ? [`错误: ${userNotice(formatTaskGroupErrors(item))}`] : []),
|
||||
],
|
||||
progress: liveProgress(Number(item.taskId)),
|
||||
source: item,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -277,6 +277,7 @@ import {
|
||||
type PriceTrackTaskDetailVo,
|
||||
} from '@/shared/api/java-modules'
|
||||
import { getPollingProgressBatch } from '@/shared/api/task-progress-polling.ts'
|
||||
import { liveProgress } from '@/shared/api/task-progress-live.ts'
|
||||
import { formatDateTime } from '@/shared/utils/datetime'
|
||||
import { taskStatusClass, taskStatusText } from '@/shared/utils/task-status-text'
|
||||
import { isTerminalTaskStatus, waitForTaskTerminal as waitForTaskTerminalShared } from '@/shared/utils/task-terminal'
|
||||
@@ -1574,6 +1575,7 @@ function toPriceTrackTaskView(item: PriceTrackHistoryItem): TaskItemView {
|
||||
...(item.outputFilename ? [`文件:${item.outputFilename}`] : []),
|
||||
...(item.error ? [`错误:${userNotice(item.error)}`] : []),
|
||||
],
|
||||
progress: liveProgress(Number(item.taskId)),
|
||||
source: item,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -193,6 +193,7 @@ import { runBatchDelete } from '@/shared/utils/batch-delete'
|
||||
import { isRecordMissingError } from '@/shared/utils/task-queue-state.ts'
|
||||
import { useTablePaging } from '@/shared/composables/useTablePaging.ts'
|
||||
import { getPollingProgressBatch } from '@/shared/api/task-progress-polling.ts'
|
||||
import { liveProgress } from '@/shared/api/task-progress-live.ts'
|
||||
import { confirmTaskDeletion } from '@/shared/task-delete-confirm'
|
||||
|
||||
const shopInput = ref('')
|
||||
@@ -724,6 +725,7 @@ function toRiskTaskView(item: ProductRiskHistoryItem): TaskItemView {
|
||||
...(item.outputFilename ? [`文件:${item.outputFilename}`] : []),
|
||||
...(item.error ? [`错误:${userNotice(item.error)}`] : []),
|
||||
],
|
||||
progress: liveProgress(Number(item.taskId)),
|
||||
source: item,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -252,6 +252,7 @@ import { isRecordMissingError, parseTaskStartTimes, removeTaskStartTime, upsertT
|
||||
import { useTablePaging } from '@/shared/composables/useTablePaging.ts'
|
||||
import { getModuleProgressLight } from '@/shared/api/progress-light.ts'
|
||||
import { createRowsVersionTracker } from '@/shared/api/task-progress-polling.ts'
|
||||
import { liveProgress } from '@/shared/api/task-progress-live.ts'
|
||||
import { confirmTaskDeletion } from '@/shared/task-delete-confirm';
|
||||
import { TERMINAL_TASK_STATUSES, isTerminalTaskStatus, waitForTaskTerminal as waitForTaskTerminalShared } from '@/shared/utils/task-terminal'
|
||||
import { dispatchedPruneNotice, mergeDispatchedArchive, pruneRows } from '@/shared/utils/dispatch-row-prune';
|
||||
@@ -355,6 +356,7 @@ function toQueryAsinTaskView(item: QueryAsinHistoryItem): TaskItemView {
|
||||
`ASIN结构: ${formatTemplateSummary(item)}`,
|
||||
...(item.error ? [`错误: ${userNotice(item.error)}`] : []),
|
||||
],
|
||||
progress: liveProgress(Number(item.taskId)),
|
||||
source: item,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -170,6 +170,7 @@ import { runBatchDelete } from '@/shared/utils/batch-delete'
|
||||
import { useTablePaging } from '@/shared/composables/useTablePaging.ts'
|
||||
import { getModuleProgressLight } from '@/shared/api/progress-light.ts'
|
||||
import { createRowsVersionTracker } from '@/shared/api/task-progress-polling.ts'
|
||||
import { liveProgress } from '@/shared/api/task-progress-live.ts'
|
||||
import { confirmTaskDeletion } from '@/shared/task-delete-confirm'
|
||||
|
||||
const COUNTRY_OPTIONS = [
|
||||
@@ -256,6 +257,7 @@ function toShopDataCrawlTaskView(item: ShopDataCrawlHistoryItem): TaskItemView {
|
||||
...(item.platform ? [`平台:${item.platform}`] : []),
|
||||
...(item.outputFilename ? [`文件:${item.outputFilename}`] : []),
|
||||
],
|
||||
progress: liveProgress(Number(item.taskId)),
|
||||
source: item,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,6 +129,7 @@ import ZiniaoVersionSetting from '@/shared/components/ZiniaoVersionSetting.vue'
|
||||
import { LISTING_FILTER_OPTIONS, type ListingFilterValue } from '@/pages/brand/components/listingFilters'
|
||||
import { activateShopMatchTask, addShopMatchCandidate, createShopMatchTask, deleteShopMatchCandidate, deleteShopMatchHistory, deleteShopMatchTask, getShopMatchCountryPreference, getShopMatchDashboard, getShopMatchHistory, getShopMatchResultDownloadUrl, getShopMatchTaskProgressBatch, listShopMatchCandidates, matchShopMatchShops, putShopMatchCountryPreference, type ShopMatchCandidateVo, type ShopMatchCreateTaskItem, type ShopMatchDashboardVo, type ShopMatchHistoryItem, type ShopMatchShopQueueItem, type ShopMatchTaskDetailVo } from '@/shared/api/java-modules'
|
||||
import { getPollingProgressBatch } from '@/shared/api/task-progress-polling.ts'
|
||||
import { liveProgress } from '@/shared/api/task-progress-live.ts'
|
||||
import { getPywebviewApi } from '@/shared/bridges/pywebview'
|
||||
import { getTaskPollIntervalMs } from '@/shared/task-progress-config'
|
||||
import { createCategorizedTimers } from '@/shared/utils/categorized-timers'
|
||||
@@ -236,6 +237,7 @@ function toShopMatchTaskView(item: ShopMatchHistoryItem): TaskItemView {
|
||||
...(item.outputFilename ? [`文件: ${item.outputFilename}`] : []),
|
||||
...(item.error ? [`错误: ${userNotice(item.error)}`] : []),
|
||||
],
|
||||
progress: liveProgress(Number(item.taskId)),
|
||||
source: item,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -233,6 +233,8 @@ function toSplitTaskView(item: SplitResultItem): TaskItemView {
|
||||
...(item.entries && item.entries.length ? [`压缩包内容:${formatSplitEntries(item.entries)}`] : []),
|
||||
...(item.error ? [`错误信息:${userNotice(item.error)}`] : []),
|
||||
],
|
||||
// 显式给 null:这一类是点了就跑完的一次性操作,卡片列的是完成记录,没有可数的分母。写死 null 而不是省略字段,是为了让「没得画」和「忘了接」在代码里长得不一样(守卫:tests/task-progress-view-wiring.test.ts)。
|
||||
progress: null,
|
||||
source: item,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -279,6 +279,7 @@ import { isRecordMissingError, parseTaskStartTimes, removeTaskStartTime, upsertT
|
||||
import { useTablePaging } from '@/shared/composables/useTablePaging.ts'
|
||||
import { getModuleProgressLight } from '@/shared/api/progress-light.ts'
|
||||
import { createRowsVersionTracker } from '@/shared/api/task-progress-polling.ts'
|
||||
import { liveProgress } from '@/shared/api/task-progress-live.ts'
|
||||
import { confirmTaskDeletion } from '@/shared/task-delete-confirm'
|
||||
import { waitForTaskTerminal as waitForTaskTerminalShared } from '@/shared/utils/task-terminal'
|
||||
|
||||
@@ -386,6 +387,7 @@ function toWithdrawTaskView(item: WithdrawTaskGroupItem): TaskItemView {
|
||||
statusText: statusText(item.taskStatus),
|
||||
statusClass: statusClass(item.taskStatus),
|
||||
extraLines: item.error ? [`错误:${userNotice(item.error)}`] : [],
|
||||
progress: liveProgress(Number(item.taskId)),
|
||||
source: item,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user