feat(export-tracker): 增强导出任务跟踪功能 (#1958)
- 添加了对数据库导出、SQL 文件导出和数据传输任务的支持 - 引入了新的状态和错误处理机制 - 实现了任务的重叠检查,防止同时进行相同目标表的数据传输 - 更新了 API 调用以支持新的任务类型 - 增加了相应的国际化文本 - 添加了单元测试以确保新功能的正确性
This commit is contained in:
15 files changed
+838
-208
No files matched your search
@@ -102,6 +102,7 @@ pub async fn start_transfer(
|
||||
}
|
||||
}
|
||||
|
||||
let mut failed_tables: Vec<String> = Vec::new();
|
||||
for (i, table) in sorted_tables.iter().enumerate() {
|
||||
if dbx_core::transfer::is_cancelled(&transfer_id).await {
|
||||
emit_progress(
|
||||
@@ -176,6 +177,7 @@ pub async fn start_transfer(
|
||||
dbx_core::transfer::clear_cancelled(&transfer_id).await;
|
||||
return;
|
||||
}
|
||||
failed_tables.push(table.clone());
|
||||
emit_progress(
|
||||
&app,
|
||||
TransferProgress {
|
||||
@@ -224,6 +226,7 @@ pub async fn start_transfer(
|
||||
return;
|
||||
}
|
||||
Err(e) => {
|
||||
failed_tables.push("schema objects".to_string());
|
||||
emit_progress(
|
||||
&app,
|
||||
TransferProgress {
|
||||
@@ -250,8 +253,16 @@ pub async fn start_transfer(
|
||||
total_tables,
|
||||
rows_transferred: 0,
|
||||
total_rows: None,
|
||||
status: TransferStatus::Done,
|
||||
error: None,
|
||||
status: if failed_tables.is_empty() { TransferStatus::Done } else { TransferStatus::Error },
|
||||
error: if failed_tables.is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(format!(
|
||||
"{} table(s) failed: {}",
|
||||
failed_tables.len(),
|
||||
failed_tables.iter().take(5).cloned().collect::<Vec<_>>().join(", ")
|
||||
))
|
||||
},
|
||||
},
|
||||
);
|
||||
dbx_core::transfer::clear_cancelled(&transfer_id).await;
|
||||
|
||||
Reference in new issue
Block a user