Skip to content

Commit 9efe9dd

Browse files
committed
expire / running status added on task list
1 parent 0dd9332 commit 9efe9dd

File tree

3 files changed

+48
-2
lines changed

3 files changed

+48
-2
lines changed

packages/helper/transRes.mjs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ let trans = {
6464
"No data to export, please try again 15 minutes later": "没有数据可以导出,请15分钟后再试",
6565
"Notice: Export history may only works on Chrome browser.":
6666
"注意:请在电脑版Chrome浏览器中导出历史数据,手机上或电脑上的其它浏览器可能无法导出。",
67+
"Expired":"已过期",
68+
"Expiring soon":"即将过期",
69+
"Running":"运行中",
70+
"Running status":"运行状态",
6771
// Below is on create task page
6872
"Please input a URL start with https:// or http://": "请输入以https://或http://开头的网址",
6973
"URL check passed.": "URL检查通过",

packages/web/src/pages/task/list.tsx

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ import { useImmerAtom } from 'jotai/immer';
44
import { useResetAtom } from 'jotai/utils'
55
import { createTaskDetailAtom, monacoEditorAtom, userInfoAtom } from '../../atoms';
66
import { CronTime } from '@webest/web-page-monitor-helper';
7-
import { fetchAPI, useI18n, innerHTML, useHeadTitle, arrayToCsv, downloadBlob } from "../../helpers/index";
7+
import { fetchAPI, useI18n, innerHTML, useHeadTitle, arrayToCsv, downloadBlob, genClassNameAndString } from "../../helpers/index";
88
import Link from "next/link";
99
import { ScriptList } from "../../components/scriptList";
1010
import { useRouter } from "next/router";
1111
import styles from "../../styles/modules/taskList.module.scss";
1212

13-
13+
const [cn, cs] = genClassNameAndString(styles);
1414
const TaskListSimpPage: NextPage = () => {
1515

1616
const [taskDetail, setTaskDetail] = useImmerAtom(createTaskDetailAtom);
@@ -93,6 +93,35 @@ const TaskListSimpPage: NextPage = () => {
9393
)
9494
}
9595
},
96+
{
97+
Header: t('Running status'),
98+
id: 'runningStatus',
99+
Cell: ({ row: {original: or} }) => {
100+
let status;
101+
let endDate;
102+
let color;
103+
let now = Date.now();
104+
if(or.endTime){
105+
endDate = new Date(or.endTime).valueOf();
106+
}
107+
if(now > endDate){
108+
status = t('Expired');
109+
color = 'red';
110+
}else if (now + 1000 * 3600 * 24 > endDate){
111+
status = t('Expiring soon');
112+
color = 'yellow';
113+
}else{
114+
status = t('Running');
115+
color = 'green';
116+
}
117+
return (
118+
<>
119+
<span {...cn(`statusIcon${color} statusIcon`)}></span>
120+
{ status }
121+
</>
122+
)
123+
}
124+
},
96125
{
97126
Header: t('Edit / Delete'),
98127
id: 'editOrView',

packages/web/src/styles/modules/taskList.module.scss

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,17 @@ br.navBr2{
77
@media screen and (min-width: 768px) {
88
display: none;
99
}
10+
}
11+
12+
.statusIcon{
13+
font-size: 1.5em;
14+
&red{
15+
color: red;
16+
}
17+
&green{
18+
color: #00ff00;
19+
}
20+
&yellow{
21+
color: yellow;
22+
}
1023
}

0 commit comments

Comments
 (0)