You've already forked DataMate
fix: 上传文件时任务中心立即显示
问题描述: 在数据管理的数据集详情页上传文件时,点击确认后,弹窗消失,但是需要等待文件处理(特别是启用按行分割时)后任务中心才弹出来,用户体验不好。 修改内容: 1. useSliceUpload.tsx: 在 createTask 函数中添加立即显示任务中心的逻辑,确保任务创建后立即显示 2. ImportConfiguration.tsx: 在 handleImportData 函数中,在执行耗时的文件处理操作(如文件分割)之前,立即触发 show:task-popover 事件显示任务中心 效果: - 修改前:点击确认 → 弹窗消失 → (等待文件处理)→ 任务中心弹出 - 修改后:点击确认 → 弹窗消失 + 任务中心立即弹出 → 文件开始处理
This commit is contained in:
@@ -37,6 +37,14 @@ export function useFileSliceUpload(
|
|||||||
taskListRef.current = [task, ...taskListRef.current];
|
taskListRef.current = [task, ...taskListRef.current];
|
||||||
|
|
||||||
setTaskList(taskListRef.current);
|
setTaskList(taskListRef.current);
|
||||||
|
|
||||||
|
// 立即显示任务中心,让用户感知上传已开始
|
||||||
|
if (showTaskCenter) {
|
||||||
|
window.dispatchEvent(
|
||||||
|
new CustomEvent("show:task-popover", { detail: { show: true } })
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return task;
|
return task;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -138,11 +146,7 @@ export function useFileSliceUpload(
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
updateTaskList(newTask);
|
updateTaskList(newTask);
|
||||||
if (showTaskCenter) {
|
// 注意:show:task-popover 事件已在 createTask 中触发,此处不再重复触发
|
||||||
window.dispatchEvent(
|
|
||||||
new CustomEvent("show:task-popover", { detail: { show: true } })
|
|
||||||
);
|
|
||||||
}
|
|
||||||
// // 更新数据状态
|
// // 更新数据状态
|
||||||
if (task.updateEvent) window.dispatchEvent(new Event(task.updateEvent));
|
if (task.updateEvent) window.dispatchEvent(new Event(task.updateEvent));
|
||||||
|
|
||||||
|
|||||||
@@ -234,6 +234,10 @@ export default function ImportConfiguration({
|
|||||||
if (!data) return;
|
if (!data) return;
|
||||||
console.log('[ImportConfiguration] handleImportData called, currentPrefix:', currentPrefix);
|
console.log('[ImportConfiguration] handleImportData called, currentPrefix:', currentPrefix);
|
||||||
if (importConfig.source === DataSource.UPLOAD) {
|
if (importConfig.source === DataSource.UPLOAD) {
|
||||||
|
// 立即显示任务中心,让用户感知上传已开始(在文件分割等耗时操作之前)
|
||||||
|
window.dispatchEvent(
|
||||||
|
new CustomEvent("show:task-popover", { detail: { show: true } })
|
||||||
|
);
|
||||||
await handleUpload(data);
|
await handleUpload(data);
|
||||||
} else if (importConfig.source === DataSource.COLLECTION) {
|
} else if (importConfig.source === DataSource.COLLECTION) {
|
||||||
await updateDatasetByIdUsingPut(data.id, {
|
await updateDatasetByIdUsingPut(data.id, {
|
||||||
|
|||||||
Reference in New Issue
Block a user