mirror of
https://github.com/Cp0204/quark-auto-save.git
synced 2026-01-16 17:30:43 +08:00
为重置文件夹功能增加 SSE 推送,支持相关数据的实时更新
This commit is contained in:
parent
338418e595
commit
da051409df
@ -3169,6 +3169,12 @@ def reset_folder():
|
|||||||
logging.error(f">>> 删除记录时出错: {str(e)}")
|
logging.error(f">>> 删除记录时出错: {str(e)}")
|
||||||
# 即使删除记录失败,也返回文件删除成功
|
# 即使删除记录失败,也返回文件删除成功
|
||||||
|
|
||||||
|
# 成功后通过 SSE 通知前端进行热更新
|
||||||
|
try:
|
||||||
|
notify_calendar_changed('reset_folder')
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
|
||||||
return jsonify({
|
return jsonify({
|
||||||
"success": True,
|
"success": True,
|
||||||
"message": f"重置成功,删除了 {deleted_files} 个文件和 {deleted_records} 条记录",
|
"message": f"重置成功,删除了 {deleted_files} 个文件和 {deleted_records} 条记录",
|
||||||
|
|||||||
@ -10488,6 +10488,19 @@
|
|||||||
.then(response => {
|
.then(response => {
|
||||||
if (response.data.success) {
|
if (response.data.success) {
|
||||||
this.showToast(`重置成功:删除了 ${response.data.deleted_files || 0} 个文件,${response.data.deleted_records || 0} 条记录`);
|
this.showToast(`重置成功:删除了 ${response.data.deleted_files || 0} 个文件,${response.data.deleted_records || 0} 条记录`);
|
||||||
|
// 重置成功后,主动热更新最近转存文件与任务元数据,避免等待 SSE 或轮询
|
||||||
|
(async () => {
|
||||||
|
try {
|
||||||
|
const latestRes = await axios.get('/task_latest_info');
|
||||||
|
if (latestRes.data && latestRes.data.success) {
|
||||||
|
const latestFiles = latestRes.data.data.latest_files || {};
|
||||||
|
this.taskLatestFiles = latestFiles;
|
||||||
|
this.taskLatestRecords = latestRes.data.data.latest_records || {};
|
||||||
|
}
|
||||||
|
} catch (e) {}
|
||||||
|
// 重新加载任务元数据(海报与详细信息)
|
||||||
|
try { await this.loadTasklistMetadata(); } catch (e) {}
|
||||||
|
})();
|
||||||
// 如果当前是历史记录页面,刷新记录
|
// 如果当前是历史记录页面,刷新记录
|
||||||
if (this.activeTab === 'history') {
|
if (this.activeTab === 'history') {
|
||||||
this.loadHistoryRecords();
|
this.loadHistoryRecords();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user