修复cron日志弹框异常

This commit is contained in:
whyour 2021-05-06 12:03:25 +08:00
parent 83ff4db8c4
commit a722b59a13
3 changed files with 12 additions and 7 deletions

View File

@ -165,4 +165,6 @@ main () {
esac
}
main "$@"
main "$@"
exit 0

View File

@ -385,6 +385,7 @@ const Crontab = () => {
useEffect(() => {
if (logCron) {
localStorage.setItem('logCron', logCron._id);
setIsLogModalVisible(true);
}
}, [logCron]);

View File

@ -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(() => {