From a722b59a135383eacb72eacfd11f358c40da1ae4 Mon Sep 17 00:00:00 2001 From: whyour Date: Thu, 6 May 2021 12:03:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dcron=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E5=BC=B9=E6=A1=86=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- shell/task.sh | 4 +++- src/pages/crontab/index.tsx | 1 + src/pages/crontab/logModal.tsx | 14 ++++++++------ 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/shell/task.sh b/shell/task.sh index 0b4529bf..7ac37476 100755 --- a/shell/task.sh +++ b/shell/task.sh @@ -165,4 +165,6 @@ main () { esac } -main "$@" \ No newline at end of file +main "$@" + +exit 0 diff --git a/src/pages/crontab/index.tsx b/src/pages/crontab/index.tsx index 7e97522c..9a01e5dc 100644 --- a/src/pages/crontab/index.tsx +++ b/src/pages/crontab/index.tsx @@ -385,6 +385,7 @@ const Crontab = () => { useEffect(() => { if (logCron) { + localStorage.setItem('logCron', logCron._id); setIsLogModalVisible(true); } }, [logCron]); diff --git a/src/pages/crontab/logModal.tsx b/src/pages/crontab/logModal.tsx index 17fbc423..a5323890 100644 --- a/src/pages/crontab/logModal.tsx +++ b/src/pages/crontab/logModal.tsx @@ -28,12 +28,14 @@ const CronLogModal = ({ request .get(`${config.apiPrefix}crons/${cron._id}/log`) .then((data: any) => { - const log = data.data as string; - setValue(log || '暂无日志'); - if (log && !log.includes('执行结束')) { - setTimeout(() => { - getCronLog(); - }, 2000); + if (localStorage.getItem('logCron') === cron._id) { + const log = data.data as string; + setValue(log || '暂无日志'); + if (log && !log.includes('执行结束')) { + setTimeout(() => { + getCronLog(); + }, 2000); + } } }) .finally(() => {