修复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 esac
} }
main "$@" main "$@"
exit 0

View File

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

View File

@ -28,12 +28,14 @@ const CronLogModal = ({
request request
.get(`${config.apiPrefix}crons/${cron._id}/log`) .get(`${config.apiPrefix}crons/${cron._id}/log`)
.then((data: any) => { .then((data: any) => {
const log = data.data as string; if (localStorage.getItem('logCron') === cron._id) {
setValue(log || '暂无日志'); const log = data.data as string;
if (log && !log.includes('执行结束')) { setValue(log || '暂无日志');
setTimeout(() => { if (log && !log.includes('执行结束')) {
getCronLog(); setTimeout(() => {
}, 2000); getCronLog();
}, 2000);
}
} }
}) })
.finally(() => { .finally(() => {