From e32a56df939cd8b1a91873ec919dbeb5e35adf9b Mon Sep 17 00:00:00 2001 From: whyour Date: Fri, 14 May 2021 14:57:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=97=A5=E5=BF=97=E5=BC=B9?= =?UTF-8?q?=E7=AA=97=E6=97=A5=E5=BF=97=E7=8A=B6=E6=80=81=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- back/loaders/initData.ts | 4 ++-- src/pages/crontab/index.tsx | 4 ++-- src/pages/crontab/logModal.tsx | 18 +++++++++++++++++- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/back/loaders/initData.ts b/back/loaders/initData.ts index ee87da6f..52eabf69 100644 --- a/back/loaders/initData.ts +++ b/back/loaders/initData.ts @@ -9,8 +9,8 @@ const initData = [ name: '更新面板', command: `ql update`, schedule: `${randomSchedule(60, 1)} ${randomSchedule( - 24, - 7, + 6, + 1, ).toString()} * * *`, status: CrontabStatus.idle, }, diff --git a/src/pages/crontab/index.tsx b/src/pages/crontab/index.tsx index b94a1752..555b0095 100644 --- a/src/pages/crontab/index.tsx +++ b/src/pages/crontab/index.tsx @@ -14,7 +14,7 @@ import { } from 'antd'; import { ClockCircleOutlined, - SyncOutlined, + Loading3QuartersOutlined, CloseCircleOutlined, FileTextOutlined, EllipsisOutlined, @@ -105,7 +105,7 @@ const Crontab = () => { )} {record.status === CrontabStatus.running && ( - } color="processing"> + } color="processing"> 运行中 )} diff --git a/src/pages/crontab/logModal.tsx b/src/pages/crontab/logModal.tsx index 452797aa..0cd50cdd 100644 --- a/src/pages/crontab/logModal.tsx +++ b/src/pages/crontab/logModal.tsx @@ -2,6 +2,10 @@ import React, { useEffect, useState } from 'react'; import { Modal, notification, Input, Form } from 'antd'; import { request } from '@/utils/http'; import config from '@/utils/config'; +import { + Loading3QuartersOutlined, + CheckCircleOutlined, +} from '@ant-design/icons'; enum CrontabStatus { 'running', @@ -20,6 +24,7 @@ const CronLogModal = ({ }) => { const [value, setValue] = useState('启动中...'); const [loading, setLoading] = useState(true); + const [excuting, setExcuting] = useState(true); const getCronLog = (isFirst?: boolean) => { if (isFirst) { @@ -31,6 +36,7 @@ const CronLogModal = ({ if (localStorage.getItem('logCron') === cron._id) { const log = data.data as string; setValue(log || '暂无日志'); + setExcuting(log && !log.includes('执行结束')); if (log && !log.includes('执行结束')) { setTimeout(() => { getCronLog(); @@ -50,6 +56,16 @@ const CronLogModal = ({ handleCancel(); }; + const titleElement = () => { + return ( + <> + 日志-{cron && cron.name}{' '} + {excuting && } + {!excuting && } + + ); + }; + useEffect(() => { if (cron) { getCronLog(true); @@ -58,7 +74,7 @@ const CronLogModal = ({ return ( cancel()}