fix(cronjob): prevent unnecessary log updates and clean log formatting (#8481)
Some checks failed
SonarCloud Scan / SonarCloud (push) Has been cancelled

Refs #8425
This commit is contained in:
igophper 2025-04-28 09:09:48 +08:00 committed by GitHub
parent ed9f1599e6
commit 8fa9f128d8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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;
}