添加最后运行时间和运行时长

This commit is contained in:
hanhh
2021-09-23 13:42:32 +08:00
parent c15ff89746
commit af2f3deeab
6 changed files with 124 additions and 14 deletions
+54
View File
@@ -33,6 +33,7 @@ import { request } from '@/utils/http';
import CronModal from './modal';
import CronLogModal from './logModal';
import cron_parser from 'cron-parser';
import { diffTime } from '@/utils/date';
const { Text } = Typography;
const { Search } = Input;
@@ -123,6 +124,59 @@ const Crontab = ({ headerStyle, isPhone }: any) => {
multiple: 1,
},
},
{
title: '最后运行时间',
align: 'center' as const,
sorter: {
compare: (a: any, b: any) => {
return a.last_execution_time - b.last_execution_time;
},
},
render: (text: string, record: any) => {
const language = navigator.language || navigator.languages[0];
return (
<span
style={{
textAlign: 'left',
display: 'block',
}}
>
{record.last_execution_time
? new Date(record.last_execution_time * 1000).toLocaleString(
language,
{
hour12: false,
},
)
: '-'}
</span>
);
},
},
{
title: '最后运行时长',
align: 'center' as const,
sorter: {
compare: (a: any, b: any) => {
return a.last_running_time - b.last_running_time;
},
},
render: (text: string, record: any) => {
const language = navigator.language || navigator.languages[0];
return (
<span
style={{
textAlign: 'left',
display: 'block',
}}
>
{record.last_running_time
? diffTime(record.last_running_time)
: '-'}
</span>
);
},
},
{
title: '下次运行时间',
align: 'center' as const,