mirror of
https://github.com/whyour/qinglong.git
synced 2025-07-07 20:06:08 +08:00
添加日志弹窗日志状态显示
This commit is contained in:
parent
2ba99d9c47
commit
e32a56df93
|
@ -9,8 +9,8 @@ const initData = [
|
|||
name: '更新面板',
|
||||
command: `ql update`,
|
||||
schedule: `${randomSchedule(60, 1)} ${randomSchedule(
|
||||
24,
|
||||
7,
|
||||
6,
|
||||
1,
|
||||
).toString()} * * *`,
|
||||
status: CrontabStatus.idle,
|
||||
},
|
||||
|
|
|
@ -14,7 +14,7 @@ import {
|
|||
} from 'antd';
|
||||
import {
|
||||
ClockCircleOutlined,
|
||||
SyncOutlined,
|
||||
Loading3QuartersOutlined,
|
||||
CloseCircleOutlined,
|
||||
FileTextOutlined,
|
||||
EllipsisOutlined,
|
||||
|
@ -105,7 +105,7 @@ const Crontab = () => {
|
|||
</Tag>
|
||||
)}
|
||||
{record.status === CrontabStatus.running && (
|
||||
<Tag icon={<SyncOutlined spin />} color="processing">
|
||||
<Tag icon={<Loading3QuartersOutlined spin />} color="processing">
|
||||
运行中
|
||||
</Tag>
|
||||
)}
|
||||
|
|
|
@ -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<string>('启动中...');
|
||||
const [loading, setLoading] = useState<any>(true);
|
||||
const [excuting, setExcuting] = useState<any>(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 (
|
||||
<>
|
||||
<span style={{ marginRight: 5 }}>日志-{cron && cron.name}</span>{' '}
|
||||
{excuting && <Loading3QuartersOutlined spin />}
|
||||
{!excuting && <CheckCircleOutlined />}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (cron) {
|
||||
getCronLog(true);
|
||||
|
@ -58,7 +74,7 @@ const CronLogModal = ({
|
|||
|
||||
return (
|
||||
<Modal
|
||||
title={`日志-${cron && cron.name}`}
|
||||
title={titleElement()}
|
||||
visible={visible}
|
||||
forceRender
|
||||
onOk={() => cancel()}
|
||||
|
|
Loading…
Reference in New Issue
Block a user