From 8fa9f128d89ecea96523e04a536453574e411898 Mon Sep 17 00:00:00 2001 From: igophper <34326532+igophper@users.noreply.github.com> Date: Mon, 28 Apr 2025 09:09:48 +0800 Subject: [PATCH] fix(cronjob): prevent unnecessary log updates and clean log formatting (#8481) Refs #8425 --- frontend/src/views/cronjob/record/index.vue | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/frontend/src/views/cronjob/record/index.vue b/frontend/src/views/cronjob/record/index.vue index b28d5c71f..72fa8219a 100644 --- a/frontend/src/views/cronjob/record/index.vue +++ b/frontend/src/views/cronjob/record/index.vue @@ -395,6 +395,7 @@ const search = async () => { if (!currentRecord.value) { currentRecord.value = records.value[0]; } else { + let oldRecordID = currentRecord.value.id; let beDelete = true; for (const item of records.value) { if (item.id === currentRecord.value.id) { @@ -406,6 +407,9 @@ const search = async () => { if (beDelete) { currentRecord.value = records.value[0]; } + if (oldRecordID === currentRecord.value.id && currentRecord.value.status !== 'Waiting') { + return; + } } if (currentRecord.value?.records) { loadRecord(currentRecord.value); @@ -419,7 +423,7 @@ const forDetail = async (row: Cronjob.Record) => { const loadRecord = async (row: Cronjob.Record) => { if (row.records) { const res = await getRecordLog(row.id); - let log = res.data.replace(/\x1B\[[0-?]*[ -/]*[@-~]/g, ''); + let log = res.data.replace(/\x1B\[[0-?]*[ -/]*[@-~]/g, '').replace(/\r/g, ''); if (currentRecordDetail.value === log) { return; }