Skip to content

Commit f88525f

Browse files
committed
created time and expire status and custom mode task alias
1 parent 020db7c commit f88525f

File tree

4 files changed

+24
-3
lines changed

4 files changed

+24
-3
lines changed

packages/helper/transRes.mjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ let trans = {
9292
"One line one id, 3 erasers max": "一行一个ID,最多3个橡皮脚本",
9393
"You can find more erasers on Script Market": "您可以在脚本市场上找到更多橡皮脚本",
9494
"Eraser Script in FAQ": "什么是橡皮脚本",
95+
"Current Task created at:": "当前任务创建日期:",
9596
"Advanced Options": "高级选项",
9697
"Please input waitForSelector": "请输入waitForSelector",
9798
"Please input some words, multiple words can be separated by commas": "请输入一些词语(文字),多个词语之间可以用逗号分隔",
@@ -121,6 +122,7 @@ Also, you can close our page, your task will keep running until ":"成功,将
121122
// below is on create custom task page
122123
"Please check the script!": "请检查脚本是否有错误!",
123124
"Custom script chars cannot > 5000": "自定义脚本字符数不能超过5000",
125+
"Task alias": "任务别名",
124126
// below is on script market page
125127
"Script Market": "脚本市场",
126128
"No Data": "没有数据",

packages/web/src/helpers/frontHelpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ export function arrayToCsv(array = []){
139139

140140
export function getTaskExpireStatusAndColor(taskMeta){
141141
let endDate;
142-
let status;
142+
let status = "";
143143
let color;
144144
let now = Date.now();
145145
if(taskMeta.endTime){

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { useResetAtom, RESET } from 'jotai/utils'
66

77
import { createTaskDetailAtom, monacoEditorAtom, userInfoAtom } from '../../atoms';
88
import { CronTime } from '@webest/web-page-monitor-helper';
9-
import { fetchAPI, useI18n, innerHTML, mergeToTarget, useHeadTitle } from "../../helpers/index";
9+
import { fetchAPI, useI18n, innerHTML, mergeToTarget, useHeadTitle, getTaskExpireStatusAndColor } from "../../helpers/index";
1010
import Link from "next/link";
1111

1212
import dynamic from 'next/dynamic'
@@ -171,6 +171,16 @@ Also, you can close our page, your task will keep running until `) + CronTime.to
171171
    
172172
<Link prefetch={false} href="/market/script/list"><a>{t('Go to script market')}</a></Link>
173173
</div>
174+
{
175+
router && router.query.id && taskDetail._id ? <>
176+
<div style={{margin: `.5em auto`}}>
177+
{t(`Current Task created at:`)} &nbsp; {new Date(parseInt(taskDetail._id.substr(0,8), 16) * 1000).toLocaleString()}
178+
&nbsp;&nbsp; {t(`Running status`)}: { t(getTaskExpireStatusAndColor(taskDetail).status) }
179+
&nbsp;&nbsp; {t(`Task alias`)}: { taskDetail.extra.alias }
180+
181+
</div>
182+
</> : null
183+
}
174184
<div>
175185
<MonacoEditor
176186
defaultValue={editorValue.value || editorValue.createCustomTaskDefaultValue}

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { useResetAtom, RESET } from 'jotai/utils'
66

77
import { createTaskDetailAtom, monacoEditorAtom, userInfoAtom } from '../../atoms';
88
import { CronTime } from '@webest/web-page-monitor-helper';
9-
import { fetchAPI, useI18n, innerHTML, mergeToTarget, useHeadTitle } from "../../helpers/index";
9+
import { fetchAPI, useI18n, innerHTML, mergeToTarget, useHeadTitle, getTaskExpireStatusAndColor } from "../../helpers/index";
1010
import Link from "next/link";
1111

1212

@@ -231,6 +231,15 @@ Also, you can close our page, your task will keep running until `) + taskDetail.
231231
<Link prefetch={false} href="/market/script/list"><a>{t('Go to script market')}</a></Link>
232232
</div>
233233
<br/>
234+
{
235+
router && router.query.id && taskDetail._id ? <>
236+
<div style={{margin: `.5em auto`}}>
237+
{t(`Current Task created at:`)} &nbsp; {new Date(parseInt(taskDetail._id.substr(0,8), 16) * 1000).toLocaleString()}
238+
&nbsp;&nbsp;
239+
{t(`Running status`)}: { t(getTaskExpireStatusAndColor(taskDetail).status) }
240+
</div>
241+
</> : null
242+
}
234243
<div>
235244
{/* input cron syntax <br /> */}
236245
{t(taskDetail.cronMsg)}:<br/>

0 commit comments

Comments
 (0)