支持多语言英文

This commit is contained in:
whyour
2023-07-29 18:26:30 +08:00
parent 39bfd39559
commit e7d023a7e0
68 changed files with 2186 additions and 982 deletions
+24
View File
@@ -6,3 +6,27 @@ package.json
.umi .umi
.umi-production .umi-production
.umi-test .umi-test
.history
.tmp
node_modules
npm-debug.log*
yarn-error.log
yarn.lock
package-lock.json
static
data
DS_Store
src/.umi
src/.umi-production
src/.umi-test
.env.local
env
history
version.ts
config
log
db
manual_log
scripts
bak
.tmp
+5
View File
@@ -5,6 +5,11 @@ const baseUrl = process.env.QlBaseUrl || '/';
export default defineConfig({ export default defineConfig({
hash: true, hash: true,
antd: {}, antd: {},
locale: {
antd: true,
title: true,
baseNavigator: true,
},
outputPath: 'static/dist', outputPath: 'static/dist',
fastRefresh: true, fastRefresh: true,
favicons: [`https://qn.whyour.cn/favicon.svg`], favicons: [`https://qn.whyour.cn/favicon.svg`],
+1 -2
View File
@@ -53,7 +53,7 @@ export default (app: Router) => {
body: Joi.object({ body: Joi.object({
filename: Joi.string().required(), filename: Joi.string().required(),
path: Joi.string().allow(''), path: Joi.string().allow(''),
type: Joi.string().optional() type: Joi.string().optional(),
}), }),
}), }),
async (req: Request, res: Response, next: NextFunction) => { async (req: Request, res: Response, next: NextFunction) => {
@@ -75,5 +75,4 @@ export default (app: Router) => {
} }
}, },
); );
}; };
+2 -3
View File
@@ -35,9 +35,8 @@ export default (app: Router) => {
try { try {
const userService = Container.get(UserService); const userService = Container.get(UserService);
const authInfo = await userService.getUserInfo(); const authInfo = await userService.getUserInfo();
const { version, changeLog, changeLogLink, publishTime } = await parseVersion( const { version, changeLog, changeLogLink, publishTime } =
config.versionFile, await parseVersion(config.versionFile);
);
let isInitialized = true; let isInitialized = true;
if ( if (
+5 -3
View File
@@ -34,9 +34,11 @@ export function formatCommand(doc: Subscription, url?: string) {
if (type === 'file') { if (type === 'file') {
command += `raw "${_url}"`; command += `raw "${_url}"`;
} else { } else {
command += `repo "${_url}" "${whitelist || ''}" "${blacklist || ''}" "${dependences || '' command += `repo "${_url}" "${whitelist || ''}" "${blacklist || ''}" "${
}" "${branch || ''}" "${extensions || ''}" "${proxy || ''}" "${isNil(autoAddCron) ? true : Boolean(autoAddCron) dependences || ''
}" "${isNil(autoDelCron) ? true : Boolean(autoDelCron)}"`; }" "${branch || ''}" "${extensions || ''}" "${proxy || ''}" "${
isNil(autoAddCron) ? true : Boolean(autoAddCron)
}" "${isNil(autoDelCron) ? true : Boolean(autoDelCron)}"`;
} }
return command; return command;
} }
+5 -3
View File
@@ -39,12 +39,14 @@ export interface LoginLogInfo {
address?: string; address?: string;
ip?: string; ip?: string;
platform?: string; platform?: string;
status?: LoginStatus, status?: LoginStatus;
} }
export type AuthModelInfo = SystemConfigInfo & Partial<NotificationInfo> & LoginLogInfo; export type AuthModelInfo = SystemConfigInfo &
Partial<NotificationInfo> &
LoginLogInfo;
export interface AuthInstance extends Model<AuthInfo, AuthInfo>, AuthInfo { } export interface AuthInstance extends Model<AuthInfo, AuthInfo>, AuthInfo {}
export const AuthModel = sequelize.define<AuthInstance>('Auth', { export const AuthModel = sequelize.define<AuthInstance>('Auth', {
ip: DataTypes.STRING, ip: DataTypes.STRING,
type: DataTypes.STRING, type: DataTypes.STRING,
+1 -1
View File
@@ -66,7 +66,7 @@ export enum unInstallDependenceCommandTypes {
export interface DependenceInstance export interface DependenceInstance
extends Model<Dependence, Dependence>, extends Model<Dependence, Dependence>,
Dependence { } Dependence {}
export const DependenceModel = sequelize.define<DependenceInstance>( export const DependenceModel = sequelize.define<DependenceInstance>(
'Dependence', 'Dependence',
{ {
+5 -5
View File
@@ -30,15 +30,15 @@ export default async () => {
}); });
// 初始化更新所有任务状态为空闲 // 初始化更新所有任务状态为空闲
await CrontabModel.update( await CrontabModel.update({ status: CrontabStatus.idle }, { where: {} });
{ status: CrontabStatus.idle },
{ where: {} },
);
// 初始化时安装所有处于安装中,安装成功,安装失败的依赖 // 初始化时安装所有处于安装中,安装成功,安装失败的依赖
DependenceModel.findAll({ DependenceModel.findAll({
where: {}, where: {},
order: [['type', 'DESC'], ['createdAt', 'DESC']], order: [
['type', 'DESC'],
['createdAt', 'DESC'],
],
raw: true, raw: true,
}).then(async (docs) => { }).then(async (docs) => {
await DependenceModel.update( await DependenceModel.update(
+1 -1
View File
@@ -5,7 +5,7 @@ import dotenv from 'dotenv';
import Logger from './logger'; import Logger from './logger';
import { fileExist } from '../config/util'; import { fileExist } from '../config/util';
const rootPath = process.env.QL_DIR as string;; const rootPath = process.env.QL_DIR as string;
const dataPath = path.join(rootPath, 'data/'); const dataPath = path.join(rootPath, 'data/');
const configPath = path.join(dataPath, 'config/'); const configPath = path.join(dataPath, 'config/');
const scriptPath = path.join(dataPath, 'scripts/'); const scriptPath = path.join(dataPath, 'scripts/');
+3 -10
View File
@@ -5,11 +5,7 @@ import { Crontab, CrontabModel, CrontabStatus } from '../data/cron';
import { exec, execSync } from 'child_process'; import { exec, execSync } from 'child_process';
import fs from 'fs'; import fs from 'fs';
import cron_parser from 'cron-parser'; import cron_parser from 'cron-parser';
import { import { getFileContentByName, fileExist, killTask } from '../config/util';
getFileContentByName,
fileExist,
killTask,
} from '../config/util';
import { promises, existsSync } from 'fs'; import { promises, existsSync } from 'fs';
import { Op, where, col as colFn, FindOptions, fn } from 'sequelize'; import { Op, where, col as colFn, FindOptions, fn } from 'sequelize';
import path from 'path'; import path from 'path';
@@ -20,7 +16,7 @@ import { spawn } from 'cross-spawn';
@Service() @Service()
export default class CronService { export default class CronService {
constructor(@Inject('logger') private logger: winston.Logger) { } constructor(@Inject('logger') private logger: winston.Logger) {}
private isSixCron(cron: Crontab) { private isSixCron(cron: Crontab) {
const { schedule } = cron; const { schedule } = cron;
@@ -508,10 +504,7 @@ export default class CronService {
private make_command(tab: Crontab) { private make_command(tab: Crontab) {
let command = tab.command.trim(); let command = tab.command.trim();
if ( if (!command.startsWith(TASK_PREFIX) && !command.startsWith(QL_PREFIX)) {
!command.startsWith(TASK_PREFIX) &&
!command.startsWith(QL_PREFIX)
) {
command = `${TASK_PREFIX}${tab.command}`; command = `${TASK_PREFIX}${tab.command}`;
} }
const crontab_job_string = `ID=${tab.id} ${command}`; const crontab_job_string = `ID=${tab.id} ${command}`;
+4 -2
View File
@@ -32,7 +32,7 @@ export default class CronViewService {
} }
public async update(payload: CrontabView): Promise<CrontabView> { public async update(payload: CrontabView): Promise<CrontabView> {
const doc = await this.getDb({ id: payload.id }) const doc = await this.getDb({ id: payload.id });
const tab = new CrontabView({ ...doc, ...payload }); const tab = new CrontabView({ ...doc, ...payload });
const newDoc = await this.updateDb(tab); const newDoc = await this.updateDb(tab);
return newDoc; return newDoc;
@@ -59,7 +59,9 @@ export default class CronViewService {
} }
} }
public async getDb(query: FindOptions<CrontabView>['where']): Promise<CrontabView> { public async getDb(
query: FindOptions<CrontabView>['where'],
): Promise<CrontabView> {
const doc: any = await CrontabViewModel.findOne({ where: { ...query } }); const doc: any = await CrontabViewModel.findOne({ where: { ...query } });
return doc && (doc.get({ plain: true }) as CrontabView); return doc && (doc.get({ plain: true }) as CrontabView);
} }
+11 -5
View File
@@ -23,7 +23,7 @@ export default class DependenceService {
constructor( constructor(
@Inject('logger') private logger: winston.Logger, @Inject('logger') private logger: winston.Logger,
private sockService: SockService, private sockService: SockService,
) { } ) {}
public async create(payloads: Dependence[]): Promise<Dependence[]> { public async create(payloads: Dependence[]): Promise<Dependence[]> {
const tabs = payloads.map((x) => { const tabs = payloads.map((x) => {
@@ -193,7 +193,9 @@ export default class DependenceService {
const depVersionStr = versionDependenceCommandTypes[dependency.type]; const depVersionStr = versionDependenceCommandTypes[dependency.type];
let depVersion = ''; let depVersion = '';
if (depName.includes(depVersionStr)) { if (depName.includes(depVersionStr)) {
const symbolRegx = new RegExp(`(.*)${depVersionStr}([0-9\\.\\-\\+a-zA-Z]*)`); const symbolRegx = new RegExp(
`(.*)${depVersionStr}([0-9\\.\\-\\+a-zA-Z]*)`,
);
const [, _depName, _depVersion] = depName.match(symbolRegx) || []; const [, _depName, _depVersion] = depName.match(symbolRegx) || [];
if (_depVersion && _depName) { if (_depVersion && _depName) {
depName = _depName; depName = _depName;
@@ -202,19 +204,23 @@ export default class DependenceService {
} }
const isNodeDependence = dependency.type === DependenceTypes.nodejs; const isNodeDependence = dependency.type === DependenceTypes.nodejs;
const isLinuxDependence = dependency.type === DependenceTypes.linux; const isLinuxDependence = dependency.type === DependenceTypes.linux;
const isPythonDependence = dependency.type === DependenceTypes.python3; const isPythonDependence =
dependency.type === DependenceTypes.python3;
const depInfo = ( const depInfo = (
await promiseExecSuccess( await promiseExecSuccess(
isNodeDependence isNodeDependence
? `${getCommandPrefix} | grep "${depName}" | head -1` ? `${getCommandPrefix} | grep "${depName}" | head -1`
: `${getCommandPrefix} ${depName}`, : `${getCommandPrefix} ${depName}`,
) )
).replace(/\s{2,}/, ' ').replace(/\s+$/, ''); )
.replace(/\s{2,}/, ' ')
.replace(/\s+$/, '');
if ( if (
depInfo && depInfo &&
((isNodeDependence && depInfo.split(' ')?.[0] === depName) || ((isNodeDependence && depInfo.split(' ')?.[0] === depName) ||
(isLinuxDependence && depInfo.toLocaleLowerCase().includes('installed')) || (isLinuxDependence &&
depInfo.toLocaleLowerCase().includes('installed')) ||
isPythonDependence) && isPythonDependence) &&
(!depVersion || depInfo.includes(depVersion)) (!depVersion || depInfo.includes(depVersion))
) { ) {
+10 -6
View File
@@ -304,7 +304,8 @@ export default class NotificationService {
} }
private async weWorkBot() { private async weWorkBot() {
const { weWorkBotKey, weWorkOrigin = 'https://qyapi.weixin.qq.com' } = this.params; const { weWorkBotKey, weWorkOrigin = 'https://qyapi.weixin.qq.com' } =
this.params;
const url = `${weWorkOrigin}/cgi-bin/webhook/send?key=${weWorkBotKey}`; const url = `${weWorkOrigin}/cgi-bin/webhook/send?key=${weWorkBotKey}`;
try { try {
const res: any = await got const res: any = await got
@@ -329,7 +330,8 @@ export default class NotificationService {
} }
private async weWorkApp() { private async weWorkApp() {
const { weWorkAppKey, weWorkOrigin = 'https://qyapi.weixin.qq.com' } = this.params; const { weWorkAppKey, weWorkOrigin = 'https://qyapi.weixin.qq.com' } =
this.params;
const [corpid, corpsecret, touser, agentid, thumb_media_id = '1'] = const [corpid, corpsecret, touser, agentid, thumb_media_id = '1'] =
weWorkAppKey.split(','); weWorkAppKey.split(',');
const url = `${weWorkOrigin}/cgi-bin/gettoken`; const url = `${weWorkOrigin}/cgi-bin/gettoken`;
@@ -565,15 +567,17 @@ export default class NotificationService {
private async pushMe() { private async pushMe() {
const { pushMeKey } = this.params; const { pushMeKey } = this.params;
try { try {
const res: any = await got const res: any = await got.post(
.post(`https://push.i-i.me/?push_key=${pushMeKey}`, { `https://push.i-i.me/?push_key=${pushMeKey}`,
{
...this.gotOption, ...this.gotOption,
json: { json: {
title: this.title, title: this.title,
content: this.content content: this.content,
}, },
headers: { 'Content-Type': 'application/json' }, headers: { 'Content-Type': 'application/json' },
}); },
);
if (res.body === 'success') { if (res.body === 'success') {
return true; return true;
} else { } else {
+2 -2
View File
@@ -42,7 +42,7 @@ export default class ScheduleService {
private maxBuffer = 200 * 1024 * 1024; private maxBuffer = 200 * 1024 * 1024;
constructor(@Inject('logger') private logger: winston.Logger) { } constructor(@Inject('logger') private logger: winston.Logger) {}
async runTask( async runTask(
command: string, command: string,
@@ -109,7 +109,7 @@ export default class ScheduleService {
await callbacks.onError?.(JSON.stringify(error)); await callbacks.onError?.(JSON.stringify(error));
} }
}); });
}) });
} }
async createCronTask( async createCronTask(
+6 -3
View File
@@ -36,7 +36,7 @@ export default class SystemService {
@Inject('logger') private logger: winston.Logger, @Inject('logger') private logger: winston.Logger,
private scheduleService: ScheduleService, private scheduleService: ScheduleService,
private sockService: SockService, private sockService: SockService,
) { } ) {}
public async getSystemConfig() { public async getSystemConfig() {
const doc = await this.getDb({ type: AuthDataType.systemConfig }); const doc = await this.getDb({ type: AuthDataType.systemConfig });
@@ -111,7 +111,7 @@ export default class SystemService {
}, },
); );
lastVersionContent = await parseContentVersion(result.body); lastVersionContent = await parseContentVersion(result.body);
} catch (error) { } } catch (error) {}
if (!lastVersionContent) { if (!lastVersionContent) {
lastVersionContent = currentVersionContent; lastVersionContent = currentVersionContent;
@@ -256,7 +256,10 @@ export default class SystemService {
public async exportData(res: Response) { public async exportData(res: Response) {
try { try {
await tar.create({ gzip: true, file: config.dataTgzFile, cwd: config.rootPath }, ['data']) await tar.create(
{ gzip: true, file: config.dataTgzFile, cwd: config.rootPath },
['data'],
);
res.download(config.dataTgzFile); res.download(config.dataTgzFile);
} catch (error: any) { } catch (error: any) {
return res.send({ code: 400, message: error.message }); return res.send({ code: 400, message: error.message });
+15 -5
View File
@@ -10,7 +10,13 @@ import config from '../config';
import * as fs from 'fs'; import * as fs from 'fs';
import jwt from 'jsonwebtoken'; import jwt from 'jsonwebtoken';
import { authenticator } from '@otplib/preset-default'; import { authenticator } from '@otplib/preset-default';
import { AuthDataType, AuthInfo, AuthModel, AuthModelInfo, LoginStatus } from '../data/auth'; import {
AuthDataType,
AuthInfo,
AuthModel,
AuthModelInfo,
LoginStatus,
} from '../data/auth';
import { NotificationInfo } from '../data/notify'; import { NotificationInfo } from '../data/notify';
import NotificationService from './notify'; import NotificationService from './notify';
import { Request } from 'express'; import { Request } from 'express';
@@ -27,7 +33,7 @@ export default class UserService {
@Inject('logger') private logger: winston.Logger, @Inject('logger') private logger: winston.Logger,
private scheduleService: ScheduleService, private scheduleService: ScheduleService,
private sockService: SockService, private sockService: SockService,
) { } ) {}
public async login( public async login(
payloads: { payloads: {
@@ -119,7 +125,8 @@ export default class UserService {
}); });
await this.notificationService.notify( await this.notificationService.notify(
'登录通知', '登录通知',
`你于${dayjs(timestamp).format('YYYY-MM-DD HH:mm:ss')}${address} ${req.platform `你于${dayjs(timestamp).format('YYYY-MM-DD HH:mm:ss')}${address} ${
req.platform
}端 登录成功,ip地址 ${ip}`, }端 登录成功,ip地址 ${ip}`,
); );
await this.getLoginLog(); await this.getLoginLog();
@@ -147,7 +154,8 @@ export default class UserService {
}); });
await this.notificationService.notify( await this.notificationService.notify(
'登录通知', '登录通知',
`你于${dayjs(timestamp).format('YYYY-MM-DD HH:mm:ss')}${address} ${req.platform `你于${dayjs(timestamp).format('YYYY-MM-DD HH:mm:ss')}${address} ${
req.platform
}端 登录失败,ip地址 ${ip}`, }端 登录失败,ip地址 ${ip}`,
); );
await this.getLoginLog(); await this.getLoginLog();
@@ -190,7 +198,9 @@ export default class UserService {
where: { type: AuthDataType.loginLog }, where: { type: AuthDataType.loginLog },
}); });
if (docs && docs.length > 0) { if (docs && docs.length > 0) {
const result = docs.sort((a, b) => b.info!.timestamp! - a.info!.timestamp!); const result = docs.sort(
(a, b) => b.info!.timestamp! - a.info!.timestamp!,
);
if (result.length > 100) { if (result.length > 100) {
await AuthModel.destroy({ await AuthModel.destroy({
where: { id: result[result.length - 1].id }, where: { id: result[result.length - 1].id },
+5 -3
View File
@@ -1,6 +1,6 @@
import pLimit from "p-limit"; import pLimit from 'p-limit';
import os from 'os'; import os from 'os';
import { AuthDataType, AuthModel } from "../data/auth"; import { AuthDataType, AuthModel } from '../data/auth';
class TaskLimit { class TaskLimit {
private oneLimit = pLimit(1); private oneLimit = pLimit(1);
@@ -17,7 +17,9 @@ class TaskLimit {
return; return;
} }
await AuthModel.sync(); await AuthModel.sync();
const doc = await AuthModel.findOne({ where: { type: AuthDataType.systemConfig } }); const doc = await AuthModel.findOne({
where: { type: AuthDataType.systemConfig },
});
if (doc?.info?.cronConcurrency) { if (doc?.info?.cronConcurrency) {
this.cpuLimit = pLimit(doc?.info?.cronConcurrency); this.cpuLimit = pLimit(doc?.info?.cronConcurrency);
} }
+3 -5
View File
@@ -1,5 +1,5 @@
import { spawn } from 'cross-spawn'; import { spawn } from 'cross-spawn';
import taskLimit from "./pLimit"; import taskLimit from './pLimit';
import Logger from '../loaders/logger'; import Logger from '../loaders/logger';
export function runCron(cmd: string): Promise<number> { export function runCron(cmd: string): Promise<number> {
@@ -27,11 +27,9 @@ export function runCron(cmd: string): Promise<number> {
}); });
cp.on('close', async (code) => { cp.on('close', async (code) => {
Logger.info( Logger.info(`[任务退出] ${cmd} 进程id: ${cp.pid} 退出,退出码 ${code}`);
`[任务退出] ${cmd} 进程id: ${cp.pid} 退出,退出码 ${code}`,
);
resolve(); resolve();
}); });
}); });
}) });
} }
+1
View File
@@ -153,6 +153,7 @@
"react-dnd": "^14.0.2", "react-dnd": "^14.0.2",
"react-dnd-html5-backend": "^14.0.0", "react-dnd-html5-backend": "^14.0.0",
"react-dom": "18.2.0", "react-dom": "18.2.0",
"react-intl-universal": "^2.6.21",
"react-split-pane": "^0.1.92", "react-split-pane": "^0.1.92",
"sockjs-client": "^1.6.0", "sockjs-client": "^1.6.0",
"ts-node": "^10.6.0", "ts-node": "^10.6.0",
+311 -183
View File
File diff suppressed because it is too large Load Diff
+15
View File
@@ -1,4 +1,19 @@
const baseUrl = window.__ENV__QlBaseUrl || '/'; const baseUrl = window.__ENV__QlBaseUrl || '/';
import intl from 'react-intl-universal';
export function rootContainer(container: any) {
const locales = {
'en-US': require('./locales/en-US.json'),
'zh-CN': require('./locales/zh-CN.json'),
};
let currentLocale = intl.determineLocale({
urlLocaleKey: 'lang',
cookieLocaleKey: 'lang',
});
intl.init({ currentLocale, locales });
return container;
}
export function modifyClientRenderOpts(memo: any) { export function modifyClientRenderOpts(memo: any) {
return { return {
+5 -1
View File
@@ -1,3 +1,4 @@
import intl from 'react-intl-universal';
import React, { useRef, useState, useEffect } from 'react'; import React, { useRef, useState, useEffect } from 'react';
import { Tooltip, Typography } from 'antd'; import { Tooltip, Typography } from 'antd';
import { CopyOutlined, CheckOutlined } from '@ant-design/icons'; import { CopyOutlined, CheckOutlined } from '@ant-design/icons';
@@ -28,7 +29,10 @@ const Copy = ({ text }: { text: string }) => {
return ( return (
<Link onClick={copyText} style={{ marginLeft: 1 }}> <Link onClick={copyText} style={{ marginLeft: 1 }}>
<CopyToClipboard text={text}> <CopyToClipboard text={text}>
<Tooltip key="copy" title={copied ? '复制成功' : '复制'}> <Tooltip
key="copy"
title={copied ? intl.get('复制成功') : intl.get('复制')}
>
{copied ? <CheckOutlined /> : <CopyOutlined />} {copied ? <CheckOutlined /> : <CopyOutlined />}
</Tooltip> </Tooltip>
</CopyToClipboard> </CopyToClipboard>
+2 -1
View File
@@ -1,3 +1,4 @@
import intl from 'react-intl-universal';
import { Tag, Input } from 'antd'; import { Tag, Input } from 'antd';
import { TweenOneGroup } from 'rc-tween-one'; import { TweenOneGroup } from 'rc-tween-one';
import { PlusOutlined } from '@ant-design/icons'; import { PlusOutlined } from '@ant-design/icons';
@@ -101,7 +102,7 @@ const EditableTagGroup = ({
onClick={showInput} onClick={showInput}
style={{ borderStyle: 'dashed', cursor: 'pointer' }} style={{ borderStyle: 'dashed', cursor: 'pointer' }}
> >
<PlusOutlined /> <PlusOutlined /> {intl.get('新建')}
</Tag> </Tag>
)} )}
</> </>
+14 -23
View File
@@ -1,14 +1,5 @@
import { import intl from 'react-intl-universal';
FormOutlined, import { SettingOutlined } from '@ant-design/icons';
FieldTimeOutlined,
DiffOutlined,
SettingOutlined,
CodeOutlined,
FolderOutlined,
RadiusSettingOutlined,
ControlOutlined,
ContainerOutlined,
} from '@ant-design/icons';
import IconFont from '@/components/iconfont'; import IconFont from '@/components/iconfont';
import { BasicLayoutProps } from '@ant-design/pro-layout'; import { BasicLayoutProps } from '@ant-design/pro-layout';
@@ -16,74 +7,74 @@ export default {
route: { route: {
routes: [ routes: [
{ {
name: '登录', name: intl.get('登录'),
path: '/login', path: '/login',
hideInMenu: true, hideInMenu: true,
component: '@/pages/login/index', component: '@/pages/login/index',
}, },
{ {
name: '初始化', name: intl.get('初始化'),
path: '/initialization', path: '/initialization',
hideInMenu: true, hideInMenu: true,
component: '@/pages/initialization/index', component: '@/pages/initialization/index',
}, },
{ {
name: '错误', name: intl.get('错误'),
path: '/error', path: '/error',
hideInMenu: true, hideInMenu: true,
component: '@/pages/error/index', component: '@/pages/error/index',
}, },
{ {
path: '/crontab', path: '/crontab',
name: '定时任务', name: intl.get('定时任务'),
icon: <IconFont type="ql-icon-crontab" />, icon: <IconFont type="ql-icon-crontab" />,
component: '@/pages/crontab/index', component: '@/pages/crontab/index',
}, },
{ {
path: '/subscription', path: '/subscription',
name: '订阅管理', name: intl.get('订阅管理'),
icon: <IconFont type="ql-icon-subs" />, icon: <IconFont type="ql-icon-subs" />,
component: '@/pages/subscription/index', component: '@/pages/subscription/index',
}, },
{ {
path: '/env', path: '/env',
name: '环境变量', name: intl.get('环境变量'),
icon: <IconFont type="ql-icon-env" />, icon: <IconFont type="ql-icon-env" />,
component: '@/pages/env/index', component: '@/pages/env/index',
}, },
{ {
path: '/config', path: '/config',
name: '配置文件', name: intl.get('配置文件'),
icon: <IconFont type="ql-icon-config" />, icon: <IconFont type="ql-icon-config" />,
component: '@/pages/config/index', component: '@/pages/config/index',
}, },
{ {
path: '/script', path: '/script',
name: '脚本管理', name: intl.get('脚本管理'),
icon: <IconFont type="ql-icon-script" />, icon: <IconFont type="ql-icon-script" />,
component: '@/pages/script/index', component: '@/pages/script/index',
}, },
{ {
path: '/dependence', path: '/dependence',
name: '依赖管理', name: intl.get('依赖管理'),
icon: <IconFont type="ql-icon-dependence" />, icon: <IconFont type="ql-icon-dependence" />,
component: '@/pages/dependence/index', component: '@/pages/dependence/index',
}, },
{ {
path: '/log', path: '/log',
name: '日志管理', name: intl.get('日志管理'),
icon: <IconFont type="ql-icon-log" />, icon: <IconFont type="ql-icon-log" />,
component: '@/pages/log/index', component: '@/pages/log/index',
}, },
{ {
path: '/diff', path: '/diff',
name: '对比工具', name: intl.get('对比工具'),
icon: <IconFont type="ql-icon-diff" />, icon: <IconFont type="ql-icon-diff" />,
component: '@/pages/diff/index', component: '@/pages/diff/index',
}, },
{ {
path: '/setting', path: '/setting',
name: '系统设置', name: intl.get('系统设置'),
icon: <SettingOutlined />, icon: <SettingOutlined />,
component: '@/pages/password/index', component: '@/pages/password/index',
}, },
+2
View File
@@ -332,6 +332,8 @@ select:-webkit-autofill:focus {
} }
.ant-pro-sider-logo { .ant-pro-sider-logo {
padding-inline: 8px !important;
.title { .title {
display: flex; display: flex;
height: 32px; height: 32px;
+11 -5
View File
@@ -1,3 +1,4 @@
import intl from 'react-intl-universal';
import React, { useEffect, useState, useRef } from 'react'; import React, { useEffect, useState, useRef } from 'react';
import ProLayout, { PageLoading } from '@ant-design/pro-layout'; import ProLayout, { PageLoading } from '@ant-design/pro-layout';
import * as DarkReader from '@umijs/ssr-darkreader'; import * as DarkReader from '@umijs/ssr-darkreader';
@@ -264,7 +265,7 @@ export default function () {
const menu: MenuProps = { const menu: MenuProps = {
items: [ items: [
{ {
label: '退出登录', label: intl.get('退出登录'),
className: 'side-menu-user-drop-menu', className: 'side-menu-user-drop-menu',
onClick: logout, onClick: logout,
key: 'logout', key: 'logout',
@@ -283,7 +284,7 @@ export default function () {
<> <>
<Image preview={false} src="https://qn.whyour.cn/logo.png" /> <Image preview={false} src="https://qn.whyour.cn/logo.png" />
<div className="title"> <div className="title">
<span className="title"></span> <span className="title">{intl.get('青龙')}</span>
<a <a
href={systemInfo?.changeLogLink} href={systemInfo?.changeLogLink}
target="_blank" target="_blank"
@@ -293,7 +294,11 @@ export default function () {
}} }}
> >
<Tooltip <Tooltip
title={systemInfo?.branch === 'develop' ? '开发版' : '正式版'} title={
systemInfo?.branch === 'develop'
? intl.get('开发版')
: intl.get('正式版')
}
> >
<Badge size="small" dot={systemInfo?.branch === 'develop'}> <Badge size="small" dot={systemInfo?.branch === 'develop'}>
<span <span
@@ -326,8 +331,9 @@ export default function () {
}} }}
pageTitleRender={(props, pageName, info) => { pageTitleRender={(props, pageName, info) => {
const title = const title =
(config.documentTitleMap as any)[location.pathname] || '未找到'; (config.documentTitleMap as any)[location.pathname] ||
return `${title} - 青龙`; intl.get('未找到');
return `${title} - ${intl.get('青龙')}`;
}} }}
onCollapse={setCollapsed} onCollapse={setCollapsed}
collapsed={collapsed} collapsed={collapsed}
+396
View File
@@ -0,0 +1,396 @@
{
"复制成功": "Copy successful",
"复制": "Copy",
"新建": "New",
"登录": "Login",
"初始化": "Initialize",
"错误": "Error",
"定时任务": "Scheduled Tasks",
"订阅管理": "Subscription Management",
"环境变量": "Environment Variables",
"配置文件": "Configuration Files",
"脚本管理": "Script Management",
"依赖管理": "Dependency Management",
"日志管理": "Log Management",
"对比工具": "Comparison Tool",
"系统设置": "System Settings",
"退出登录": "Logout",
"青龙": "Qinglong",
"返回首页": "Return to Home",
"保存": "Save",
"日志": "Log",
"脚本": "Script",
"确认保存文件": "Confirm to Save File",
",保存后不可恢复": ", it can't be recovered after saving.",
"确认运行": "Confirm to Run",
"确认运行定时任务": "Confirm to Run Scheduled Task",
"吗": "?",
"确认停止": "Confirm to Stop",
"确认停止定时任务": "Confirm to Stop Scheduled Task",
"确认": "Confirm",
"任务": "Task",
"状态": "Status",
"空闲中": "Idle",
"运行中": "Running",
"队列中": "In Queue",
"已禁用": "Disabled",
"定时": "Schedule",
"最后运行时间": "Last Run Time",
"最后运行时长": "Last Run Duration",
"下次运行时间": "Next Run Time",
"名称": "Name",
"命令/脚本": "Command/Script",
"定时规则": "Schedule Rule",
"操作": "Action",
"确认删除": "Confirm to Delete",
"确认删除定时任务": "Confirm to Delete Scheduled Task",
"编辑": "Edit",
"删除": "Delete",
"确认删除选中的定时任务吗": "Confirm to delete the selected scheduled tasks?",
"选中的定时任务吗": "selected scheduled tasks?",
"创建视图": "Create View",
"视图管理": "View Management",
"请输入名称或者关键词": "Please enter a name or keyword",
"创建任务": "Create Task",
"更多": "More",
"批量删除": "Batch Delete",
"批量启用": "Batch Enable",
"批量禁用": "Batch Disable",
"批量运行": "Batch Run",
"批量停止": "Batch Stop",
"批量置顶": "Batch Top",
"批量取消置顶": "Batch Un-top",
"批量修改标签": "Batch Modify Tags",
"已选择": "Selected",
"项": "items",
"知道了": "Got it",
"请输入任务名称": "Please enter the task name",
"支持输入脚本路径/任意系统可执行命令/task 脚本路径": "Supports input of script paths / any system executable commands / task script paths",
"秒(可选) 分 时 天 月 周": "Seconds (optional) Minutes Hours Day Month Week",
"标签": "Tags",
"取消": "Cancel",
"添加": "Add",
"启用": "Enable",
"禁用": "Disable",
"运行": "Run",
"停止": "Stop",
"置顶": "Top",
"取消置顶": "Un-top",
"命令": "Command",
"包含": "Include",
"不包含": "Exclude",
"属于": "Belong to",
"不属于": "Not Belong to",
"顺序": "Order",
"倒序": "Reverse",
"且": "And",
"或": "Or",
"输入后回车增加自定义选项": "Press Enter to add custom options",
"视图名称": "View Name",
"请输入视图名称": "Please enter the view name",
"请输入内容": "Please enter the content",
"新增筛选条件": "Add Filter",
"新增排序方式": "Add Sort",
"类型": "Type",
"显示": "Display",
"确认删除视图": "Confirm to delete the view",
"安装中": "Installing",
"已安装": "Installed",
"安装失败": "Installation Failed",
"删除中": "Deleting",
"已删除": "Deleted",
"删除失败": "Deletion Failed",
"序号": "Number",
"备注": "Remarks",
"更新时间": "Update Time",
"创建时间": "Creation Time",
"确认删除依赖": "Confirm to delete the dependency",
"确认重新安装": "Confirm to reinstall",
"确认删除选中的依赖吗": "Confirm to delete the selected dependencies?",
"确认重新安装选中的依赖吗": "Confirm to reinstall the selected dependencies?",
"请输入名称": "Please enter a name",
"创建依赖": "Create Dependency",
"批量安装": "Batch Install",
"批量强制删除": "Batch Force Delete",
"日志 -": "Log -",
"依赖类型": "Dependency Type",
"自动拆分": "Auto Split",
"多个依赖是否换行分割": "Whether to separate multiple dependencies with new lines",
"是": "Yes",
"否": "No",
"请输入依赖名称,支持指定版本": "Please enter the dependency name, version specification is supported",
"请输入依赖名称": "Please enter the dependency name",
"请输入备注": "Please enter remarks",
"源文件": "Source File",
"当前文件": "Current File",
"修改环境变量名称": "Modify Environment Variable Name",
"请输入新的环境变量名称": "Please enter the new environment variable name",
"已启用": "Enabled",
"值": "Value",
"确认删除变量": "Confirm to delete the variable",
"确认删除选中的变量吗": "Confirm to delete the selected variables?",
"选中的变量吗": "selected variables?",
"请输入名称/值/备注": "Please enter name/value/remarks",
"导入": "Import",
"创建变量": "Create Variable",
"批量修改变量名称": "Batch Modify Variable Names",
"批量导出": "Batch Export",
"请输入环境变量名称": "Please enter the environment variable name",
"只能输入字母数字下划线,且不能以数字开头": "Only letters, numbers, and underscores are allowed, and cannot start with a number",
"请输入环境变量值": "Please enter the environment variable value",
"服务启动超时": "Service startup timeout",
"请先按如下方式修复:": "Please fix it as follows:",
"1. 宿主机执行 docker run --rm -v\n /var/run/docker.sock:/var/run/docker.sock\n containrrr/watchtower -cR <容器名>": "1. Execute 'docker run --rm -v /var/run/docker.sock:/var/run/docker.sock containrrr/watchtower -cR <container_name>' on the host machine",
"2. 容器内执行 ql -l check、ql -l update": "2. Execute 'ql -l check' and 'ql -l update' inside the container",
"3. 如果无法解决,容器内执行 pm2 logs,拷贝执行结果": "3. If the problem persists, execute 'pm2 logs' inside the container and copy the results",
"提交 issue": "Submit an issue",
"启动中,请稍后...": "Starting, please wait...",
"欢迎使用": "Welcome to use",
"欢迎使用青龙": "Welcome to use Qinglong",
"支持python3、javascript、shell、typescript 的定时任务管理面板": "A scheduling task management panel that supports python3, javascript, shell, and typescript",
"开始安装": "Start Installation",
"账户设置": "Account Settings",
"用户名": "Username",
"密码": "Password",
"密码不能为admin": "The password cannot be 'admin'",
"确认密码": "Confirm Password",
"您输入的两个密码不匹配!": "The two passwords you entered do not match!",
"提交": "Submit",
"通知设置": "Notification Settings",
"通知方式": "Notification Method",
"请选择通知方式": "Please select a notification method",
"跳过": "Skip",
"完成安装": "Installation Completed",
"恭喜安装完成!": "Congratulations, the installation is completed!",
"Telegram频道": "Telegram Channel",
"去登录": "Go to Login",
"初始化配置": "Initialize Configuration",
"文件": "File",
",删除后不可恢复": ", it can't be recovered after deletion",
"请选择日志": "Please select a log",
"请输入日志名": "Please enter the log name",
"暂无日志": "No logs available",
"登录成功!": "Login successful!",
"上次登录时间:": "Last login time: ",
"上次登录地点:": "Last login location: ",
"上次登录IP": "Last login IP: ",
"上次登录设备:": "Last login device: ",
"上次登录状态:": "Last login status: ",
"验证码": "Verification Code",
"验证码为6位数字": "Verification code is a 6-digit number",
"6位数字": "6-digit number",
"验证": "Verify",
"请": "Please",
"秒后重试": "Retry after seconds",
"在您的设备上打开两步验证应用程序以查看您的身份验证代码并验证您的身份。": "Open the two-factor authentication application on your device to view your authentication code and verify your identity.",
"请选择脚本文件": "Please select a script file",
"清空日志": "Clear Logs",
"设置": "Settings",
"退出": "Exit",
"空文件": "Empty File",
"本地文件": "Local File",
"文件夹": "Folder",
"文件名": "File Name",
"请输入文件名": "Please enter the file name",
"文件名不能包含斜杠": "File names cannot contain slashes",
"文件夹名": "Folder Name",
"请输入文件夹名": "Please enter the folder name",
"父目录": "Parent Directory",
"请选择父目录": "Please select a parent directory",
"点击或者拖拽文件到此区域上传": "Click or drag files here to upload",
"当前修改未保存,确定离开吗": "The current changes are not saved. Are you sure you want to leave?",
"退出编辑": "Exit Editing",
"重命名": "Rename",
"请选择脚本": "Please select a script",
"调试": "Debug",
"请输入脚本名": "Please enter the script name",
"暂无脚本": "No scripts available",
"请输入新名称": "Please enter a new name",
"保存文件": "Save File",
"保存目录": "Save Directory",
"请输入保存目录,默认scripts目录": "Please enter the save directory, default is 'scripts'",
"运行设置": "Run Settings",
"待开发": "To Be Developed",
"开发版": "Developer Edition",
"正式版": "Official Edition",
"版本": "Version",
"更新日志": "Changelog",
"查看": "View",
"提交BUG": "Submit Bug",
"名称不能为保留关键字": "The name cannot be a reserved keyword",
"请输入应用名称": "Please enter the application name",
"权限": "Permission",
"请选择模块权限": "Please select module permissions",
"更新": "Update",
"已经是最新版了!": "It is already the latest version!",
"是目前检测到的最新可用版本了。": "It is the latest available version currently detected.",
"重新下载": "Redownload",
"更新可用": "Update Available",
"新版本": "Create Version",
"可用,你使用的版本为": "available, the version you are using is",
"下载更新": "Download Update",
"以后再说": "Later",
"下载更新中...": "Downloading Update...",
"确认重启": "Confirm to Restart",
"系统安装包下载成功,确认重启": "System installation package downloaded successfully, confirm to restart",
"重启": "Restart",
"系统将在": "The system will restart in",
"秒后自动刷新": "seconds and automatically refresh",
"检查更新": "Check for Updates",
"确认删除应用": "Confirm to delete the application",
"确认重置": "Confirm to reset",
"确认重置应用": "Confirm to reset the application",
"的Secret吗": "'s Secret?",
"重置Secret会让当前应用所有token失效": "Resetting the Secret will invalidate all tokens for the current application",
"创建应用": "Create Application",
"安全设置": "Security Settings",
"应用设置": "Application Settings",
"登录日志": "Login Logs",
"其他设置": "Other Settings",
"关于": "About",
"成功": "Success",
"失败": "Failure",
"登录时间": "Login Time",
"登录地址": "Login Address",
"登录IP": "Login IP",
"登录设备": "Login Device",
"登录状态": "Login Status",
"亮色": "Light",
"暗色": "Dark",
"跟随系统": "Follow System",
"备份数据上传成功,确认覆盖数据": "Data backup uploaded successfully, confirm data overwrite",
"主题设置": "Theme Settings",
"日志删除频率": "Log Deletion Frequency",
"每x天自动删除x天以前的日志": "Automatically delete logs older than x days every x days",
"每": "Every",
"天": "day(s)",
"定时任务并发数": "Concurrent Scheduled Tasks",
"数据备份还原": "Data Backup & Restore",
"还原数据": "Restore Data",
"第一步": "Step 1",
"下载两步验证手机应用,比如 Google Authenticator 、": "Download a two-factor authentication mobile app, like Google Authenticator,",
"第二步": "Step 2",
"使用手机应用扫描二维码,或者输入秘钥": "Scan the QR code with the mobile app or enter the key",
"第三步": "Step 3",
"输入手机应用上的6位数字": "Enter the 6-digit code from the mobile app",
"完成设置": "Finish Setup",
"修改用户名密码": "Change Username and Password",
"两步验证": "Two-Factor Authentication",
"头像": "Profile Picture",
"更换头像": "Change Profile Picture",
"时": "hour(s)",
"分": "minute(s)",
"秒": "second(s)",
"私有仓库": "Private Repository",
"公开仓库": "Public Repository",
"单文件": "Single File",
"链接": "Link",
"分支": "Branch",
"确认删除定时订阅": "Confirm Deletion of Scheduled Subscription",
"定时订阅": "Scheduled Subscription",
"创建订阅": "Create Subscription",
"私钥": "Private Key",
"请输入私钥": "Please enter the private key",
"请输入认证用户名": "Please enter the authentication username",
"Github已不支持密码认证,请使用Token方式": "Github no longer supports password authentication. Please use the Token method.",
"密码/Token": "Password/Token",
"请输入密码或者Token": "Please enter the password or Token",
"支持拷贝 ql repo/raw 命令,粘贴导入": "Supports copying ql repo/raw command for import",
"请输入订阅链接": "Please enter the subscription link",
"请输入分支": "Please enter the branch",
"唯一值": "Unique Value",
"唯一值用于日志目录和私钥别名": "Unique value used for log directory and private key alias",
"自动生成": "Auto-generated",
"拉取方式": "Pull Method",
"用户名密码/Token": "Username/Password or Token",
"定时类型": "Schedule Type",
"白名单": "Whitelist",
"多个关键词竖线分割,支持正则表达式": "Multiple keywords separated by vertical lines (|), supports regular expressions",
"请输入脚本筛选白名单关键词,多个关键词竖线分割": "Please enter script filtering whitelist keywords, multiple keywords separated by vertical lines (|)",
"黑名单": "Blacklist",
"请输入脚本筛选黑名单关键词,多个关键词竖线分割": "Please enter script filtering blacklist keywords, multiple keywords separated by vertical lines (|)",
"依赖文件": "Dependency Files",
"请输入脚本依赖文件关键词,多个关键词竖线分割": "Please enter script dependency file keywords, multiple keywords separated by vertical lines (|)",
"文件后缀": "File Extension",
"仓库需要拉取的文件后缀,多个后缀空格分隔,默认使用配置文件中的RepoFileExtensions": "Repository requires pulling specific file extensions, multiple extensions separated by spaces, uses RepoFileExtensions from the configuration file by default",
"请输入文件后缀": "Please enter the file extension",
"执行前": "Before Execution",
"运行订阅前执行的命令,比如 cp/mv/python3 xxx.py/node xxx.js": "Run commands before executing the subscription, e.g., cp/mv/python3 xxx.py/node xxx.js",
"请输入运行订阅前要执行的命令": "Please enter the command to run before executing the subscription",
"执行后": "After Execution",
"运行订阅后执行的命令,比如 cp/mv/python3 xxx.py/node xxx.js": "Run commands after executing the subscription, e.g., cp/mv/python3 xxx.py/node xxx.js",
"请输入运行订阅后要执行的命令": "Please enter the command to run after executing the subscription",
"代理": "Proxy",
"公开仓库支持HTTP/SOCK5代理,私有仓库支持SOCK5代理": "Public repositories support HTTP/SOCK5 proxies, private repositories support SOCK5 proxies",
"自动添加任务": "Automatically Add Tasks",
"自动删除任务": "Automatically Delete Tasks",
"中文": "Chinese",
"系统信息": "System Information",
"Server酱": "ServerChan",
"Telegram机器人": "Telegram Bot",
"钉钉机器人": "DingTalk Bot",
"企业微信机器人": "WeChat Work Bot",
"企业微信应用": "WeChat Work App",
"智能微秘书": "Smart WeChat Assistant",
"群晖chat": "Synology Chat",
"邮箱": "Email",
"飞书机器人": "Feishu Bot",
"自定义通知": "Custom Notification",
"已关闭": "Disabled",
"gotify的url地址,例如 https://push.example.de:8080": "gotify URL address, e.g., https://push.example.de:8080",
"gotify的消息应用token码": "gotify message application token code",
"推送消息的优先级": "Priority of Push Messages",
"chat的url地址": "Chat URL address",
"chat的token码": "Chat token code",
"推送到个人QQ: http://127.0.0.1/send_private_msg,群:http://127.0.0.1/send_group_msg": "Push to personal QQ: http://127.0.0.1/send_private_msg, group: http://127.0.0.1/send_group_msg",
"访问密钥": "Access Key",
"如果GOBOT_URL设置 /send_private_msg 则需要填入 user_id=个人QQ 相反如果是 /send_group_msg 则需要填入 group_id=QQ群": "If GOBOT_URL is set to /send_private_msg, enter user_id=personal QQ; if set to /send_group_msg, enter group_id=QQ group",
"Server酱SENDKEY": "ServerChan SENDKEY",
"PushDeer的Keyhttps://github.com/easychen/pushdeer": "PushDeer Key, https://github.com/easychen/pushdeer",
"PushDeer的自架API endpoint,默认是 https://api2.pushdeer.com/message/push": "PushDeer's self-hosted API endpoint, default is https://api2.pushdeer.com/message/push",
"Bark的信息IP/设备码,例如:https://api.day.app/XXXXXXXX": "Bark information IP/device code, e.g., https://api.day.app/XXXXXXXX",
"BARK推送图标,自定义推送图标 (需iOS15或以上才能显示)": "BARK push icon, custom push icon (requires iOS 15 or above to display)",
"BARK推送铃声,铃声列表去APP查看复制填写": "BARK push ringtone, check and copy from the APP's ringtone list",
"BARK推送消息的分组,默认为qinglong": "BARK push message grouping, default is qinglong",
"telegram机器人的token,例如:1077xxx4424:AAFjv0FcqxxxxxxgEMGfi22B4yh15R5uw": "Telegram Bot token, e.g., 1077xxx4424:AAFjv0FcqxxxxxxgEMGfi22B4yh15R5uw",
"telegram用户的id,例如:129xxx206": "Telegram user ID, e.g., 129xxx206",
"代理IP": "Proxy IP",
"代理端口": "Proxy Port",
"telegram代理配置认证参数,用户名与密码用英文冒号连接 user:password": "Telegram proxy configuration authentication parameters, connect username and password with a colon, e.g., user:password",
"telegram api自建的反向代理地址,默认tg官方api": "Telegram API's self-built reverse proxy address, default is official tg API",
"钉钉机器人webhook token,例如:5a544165465465645d0f31dca676e7bd07415asdasd": "DingTalk Bot webhook token, e.g., 5a544165465465645d0f31dca676e7bd07415asdasd",
"密钥,机器人安全设置页面,加签一栏下面显示的SEC开头的字符串": "Secret key, shown below the signing section on the robot's security settings page, starts with SEC",
"企业微信机器人的webhook(详见文档 https://work.weixin.qq.com/api/doc/90000/90136/91770),例如:693a91f6-7xxx-4bc4-97a0-0ec2sifa5aaa": "WeChat Work Bot webhook (see documentation at https://work.weixin.qq.com/api/doc/90000/90136/91770), e.g., 693a91f6-7xxx-4bc4-97a0-0ec2sifa5aaa",
"企业微信代理地址": "WeChat Work Proxy Address",
"corpid、corpsecret、touser(注:多个成员ID使用|隔开)、agentid、消息类型(选填,不填默认文本消息类型) 注意用,号隔开(英文输入法的逗号),例如:wwcfrs,B-76WERQ,qinglong,1000001,2COat": "corpid, corpsecret, touser (note: separate multiple member IDs with |), agentid, message type (optional, defaults to text message type) separated by commas (`,`), e.g., wwcfrs, B-76WERQ, qinglong, 1000001, 2COat",
"密钥key,智能微秘书个人中心获取apikey,申请地址:https://wechat.aibotk.com/signup?from=ql": "Key, obtain the API key from the Smart WeChat Assistant's personal center, apply at: https://wechat.aibotk.com/signup?from=ql",
"发送的目标,群组或者好友": "Recipient, group, or friend",
"请输入要发送的目标": "Please enter the recipient's name (group or friend)",
"群聊": "Group Chat",
"好友": "Friend",
"要发送的用户昵称或群名,如果目标是群,需要填群名,如果目标是好友,需要填好友昵称": "Enter the recipient's nickname if it's a friend or the group name if it's a group",
"iGot的信息推送key,例如:https://push.hellyw.com/XXXXXXXX": "iGot information push key, e.g., https://push.hellyw.com/XXXXXXXX",
"微信扫码登录后一对一推送或一对多推送下面的token(您的Token),不提供PUSH_PLUS_USER则默认为一对一推送,参考 https://www.pushplus.plus/": "After WeChat scan login, one-to-one or one-to-many push using the provided token (your Token). If PUSH_PLUS_USER is not provided, it defaults to one-to-one push. See reference at https://www.pushplus.plus/",
"一对多推送的“群组编码”(一对多推送下面->您的群组(如无则创建)->群组编码,如果您是创建群组人。也需点击“查看二维码”扫描绑定,否则不能接受群组消息推送)": "The 'group code' for one-to-many push (one-to-many push -> your group (if none, create one) -> group code). If you are the creator of the group, you need to click 'View QR code' to scan and bind, otherwise, you won't receive group messages.",
"飞书群组机器人:https://www.feishu.cn/hc/zh-CN/articles/360024984973": "Feishu group bot: https://www.feishu.cn/hc/zh-CN/articles/360024984973",
"邮箱服务名称,比如126、163、Gmail、QQ等,支持列表https://nodemailer.com/smtp/well-known/": "Email service name, e.g., 126, 163, Gmail, QQ, etc. Supported list: https://nodemailer.com/smtp/well-known/",
"邮箱地址": "Email Address",
"邮箱SMTP授权码": "Email SMTP Authorization Code",
"PushMe的Keyhttps://push.i-i.me/": "PushMe key, https://push.i-i.me/",
"请求方法": "Request Method",
"请求头Content-Type": "Request Header Content-Type",
"请求链接以http或者https开头。url或者body中必须包含$title$content可选,对应api内容的位置": "Request URL should start with http or https. URL or body must contain $title, $content is optional and corresponds to the API content position.",
"请求头格式Custom-Header1: Header1,多个换行分割": "Request header format: Custom-Header1: Header1 (separate multiple headers with line breaks)",
"请求体格式key1: value1,多个换行分割。url或者body中必须包含$title$content可选,对应api内容的位置": "Request body format: key1: value1 (separate multiple keys with line breaks). URL or body must contain $title, $content is optional and corresponds to the API content position.",
"错误日志": "Error Log",
"执行结束": "Execution Finished",
"备份": "Backup",
"生成数据中...": "Generating data...",
"请选择日志文件": "Please select a log file",
"筛选条件": "Filter Conditions",
"系统": "System",
"个人": "Personal",
"重新安装": "Reinstall",
"强制删除": "Force Delete",
"全部任务": "All Tasks"
}
+396
View File
@@ -0,0 +1,396 @@
{
"复制成功": "复制成功",
"复制": "复制",
"新建": "新建",
"登录": "登录",
"初始化": "初始化",
"错误": "错误",
"定时任务": "定时任务",
"订阅管理": "订阅管理",
"环境变量": "环境变量",
"配置文件": "配置文件",
"脚本管理": "脚本管理",
"依赖管理": "依赖管理",
"日志管理": "日志管理",
"对比工具": "对比工具",
"系统设置": "系统设置",
"退出登录": "退出登录",
"青龙": "青龙",
"返回首页": "返回首页",
"保存": "保存",
"日志": "日志",
"脚本": "脚本",
"确认保存文件": "确认保存文件",
",保存后不可恢复": ",保存后不可恢复",
"确认运行": "确认运行",
"确认运行定时任务": "确认运行定时任务",
"吗": "吗",
"确认停止": "确认停止",
"确认停止定时任务": "确认停止定时任务",
"确认": "确认",
"任务": "任务",
"状态": "状态",
"空闲中": "空闲中",
"运行中": "运行中",
"队列中": "队列中",
"已禁用": "已禁用",
"定时": "定时",
"最后运行时间": "最后运行时间",
"最后运行时长": "最后运行时长",
"下次运行时间": "下次运行时间",
"名称": "名称",
"命令/脚本": "命令/脚本",
"定时规则": "定时规则",
"操作": "操作",
"确认删除": "确认删除",
"确认删除定时任务": "确认删除定时任务",
"编辑": "编辑",
"删除": "删除",
"确认删除选中的定时任务吗": "确认删除选中的定时任务吗",
"选中的定时任务吗": "选中的定时任务吗",
"创建视图": "创建视图",
"视图管理": "视图管理",
"请输入名称或者关键词": "请输入名称或者关键词",
"创建任务": "创建任务",
"更多": "更多",
"批量删除": "批量删除",
"批量启用": "批量启用",
"批量禁用": "批量禁用",
"批量运行": "批量运行",
"批量停止": "批量停止",
"批量置顶": "批量置顶",
"批量取消置顶": "批量取消置顶",
"批量修改标签": "批量修改标签",
"已选择": "已选择",
"项": "项",
"知道了": "知道了",
"请输入任务名称": "请输入任务名称",
"支持输入脚本路径/任意系统可执行命令/task 脚本路径": "支持输入脚本路径/任意系统可执行命令/task 脚本路径",
"秒(可选) 分 时 天 月 周": "秒(可选) 分 时 天 月 周",
"标签": "标签",
"取消": "取消",
"添加": "添加",
"启用": "启用",
"禁用": "禁用",
"运行": "运行",
"停止": "停止",
"置顶": "置顶",
"取消置顶": "取消置顶",
"命令": "命令",
"包含": "包含",
"不包含": "不包含",
"属于": "属于",
"不属于": "不属于",
"顺序": "顺序",
"倒序": "倒序",
"且": "且",
"或": "或",
"输入后回车增加自定义选项": "输入后回车增加自定义选项",
"视图名称": "视图名称",
"请输入视图名称": "请输入视图名称",
"请输入内容": "请输入内容",
"新增筛选条件": "新增筛选条件",
"新增排序方式": "新增排序方式",
"类型": "类型",
"显示": "显示",
"确认删除视图": "确认删除视图",
"安装中": "安装中",
"已安装": "已安装",
"安装失败": "安装失败",
"删除中": "删除中",
"已删除": "已删除",
"删除失败": "删除失败",
"序号": "序号",
"备注": "备注",
"更新时间": "更新时间",
"创建时间": "创建时间",
"确认删除依赖": "确认删除依赖",
"确认重新安装": "确认重新安装",
"确认删除选中的依赖吗": "确认删除选中的依赖吗",
"确认重新安装选中的依赖吗": "确认重新安装选中的依赖吗",
"请输入名称": "请输入名称",
"创建依赖": "创建依赖",
"批量安装": "批量安装",
"批量强制删除": "批量强制删除",
"日志 -": "日志 -",
"依赖类型": "依赖类型",
"自动拆分": "自动拆分",
"多个依赖是否换行分割": "多个依赖是否换行分割",
"是": "是",
"否": "否",
"请输入依赖名称,支持指定版本": "请输入依赖名称,支持指定版本",
"请输入依赖名称": "请输入依赖名称",
"请输入备注": "请输入备注",
"源文件": "源文件",
"当前文件": "当前文件",
"修改环境变量名称": "修改环境变量名称",
"请输入新的环境变量名称": "请输入新的环境变量名称",
"已启用": "已启用",
"值": "值",
"确认删除变量": "确认删除变量",
"确认删除选中的变量吗": "确认删除选中的变量吗",
"选中的变量吗": "选中的变量吗",
"请输入名称/值/备注": "请输入名称/值/备注",
"导入": "导入",
"创建变量": "创建变量",
"批量修改变量名称": "批量修改变量名称",
"批量导出": "批量导出",
"请输入环境变量名称": "请输入环境变量名称",
"只能输入字母数字下划线,且不能以数字开头": "只能输入字母数字下划线,且不能以数字开头",
"请输入环境变量值": "请输入环境变量值",
"服务启动超时": "服务启动超时",
"请先按如下方式修复:": "请先按如下方式修复:",
"1. 宿主机执行 docker run --rm -v\n /var/run/docker.sock:/var/run/docker.sock\n containrrr/watchtower -cR <容器名>": "1. 宿主机执行 docker run --rm -v\n /var/run/docker.sock:/var/run/docker.sock\n containrrr/watchtower -cR <容器名>",
"2. 容器内执行 ql -l check、ql -l update": "2. 容器内执行 ql -l check、ql -l update",
"3. 如果无法解决,容器内执行 pm2 logs,拷贝执行结果": "3. 如果无法解决,容器内执行 pm2 logs,拷贝执行结果",
"提交 issue": "提交 issue",
"启动中,请稍后...": "启动中,请稍后...",
"欢迎使用": "欢迎使用",
"欢迎使用青龙": "欢迎使用青龙",
"支持python3、javascript、shell、typescript 的定时任务管理面板": "支持python3、javaScript、shell、typescript 的定时任务管理面板",
"开始安装": "开始安装",
"账户设置": "账户设置",
"用户名": "用户名",
"密码": "密码",
"密码不能为admin": "密码不能为admin",
"确认密码": "确认密码",
"您输入的两个密码不匹配!": "您输入的两个密码不匹配!",
"提交": "提交",
"通知设置": "通知设置",
"通知方式": "通知方式",
"请选择通知方式": "请选择通知方式",
"跳过": "跳过",
"完成安装": "完成安装",
"恭喜安装完成!": "恭喜安装完成!",
"Telegram频道": "Telegram频道",
"去登录": "去登录",
"初始化配置": "初始化配置",
"文件": "文件",
",删除后不可恢复": ",删除后不可恢复",
"请选择日志": "请选择日志",
"请输入日志名": "请输入日志名",
"暂无日志": "暂无日志",
"登录成功!": "登录成功!",
"上次登录时间:": "上次登录时间:",
"上次登录地点:": "上次登录地点:",
"上次登录IP": "上次登录IP",
"上次登录设备:": "上次登录设备:",
"上次登录状态:": "上次登录状态:",
"验证码": "验证码",
"验证码为6位数字": "验证码为6位数字",
"6位数字": "6位数字",
"验证": "验证",
"请": "请",
"秒后重试": "秒后重试",
"在您的设备上打开两步验证应用程序以查看您的身份验证代码并验证您的身份。": "在您的设备上打开两步验证应用程序以查看您的身份验证代码并验证您的身份。",
"请选择脚本文件": "请选择脚本文件",
"清空日志": "清空日志",
"设置": "设置",
"退出": "退出",
"空文件": "空文件",
"本地文件": "本地文件",
"文件夹": "文件夹",
"文件名": "文件名",
"请输入文件名": "请输入文件名",
"文件名不能包含斜杠": "文件名不能包含斜杠",
"文件夹名": "文件夹名",
"请输入文件夹名": "请输入文件夹名",
"父目录": "父目录",
"请选择父目录": "请选择父目录",
"点击或者拖拽文件到此区域上传": "点击或者拖拽文件到此区域上传",
"当前修改未保存,确定离开吗": "当前修改未保存,确定离开吗",
"退出编辑": "退出编辑",
"重命名": "重命名",
"请选择脚本": "请选择脚本",
"调试": "调试",
"请输入脚本名": "请输入脚本名",
"暂无脚本": "暂无脚本",
"请输入新名称": "请输入新名称",
"保存文件": "保存文件",
"保存目录": "保存目录",
"请输入保存目录,默认scripts目录": "请输入保存目录,默认scripts目录",
"运行设置": "运行设置",
"待开发": "待开发",
"开发版": "开发版",
"正式版": "正式版",
"版本": "版本",
"更新日志": "更新日志",
"查看": "查看",
"提交BUG": "提交BUG",
"名称不能为保留关键字": "名称不能为保留关键字",
"请输入应用名称": "请输入应用名称",
"权限": "权限",
"请选择模块权限": "请选择模块权限",
"更新": "更新",
"已经是最新版了!": "已经是最新版了!",
"是目前检测到的最新可用版本了。": "是目前检测到的最新可用版本了。",
"重新下载": "重新下载",
"更新可用": "更新可用",
"新版本": "新版本",
"可用,你使用的版本为": "可用,你使用的版本为",
"下载更新": "下载更新",
"以后再说": "以后再说",
"下载更新中...": "下载更新中...",
"确认重启": "确认重启",
"系统安装包下载成功,确认重启": "系统安装包下载成功,确认重启",
"重启": "重启",
"系统将在": "系统将在",
"秒后自动刷新": "秒后自动刷新",
"检查更新": "检查更新",
"确认删除应用": "确认删除应用",
"确认重置": "确认重置",
"确认重置应用": "确认重置应用",
"的Secret吗": "的Secret吗",
"重置Secret会让当前应用所有token失效": "重置Secret会让当前应用所有token失效",
"创建应用": "创建应用",
"安全设置": "安全设置",
"应用设置": "应用设置",
"登录日志": "登录日志",
"其他设置": "其他设置",
"关于": "关于",
"成功": "成功",
"失败": "失败",
"登录时间": "登录时间",
"登录地址": "登录地址",
"登录IP": "登录IP",
"登录设备": "登录设备",
"登录状态": "登录状态",
"亮色": "亮色",
"暗色": "暗色",
"跟随系统": "跟随系统",
"备份数据上传成功,确认覆盖数据": "备份数据上传成功,确认覆盖数据",
"主题设置": "主题设置",
"日志删除频率": "日志删除频率",
"每x天自动删除x天以前的日志": "每x天自动删除x天以前的日志",
"每": "每",
"天": "天",
"定时任务并发数": "定时任务并发数",
"数据备份还原": "数据备份还原",
"还原数据": "还原数据",
"第一步": "第一步",
"下载两步验证手机应用,比如 Google Authenticator 、": "下载两步验证手机应用,比如 Google Authenticator 、",
"第二步": "第二步",
"使用手机应用扫描二维码,或者输入秘钥": "使用手机应用扫描二维码,或者输入秘钥",
"第三步": "第三步",
"输入手机应用上的6位数字": "输入手机应用上的6位数字",
"完成设置": "完成设置",
"修改用户名密码": "修改用户名密码",
"两步验证": "两步验证",
"头像": "头像",
"更换头像": "更换头像",
"时": "时",
"分": "分",
"秒": "秒",
"私有仓库": "私有仓库",
"公开仓库": "公开仓库",
"单文件": "单文件",
"链接": "链接",
"分支": "分支",
"确认删除定时订阅": "确认删除定时订阅",
"定时订阅": "定时订阅",
"创建订阅": "创建订阅",
"私钥": "私钥",
"请输入私钥": "请输入私钥",
"请输入认证用户名": "请输入认证用户名",
"Github已不支持密码认证,请使用Token方式": "Github已不支持密码认证,请使用Token方式",
"密码/Token": "密码/Token",
"请输入密码或者Token": "请输入密码或者Token",
"支持拷贝 ql repo/raw 命令,粘贴导入": "支持拷贝 ql repo/raw 命令,粘贴导入",
"请输入订阅链接": "请输入订阅链接",
"请输入分支": "请输入分支",
"唯一值": "唯一值",
"唯一值用于日志目录和私钥别名": "唯一值用于日志目录和私钥别名",
"自动生成": "自动生成",
"拉取方式": "拉取方式",
"用户名密码/Token": "用户名密码/Token",
"定时类型": "定时类型",
"白名单": "白名单",
"多个关键词竖线分割,支持正则表达式": "多个关键词竖线分割,支持正则表达式",
"请输入脚本筛选白名单关键词,多个关键词竖线分割": "请输入脚本筛选白名单关键词,多个关键词竖线分割",
"黑名单": "黑名单",
"请输入脚本筛选黑名单关键词,多个关键词竖线分割": "请输入脚本筛选黑名单关键词,多个关键词竖线分割",
"依赖文件": "依赖文件",
"请输入脚本依赖文件关键词,多个关键词竖线分割": "请输入脚本依赖文件关键词,多个关键词竖线分割",
"文件后缀": "文件后缀",
"仓库需要拉取的文件后缀,多个后缀空格分隔,默认使用配置文件中的RepoFileExtensions": "仓库需要拉取的文件后缀,多个后缀空格分隔,默认使用配置文件中的RepoFileExtensions",
"请输入文件后缀": "请输入文件后缀",
"执行前": "执行前",
"运行订阅前执行的命令,比如 cp/mv/python3 xxx.py/node xxx.js": "运行订阅前执行的命令,比如 cp/mv/python3 xxx.py/node xxx.js",
"请输入运行订阅前要执行的命令": "请输入运行订阅前要执行的命令",
"执行后": "执行后",
"运行订阅后执行的命令,比如 cp/mv/python3 xxx.py/node xxx.js": "运行订阅后执行的命令,比如 cp/mv/python3 xxx.py/node xxx.js",
"请输入运行订阅后要执行的命令": "请输入运行订阅后要执行的命令",
"代理": "代理",
"公开仓库支持HTTP/SOCK5代理,私有仓库支持SOCK5代理": "公开仓库支持HTTP/SOCK5代理,私有仓库支持SOCK5代理",
"自动添加任务": "自动添加任务",
"自动删除任务": "自动删除任务",
"中文": "中文",
"系统信息": "系统信息",
"Server酱": "Server酱",
"Telegram机器人": "Telegram机器人",
"钉钉机器人": "钉钉机器人",
"企业微信机器人": "企业微信机器人",
"企业微信应用": "企业微信应用",
"智能微秘书": "智能微秘书",
"群晖chat": "群晖chat",
"邮箱": "邮箱",
"飞书机器人": "飞书机器人",
"自定义通知": "自定义通知",
"已关闭": "已关闭",
"gotify的url地址,例如 https://push.example.de:8080": "gotify的url地址,例如 https://push.example.de:8080",
"gotify的消息应用token码": "gotify的消息应用token码",
"推送消息的优先级": "推送消息的优先级",
"chat的url地址": "chat的url地址",
"chat的token码": "chat的token码",
"推送到个人QQ: http://127.0.0.1/send_private_msg,群:http://127.0.0.1/send_group_msg": "推送到个人QQ: http://127.0.0.1/send_private_msg,群:http://127.0.0.1/send_group_msg",
"访问密钥": "访问密钥",
"如果GOBOT_URL设置 /send_private_msg 则需要填入 user_id=个人QQ 相反如果是 /send_group_msg 则需要填入 group_id=QQ群": "如果GOBOT_URL设置 /send_private_msg 则需要填入 user_id=个人QQ 相反如果是 /send_group_msg 则需要填入 group_id=QQ群",
"Server酱SENDKEY": "Server酱SENDKEY",
"PushDeer的Keyhttps://github.com/easychen/pushdeer": "PushDeer的Keyhttps://github.com/easychen/pushdeer",
"PushDeer的自架API endpoint,默认是 https://api2.pushdeer.com/message/push": "PushDeer的自架API endpoint,默认是 https://api2.pushdeer.com/message/push",
"Bark的信息IP/设备码,例如:https://api.day.app/XXXXXXXX": "Bark的信息IP/设备码,例如:https://api.day.app/XXXXXXXX",
"BARK推送图标,自定义推送图标 (需iOS15或以上才能显示)": "BARK推送图标,自定义推送图标 (需iOS15或以上才能显示)",
"BARK推送铃声,铃声列表去APP查看复制填写": "BARK推送铃声,铃声列表去APP查看复制填写",
"BARK推送消息的分组, 默认为qinglong": "BARK推送消息的分组, 默认为qinglong",
"telegram机器人的token,例如:1077xxx4424:AAFjv0FcqxxxxxxgEMGfi22B4yh15R5uw": "telegram机器人的token,例如:1077xxx4424:AAFjv0FcqxxxxxxgEMGfi22B4yh15R5uw",
"telegram用户的id,例如:129xxx206": "telegram用户的id,例如:129xxx206",
"代理IP": "代理IP",
"代理端口": "代理端口",
"telegram代理配置认证参数, 用户名与密码用英文冒号连接 user:password": "telegram代理配置认证参数, 用户名与密码用英文冒号连接 user:password",
"telegram api自建的反向代理地址,默认tg官方api": "telegram api自建的反向代理地址,默认tg官方api",
"钉钉机器人webhook token,例如:5a544165465465645d0f31dca676e7bd07415asdasd": "钉钉机器人webhook token,例如:5a544165465465645d0f31dca676e7bd07415asdasd",
"密钥,机器人安全设置页面,加签一栏下面显示的SEC开头的字符串": "密钥,机器人安全设置页面,加签一栏下面显示的SEC开头的字符串",
"企业微信机器人的 webhook(详见文档 https://work.weixin.qq.com/api/doc/90000/90136/91770),例如:693a91f6-7xxx-4bc4-97a0-0ec2sifa5aaa": "企业微信机器人的 webhook(详见文档 https://work.weixin.qq.com/api/doc/90000/90136/91770),例如:693a91f6-7xxx-4bc4-97a0-0ec2sifa5aaa",
"企业微信代理地址": "企业微信代理地址",
"corpid,corpsecret,touser(注:多个成员ID使用|隔开),agentid,消息类型(选填,不填默认文本消息类型) 注意用,号隔开(英文输入法的逗号),例如:wwcfrs,B-76WERQ,qinglong,1000001,2COat": "corpid,corpsecret,touser(注:多个成员ID使用|隔开),agentid,消息类型(选填,不填默认文本消息类型) 注意用,号隔开(英文输入法的逗号),例如:wwcfrs,B-76WERQ,qinglong,1000001,2COat",
"密钥key,智能微秘书个人中心获取apikey,申请地址:https://wechat.aibotk.com/signup?from=ql": "密钥key,智能微秘书个人中心获取apikey,申请地址:https://wechat.aibotk.com/signup?from=ql",
"发送的目标,群组或者好友": "发送的目标,群组或者好友",
"请输入要发送的目标": "请输入要发送的目标",
"群聊": "群聊",
"好友": "好友",
"要发送的用户昵称或群名,如果目标是群,需要填群名,如果目标是好友,需要填好友昵称": "要发送的用户昵称或群名,如果目标是群,需要填群名,如果目标是好友,需要填好友昵称",
"iGot的信息推送key,例如:https://push.hellyw.com/XXXXXXXX": "iGot的信息推送key,例如:https://push.hellyw.com/XXXXXXXX",
"微信扫码登录后一对一推送或一对多推送下面的token(您的Token),不提供PUSH_PLUS_USER则默认为一对一推送,参考 https://www.pushplus.plus/": "微信扫码登录后一对一推送或一对多推送下面的token(您的Token),不提供PUSH_PLUS_USER则默认为一对一推送,参考 https://www.pushplus.plus/",
"一对多推送的“群组编码”(一对多推送下面->您的群组(如无则创建)->群组编码,如果您是创建群组人。也需点击“查看二维码”扫描绑定,否则不能接受群组消息推送)": "一对多推送的“群组编码”(一对多推送下面->您的群组(如无则创建)->群组编码,如果您是创建群组人。也需点击“查看二维码”扫描绑定,否则不能接受群组消息推送)",
"飞书群组机器人:https://www.feishu.cn/hc/zh-CN/articles/360024984973": "飞书群组机器人:https://www.feishu.cn/hc/zh-CN/articles/360024984973",
"邮箱服务名称,比如126、163、Gmail、QQ等,支持列表https://nodemailer.com/smtp/well-known/": "邮箱服务名称,比如126、163、Gmail、QQ等,支持列表https://nodemailer.com/smtp/well-known/",
"邮箱地址": "邮箱地址",
"邮箱SMTP授权码": "邮箱SMTP授权码",
"PushMe的Keyhttps://push.i-i.me/": "PushMe的Keyhttps://push.i-i.me/",
"请求方法": "请求方法",
"请求头Content-Type": "请求头Content-Type",
"请求链接以http或者https开头。url或者body中必须包含$title$content可选,对应api内容的位置": "请求链接以http或者https开头。url或者body中必须包含$title$content可选,对应api内容的位置",
"请求头格式Custom-Header1: Header1,多个换行分割": "请求头格式Custom-Header1: Header1,多个换行分割",
"请求体格式key1: value1,多个换行分割。url或者body中必须包含$title$content可选,对应api内容的位置": "请求体格式key1: value1,多个换行分割。url或者body中必须包含$title$content可选,对应api内容的位置",
"错误日志": "错误日志",
"执行结束": "执行结束",
"备份": "备份",
"生成数据中...": "生成数据中...",
"请选择日志文件": "请选择日志文件",
"筛选条件": "筛选条件",
"系统": "系统",
"个人": "个人",
"重新安装": "重新安装",
"强制删除": "强制删除",
"全部任务": "全部任务"
}
+2 -1
View File
@@ -1,3 +1,4 @@
import intl from 'react-intl-universal';
import React from 'react'; import React from 'react';
import { Button, Result, Typography } from 'antd'; import { Button, Result, Typography } from 'antd';
@@ -9,7 +10,7 @@ const NotFound: React.FC = () => (
title="404" title="404"
extra={ extra={
<Button type="primary"> <Button type="primary">
<Link href="/"></Link> <Link href="/">{intl.get('返回首页')}</Link>
</Button> </Button>
} }
/> />
+2 -1
View File
@@ -1,3 +1,4 @@
import intl from 'react-intl-universal'
import React, { import React, {
PureComponent, PureComponent,
Fragment, Fragment,
@@ -93,7 +94,7 @@ const Config = () => {
type="primary" type="primary"
onClick={updateConfig} onClick={updateConfig}
> >
{intl.get('保存')}
</Button>, </Button>,
]} ]}
header={{ header={{
+59 -32
View File
@@ -1,3 +1,4 @@
import intl from 'react-intl-universal';
import React, { useEffect, useRef, useState } from 'react'; import React, { useEffect, useRef, useState } from 'react';
import { import {
Modal, Modal,
@@ -38,11 +39,11 @@ const { Text } = Typography;
const tabList = [ const tabList = [
{ {
key: 'log', key: 'log',
tab: '日志', tab: intl.get('日志'),
}, },
{ {
key: 'script', key: 'script',
tab: '脚本', tab: intl.get('脚本'),
}, },
]; ];
const LangMap: any = { const LangMap: any = {
@@ -181,11 +182,11 @@ const CronDetailModal = ({
title: `确认保存`, title: `确认保存`,
content: ( content: (
<> <>
{intl.get('确认保存文件')}
<Text style={{ wordBreak: 'break-all' }} type="warning"> <Text style={{ wordBreak: 'break-all' }} type="warning">
{scriptInfo.filename} {scriptInfo.filename}
</Text>{' '} </Text>{' '}
{intl.get(',保存后不可恢复')}
</> </>
), ),
onOk() { onOk() {
@@ -217,14 +218,14 @@ const CronDetailModal = ({
const runCron = () => { const runCron = () => {
Modal.confirm({ Modal.confirm({
title: '确认运行', title: intl.get('确认运行'),
content: ( content: (
<> <>
{' '} {intl.get('确认运行定时任务')}{' '}
<Text style={{ wordBreak: 'break-all' }} type="warning"> <Text style={{ wordBreak: 'break-all' }} type="warning">
{currentCron.name} {currentCron.name}
</Text>{' '} </Text>{' '}
{intl.get('吗')}
</> </>
), ),
onOk() { onOk() {
@@ -247,14 +248,14 @@ const CronDetailModal = ({
const stopCron = () => { const stopCron = () => {
Modal.confirm({ Modal.confirm({
title: '确认停止', title: intl.get('确认停止'),
content: ( content: (
<> <>
{' '} {intl.get('确认停止定时任务')}{' '}
<Text style={{ wordBreak: 'break-all' }} type="warning"> <Text style={{ wordBreak: 'break-all' }} type="warning">
{currentCron.name} {currentCron.name}
</Text>{' '} </Text>{' '}
{intl.get('吗')}
</> </>
), ),
onOk() { onOk() {
@@ -274,15 +275,18 @@ const CronDetailModal = ({
const enabledOrDisabledCron = () => { const enabledOrDisabledCron = () => {
Modal.confirm({ Modal.confirm({
title: `确认${currentCron.isDisabled === 1 ? '启用' : '禁用'}`, title: `确认${
currentCron.isDisabled === 1 ? intl.get('启用') : intl.get('禁用')
}`,
content: ( content: (
<> <>
{currentCron.isDisabled === 1 ? '启用' : '禁用'} {intl.get('确认')}
{' '} {currentCron.isDisabled === 1 ? intl.get('启用') : intl.get('禁用')}
{intl.get('定时任务')}{' '}
<Text style={{ wordBreak: 'break-all' }} type="warning"> <Text style={{ wordBreak: 'break-all' }} type="warning">
{currentCron.name} {currentCron.name}
</Text>{' '} </Text>{' '}
{intl.get('吗')}
</> </>
), ),
onOk() { onOk() {
@@ -310,15 +314,18 @@ const CronDetailModal = ({
const pinOrUnPinCron = () => { const pinOrUnPinCron = () => {
Modal.confirm({ Modal.confirm({
title: `确认${currentCron.isPinned === 1 ? '取消置顶' : '置顶'}`, title: `确认${
currentCron.isPinned === 1 ? intl.get('取消置顶') : intl.get('置顶')
}`,
content: ( content: (
<> <>
{currentCron.isPinned === 1 ? '取消置顶' : '置顶'} {intl.get('确认')}
{' '} {currentCron.isPinned === 1 ? intl.get('取消置顶') : intl.get('置顶')}
{intl.get('定时任务')}{' '}
<Text style={{ wordBreak: 'break-all' }} type="warning"> <Text style={{ wordBreak: 'break-all' }} type="warning">
{currentCron.name} {currentCron.name}
</Text>{' '} </Text>{' '}
{intl.get('吗')}
</> </>
), ),
onOk() { onOk() {
@@ -378,7 +385,9 @@ const CronDetailModal = ({
<div className="operations"> <div className="operations">
<Tooltip <Tooltip
title={ title={
currentCron.status === CrontabStatus.idle ? '运行' : '停止' currentCron.status === CrontabStatus.idle
? intl.get('运行')
: intl.get('停止')
} }
> >
<Button <Button
@@ -396,7 +405,13 @@ const CronDetailModal = ({
} }
/> />
</Tooltip> </Tooltip>
<Tooltip title={currentCron.isDisabled === 1 ? '启用' : '禁用'}> <Tooltip
title={
currentCron.isDisabled === 1
? intl.get('启用')
: intl.get('禁用')
}
>
<Button <Button
type="link" type="link"
icon={ icon={
@@ -412,7 +427,13 @@ const CronDetailModal = ({
onClick={enabledOrDisabledCron} onClick={enabledOrDisabledCron}
/> />
</Tooltip> </Tooltip>
<Tooltip title={currentCron.isPinned === 1 ? '取消置顶' : '置顶'}> <Tooltip
title={
currentCron.isPinned === 1
? intl.get('取消置顶')
: intl.get('置顶')
}
>
<Button <Button
type="link" type="link"
icon={ icon={
@@ -442,20 +463,20 @@ const CronDetailModal = ({
<div className="card-wrapper"> <div className="card-wrapper">
<Card> <Card>
<div className="cron-detail-info-item"> <div className="cron-detail-info-item">
<div className="cron-detail-info-title"></div> <div className="cron-detail-info-title">{intl.get('任务')}</div>
<div className="cron-detail-info-value">{currentCron.command}</div> <div className="cron-detail-info-value">{currentCron.command}</div>
</div> </div>
</Card> </Card>
<Card style={{ marginTop: 10 }}> <Card style={{ marginTop: 10 }}>
<div className="cron-detail-info-item"> <div className="cron-detail-info-item">
<div className="cron-detail-info-title"></div> <div className="cron-detail-info-title">{intl.get('状态')}</div>
<div className="cron-detail-info-value"> <div className="cron-detail-info-value">
{(!currentCron.isDisabled || {(!currentCron.isDisabled ||
currentCron.status !== CrontabStatus.idle) && ( currentCron.status !== CrontabStatus.idle) && (
<> <>
{currentCron.status === CrontabStatus.idle && ( {currentCron.status === CrontabStatus.idle && (
<Tag icon={<ClockCircleOutlined />} color="default"> <Tag icon={<ClockCircleOutlined />} color="default">
{intl.get('空闲中')}
</Tag> </Tag>
)} )}
{currentCron.status === CrontabStatus.running && ( {currentCron.status === CrontabStatus.running && (
@@ -463,12 +484,12 @@ const CronDetailModal = ({
icon={<Loading3QuartersOutlined spin />} icon={<Loading3QuartersOutlined spin />}
color="processing" color="processing"
> >
{intl.get('运行中')}
</Tag> </Tag>
)} )}
{currentCron.status === CrontabStatus.queued && ( {currentCron.status === CrontabStatus.queued && (
<Tag icon={<FieldTimeOutlined />} color="default"> <Tag icon={<FieldTimeOutlined />} color="default">
{intl.get('队列中')}
</Tag> </Tag>
)} )}
</> </>
@@ -476,17 +497,19 @@ const CronDetailModal = ({
{currentCron.isDisabled === 1 && {currentCron.isDisabled === 1 &&
currentCron.status === CrontabStatus.idle && ( currentCron.status === CrontabStatus.idle && (
<Tag icon={<CloseCircleOutlined />} color="error"> <Tag icon={<CloseCircleOutlined />} color="error">
{intl.get('已禁用')}
</Tag> </Tag>
)} )}
</div> </div>
</div> </div>
<div className="cron-detail-info-item"> <div className="cron-detail-info-item">
<div className="cron-detail-info-title"></div> <div className="cron-detail-info-title">{intl.get('定时')}</div>
<div className="cron-detail-info-value">{currentCron.schedule}</div> <div className="cron-detail-info-value">{currentCron.schedule}</div>
</div> </div>
<div className="cron-detail-info-item"> <div className="cron-detail-info-item">
<div className="cron-detail-info-title"></div> <div className="cron-detail-info-title">
{intl.get('最后运行时间')}
</div>
<div className="cron-detail-info-value"> <div className="cron-detail-info-value">
{currentCron.last_execution_time {currentCron.last_execution_time
? new Date(currentCron.last_execution_time * 1000) ? new Date(currentCron.last_execution_time * 1000)
@@ -498,7 +521,9 @@ const CronDetailModal = ({
</div> </div>
</div> </div>
<div className="cron-detail-info-item"> <div className="cron-detail-info-item">
<div className="cron-detail-info-title"></div> <div className="cron-detail-info-title">
{intl.get('最后运行时长')}
</div>
<div className="cron-detail-info-value"> <div className="cron-detail-info-value">
{currentCron.last_running_time {currentCron.last_running_time
? diffTime(currentCron.last_running_time) ? diffTime(currentCron.last_running_time)
@@ -506,7 +531,9 @@ const CronDetailModal = ({
</div> </div>
</div> </div>
<div className="cron-detail-info-item"> <div className="cron-detail-info-item">
<div className="cron-detail-info-title"></div> <div className="cron-detail-info-title">
{intl.get('下次运行时间')}
</div>
<div className="cron-detail-info-value"> <div className="cron-detail-info-value">
{currentCron.nextRunTime && {currentCron.nextRunTime &&
currentCron.nextRunTime currentCron.nextRunTime
@@ -532,7 +559,7 @@ const CronDetailModal = ({
style={{ marginRight: 8 }} style={{ marginRight: 8 }}
onClick={saveFile} onClick={saveFile}
> >
{intl.get('保存')}
</Button> </Button>
<Button <Button
type="primary" type="primary"
+98 -79
View File
@@ -1,3 +1,4 @@
import intl from 'react-intl-universal';
import React, { useState, useEffect, useRef, useMemo } from 'react'; import React, { useState, useEffect, useRef, useMemo } from 'react';
import { import {
Button, Button,
@@ -63,10 +64,10 @@ const Crontab = () => {
const { headerStyle, isPhone, theme } = useOutletContext<SharedContext>(); const { headerStyle, isPhone, theme } = useOutletContext<SharedContext>();
const columns: ColumnProps<ICrontab>[] = [ const columns: ColumnProps<ICrontab>[] = [
{ {
title: '名称', title: intl.get('名称'),
dataIndex: 'name', dataIndex: 'name',
key: 'name', key: 'name',
width: 150, width: 120,
render: (text: string, record: any) => ( render: (text: string, record: any) => (
<> <>
<a <a
@@ -118,10 +119,10 @@ const Crontab = () => {
}, },
}, },
{ {
title: '命令/脚本', title: intl.get('命令/脚本'),
dataIndex: 'command', dataIndex: 'command',
key: 'command', key: 'command',
width: 300, width: 240,
render: (text, record) => { render: (text, record) => {
return ( return (
<Paragraph <Paragraph
@@ -146,19 +147,35 @@ const Crontab = () => {
}, },
}, },
{ {
title: '定时规则', title: intl.get('定时规则'),
dataIndex: 'schedule', dataIndex: 'schedule',
key: 'schedule', key: 'schedule',
width: 110, width: 140,
sorter: { sorter: {
compare: (a, b) => a.schedule.localeCompare(b.schedule), compare: (a, b) => a.schedule.localeCompare(b.schedule),
}, },
}, },
{ {
title: '最后运行时', title: intl.get('最后运行时'),
width: 150,
dataIndex: 'last_running_time',
key: 'last_running_time',
sorter: {
compare: (a: any, b: any) => {
return a.last_running_time - b.last_running_time;
},
},
render: (text, record) => {
return record.last_running_time
? diffTime(record.last_running_time)
: '-';
},
},
{
title: intl.get('最后运行时间'),
dataIndex: 'last_execution_time', dataIndex: 'last_execution_time',
key: 'last_execution_time', key: 'last_execution_time',
width: 150, width: 120,
sorter: { sorter: {
compare: (a, b) => { compare: (a, b) => {
return (a.last_execution_time || 0) - (b.last_execution_time || 0); return (a.last_execution_time || 0) - (b.last_execution_time || 0);
@@ -184,24 +201,8 @@ const Crontab = () => {
}, },
}, },
{ {
title: '最后运行时', title: intl.get('下次运行时'),
width: 120, width: 120,
dataIndex: 'last_running_time',
key: 'last_running_time',
sorter: {
compare: (a: any, b: any) => {
return a.last_running_time - b.last_running_time;
},
},
render: (text, record) => {
return record.last_running_time
? diffTime(record.last_running_time)
: '-';
},
},
{
title: '下次运行时间',
width: 150,
sorter: { sorter: {
compare: (a: any, b: any) => { compare: (a: any, b: any) => {
return a.nextRunTime - b.nextRunTime; return a.nextRunTime - b.nextRunTime;
@@ -217,25 +218,25 @@ const Crontab = () => {
}, },
}, },
{ {
title: '状态', title: intl.get('状态'),
key: 'status', key: 'status',
dataIndex: 'status', dataIndex: 'status',
width: 88, width: 88,
filters: [ filters: [
{ {
text: '运行中', text: intl.get('运行中'),
value: CrontabStatus.running, value: CrontabStatus.running,
}, },
{ {
text: '空闲中', text: intl.get('空闲中'),
value: CrontabStatus.idle, value: CrontabStatus.idle,
}, },
{ {
text: '已禁用', text: intl.get('已禁用'),
value: CrontabStatus.disabled, value: CrontabStatus.disabled,
}, },
{ {
text: '队列中', text: intl.get('队列中'),
value: CrontabStatus.queued, value: CrontabStatus.queued,
}, },
], ],
@@ -245,7 +246,7 @@ const Crontab = () => {
<> <>
{record.status === CrontabStatus.idle && ( {record.status === CrontabStatus.idle && (
<Tag icon={<ClockCircleOutlined />} color="default"> <Tag icon={<ClockCircleOutlined />} color="default">
{intl.get('空闲中')}
</Tag> </Tag>
)} )}
{record.status === CrontabStatus.running && ( {record.status === CrontabStatus.running && (
@@ -253,26 +254,26 @@ const Crontab = () => {
icon={<Loading3QuartersOutlined spin />} icon={<Loading3QuartersOutlined spin />}
color="processing" color="processing"
> >
{intl.get('运行中')}
</Tag> </Tag>
)} )}
{record.status === CrontabStatus.queued && ( {record.status === CrontabStatus.queued && (
<Tag icon={<FieldTimeOutlined />} color="default"> <Tag icon={<FieldTimeOutlined />} color="default">
{intl.get('队列中')}
</Tag> </Tag>
)} )}
</> </>
)} )}
{record.isDisabled === 1 && record.status === CrontabStatus.idle && ( {record.isDisabled === 1 && record.status === CrontabStatus.idle && (
<Tag icon={<CloseCircleOutlined />} color="error"> <Tag icon={<CloseCircleOutlined />} color="error">
{intl.get('已禁用')}
</Tag> </Tag>
)} )}
</> </>
), ),
}, },
{ {
title: '操作', title: intl.get('操作'),
key: 'action', key: 'action',
width: 130, width: 130,
render: (text, record, index) => { render: (text, record, index) => {
@@ -280,7 +281,7 @@ const Crontab = () => {
return ( return (
<Space size="middle"> <Space size="middle">
{record.status === CrontabStatus.idle && ( {record.status === CrontabStatus.idle && (
<Tooltip title={isPc ? '运行' : ''}> <Tooltip title={isPc ? intl.get('运行') : ''}>
<a <a
onClick={(e) => { onClick={(e) => {
e.stopPropagation(); e.stopPropagation();
@@ -292,7 +293,7 @@ const Crontab = () => {
</Tooltip> </Tooltip>
)} )}
{record.status !== CrontabStatus.idle && ( {record.status !== CrontabStatus.idle && (
<Tooltip title={isPc ? '停止' : ''}> <Tooltip title={isPc ? intl.get('停止') : ''}>
<a <a
onClick={(e) => { onClick={(e) => {
e.stopPropagation(); e.stopPropagation();
@@ -303,7 +304,7 @@ const Crontab = () => {
</a> </a>
</Tooltip> </Tooltip>
)} )}
<Tooltip title={isPc ? '日志' : ''}> <Tooltip title={isPc ? intl.get('日志') : ''}>
<a <a
onClick={(e) => { onClick={(e) => {
e.stopPropagation(); e.stopPropagation();
@@ -412,14 +413,14 @@ const Crontab = () => {
const delCron = (record: any, index: number) => { const delCron = (record: any, index: number) => {
Modal.confirm({ Modal.confirm({
title: '确认删除', title: intl.get('确认删除'),
content: ( content: (
<> <>
{' '} {intl.get('确认删除定时任务')}{' '}
<Text style={{ wordBreak: 'break-all' }} type="warning"> <Text style={{ wordBreak: 'break-all' }} type="warning">
{record.name} {record.name}
</Text>{' '} </Text>{' '}
{intl.get('吗')}
</> </>
), ),
onOk() { onOk() {
@@ -445,14 +446,14 @@ const Crontab = () => {
const runCron = (record: any, index: number) => { const runCron = (record: any, index: number) => {
Modal.confirm({ Modal.confirm({
title: '确认运行', title: intl.get('确认运行'),
content: ( content: (
<> <>
{' '} {intl.get('确认运行定时任务')}{' '}
<Text style={{ wordBreak: 'break-all' }} type="warning"> <Text style={{ wordBreak: 'break-all' }} type="warning">
{record.name} {record.name}
</Text>{' '} </Text>{' '}
{intl.get('吗')}
</> </>
), ),
onOk() { onOk() {
@@ -480,14 +481,14 @@ const Crontab = () => {
const stopCron = (record: any, index: number) => { const stopCron = (record: any, index: number) => {
Modal.confirm({ Modal.confirm({
title: '确认停止', title: intl.get('确认停止'),
content: ( content: (
<> <>
{' '} {intl.get('确认停止定时任务')}{' '}
<Text style={{ wordBreak: 'break-all' }} type="warning"> <Text style={{ wordBreak: 'break-all' }} type="warning">
{record.name} {record.name}
</Text>{' '} </Text>{' '}
{intl.get('吗')}
</> </>
), ),
onOk() { onOk() {
@@ -516,15 +517,18 @@ const Crontab = () => {
const enabledOrDisabledCron = (record: any, index: number) => { const enabledOrDisabledCron = (record: any, index: number) => {
Modal.confirm({ Modal.confirm({
title: `确认${record.isDisabled === 1 ? '启用' : '禁用'}`, title: `确认${
record.isDisabled === 1 ? intl.get('启用') : intl.get('禁用')
}`,
content: ( content: (
<> <>
{record.isDisabled === 1 ? '启用' : '禁用'} {intl.get('确认')}
{' '} {record.isDisabled === 1 ? intl.get('启用') : intl.get('禁用')}
{intl.get('定时任务')}{' '}
<Text style={{ wordBreak: 'break-all' }} type="warning"> <Text style={{ wordBreak: 'break-all' }} type="warning">
{record.name} {record.name}
</Text>{' '} </Text>{' '}
{intl.get('吗')}
</> </>
), ),
onOk() { onOk() {
@@ -558,15 +562,18 @@ const Crontab = () => {
const pinOrUnPinCron = (record: any, index: number) => { const pinOrUnPinCron = (record: any, index: number) => {
Modal.confirm({ Modal.confirm({
title: `确认${record.isPinned === 1 ? '取消置顶' : '置顶'}`, title: `确认${
record.isPinned === 1 ? intl.get('取消置顶') : intl.get('置顶')
}`,
content: ( content: (
<> <>
{record.isPinned === 1 ? '取消置顶' : '置顶'} {intl.get('确认')}
{' '} {record.isPinned === 1 ? intl.get('取消置顶') : intl.get('置顶')}
{intl.get('定时任务')}{' '}
<Text style={{ wordBreak: 'break-all' }} type="warning"> <Text style={{ wordBreak: 'break-all' }} type="warning">
{record.name} {record.name}
</Text>{' '} </Text>{' '}
{intl.get('吗')}
</> </>
), ),
onOk() { onOk() {
@@ -600,16 +607,16 @@ const Crontab = () => {
const getMenuItems = (record: any) => { const getMenuItems = (record: any) => {
return [ return [
{ label: '编辑', key: 'edit', icon: <EditOutlined /> }, { label: intl.get('编辑'), key: 'edit', icon: <EditOutlined /> },
{ {
label: record.isDisabled === 1 ? '启用' : '禁用', label: record.isDisabled === 1 ? intl.get('启用') : intl.get('禁用'),
key: 'enableOrDisable', key: 'enableOrDisable',
icon: icon:
record.isDisabled === 1 ? <CheckCircleOutlined /> : <StopOutlined />, record.isDisabled === 1 ? <CheckCircleOutlined /> : <StopOutlined />,
}, },
{ label: '删除', key: 'delete', icon: <DeleteOutlined /> }, { label: intl.get('删除'), key: 'delete', icon: <DeleteOutlined /> },
{ {
label: record.isPinned === 1 ? '取消置顶' : '置顶', label: record.isPinned === 1 ? intl.get('取消置顶') : intl.get('置顶'),
key: 'pinOrUnPin', key: 'pinOrUnPin',
icon: record.isPinned === 1 ? <StopOutlined /> : <PushpinOutlined />, icon: record.isPinned === 1 ? <StopOutlined /> : <PushpinOutlined />,
}, },
@@ -696,8 +703,8 @@ const Crontab = () => {
const delCrons = () => { const delCrons = () => {
Modal.confirm({ Modal.confirm({
title: '确认删除', title: intl.get('确认删除'),
content: <></>, content: <>{intl.get('确认删除选中的定时任务吗')}</>,
onOk() { onOk() {
request request
.delete(`${config.apiPrefix}crons`, { data: selectedRowIds }) .delete(`${config.apiPrefix}crons`, { data: selectedRowIds })
@@ -718,7 +725,13 @@ const Crontab = () => {
const operateCrons = (operationStatus: number) => { const operateCrons = (operationStatus: number) => {
Modal.confirm({ Modal.confirm({
title: `确认${OperationName[operationStatus]}`, title: `确认${OperationName[operationStatus]}`,
content: <>{OperationName[operationStatus]}</>, content: (
<>
{intl.get('确认')}
{OperationName[operationStatus]}
{intl.get('选中的定时任务吗')}
</>
),
onOk() { onOk() {
request request
.put( .put(
@@ -821,12 +834,12 @@ const Crontab = () => {
type: 'divider' as 'group', type: 'divider' as 'group',
}, },
{ {
label: '建视图', label: intl.get('建视图'),
key: 'new', key: 'new',
icon: <PlusOutlined />, icon: <PlusOutlined />,
}, },
{ {
label: '视图管理', label: intl.get('视图管理'),
key: 'manage', key: 'manage',
icon: <SettingOutlined />, icon: <SettingOutlined />,
}, },
@@ -840,7 +853,12 @@ const Crontab = () => {
.then(({ code, data }) => { .then(({ code, data }) => {
if (code === 200) { if (code === 200) {
setCronViews(data); setCronViews(data);
const firstEnableView = data.filter((x) => !x.isDisabled); const firstEnableView = data
.filter((x) => !x.isDisabled)
.map((x) => ({
...x,
name: x.name === '全部任务' ? intl.get('全部任务') : x.name,
}));
setEnabledCronViews(firstEnableView); setEnabledCronViews(firstEnableView);
setPageConf({ setPageConf({
page: 1, page: 1,
@@ -873,10 +891,10 @@ const Crontab = () => {
return ( return (
<PageContainer <PageContainer
className="ql-container-wrapper crontab-wrapper ql-container-wrapper-has-tab" className="ql-container-wrapper crontab-wrapper ql-container-wrapper-has-tab"
title="定时任务" title={intl.get('定时任务')}
extra={[ extra={[
<Search <Search
placeholder="请输入名称或者关键词" placeholder={intl.get('请输入名称或者关键词')}
style={{ width: 'auto' }} style={{ width: 'auto' }}
enterButton enterButton
allowClear allowClear
@@ -886,7 +904,7 @@ const Crontab = () => {
onSearch={onSearch} onSearch={onSearch}
/>, />,
<Button key="2" type="primary" onClick={() => addCron()}> <Button key="2" type="primary" onClick={() => addCron()}>
{intl.get('创建任务')}
</Button>, </Button>,
]} ]}
header={{ header={{
@@ -906,7 +924,7 @@ const Crontab = () => {
> >
<div className={`view-more ${moreMenuActive ? 'active' : ''}`}> <div className={`view-more ${moreMenuActive ? 'active' : ''}`}>
<Space> <Space>
{intl.get('更多')}
<DownOutlined /> <DownOutlined />
</Space> </Space>
<div className="ant-tabs-ink-bar ant-tabs-ink-bar-animated"></div> <div className="ant-tabs-ink-bar ant-tabs-ink-bar-animated"></div>
@@ -929,56 +947,57 @@ const Crontab = () => {
style={{ marginBottom: 5 }} style={{ marginBottom: 5 }}
onClick={delCrons} onClick={delCrons}
> >
{intl.get('批量删除')}
</Button> </Button>
<Button <Button
type="primary" type="primary"
onClick={() => operateCrons(0)} onClick={() => operateCrons(0)}
style={{ marginLeft: 8, marginBottom: 5 }} style={{ marginLeft: 8, marginBottom: 5 }}
> >
{intl.get('批量启用')}
</Button> </Button>
<Button <Button
type="primary" type="primary"
onClick={() => operateCrons(1)} onClick={() => operateCrons(1)}
style={{ marginLeft: 8, marginRight: 8 }} style={{ marginLeft: 8, marginRight: 8 }}
> >
{intl.get('批量禁用')}
</Button> </Button>
<Button <Button
type="primary" type="primary"
style={{ marginRight: 8 }} style={{ marginRight: 8 }}
onClick={() => operateCrons(2)} onClick={() => operateCrons(2)}
> >
{intl.get('批量运行')}
</Button> </Button>
<Button type="primary" onClick={() => operateCrons(3)}> <Button type="primary" onClick={() => operateCrons(3)}>
{intl.get('批量停止')}
</Button> </Button>
<Button <Button
type="primary" type="primary"
onClick={() => operateCrons(4)} onClick={() => operateCrons(4)}
style={{ marginLeft: 8, marginRight: 8 }} style={{ marginLeft: 8, marginRight: 8 }}
> >
{intl.get('批量置顶')}
</Button> </Button>
<Button <Button
type="primary" type="primary"
onClick={() => operateCrons(5)} onClick={() => operateCrons(5)}
style={{ marginLeft: 8, marginRight: 8 }} style={{ marginLeft: 8, marginRight: 8 }}
> >
{intl.get('批量取消置顶')}
</Button> </Button>
<Button <Button
type="primary" type="primary"
onClick={() => setIsLabelModalVisible(true)} onClick={() => setIsLabelModalVisible(true)}
style={{ marginLeft: 8, marginRight: 8 }} style={{ marginLeft: 8, marginRight: 8 }}
> >
{intl.get('批量修改标签')}
</Button> </Button>
<span style={{ marginLeft: 8 }}> <span style={{ marginLeft: 8 }}>
{intl.get('已选择')}
<a>{selectedRowIds?.length}</a> <a>{selectedRowIds?.length}</a>
{intl.get('项')}
</span> </span>
</div> </div>
)} )}
+3 -2
View File
@@ -1,3 +1,4 @@
import intl from 'react-intl-universal';
import React, { useEffect, useRef, useState } from 'react'; import React, { useEffect, useRef, useState } from 'react';
import { Modal, message, Input, Form, Statistic, Button } from 'antd'; import { Modal, message, Input, Form, Statistic, Button } from 'antd';
import { request } from '@/utils/http'; import { request } from '@/utils/http';
@@ -44,7 +45,7 @@ const CronLogModal = ({
data !== value data !== value
) { ) {
const log = data as string; const log = data as string;
setValue(log || '暂无日志'); setValue(log || intl.get('暂无日志'));
const hasNext = Boolean( const hasNext = Boolean(
log && !logEnded(log) && !log.includes('任务未运行'), log && !logEnded(log) && !log.includes('任务未运行'),
); );
@@ -131,7 +132,7 @@ const CronLogModal = ({
onCancel={() => cancel()} onCancel={() => cancel()}
footer={[ footer={[
<Button type="primary" onClick={() => cancel()}> <Button type="primary" onClick={() => cancel()}>
{intl.get('知道了')}
</Button>, </Button>,
]} ]}
> >
+22 -15
View File
@@ -1,3 +1,4 @@
import intl from 'react-intl-universal';
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { Modal, message, Input, Form, Button } from 'antd'; import { Modal, message, Input, Form, Button } from 'antd';
import { request } from '@/utils/http'; import { request } from '@/utils/http';
@@ -31,7 +32,9 @@ const CronModal = ({
); );
if (code === 200) { if (code === 200) {
message.success(cron ? '更新任务成功' : '新建任务成功'); message.success(
cron ? intl.get('更新任务成功') : intl.get('创建任务成功'),
);
handleCancel(data); handleCancel(data);
} }
setLoading(false); setLoading(false);
@@ -46,7 +49,7 @@ const CronModal = ({
return ( return (
<Modal <Modal
title={cron ? '编辑任务' : '建任务'} title={cron ? intl.get('编辑任务') : intl.get('建任务')}
open={visible} open={visible}
forceRender forceRender
centered centered
@@ -70,23 +73,25 @@ const CronModal = ({
name="form_in_modal" name="form_in_modal"
initialValues={cron} initialValues={cron}
> >
<Form.Item name="name" label="名称"> <Form.Item name="name" label={intl.get('名称')}>
<Input placeholder="请输入任务名称" /> <Input placeholder={intl.get('请输入任务名称')} />
</Form.Item> </Form.Item>
<Form.Item <Form.Item
name="command" name="command"
label="命令/脚本" label={intl.get('命令/脚本')}
rules={[{ required: true, whitespace: true }]} rules={[{ required: true, whitespace: true }]}
> >
<Input.TextArea <Input.TextArea
rows={4} rows={4}
autoSize={true} autoSize={true}
placeholder="支持输入脚本路径/任意系统可执行命令/task 脚本路径" placeholder={intl.get(
'支持输入脚本路径/任意系统可执行命令/task 脚本路径',
)}
/> />
</Form.Item> </Form.Item>
<Form.Item <Form.Item
name="schedule" name="schedule"
label="定时规则" label={intl.get('定时规则')}
rules={[ rules={[
{ required: true }, { required: true },
{ {
@@ -100,9 +105,9 @@ const CronModal = ({
}, },
]} ]}
> >
<Input placeholder="秒(可选) 分 时 天 月 周" /> <Input placeholder={intl.get('秒(可选) 分 时 天 月 周')} />
</Form.Item> </Form.Item>
<Form.Item name="labels" label="标签"> <Form.Item name="labels" label={intl.get('标签')}>
<EditableTagGroup /> <EditableTagGroup />
</Form.Item> </Form.Item>
</Form> </Form>
@@ -136,7 +141,9 @@ const CronLabelModal = ({
if (code === 200) { if (code === 200) {
message.success( message.success(
action === 'post' ? '添加Labels成功' : '删除Labels成功', action === 'post'
? intl.get('添加Labels成功')
: intl.get('删除Labels成功'),
); );
handleCancel(true); handleCancel(true);
} }
@@ -155,18 +162,18 @@ const CronLabelModal = ({
}, [ids, visible]); }, [ids, visible]);
const buttons = [ const buttons = [
<Button onClick={() => handleCancel(false)}></Button>, <Button onClick={() => handleCancel(false)}>{intl.get('取消')}</Button>,
<Button type="primary" danger onClick={() => update('delete')}> <Button type="primary" danger onClick={() => update('delete')}>
{intl.get('删除')}
</Button>, </Button>,
<Button type="primary" onClick={() => update('post')}> <Button type="primary" onClick={() => update('post')}>
{intl.get('添加')}
</Button>, </Button>,
]; ];
return ( return (
<Modal <Modal
title="批量修改标签" title={intl.get('批量修改标签')}
open={visible} open={visible}
footer={buttons} footer={buttons}
centered centered
@@ -176,7 +183,7 @@ const CronLabelModal = ({
confirmLoading={loading} confirmLoading={loading}
> >
<Form form={form} layout="vertical" name="form_in_label_modal"> <Form form={form} layout="vertical" name="form_in_label_modal">
<Form.Item name="labels" label="标签"> <Form.Item name="labels" label={intl.get('标签')}>
<EditableTagGroup /> <EditableTagGroup />
</Form.Item> </Form.Item>
</Form> </Form>
+32 -25
View File
@@ -1,3 +1,4 @@
import intl from 'react-intl-universal';
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { import {
Modal, Modal,
@@ -17,11 +18,11 @@ import get from 'lodash/get';
import { CrontabStatus } from './type'; import { CrontabStatus } from './type';
const PROPERTIES = [ const PROPERTIES = [
{ name: '命令', value: 'command' }, { name: intl.get('命令'), value: 'command' },
{ name: '名称', value: 'name' }, { name: intl.get('名称'), value: 'name' },
{ name: '定时规则', value: 'schedule' }, { name: intl.get('定时规则'), value: 'schedule' },
{ name: '状态', value: 'status' }, { name: intl.get('状态'), value: 'status' },
{ name: '标签', value: 'labels' }, { name: intl.get('标签'), value: 'labels' },
]; ];
const EOperation: any = { const EOperation: any = {
@@ -31,10 +32,10 @@ const EOperation: any = {
Nin: 'select', Nin: 'select',
}; };
const OPERATIONS = [ const OPERATIONS = [
{ name: '包含', value: 'Reg' }, { name: intl.get('包含'), value: 'Reg' },
{ name: '不包含', value: 'NotReg' }, { name: intl.get('不包含'), value: 'NotReg' },
{ name: '属于', value: 'In', type: 'select' }, { name: intl.get('属于'), value: 'In', type: 'select' },
{ name: '不属于', value: 'Nin', type: 'select' }, { name: intl.get('不属于'), value: 'Nin', type: 'select' },
// { name: '等于', value: 'Eq' }, // { name: '等于', value: 'Eq' },
// { name: '不等于', value: 'Ne' }, // { name: '不等于', value: 'Ne' },
// { name: '为空', value: 'IsNull' }, // { name: '为空', value: 'IsNull' },
@@ -42,15 +43,15 @@ const OPERATIONS = [
]; ];
const SORTTYPES = [ const SORTTYPES = [
{ name: '顺序', value: 'ASC' }, { name: intl.get('顺序'), value: 'ASC' },
{ name: '倒序', value: 'DESC' }, { name: intl.get('倒序'), value: 'DESC' },
]; ];
const STATUS_MAP = { const STATUS_MAP = {
status: [ status: [
{ name: '运行中', value: CrontabStatus.running }, { name: intl.get('运行中'), value: CrontabStatus.running },
{ name: '空闲中', value: CrontabStatus.idle }, { name: intl.get('空闲中'), value: CrontabStatus.idle },
{ name: '已禁用', value: CrontabStatus.disabled }, { name: intl.get('已禁用'), value: CrontabStatus.disabled },
], ],
}; };
@@ -137,7 +138,11 @@ const ViewCreateModal = ({
const statusElement = (property: keyof typeof STATUS_MAP) => { const statusElement = (property: keyof typeof STATUS_MAP) => {
return ( return (
<Select mode="tags" allowClear placeholder="输入后回车增加自定义选项"> <Select
mode="tags"
allowClear
placeholder={intl.get('输入后回车增加自定义选项')}
>
{STATUS_MAP[property]?.map((x) => ( {STATUS_MAP[property]?.map((x) => (
<Select.Option key={x.name} value={x.value}> <Select.Option key={x.name} value={x.value}>
{x.name} {x.name}
@@ -149,7 +154,7 @@ const ViewCreateModal = ({
return ( return (
<Modal <Modal
title={view ? '编辑视图' : '建视图'} title={view ? intl.get('编辑视图') : intl.get('建视图')}
open={visible} open={visible}
forceRender forceRender
width={580} width={580}
@@ -171,10 +176,10 @@ const ViewCreateModal = ({
<Form form={form} layout="vertical" name="env_modal"> <Form form={form} layout="vertical" name="env_modal">
<Form.Item <Form.Item
name="name" name="name"
label="视图名称" label={intl.get('视图名称')}
rules={[{ required: true, message: '请输入视图名称' }]} rules={[{ required: true, message: intl.get('请输入视图名称') }]}
> >
<Input placeholder="请输入视图名称" /> <Input placeholder={intl.get('请输入视图名称')} />
</Form.Item> </Form.Item>
<Form.List name="filters"> <Form.List name="filters">
{(fields, { add, remove }) => ( {(fields, { add, remove }) => (
@@ -223,7 +228,7 @@ const ViewCreateModal = ({
<div> <div>
{fields.map(({ key, name, ...restField }) => ( {fields.map(({ key, name, ...restField }) => (
<Form.Item <Form.Item
label={name === 0 ? '筛选条件' : ''} label={name === 0 ? intl.get('筛选条件') : ''}
key={key} key={key}
style={{ marginBottom: 0 }} style={{ marginBottom: 0 }}
required required
@@ -250,13 +255,15 @@ const ViewCreateModal = ({
<Form.Item <Form.Item
{...restField} {...restField}
name={[name, 'value']} name={[name, 'value']}
rules={[{ required: true, message: '请输入内容' }]} rules={[
{ required: true, message: intl.get('请输入内容') },
]}
> >
{EOperation[filtersValue?.[name]['operation']] === {EOperation[filtersValue?.[name]['operation']] ===
'select' ? ( 'select' ? (
statusElement(filtersValue?.[name]['property']) statusElement(filtersValue?.[name]['property'])
) : ( ) : (
<Input placeholder="请输入内容" /> <Input placeholder={intl.get('请输入内容')} />
)} )}
</Form.Item> </Form.Item>
{name !== 0 && ( {name !== 0 && (
@@ -272,7 +279,7 @@ const ViewCreateModal = ({
} }
> >
<PlusOutlined /> <PlusOutlined />
{intl.get('新增筛选条件')}
</a> </a>
</Form.Item> </Form.Item>
</div> </div>
@@ -320,7 +327,7 @@ const ViewCreateModal = ({
<div> <div>
{fields.map(({ key, name, ...restField }) => ( {fields.map(({ key, name, ...restField }) => (
<Form.Item <Form.Item
label={name === 0 ? '排序方式' : ''} label={name === 0 ? intl.get('排序方式') : ''}
key={key} key={key}
style={{ marginBottom: 0 }} style={{ marginBottom: 0 }}
className="filter-item" className="filter-item"
@@ -347,7 +354,7 @@ const ViewCreateModal = ({
<Form.Item> <Form.Item>
<a onClick={() => add({ property: 'command', type: 'ASC' })}> <a onClick={() => add({ property: 'command', type: 'ASC' })}>
<PlusOutlined /> <PlusOutlined />
{intl.get('新增排序方式')}
</a> </a>
</Form.Item> </Form.Item>
</div> </div>
+11 -10
View File
@@ -1,3 +1,4 @@
import intl from 'react-intl-universal';
import React, { useCallback, useEffect, useRef, useState } from 'react'; import React, { useCallback, useEffect, useRef, useState } from 'react';
import { import {
Modal, Modal,
@@ -81,18 +82,18 @@ const ViewManageModal = ({
const columns: any = [ const columns: any = [
{ {
title: '名称', title: intl.get('名称'),
dataIndex: 'name', dataIndex: 'name',
key: 'name', key: 'name',
}, },
{ {
title: '类型', title: intl.get('类型'),
dataIndex: 'type', dataIndex: 'type',
key: 'type', key: 'type',
render: (v) => (v === 1 ? '系统' : '个人'), render: (v) => (v === 1 ? intl.get('系统') : intl.get('个人')),
}, },
{ {
title: '显示', title: intl.get('显示'),
key: 'isDisabled', key: 'isDisabled',
dataIndex: 'isDisabled', dataIndex: 'isDisabled',
width: 100, width: 100,
@@ -107,7 +108,7 @@ const ViewManageModal = ({
}, },
}, },
{ {
title: '操作', title: intl.get('操作'),
key: 'action', key: 'action',
width: 100, width: 100,
render: (text: string, record: any, index: number) => { render: (text: string, record: any, index: number) => {
@@ -140,14 +141,14 @@ const ViewManageModal = ({
const deleteView = (record: any, index: number) => { const deleteView = (record: any, index: number) => {
Modal.confirm({ Modal.confirm({
title: '确认删除', title: intl.get('确认删除'),
content: ( content: (
<> <>
{' '} {intl.get('确认删除视图')}{' '}
<Text style={{ wordBreak: 'break-all' }} type="warning"> <Text style={{ wordBreak: 'break-all' }} type="warning">
{record.name} {record.name}
</Text>{' '} </Text>{' '}
{intl.get('吗')}
</> </>
), ),
onOk() { onOk() {
@@ -218,7 +219,7 @@ const ViewManageModal = ({
return ( return (
<Modal <Modal
title="视图管理" title={intl.get('视图管理')}
open={visible} open={visible}
centered centered
width={620} width={620}
@@ -243,7 +244,7 @@ const ViewManageModal = ({
setIsCreateViewModalVisible(true); setIsCreateViewModalVisible(true);
}} }}
> >
{intl.get('创建视图')}
</Button> </Button>
</Space> </Space>
<DndProvider backend={HTML5Backend}> <DndProvider backend={HTML5Backend}>
+39 -31
View File
@@ -1,3 +1,4 @@
import intl from 'react-intl-universal';
import React, { useCallback, useRef, useState, useEffect } from 'react'; import React, { useCallback, useRef, useState, useEffect } from 'react';
import { import {
Button, Button,
@@ -90,20 +91,22 @@ const Dependence = () => {
useOutletContext<SharedContext>(); useOutletContext<SharedContext>();
const columns: any = [ const columns: any = [
{ {
title: '序号', title: intl.get('序号'),
width: 50, width: 80,
render: (text: string, record: any, index: number) => { render: (text: string, record: any, index: number) => {
return <span style={{ cursor: 'text' }}>{index + 1} </span>; return <span style={{ cursor: 'text' }}>{index + 1} </span>;
}, },
}, },
{ {
title: '名称', title: intl.get('名称'),
dataIndex: 'name', dataIndex: 'name',
width: 120,
key: 'name', key: 'name',
}, },
{ {
title: '状态', title: intl.get('状态'),
key: 'status', key: 'status',
width: 100,
dataIndex: 'status', dataIndex: 'status',
render: (text: string, record: any, index: number) => { render: (text: string, record: any, index: number) => {
return ( return (
@@ -113,41 +116,45 @@ const Dependence = () => {
icon={StatusMap[record.status].icon} icon={StatusMap[record.status].icon}
style={{ marginRight: 0 }} style={{ marginRight: 0 }}
> >
{Status[record.status]} {intl.get(Status[record.status])}
</Tag> </Tag>
</Space> </Space>
); );
}, },
}, },
{ {
title: '备注', title: intl.get('备注'),
dataIndex: 'remark', dataIndex: 'remark',
width: 120,
key: 'remark', key: 'remark',
}, },
{ {
title: '更新时间', title: intl.get('更新时间'),
key: 'updatedAt', key: 'updatedAt',
dataIndex: 'updatedAt', dataIndex: 'updatedAt',
width: 150,
render: (text: string) => { render: (text: string) => {
return <span>{dayjs(text).format('YYYY-MM-DD HH:mm:ss')}</span>; return <span>{dayjs(text).format('YYYY-MM-DD HH:mm:ss')}</span>;
}, },
}, },
{ {
title: '创建时间', title: intl.get('创建时间'),
key: 'createdAt', key: 'createdAt',
dataIndex: 'createdAt', dataIndex: 'createdAt',
width: 150,
render: (text: string) => { render: (text: string) => {
return <span>{dayjs(text).format('YYYY-MM-DD HH:mm:ss')}</span>; return <span>{dayjs(text).format('YYYY-MM-DD HH:mm:ss')}</span>;
}, },
}, },
{ {
title: '操作', title: intl.get('操作'),
key: 'action', key: 'action',
width: 150,
render: (text: string, record: any, index: number) => { render: (text: string, record: any, index: number) => {
const isPc = !isPhone; const isPc = !isPhone;
return ( return (
<Space size="middle"> <Space size="middle">
<Tooltip title={isPc ? '日志' : ''}> <Tooltip title={isPc ? intl.get('日志') : ''}>
<a <a
onClick={() => { onClick={() => {
setLogDependence({ ...record, timestamp: Date.now() }); setLogDependence({ ...record, timestamp: Date.now() });
@@ -159,17 +166,17 @@ const Dependence = () => {
{record.status !== Status. && {record.status !== Status. &&
record.status !== Status. && ( record.status !== Status. && (
<> <>
<Tooltip title={isPc ? '重新安装' : ''}> <Tooltip title={isPc ? intl.get('重新安装') : ''}>
<a onClick={() => reInstallDependence(record, index)}> <a onClick={() => reInstallDependence(record, index)}>
<BugOutlined /> <BugOutlined />
</a> </a>
</Tooltip> </Tooltip>
<Tooltip title={isPc ? '删除' : ''}> <Tooltip title={isPc ? intl.get('删除') : ''}>
<a onClick={() => deleteDependence(record, index)}> <a onClick={() => deleteDependence(record, index)}>
<DeleteOutlined /> <DeleteOutlined />
</a> </a>
</Tooltip> </Tooltip>
<Tooltip title={isPc ? '强制删除' : ''}> <Tooltip title={isPc ? intl.get('强制删除') : ''}>
<a onClick={() => deleteDependence(record, index, true)}> <a onClick={() => deleteDependence(record, index, true)}>
<DeleteFilled /> <DeleteFilled />
</a> </a>
@@ -223,14 +230,14 @@ const Dependence = () => {
force: boolean = false, force: boolean = false,
) => { ) => {
Modal.confirm({ Modal.confirm({
title: '确认删除', title: intl.get('确认删除'),
content: ( content: (
<> <>
{' '} {intl.get('确认删除依赖')}{' '}
<Text style={{ wordBreak: 'break-all' }} type="warning"> <Text style={{ wordBreak: 'break-all' }} type="warning">
{record.name} {record.name}
</Text>{' '} </Text>{' '}
{intl.get('吗')}
</> </>
), ),
onOk() { onOk() {
@@ -257,14 +264,14 @@ const Dependence = () => {
const reInstallDependence = (record: any, index: number) => { const reInstallDependence = (record: any, index: number) => {
Modal.confirm({ Modal.confirm({
title: '确认重新安装', title: intl.get('确认重新安装'),
content: ( content: (
<> <>
{' '} {intl.get('确认重新安装')}{' '}
<Text style={{ wordBreak: 'break-all' }} type="warning"> <Text style={{ wordBreak: 'break-all' }} type="warning">
{record.name} {record.name}
</Text>{' '} </Text>{' '}
{intl.get('吗')}
</> </>
), ),
onOk() { onOk() {
@@ -314,8 +321,8 @@ const Dependence = () => {
const delDependencies = (force: boolean) => { const delDependencies = (force: boolean) => {
const forceUrl = force ? '/force' : ''; const forceUrl = force ? '/force' : '';
Modal.confirm({ Modal.confirm({
title: '确认删除', title: intl.get('确认删除'),
content: <></>, content: <>{intl.get('确认删除选中的依赖吗')}</>,
onOk() { onOk() {
request request
.delete(`${config.apiPrefix}dependencies${forceUrl}`, { .delete(`${config.apiPrefix}dependencies${forceUrl}`, {
@@ -336,8 +343,8 @@ const Dependence = () => {
const handlereInstallDependencies = () => { const handlereInstallDependencies = () => {
Modal.confirm({ Modal.confirm({
title: '确认重新安装', title: intl.get('确认重新安装'),
content: <></>, content: <>{intl.get('确认重新安装选中的依赖吗')}</>,
onOk() { onOk() {
request request
.put(`${config.apiPrefix}dependencies/reinstall`, selectedRowIds) .put(`${config.apiPrefix}dependencies/reinstall`, selectedRowIds)
@@ -454,17 +461,17 @@ const Dependence = () => {
return ( return (
<PageContainer <PageContainer
className="ql-container-wrapper dependence-wrapper ql-container-wrapper-has-tab" className="ql-container-wrapper dependence-wrapper ql-container-wrapper-has-tab"
title="依赖管理" title={intl.get('依赖管理')}
extra={[ extra={[
<Search <Search
placeholder="请输入名称" placeholder={intl.get('请输入名称')}
style={{ width: 'auto' }} style={{ width: 'auto' }}
enterButton enterButton
loading={loading} loading={loading}
onSearch={onSearch} onSearch={onSearch}
/>, />,
<Button key="2" type="primary" onClick={() => addDependence()}> <Button key="2" type="primary" onClick={() => addDependence()}>
{intl.get('创建依赖')}
</Button>, </Button>,
]} ]}
header={{ header={{
@@ -499,25 +506,26 @@ const Dependence = () => {
style={{ marginBottom: 5, marginLeft: 8 }} style={{ marginBottom: 5, marginLeft: 8 }}
onClick={() => handlereInstallDependencies()} onClick={() => handlereInstallDependencies()}
> >
{intl.get('批量安装')}
</Button> </Button>
<Button <Button
type="primary" type="primary"
style={{ marginBottom: 5, marginLeft: 8 }} style={{ marginBottom: 5, marginLeft: 8 }}
onClick={() => delDependencies(false)} onClick={() => delDependencies(false)}
> >
{intl.get('批量删除')}
</Button> </Button>
<Button <Button
type="primary" type="primary"
style={{ marginBottom: 5, marginLeft: 8 }} style={{ marginBottom: 5, marginLeft: 8 }}
onClick={() => delDependencies(true)} onClick={() => delDependencies(true)}
> >
{intl.get('批量强制删除')}
</Button> </Button>
<span style={{ marginLeft: 8 }}> <span style={{ marginLeft: 8 }}>
{intl.get('已选择')}
<a>{selectedRowIds?.length}</a> <a>{selectedRowIds?.length}</a>
{intl.get('项')}
</span> </span>
</div> </div>
)} )}
+3 -2
View File
@@ -1,3 +1,4 @@
import intl from 'react-intl-universal';
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { Modal, message, Input, Form, Statistic, Button } from 'antd'; import { Modal, message, Input, Form, Statistic, Button } from 'antd';
import { request } from '@/utils/http'; import { request } from '@/utils/http';
@@ -38,7 +39,7 @@ const DependenceLogModal = ({
{executing && <Loading3QuartersOutlined spin />} {executing && <Loading3QuartersOutlined spin />}
{!executing && <CheckCircleOutlined />} {!executing && <CheckCircleOutlined />}
<span style={{ marginLeft: 5 }}> <span style={{ marginLeft: 5 }}>
- {dependence && dependence.name} {intl.get('日志 -')} {dependence && dependence.name}
</span>{' '} </span>{' '}
</> </>
); );
@@ -130,7 +131,7 @@ const DependenceLogModal = ({
onCancel={() => cancel()} onCancel={() => cancel()}
footer={[ footer={[
<Button type="primary" onClick={footerClick} loading={removeLoading}> <Button type="primary" onClick={footerClick} loading={removeLoading}>
{isRemoveFailed ? '强制删除' : '知道了'} {isRemoveFailed ? intl.get('强制删除') : intl.get('知道了')}
</Button>, </Button>,
]} ]}
> >
+12 -11
View File
@@ -1,3 +1,4 @@
import intl from 'react-intl-universal';
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { Modal, message, Input, Form, Radio, Select } from 'antd'; import { Modal, message, Input, Form, Radio, Select } from 'antd';
import { request } from '@/utils/http'; import { request } from '@/utils/http';
@@ -66,7 +67,7 @@ const DependenceModal = ({
return ( return (
<Modal <Modal
title={dependence ? '编辑依赖' : '建依赖'} title={dependence ? intl.get('编辑依赖') : intl.get('建依赖')}
open={visible} open={visible}
forceRender forceRender
centered centered
@@ -92,7 +93,7 @@ const DependenceModal = ({
> >
<Form.Item <Form.Item
name="type" name="type"
label="依赖类型" label={intl.get('依赖类型')}
initialValue={DependenceTypes[defaultType as any]} initialValue={DependenceTypes[defaultType as any]}
> >
<Select> <Select>
@@ -106,23 +107,23 @@ const DependenceModal = ({
{!dependence && ( {!dependence && (
<Form.Item <Form.Item
name="split" name="split"
label="自动拆分" label={intl.get('自动拆分')}
initialValue="0" initialValue="0"
tooltip="多个依赖是否换行分割" tooltip={intl.get('多个依赖是否换行分割')}
> >
<Radio.Group> <Radio.Group>
<Radio value="1"></Radio> <Radio value="1">{intl.get('是')}</Radio>
<Radio value="0"></Radio> <Radio value="0">{intl.get('否')}</Radio>
</Radio.Group> </Radio.Group>
</Form.Item> </Form.Item>
)} )}
<Form.Item <Form.Item
name="name" name="name"
label="名称" label={intl.get('名称')}
rules={[ rules={[
{ {
required: true, required: true,
message: '请输入依赖名称,支持指定版本', message: intl.get('请输入依赖名称,支持指定版本'),
whitespace: true, whitespace: true,
}, },
]} ]}
@@ -130,11 +131,11 @@ const DependenceModal = ({
<Input.TextArea <Input.TextArea
rows={4} rows={4}
autoSize={true} autoSize={true}
placeholder="请输入依赖名称" placeholder={intl.get('请输入依赖名称')}
/> />
</Form.Item> </Form.Item>
<Form.Item name="remark" label="备注"> <Form.Item name="remark" label={intl.get('备注')}>
<Input placeholder="请输入备注" /> <Input placeholder={intl.get('请输入备注')} />
</Form.Item> </Form.Item>
</Form> </Form>
</Modal> </Modal>
+5 -4
View File
@@ -1,3 +1,4 @@
import intl from 'react-intl-universal';
import React, { PureComponent, useRef, useState, useEffect } from 'react'; import React, { PureComponent, useRef, useState, useEffect } from 'react';
import { Button, message, Select, Form, Row, Col } from 'antd'; import { Button, message, Select, Form, Row, Col } from 'antd';
import config from '@/utils/config'; import config from '@/utils/config';
@@ -93,7 +94,7 @@ const Diff = () => {
return ( return (
<PageContainer <PageContainer
className="ql-container-wrapper" className="ql-container-wrapper"
title="对比工具" title={intl.get('对比工具')}
loading={loading} loading={loading}
header={{ header={{
style: headerStyle, style: headerStyle,
@@ -101,14 +102,14 @@ const Diff = () => {
extra={ extra={
!isPhone && [ !isPhone && [
<Button key="1" type="primary" onClick={updateConfig}> <Button key="1" type="primary" onClick={updateConfig}>
{intl.get('保存')}
</Button>, </Button>,
] ]
} }
> >
<Row gutter={24} className="diff-switch-file"> <Row gutter={24} className="diff-switch-file">
<Col span={12}> <Col span={12}>
<Form.Item label="源文件"> <Form.Item label={intl.get('源文件')}>
<Select value={origin} onChange={originFileChange}> <Select value={origin} onChange={originFileChange}>
{files.map((x) => ( {files.map((x) => (
<Option key={x.value} value={x.value}> <Option key={x.value} value={x.value}>
@@ -119,7 +120,7 @@ const Diff = () => {
</Form.Item> </Form.Item>
</Col> </Col>
<Col span={12}> <Col span={12}>
<Form.Item label="当前文件"> <Form.Item label={intl.get('当前文件')}>
<Select value={current} onChange={currentFileChange}> <Select value={current} onChange={currentFileChange}>
{files.map((x) => ( {files.map((x) => (
<Option key={x.value} value={x.value}> <Option key={x.value} value={x.value}>
+4 -3
View File
@@ -1,3 +1,4 @@
import intl from 'react-intl-universal'
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { Modal, message, Input, Form } from 'antd'; import { Modal, message, Input, Form } from 'antd';
import { request } from '@/utils/http'; import { request } from '@/utils/http';
@@ -39,7 +40,7 @@ const EditNameModal = ({
return ( return (
<Modal <Modal
title="修改环境变量名称" title={intl.get('修改环境变量名称')}
open={visible} open={visible}
forceRender forceRender
centered centered
@@ -60,9 +61,9 @@ const EditNameModal = ({
<Form form={form} layout="vertical" name="edit_name_modal"> <Form form={form} layout="vertical" name="edit_name_modal">
<Form.Item <Form.Item
name="name" name="name"
rules={[{ required: true, message: '请输入新的环境变量名称' }]} rules={[{ required: true, message: intl.get('请输入新的环境变量名称') }]}
> >
<Input placeholder="请输入新的环境变量名称" /> <Input placeholder={intl.get('请输入新的环境变量名称')} />
</Form.Item> </Form.Item>
</Form> </Form>
</Modal> </Modal>
+37 -36
View File
@@ -1,3 +1,4 @@
import intl from 'react-intl-universal'
import React, { import React, {
useCallback, useCallback,
useRef, useRef,
@@ -70,20 +71,20 @@ const Env = () => {
const { headerStyle, isPhone, theme } = useOutletContext<SharedContext>(); const { headerStyle, isPhone, theme } = useOutletContext<SharedContext>();
const columns: any = [ const columns: any = [
{ {
title: '序号', title: intl.get('序号'),
width: 60, width: 80,
render: (text: string, record: any, index: number) => { render: (text: string, record: any, index: number) => {
return <span style={{ cursor: 'text' }}>{index + 1} </span>; return <span style={{ cursor: 'text' }}>{index + 1} </span>;
}, },
}, },
{ {
title: '名称', title: intl.get('名称'),
dataIndex: 'name', dataIndex: 'name',
key: 'name', key: 'name',
sorter: (a: any, b: any) => a.name.localeCompare(b.name), sorter: (a: any, b: any) => a.name.localeCompare(b.name),
}, },
{ {
title: '值', title: intl.get('值'),
dataIndex: 'value', dataIndex: 'value',
key: 'value', key: 'value',
width: '35%', width: '35%',
@@ -99,7 +100,7 @@ const Env = () => {
}, },
}, },
{ {
title: '备注', title: intl.get('备注'),
dataIndex: 'remarks', dataIndex: 'remarks',
key: 'remarks', key: 'remarks',
render: (text: string, record: any) => { render: (text: string, record: any) => {
@@ -111,7 +112,7 @@ const Env = () => {
}, },
}, },
{ {
title: '更新时间', title: intl.get('更新时间'),
dataIndex: 'timestamp', dataIndex: 'timestamp',
key: 'timestamp', key: 'timestamp',
width: 165, width: 165,
@@ -145,17 +146,17 @@ const Env = () => {
}, },
}, },
{ {
title: '状态', title: intl.get('状态'),
key: 'status', key: 'status',
dataIndex: 'status', dataIndex: 'status',
width: 70, width: 80,
filters: [ filters: [
{ {
text: '已启用', text: intl.get('已启用'),
value: 0, value: 0,
}, },
{ {
text: '已禁用', text: intl.get('已禁用'),
value: 1, value: 1,
}, },
], ],
@@ -164,28 +165,28 @@ const Env = () => {
return ( return (
<Space size="middle" style={{ cursor: 'text' }}> <Space size="middle" style={{ cursor: 'text' }}>
<Tag color={StatusColor[record.status]} style={{ marginRight: 0 }}> <Tag color={StatusColor[record.status]} style={{ marginRight: 0 }}>
{Status[record.status]} {intl.get(Status[record.status])}
</Tag> </Tag>
</Space> </Space>
); );
}, },
}, },
{ {
title: '操作', title: intl.get('操作'),
key: 'action', key: 'action',
width: 120, width: 120,
render: (text: string, record: any, index: number) => { render: (text: string, record: any, index: number) => {
const isPc = !isPhone; const isPc = !isPhone;
return ( return (
<Space size="middle"> <Space size="middle">
<Tooltip title={isPc ? '编辑' : ''}> <Tooltip title={isPc ? intl.get('编辑') : ''}>
<a onClick={() => editEnv(record, index)}> <a onClick={() => editEnv(record, index)}>
<EditOutlined /> <EditOutlined />
</a> </a>
</Tooltip> </Tooltip>
<Tooltip <Tooltip
title={ title={
isPc ? (record.status === Status. ? '启用' : '禁用') : '' isPc ? (record.status === Status. ? intl.get('启用') : intl.get('禁用')) : ''
} }
> >
<a onClick={() => enabledOrDisabledEnv(record, index)}> <a onClick={() => enabledOrDisabledEnv(record, index)}>
@@ -196,7 +197,7 @@ const Env = () => {
)} )}
</a> </a>
</Tooltip> </Tooltip>
<Tooltip title={isPc ? '删除' : ''}> <Tooltip title={isPc ? intl.get('删除') : ''}>
<a onClick={() => deleteEnv(record, index)}> <a onClick={() => deleteEnv(record, index)}>
<DeleteOutlined /> <DeleteOutlined />
</a> </a>
@@ -231,15 +232,15 @@ const Env = () => {
const enabledOrDisabledEnv = (record: any, index: number) => { const enabledOrDisabledEnv = (record: any, index: number) => {
Modal.confirm({ Modal.confirm({
title: `确认${record.status === Status. ? '启用' : '禁用'}`, title: `确认${record.status === Status. ? intl.get('启用') : intl.get('禁用')}`,
content: ( content: (
<> <>
{record.status === Status. ? '启用' : '禁用'} {intl.get('确认')}{record.status === Status. ? intl.get('启用') : intl.get('禁用')}
Env{' '} Env{' '}
<Text style={{ wordBreak: 'break-all' }} type="warning"> <Text style={{ wordBreak: 'break-all' }} type="warning">
{record.value} {record.value}
</Text>{' '} </Text>{' '}
{intl.get('吗')}
</> </>
), ),
onOk() { onOk() {
@@ -253,7 +254,7 @@ const Env = () => {
.then(({ code, data }) => { .then(({ code, data }) => {
if (code === 200) { if (code === 200) {
message.success( message.success(
`${record.status === Status. ? '启用' : '禁用'}成功`, `${record.status === Status. ? intl.get('启用') : intl.get('禁用')}成功`,
); );
const newStatus = const newStatus =
record.status === Status. ? Status.已启用 : Status.已禁用; record.status === Status. ? Status.已启用 : Status.已禁用;
@@ -284,14 +285,14 @@ const Env = () => {
const deleteEnv = (record: any, index: number) => { const deleteEnv = (record: any, index: number) => {
Modal.confirm({ Modal.confirm({
title: '确认删除', title: intl.get('确认删除'),
content: ( content: (
<> <>
{' '} {intl.get('确认删除变量')}{' '}
<Text style={{ wordBreak: 'break-all' }} type="warning"> <Text style={{ wordBreak: 'break-all' }} type="warning">
{record.name}: {record.value} {record.name}: {record.value}
</Text>{' '} </Text>{' '}
{intl.get('吗')}
</> </>
), ),
onOk() { onOk() {
@@ -412,8 +413,8 @@ const Env = () => {
const delEnvs = () => { const delEnvs = () => {
Modal.confirm({ Modal.confirm({
title: '确认删除', title: intl.get('确认删除'),
content: <></>, content: <>{intl.get('确认删除选中的变量吗')}</>,
onOk() { onOk() {
request request
.delete(`${config.apiPrefix}envs`, { data: selectedRowIds }) .delete(`${config.apiPrefix}envs`, { data: selectedRowIds })
@@ -434,7 +435,7 @@ const Env = () => {
const operateEnvs = (operationStatus: number) => { const operateEnvs = (operationStatus: number) => {
Modal.confirm({ Modal.confirm({
title: `确认${OperationName[operationStatus]}`, title: `确认${OperationName[operationStatus]}`,
content: <>{OperationName[operationStatus]}</>, content: <>{intl.get('确认')}{OperationName[operationStatus]}{intl.get('选中的变量吗')}</>,
onOk() { onOk() {
request request
.put( .put(
@@ -500,10 +501,10 @@ const Env = () => {
return ( return (
<PageContainer <PageContainer
className="ql-container-wrapper env-wrapper" className="ql-container-wrapper env-wrapper"
title="环境变量" title={intl.get('环境变量')}
extra={[ extra={[
<Search <Search
placeholder="请输入名称/值/备注" placeholder={intl.get('请输入名称/值/备注')}
style={{ width: 'auto' }} style={{ width: 'auto' }}
enterButton enterButton
loading={loading} loading={loading}
@@ -515,11 +516,11 @@ const Env = () => {
icon={<UploadOutlined />} icon={<UploadOutlined />}
loading={importLoading} loading={importLoading}
> >
{intl.get('导入')}
</Button> </Button>
</Upload>, </Upload>,
<Button key="2" type="primary" onClick={() => addEnv()}> <Button key="2" type="primary" onClick={() => addEnv()}>
{intl.get('创建变量')}
</Button>, </Button>,
]} ]}
header={{ header={{
@@ -534,39 +535,39 @@ const Env = () => {
style={{ marginBottom: 5 }} style={{ marginBottom: 5 }}
onClick={modifyName} onClick={modifyName}
> >
{intl.get('批量修改变量名称')}
</Button> </Button>
<Button <Button
type="primary" type="primary"
style={{ marginBottom: 5, marginLeft: 8 }} style={{ marginBottom: 5, marginLeft: 8 }}
onClick={delEnvs} onClick={delEnvs}
> >
{intl.get('批量删除')}
</Button> </Button>
<Button <Button
type="primary" type="primary"
onClick={() => exportEnvs()} onClick={() => exportEnvs()}
style={{ marginLeft: 8, marginRight: 8 }} style={{ marginLeft: 8, marginRight: 8 }}
> >
{intl.get('批量导出')}
</Button> </Button>
<Button <Button
type="primary" type="primary"
onClick={() => operateEnvs(0)} onClick={() => operateEnvs(0)}
style={{ marginLeft: 8, marginBottom: 5 }} style={{ marginLeft: 8, marginBottom: 5 }}
> >
{intl.get('批量启用')}
</Button> </Button>
<Button <Button
type="primary" type="primary"
onClick={() => operateEnvs(1)} onClick={() => operateEnvs(1)}
style={{ marginLeft: 8, marginRight: 8 }} style={{ marginLeft: 8, marginRight: 8 }}
> >
{intl.get('批量禁用')}
</Button> </Button>
<span style={{ marginLeft: 8 }}> <span style={{ marginLeft: 8 }}>
{intl.get('已选择')}
<a>{selectedRowIds?.length}</a> <a>{selectedRowIds?.length}</a>{intl.get('项')}
</span> </span>
</div> </div>
)} )}
+16 -15
View File
@@ -1,3 +1,4 @@
import intl from 'react-intl-universal'
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { Modal, message, Input, Form, Radio } from 'antd'; import { Modal, message, Input, Form, Radio } from 'antd';
import { request } from '@/utils/http'; import { request } from '@/utils/http';
@@ -43,7 +44,7 @@ const EnvModal = ({
); );
if (code === 200) { if (code === 200) {
message.success(env ? '更新变量成功' : '建变量成功'); message.success(env ? intl.get('更新变量成功') : intl.get('建变量成功'));
handleCancel(data); handleCancel(data);
} }
setLoading(false); setLoading(false);
@@ -58,7 +59,7 @@ const EnvModal = ({
return ( return (
<Modal <Modal
title={env ? '编辑变量' : '建变量'} title={env ? intl.get('编辑变量') : intl.get('建变量')}
open={visible} open={visible}
forceRender forceRender
centered centered
@@ -79,45 +80,45 @@ const EnvModal = ({
<Form form={form} layout="vertical" name="env_modal" initialValues={env}> <Form form={form} layout="vertical" name="env_modal" initialValues={env}>
<Form.Item <Form.Item
name="name" name="name"
label="名称" label={intl.get('名称')}
rules={[ rules={[
{ required: true, message: '请输入环境变量名称', whitespace: true }, { required: true, message: intl.get('请输入环境变量名称'), whitespace: true },
{ {
pattern: /^[a-zA-Z_][0-9a-zA-Z_]*$/, pattern: /^[a-zA-Z_][0-9a-zA-Z_]*$/,
message: '只能输入字母数字下划线,且不能以数字开头', message: intl.get('只能输入字母数字下划线,且不能以数字开头'),
}, },
]} ]}
> >
<Input placeholder="请输入环境变量名称" /> <Input placeholder={intl.get('请输入环境变量名称')} />
</Form.Item> </Form.Item>
{!env && ( {!env && (
<Form.Item <Form.Item
name="split" name="split"
label="自动拆分" label={intl.get('自动拆分')}
initialValue="0" initialValue="0"
tooltip="多个依赖是否换行分割" tooltip={intl.get('多个依赖是否换行分割')}
> >
<Radio.Group> <Radio.Group>
<Radio value="1"></Radio> <Radio value="1">{intl.get('是')}</Radio>
<Radio value="0"></Radio> <Radio value="0">{intl.get('否')}</Radio>
</Radio.Group> </Radio.Group>
</Form.Item> </Form.Item>
)} )}
<Form.Item <Form.Item
name="value" name="value"
label="值" label={intl.get('值')}
rules={[ rules={[
{ required: true, message: '请输入环境变量值', whitespace: true }, { required: true, message: intl.get('请输入环境变量值'), whitespace: true },
]} ]}
> >
<Input.TextArea <Input.TextArea
rows={4} rows={4}
autoSize={true} autoSize={true}
placeholder="请输入环境变量值" placeholder={intl.get('请输入环境变量值')}
/> />
</Form.Item> </Form.Item>
<Form.Item name="remarks" label="备注"> <Form.Item name="remarks" label={intl.get('备注')}>
<Input placeholder="请输入备注" /> <Input placeholder={intl.get('请输入备注')} />
</Form.Item> </Form.Item>
</Form> </Form>
</Modal> </Modal>
+9 -6
View File
@@ -1,3 +1,4 @@
import intl from 'react-intl-universal';
import React, { useState, useEffect, useRef } from 'react'; import React, { useState, useEffect, useRef } from 'react';
import config from '@/utils/config'; import config from '@/utils/config';
import { request } from '@/utils/http'; import { request } from '@/utils/http';
@@ -54,22 +55,24 @@ const Error = () => {
type="error" type="error"
message={ message={
<Typography.Title level={5} type="danger"> <Typography.Title level={5} type="danger">
{intl.get('服务启动超时')}
</Typography.Title> </Typography.Title>
} }
description={ description={
<Typography.Text type="danger"> <Typography.Text type="danger">
<div></div> <div>{intl.get('请先按如下方式修复:')}</div>
<div> <div>
1. 宿 docker run --rm -v 1. 宿 docker run --rm -v
/var/run/docker.sock:/var/run/docker.sock /var/run/docker.sock:/var/run/docker.sock
containrrr/watchtower -cR &lt;&gt; containrrr/watchtower -cR &lt;&gt;
</div> </div>
<div>2. ql -l checkql -l update</div> <div>{intl.get('2. 容器内执行 ql -l check、ql -l update')}</div>
<div> <div>
3. pm2 logs {intl.get(
'3. 如果无法解决,容器内执行 pm2 logs,拷贝执行结果',
)}
<Typography.Link href="https://github.com/whyour/qinglong/issues/new?assignees=&labels=&template=bug_report.yml"> <Typography.Link href="https://github.com/whyour/qinglong/issues/new?assignees=&labels=&template=bug_report.yml">
issue {intl.get('提交 issue')}
</Typography.Link> </Typography.Link>
</div> </div>
</Typography.Text> </Typography.Text>
@@ -81,7 +84,7 @@ const Error = () => {
</Typography.Paragraph> </Typography.Paragraph>
</div> </div>
) : ( ) : (
<PageLoading tip="启动中,请稍后..." /> <PageLoading tip={intl.get('启动中,请稍后...')} />
)} )}
</div> </div>
); );
+30 -27
View File
@@ -1,3 +1,4 @@
import intl from 'react-intl-universal';
import React, { Fragment, useEffect, useState } from 'react'; import React, { Fragment, useEffect, useState } from 'react';
import { import {
Button, Button,
@@ -70,15 +71,15 @@ const Initialization = () => {
const steps = [ const steps = [
{ {
title: '欢迎使用', title: intl.get('欢迎使用'),
content: ( content: (
<div className={styles.top} style={{ marginTop: 30 }}> <div className={styles.top} style={{ marginTop: 30 }}>
<div className={styles.header}> <div className={styles.header}>
<span className={styles.title}>使</span> <span className={styles.title}>{intl.get('欢迎使用青龙')}</span>
<span className={styles.desc}> <span className={styles.desc}>
python3javaScriptshelltypescript A {intl.get(
timed task management panel that supports typescript, javaScript, '支持python3、javascript、shell、typescript 的定时任务管理面板',
python3, and shell. )}
</span> </span>
</div> </div>
<div className={styles.action}> <div className={styles.action}>
@@ -88,42 +89,42 @@ const Initialization = () => {
next(); next();
}} }}
> >
{intl.get('开始安装')}
</Button> </Button>
</div> </div>
</div> </div>
), ),
}, },
{ {
title: '账户设置', title: intl.get('账户设置'),
content: ( content: (
<Form onFinish={submitAccountSetting} layout="vertical"> <Form onFinish={submitAccountSetting} layout="vertical">
<Form.Item <Form.Item
label="用户名" label={intl.get('用户名')}
name="username" name="username"
rules={[{ required: true }]} rules={[{ required: true }]}
style={{ maxWidth: 350 }} style={{ maxWidth: 350 }}
> >
<Input placeholder="用户名" /> <Input placeholder={intl.get('用户名')} />
</Form.Item> </Form.Item>
<Form.Item <Form.Item
label="密码" label={intl.get('密码')}
name="password" name="password"
rules={[ rules={[
{ required: true }, { required: true },
{ {
pattern: /^(?!admin$).*$/, pattern: /^(?!admin$).*$/,
message: '密码不能为admin', message: intl.get('密码不能为admin'),
}, },
]} ]}
hasFeedback hasFeedback
style={{ maxWidth: 350 }} style={{ maxWidth: 350 }}
> >
<Input type="password" placeholder="密码" /> <Input type="password" placeholder={intl.get('密码')} />
</Form.Item> </Form.Item>
<Form.Item <Form.Item
name="confirm" name="confirm"
label="确认密码" label={intl.get('确认密码')}
dependencies={['password']} dependencies={['password']}
hasFeedback hasFeedback
style={{ maxWidth: 350 }} style={{ maxWidth: 350 }}
@@ -136,32 +137,34 @@ const Initialization = () => {
if (!value || getFieldValue('password') === value) { if (!value || getFieldValue('password') === value) {
return Promise.resolve(); return Promise.resolve();
} }
return Promise.reject(new Error('您输入的两个密码不匹配!')); return Promise.reject(
new Error(intl.get('您输入的两个密码不匹配!')),
);
}, },
}), }),
]} ]}
> >
<Input.Password placeholder="确认密码" /> <Input.Password placeholder={intl.get('确认密码')} />
</Form.Item> </Form.Item>
<Button type="primary" htmlType="submit" loading={loading}> <Button type="primary" htmlType="submit" loading={loading}>
{intl.get('提交')}
</Button> </Button>
</Form> </Form>
), ),
}, },
{ {
title: '通知设置', title: intl.get('通知设置'),
content: ( content: (
<Form onFinish={submitNotification} layout="vertical"> <Form onFinish={submitNotification} layout="vertical">
<Form.Item <Form.Item
label="通知方式" label={intl.get('通知方式')}
name="type" name="type"
rules={[{ required: true, message: '请选择通知方式' }]} rules={[{ required: true, message: intl.get('请选择通知方式') }]}
style={{ maxWidth: 350 }} style={{ maxWidth: 350 }}
> >
<Select <Select
onChange={notificationModeChange} onChange={notificationModeChange}
placeholder="请选择通知方式" placeholder={intl.get('请选择通知方式')}
> >
{config.notificationModes {config.notificationModes
.filter((x) => x.value !== 'closed') .filter((x) => x.value !== 'closed')
@@ -188,25 +191,25 @@ const Initialization = () => {
</Form.Item> </Form.Item>
))} ))}
<Button type="primary" htmlType="submit" loading={loading}> <Button type="primary" htmlType="submit" loading={loading}>
{intl.get('保存')}
</Button> </Button>
<Button type="link" htmlType="button" onClick={() => next()}> <Button type="link" htmlType="button" onClick={() => next()}>
{intl.get('跳过')}
</Button> </Button>
</Form> </Form>
), ),
}, },
{ {
title: '完成安装', title: intl.get('完成安装'),
content: ( content: (
<div className={styles.top} style={{ marginTop: 80 }}> <div className={styles.top} style={{ marginTop: 80 }}>
<div className={styles.header}> <div className={styles.header}>
<span className={styles.title}></span> <span className={styles.title}>{intl.get('恭喜安装完成!')}</span>
<Link href="https://github.com/whyour/qinglong" target="_blank"> <Link href="https://github.com/whyour/qinglong" target="_blank">
Github Github
</Link> </Link>
<Link href="https://t.me/jiao_long" target="_blank"> <Link href="https://t.me/jiao_long" target="_blank">
Telegram频道 {intl.get('Telegram频道')}
</Link> </Link>
</div> </div>
<div style={{ marginTop: 16 }}> <div style={{ marginTop: 16 }}>
@@ -216,7 +219,7 @@ const Initialization = () => {
window.location.reload(); window.location.reload();
}} }}
> >
{intl.get('去登录')}
</Button> </Button>
</div> </div>
</div> </div>
@@ -233,7 +236,7 @@ const Initialization = () => {
className={styles.logo} className={styles.logo}
src="https://qn.whyour.cn/logo.png" src="https://qn.whyour.cn/logo.png"
/> />
<span className={styles.title}></span> <span className={styles.title}>{intl.get('初始化配置')}</span>
</div> </div>
</div> </div>
<div className={styles.main}> <div className={styles.main}>
+11 -10
View File
@@ -1,3 +1,4 @@
import intl from 'react-intl-universal'
import { useState, useEffect, useCallback, Key, useRef } from 'react'; import { useState, useEffect, useCallback, Key, useRef } from 'react';
import { import {
TreeSelect, TreeSelect,
@@ -29,7 +30,7 @@ const { Text } = Typography;
const Log = () => { const Log = () => {
const { headerStyle, isPhone, theme } = useOutletContext<SharedContext>(); const { headerStyle, isPhone, theme } = useOutletContext<SharedContext>();
const [value, setValue] = useState('请选择日志文件'); const [value, setValue] = useState(intl.get('请选择日志文件'));
const [select, setSelect] = useState<string>(''); const [select, setSelect] = useState<string>('');
const [data, setData] = useState<any[]>([]); const [data, setData] = useState<any[]>([]);
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
@@ -70,7 +71,7 @@ const Log = () => {
} }
if (node.type === 'directory') { if (node.type === 'directory') {
setValue('请选择日志文件'); setValue(intl.get('请选择日志文件'));
return; return;
} }
@@ -112,12 +113,12 @@ const Log = () => {
title: `确认删除`, title: `确认删除`,
content: ( content: (
<> <>
{intl.get('确认删除')}
<Text style={{ wordBreak: 'break-all' }} type="warning"> <Text style={{ wordBreak: 'break-all' }} type="warning">
{select} {select}
</Text> </Text>
{currentNode.type === 'directory' ? '夹下所以日志' : ''} {intl.get('文件')}{currentNode.type === 'directory' ? intl.get('夹下所以日志') : ''}
{intl.get(',删除后不可恢复')}
</> </>
), ),
onOk() { onOk() {
@@ -160,7 +161,7 @@ const Log = () => {
const initState = () => { const initState = () => {
setSelect(''); setSelect('');
setCurrentNode(null); setCurrentNode(null);
setValue('请选择脚本文件'); setValue(intl.get('请选择脚本文件'));
}; };
const onExpand = (expKeys: any) => { const onExpand = (expKeys: any) => {
@@ -191,7 +192,7 @@ const Log = () => {
value={select} value={select}
dropdownStyle={{ maxHeight: 400, overflow: 'auto' }} dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
treeData={data} treeData={data}
placeholder="请选择日志" placeholder={intl.get('请选择日志')}
fieldNames={{ value: 'key' }} fieldNames={{ value: 'key' }}
treeNodeFilterProp="title" treeNodeFilterProp="title"
showSearch showSearch
@@ -200,7 +201,7 @@ const Log = () => {
/>, />,
] ]
: [ : [
<Tooltip title="删除"> <Tooltip title={intl.get('删除')}>
<Button <Button
type="primary" type="primary"
disabled={!select} disabled={!select}
@@ -224,7 +225,7 @@ const Log = () => {
<Input.Search <Input.Search
className={styles['left-tree-search']} className={styles['left-tree-search']}
onChange={onSearch} onChange={onSearch}
placeholder="请输入日志名" placeholder={intl.get('请输入日志名')}
allowClear allowClear
></Input.Search> ></Input.Search>
<div className={styles['left-tree-scroller']} ref={treeDom}> <div className={styles['left-tree-scroller']} ref={treeDom}>
@@ -252,7 +253,7 @@ const Log = () => {
}} }}
> >
<Empty <Empty
description="暂无日志" description={intl.get('暂无日志')}
image={Empty.PRESENTED_IMAGE_SIMPLE} image={Empty.PRESENTED_IMAGE_SIMPLE}
/> />
</div> </div>
+34 -19
View File
@@ -1,3 +1,4 @@
import intl from 'react-intl-universal';
import React, { Fragment, useEffect, useState } from 'react'; import React, { Fragment, useEffect, useState } from 'react';
import { import {
Button, Button,
@@ -80,17 +81,29 @@ const Login = () => {
} = data; } = data;
localStorage.setItem(config.authKey, token); localStorage.setItem(config.authKey, token);
notification.success({ notification.success({
message: '登录成功!', message: intl.get('登录成功!'),
description: ( description: (
<> <>
<div> <div>
{intl.get('上次登录时间:')}
{lastlogon ? new Date(lastlogon).toLocaleString() : '-'} {lastlogon ? new Date(lastlogon).toLocaleString() : '-'}
</div> </div>
<div>{lastaddr || '-'}</div> <div>
<div>IP{lastip || '-'}</div> {intl.get('上次登录地点:')}
<div>{platform || '-'}</div> {lastaddr || '-'}
<div>{retries > 0 ? `失败${retries}` : '成功'}</div> </div>
<div>
{intl.get('上次登录IP')}
{lastip || '-'}
</div>
<div>
{intl.get('上次登录设备:')}
{platform || '-'}
</div>
<div>
{intl.get('上次登录状态:')}
{retries > 0 ? `失败${retries}` : intl.get('成功')}
</div>
</> </>
), ),
}); });
@@ -136,7 +149,7 @@ const Login = () => {
src="https://qn.whyour.cn/logo.png" src="https://qn.whyour.cn/logo.png"
/> />
<span className={styles.title}> <span className={styles.title}>
{twoFactor ? '两步验证' : config.siteName} {twoFactor ? intl.get('两步验证') : config.siteName}
</span> </span>
</div> </div>
</div> </div>
@@ -145,17 +158,17 @@ const Login = () => {
<Form layout="vertical" onFinish={completeTowFactor}> <Form layout="vertical" onFinish={completeTowFactor}>
<FormItem <FormItem
name="code" name="code"
label="验证码" label={intl.get('验证码')}
rules={[ rules={[
{ {
pattern: /^[0-9]{6}$/, pattern: /^[0-9]{6}$/,
message: '验证码为6位数字', message: intl.get('验证码为6位数字'),
}, },
]} ]}
validateTrigger="onBlur" validateTrigger="onBlur"
> >
<Input <Input
placeholder="6位数字" placeholder={intl.get('6位数字')}
onChange={codeInputChange} onChange={codeInputChange}
autoFocus autoFocus
autoComplete="off" autoComplete="off"
@@ -167,27 +180,27 @@ const Login = () => {
style={{ width: '100%' }} style={{ width: '100%' }}
loading={verifying} loading={verifying}
> >
{intl.get('验证')}
</Button> </Button>
</Form> </Form>
) : ( ) : (
<Form layout="vertical" onFinish={handleOk}> <Form layout="vertical" onFinish={handleOk}>
<FormItem name="username" label="用户名" hasFeedback> <FormItem name="username" label={intl.get('用户名')} hasFeedback>
<Input <Input
placeholder={`用户名${isDemoEnv ? ': admin' : ''}`} placeholder={`${intl.get('用户名')}${isDemoEnv ? ': admin' : ''}`}
autoFocus autoFocus
/> />
</FormItem> </FormItem>
<FormItem name="password" label="密码" hasFeedback> <FormItem name="password" label={intl.get('密码')} hasFeedback>
<Input <Input
type="password" type="password"
placeholder={`密码${isDemoEnv ? ': 123' : ''}`} placeholder={`${intl.get('密码')}${isDemoEnv ? ': 123' : ''}`}
/> />
</FormItem> </FormItem>
<Row> <Row>
{waitTime ? ( {waitTime ? (
<Button type="primary" style={{ width: '100%' }} disabled> <Button type="primary" style={{ width: '100%' }} disabled>
{intl.get('请')}
<Countdown <Countdown
valueStyle={{ valueStyle={{
color: color:
@@ -200,7 +213,7 @@ const Login = () => {
format="ss" format="ss"
value={Date.now() + 1000 * waitTime} value={Date.now() + 1000 * waitTime}
/> />
{intl.get('秒后重试')}
</Button> </Button>
) : ( ) : (
<Button <Button
@@ -209,7 +222,7 @@ const Login = () => {
style={{ width: '100%' }} style={{ width: '100%' }}
loading={loading} loading={loading}
> >
{intl.get('登录')}
</Button> </Button>
)} )}
</Row> </Row>
@@ -220,7 +233,9 @@ const Login = () => {
{twoFactor ? ( {twoFactor ? (
<div style={{ paddingLeft: 20, position: 'relative' }}> <div style={{ paddingLeft: 20, position: 'relative' }}>
<MobileOutlined style={{ position: 'absolute', left: 0, top: 4 }} /> <MobileOutlined style={{ position: 'absolute', left: 0, top: 4 }} />
{intl.get(
'在您的设备上打开两步验证应用程序以查看您的身份验证代码并验证您的身份。',
)}
</div> </div>
) : ( ) : (
'' ''
+7 -6
View File
@@ -1,3 +1,4 @@
import intl from 'react-intl-universal';
import React, { useEffect, useState, useRef } from 'react'; import React, { useEffect, useState, useRef } from 'react';
import { Drawer, Button, Tabs, Badge, Select, TreeSelect } from 'antd'; import { Drawer, Button, Tabs, Badge, Select, TreeSelect } from 'antd';
import { request } from '@/utils/http'; import { request } from '@/utils/http';
@@ -161,7 +162,7 @@ const EditModal = ({
value={selectedKey} value={selectedKey}
dropdownStyle={{ maxHeight: 400, overflow: 'auto' }} dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
treeData={treeData} treeData={treeData}
placeholder="请选择脚本文件" placeholder={intl.get('请选择脚本文件')}
fieldNames={{ value: 'key', label: 'title' }} fieldNames={{ value: 'key', label: 'title' }}
showSearch showSearch
onSelect={onSelect} onSelect={onSelect}
@@ -183,7 +184,7 @@ const EditModal = ({
style={{ marginRight: 8 }} style={{ marginRight: 8 }}
onClick={isRunning ? stop : run} onClick={isRunning ? stop : run}
> >
{isRunning ? '停止' : '运行'} {isRunning ? intl.get('停止') : intl.get('运行')}
</Button> </Button>
<Button <Button
type="primary" type="primary"
@@ -192,7 +193,7 @@ const EditModal = ({
setLog(''); setLog('');
}} }}
> >
{intl.get('清空日志')}
</Button> </Button>
<Button <Button
type="primary" type="primary"
@@ -201,7 +202,7 @@ const EditModal = ({
setSettingModalVisible(true); setSettingModalVisible(true);
}} }}
> >
{intl.get('设置')}
</Button> </Button>
<Button <Button
type="primary" type="primary"
@@ -210,7 +211,7 @@ const EditModal = ({
setSaveModalVisible(true); setSaveModalVisible(true);
}} }}
> >
{intl.get('保存')}
</Button> </Button>
<Button <Button
type="primary" type="primary"
@@ -220,7 +221,7 @@ const EditModal = ({
handleCancel(); handleCancel();
}} }}
> >
退 {intl.get('退出')}
</Button> </Button>
</> </>
} }
+22 -17
View File
@@ -1,3 +1,4 @@
import intl from 'react-intl-universal';
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { import {
Modal, Modal,
@@ -47,7 +48,9 @@ const EditScriptNameModal = ({
.post(`${config.apiPrefix}scripts`, formData) .post(`${config.apiPrefix}scripts`, formData)
.then(({ code, data }) => { .then(({ code, data }) => {
if (code === 200) { if (code === 200) {
message.success(directory ? '新建文件夹成功' : '新建文件成功'); message.success(
directory ? intl.get('创建文件夹成功') : intl.get('创建文件成功'),
);
const key = path ? `${path}/` : ''; const key = path ? `${path}/` : '';
const filename = file ? file.name : inputFilename; const filename = file ? file.name : inputFilename;
handleCancel({ handleCancel({
@@ -96,7 +99,7 @@ const EditScriptNameModal = ({
return ( return (
<Modal <Modal
title="新建" title={intl.get('创建')}
open={visible} open={visible}
forceRender forceRender
centered centered
@@ -117,58 +120,60 @@ const EditScriptNameModal = ({
<Form form={form} layout="vertical" name="edit_name_modal"> <Form form={form} layout="vertical" name="edit_name_modal">
<Form.Item <Form.Item
name="type" name="type"
label="类型" label={intl.get('类型')}
rules={[{ required: true }]} rules={[{ required: true }]}
initialValue={'blank'} initialValue={'blank'}
> >
<Radio.Group onChange={typeChange}> <Radio.Group onChange={typeChange}>
<Radio value="blank"></Radio> <Radio value="blank">{intl.get('空文件')}</Radio>
<Radio value="upload"></Radio> <Radio value="upload">{intl.get('本地文件')}</Radio>
<Radio value="directory"></Radio> <Radio value="directory">{intl.get('文件夹')}</Radio>
</Radio.Group> </Radio.Group>
</Form.Item> </Form.Item>
{type === 'blank' && ( {type === 'blank' && (
<Form.Item <Form.Item
name="filename" name="filename"
label="文件名" label={intl.get('文件名')}
rules={[ rules={[
{ required: true, message: '请输入文件名' }, { required: true, message: intl.get('请输入文件名') },
{ {
validator: (_, value) => validator: (_, value) =>
value.includes('/') value.includes('/')
? Promise.reject(new Error('文件名不能包含斜杠')) ? Promise.reject(new Error(intl.get('文件名不能包含斜杠')))
: Promise.resolve(), : Promise.resolve(),
}, },
]} ]}
> >
<Input placeholder="请输入文件名" /> <Input placeholder={intl.get('请输入文件名')} />
</Form.Item> </Form.Item>
)} )}
{type === 'directory' && ( {type === 'directory' && (
<Form.Item <Form.Item
name="directory" name="directory"
label="文件夹名" label={intl.get('文件夹名')}
rules={[{ required: true, message: '请输入文件夹名' }]} rules={[{ required: true, message: intl.get('请输入文件夹名') }]}
> >
<Input placeholder="请输入文件夹名" /> <Input placeholder={intl.get('请输入文件夹名')} />
</Form.Item> </Form.Item>
)} )}
<Form.Item label="父目录" name="path"> <Form.Item label={intl.get('父目录')} name="path">
<TreeSelect <TreeSelect
allowClear allowClear
treeData={dirs} treeData={dirs}
fieldNames={{ value: 'key', label: 'title' }} fieldNames={{ value: 'key', label: 'title' }}
placeholder="请选择父目录" placeholder={intl.get('请选择父目录')}
treeDefaultExpandAll treeDefaultExpandAll
/> />
</Form.Item> </Form.Item>
{type === 'upload' && ( {type === 'upload' && (
<Form.Item label="文件" name="file"> <Form.Item label={intl.get('文件')} name="file">
<Upload.Dragger beforeUpload={beforeUpload} maxCount={1}> <Upload.Dragger beforeUpload={beforeUpload} maxCount={1}>
<p className="ant-upload-drag-icon"> <p className="ant-upload-drag-icon">
<UploadOutlined /> <UploadOutlined />
</p> </p>
<p className="ant-upload-text"></p> <p className="ant-upload-text">
{intl.get('点击或者拖拽文件到此区域上传')}
</p>
</Upload.Dragger> </Upload.Dragger>
</Form.Item> </Form.Item>
)} )}
+27 -25
View File
@@ -1,3 +1,4 @@
import intl from 'react-intl-universal';
import { useState, useEffect, useCallback, Key, useRef } from 'react'; import { useState, useEffect, useCallback, Key, useRef } from 'react';
import { import {
TreeSelect, TreeSelect,
@@ -55,7 +56,7 @@ const LangMap: any = {
const Script = () => { const Script = () => {
const { headerStyle, isPhone, theme, socketMessage } = const { headerStyle, isPhone, theme, socketMessage } =
useOutletContext<SharedContext>(); useOutletContext<SharedContext>();
const [value, setValue] = useState('请选择脚本文件'); const [value, setValue] = useState(intl.get('请选择脚本文件'));
const [select, setSelect] = useState<string>(''); const [select, setSelect] = useState<string>('');
const [data, setData] = useState<any[]>([]); const [data, setData] = useState<any[]>([]);
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
@@ -128,7 +129,7 @@ const Script = () => {
} }
if (node.type === 'directory') { if (node.type === 'directory') {
setValue('请选择脚本文件'); setValue(intl.get('请选择脚本文件'));
return; return;
} }
@@ -146,7 +147,7 @@ const Script = () => {
if (content !== value) { if (content !== value) {
Modal.confirm({ Modal.confirm({
title: `确认离开`, title: `确认离开`,
content: <></>, content: <>{intl.get('当前修改未保存,确定离开吗')}</>,
onOk() { onOk() {
onSelect(keys[0], e.node); onSelect(keys[0], e.node);
setIsEditing(false); setIsEditing(false);
@@ -209,11 +210,11 @@ const Script = () => {
title: `确认保存`, title: `确认保存`,
content: ( content: (
<> <>
{intl.get('确认保存文件')}
<Text style={{ wordBreak: 'break-all' }} type="warning"> <Text style={{ wordBreak: 'break-all' }} type="warning">
{currentNode.title} {currentNode.title}
</Text>{' '} </Text>{' '}
{intl.get(',保存后不可恢复')}
</> </>
), ),
onOk() { onOk() {
@@ -249,12 +250,13 @@ const Script = () => {
title: `确认删除`, title: `确认删除`,
content: ( content: (
<> <>
{intl.get('确认删除')}
<Text style={{ wordBreak: 'break-all' }} type="warning"> <Text style={{ wordBreak: 'break-all' }} type="warning">
{select} {select}
</Text> </Text>
{currentNode.type === 'directory' ? '夹及其子文件' : ''} {intl.get('文件')}
{currentNode.type === 'directory' ? intl.get('夹及其子文件') : ''}
{intl.get(',删除后不可恢复')}
</> </>
), ),
onOk() { onOk() {
@@ -358,7 +360,7 @@ const Script = () => {
const initState = () => { const initState = () => {
setSelect(''); setSelect('');
setCurrentNode(null); setCurrentNode(null);
setValue('请选择脚本文件'); setValue(intl.get('请选择脚本文件'));
}; };
useEffect(() => { useEffect(() => {
@@ -406,8 +408,8 @@ const Script = () => {
const menu: MenuProps = isEditing const menu: MenuProps = isEditing
? { ? {
items: [ items: [
{ label: '保存', key: 'save', icon: <PlusOutlined /> }, { label: intl.get('保存'), key: 'save', icon: <PlusOutlined /> },
{ label: '退出编辑', key: 'exit', icon: <EditOutlined /> }, { label: intl.get('退出编辑'), key: 'exit', icon: <EditOutlined /> },
], ],
onClick: ({ key, domEvent }) => { onClick: ({ key, domEvent }) => {
domEvent.stopPropagation(); domEvent.stopPropagation();
@@ -416,21 +418,21 @@ const Script = () => {
} }
: { : {
items: [ items: [
{ label: '建', key: 'add', icon: <PlusOutlined /> }, { label: intl.get('建'), key: 'add', icon: <PlusOutlined /> },
{ {
label: '编辑', label: intl.get('编辑'),
key: 'edit', key: 'edit',
icon: <EditOutlined />, icon: <EditOutlined />,
disabled: !select, disabled: !select,
}, },
{ {
label: '重命名', label: intl.get('重命名'),
key: 'rename', key: 'rename',
icon: <IconFont type="ql-icon-rename" />, icon: <IconFont type="ql-icon-rename" />,
disabled: !select, disabled: !select,
}, },
{ {
label: '删除', label: intl.get('删除'),
key: 'delete', key: 'delete',
icon: <DeleteOutlined />, icon: <DeleteOutlined />,
disabled: !select, disabled: !select,
@@ -456,7 +458,7 @@ const Script = () => {
value={select} value={select}
dropdownStyle={{ maxHeight: 400, overflow: 'auto' }} dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
treeData={data} treeData={data}
placeholder="请选择脚本" placeholder={intl.get('请选择脚本')}
fieldNames={{ value: 'key' }} fieldNames={{ value: 'key' }}
treeNodeFilterProp="title" treeNodeFilterProp="title"
showSearch showSearch
@@ -470,21 +472,21 @@ const Script = () => {
: isEditing : isEditing
? [ ? [
<Button type="primary" onClick={saveFile}> <Button type="primary" onClick={saveFile}>
{intl.get('保存')}
</Button>, </Button>,
<Button type="primary" onClick={cancelEdit}> <Button type="primary" onClick={cancelEdit}>
退 {intl.get('退出编辑')}
</Button>, </Button>,
] ]
: [ : [
<Tooltip title="新建"> <Tooltip title={intl.get('创建')}>
<Button <Button
type="primary" type="primary"
onClick={addFile} onClick={addFile}
icon={<PlusOutlined />} icon={<PlusOutlined />}
/> />
</Tooltip>, </Tooltip>,
<Tooltip title="编辑"> <Tooltip title={intl.get('编辑')}>
<Button <Button
disabled={!select} disabled={!select}
type="primary" type="primary"
@@ -492,7 +494,7 @@ const Script = () => {
icon={<EditOutlined />} icon={<EditOutlined />}
/> />
</Tooltip>, </Tooltip>,
<Tooltip title="重命名"> <Tooltip title={intl.get('重命名')}>
<Button <Button
disabled={!select} disabled={!select}
type="primary" type="primary"
@@ -500,7 +502,7 @@ const Script = () => {
icon={<IconFont type="ql-icon-rename" />} icon={<IconFont type="ql-icon-rename" />}
/> />
</Tooltip>, </Tooltip>,
<Tooltip title="删除"> <Tooltip title={intl.get('删除')}>
<Button <Button
type="primary" type="primary"
disabled={!select} disabled={!select}
@@ -514,7 +516,7 @@ const Script = () => {
setIsLogModalVisible(true); setIsLogModalVisible(true);
}} }}
> >
{intl.get('调试')}
</Button>, </Button>,
] ]
} }
@@ -532,7 +534,7 @@ const Script = () => {
<Input.Search <Input.Search
className={styles['left-tree-search']} className={styles['left-tree-search']}
onChange={onSearch} onChange={onSearch}
placeholder="请输入脚本名" placeholder={intl.get('请输入脚本名')}
allowClear allowClear
></Input.Search> ></Input.Search>
<div className={styles['left-tree-scroller']} ref={treeDom}> <div className={styles['left-tree-scroller']} ref={treeDom}>
@@ -560,7 +562,7 @@ const Script = () => {
}} }}
> >
<Empty <Empty
description="暂无脚本" description={intl.get('暂无脚本')}
image={Empty.PRESENTED_IMAGE_SIMPLE} image={Empty.PRESENTED_IMAGE_SIMPLE}
/> />
</div> </div>
+4 -3
View File
@@ -1,3 +1,4 @@
import intl from 'react-intl-universal';
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { Modal, message, Input, Form } from 'antd'; import { Modal, message, Input, Form } from 'antd';
import { request } from '@/utils/http'; import { request } from '@/utils/http';
@@ -43,7 +44,7 @@ const RenameModal = ({
return ( return (
<Modal <Modal
title="重命名" title={intl.get('重命名')}
open={visible} open={visible}
forceRender forceRender
centered centered
@@ -64,9 +65,9 @@ const RenameModal = ({
<Form form={form} layout="vertical" name="edit_name_modal"> <Form form={form} layout="vertical" name="edit_name_modal">
<Form.Item <Form.Item
name="name" name="name"
rules={[{ required: true, message: '请输入新名称' }]} rules={[{ required: true, message: intl.get('请输入新名称') }]}
> >
<Input placeholder="请输入新名称" /> <Input placeholder={intl.get('请输入新名称')} />
</Form.Item> </Form.Item>
</Form> </Form>
</Modal> </Modal>
+7 -6
View File
@@ -1,3 +1,4 @@
import intl from 'react-intl-universal';
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { Modal, message, Input, Form } from 'antd'; import { Modal, message, Input, Form } from 'antd';
import { request } from '@/utils/http'; import { request } from '@/utils/http';
@@ -36,7 +37,7 @@ const SaveModal = ({
return ( return (
<Modal <Modal
title="保存文件" title={intl.get('保存文件')}
open={visible} open={visible}
forceRender forceRender
centered centered
@@ -62,13 +63,13 @@ const SaveModal = ({
> >
<Form.Item <Form.Item
name="filename" name="filename"
label="文件名" label={intl.get('文件名')}
rules={[{ required: true, message: '请输入文件名' }]} rules={[{ required: true, message: intl.get('请输入文件名') }]}
> >
<Input placeholder="请输入文件名" /> <Input placeholder={intl.get('请输入文件名')} />
</Form.Item> </Form.Item>
<Form.Item name="path" label="保存目录"> <Form.Item name="path" label={intl.get('保存目录')}>
<Input placeholder="请输入保存目录,默认scripts目录" /> <Input placeholder={intl.get('请输入保存目录,默认scripts目录')} />
</Form.Item> </Form.Item>
</Form> </Form>
</Modal> </Modal>
+5 -4
View File
@@ -1,3 +1,4 @@
import intl from 'react-intl-universal';
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { Modal, message, Input, Form } from 'antd'; import { Modal, message, Input, Form } from 'antd';
import { request } from '@/utils/http'; import { request } from '@/utils/http';
@@ -36,7 +37,7 @@ const SettingModal = ({
return ( return (
<Modal <Modal
title="运行设置" title={intl.get('运行设置')}
open={visible} open={visible}
forceRender forceRender
centered centered
@@ -50,10 +51,10 @@ const SettingModal = ({
> >
<Form.Item <Form.Item
name="filename" name="filename"
label="待开发" label={intl.get('待开发')}
rules={[{ required: true, message: '待开发' }]} rules={[{ required: true, message: intl.get('待开发') }]}
> >
<Input placeholder="待开发" /> <Input placeholder={intl.get('待开发')} />
</Form.Item> </Form.Item>
</Form> </Form>
</Modal> </Modal>
+13 -14
View File
@@ -1,3 +1,4 @@
import intl from 'react-intl-universal';
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { Typography, Input, Form, Button, message, Descriptions } from 'antd'; import { Typography, Input, Form, Button, message, Descriptions } from 'antd';
import styles from './index.less'; import styles from './index.less';
@@ -20,27 +21,25 @@ const About = ({ systemInfo }: { systemInfo: SharedContext['systemInfo'] }) => {
src="https://qn.whyour.cn/logo.png" src="https://qn.whyour.cn/logo.png"
/> />
<div className={styles.right}> <div className={styles.right}>
<span className={styles.title}></span> <span className={styles.title}>{intl.get('青龙')}</span>
<span className={styles.desc}> <span className={styles.desc}>
python3javaScriptshelltypescript A timed {intl.get(
task management panel that supports typescript, javaScript, python3, '支持python3、javascript、shell、typescript 的定时任务管理面板',
and shell. )}
</span> </span>
<Descriptions> <Descriptions>
<Descriptions.Item label="版本" span={3}> <Descriptions.Item label={intl.get('版本')} span={3}>
{TVersion[systemInfo.branch]} v{systemInfo.version} {intl.get(TVersion[systemInfo.branch])} v{systemInfo.version}
</Descriptions.Item> </Descriptions.Item>
<Descriptions.Item label="更新时间" span={3}> <Descriptions.Item label={intl.get('更新时间')} span={3}>
{dayjs(systemInfo.publishTime * 1000).format( {dayjs(systemInfo.publishTime * 1000).format('YYYY-MM-DD HH:mm')}
'YYYY-MM-DD HH:mm',
)}
</Descriptions.Item> </Descriptions.Item>
<Descriptions.Item label="更新日志" span={3}> <Descriptions.Item label={intl.get('更新日志')} span={3}>
<Link <Link
href={`https://qn.whyour.cn/version.yaml?t=${Date.now()}`} href={`https://qn.whyour.cn/version.yaml?t=${Date.now()}`}
target="_blank" target="_blank"
> >
{intl.get('查看')}
</Link> </Link>
</Descriptions.Item> </Descriptions.Item>
</Descriptions> </Descriptions>
@@ -57,13 +56,13 @@ const About = ({ systemInfo }: { systemInfo: SharedContext['systemInfo'] }) => {
target="_blank" target="_blank"
style={{ marginRight: 15 }} style={{ marginRight: 15 }}
> >
Telegram频道 {intl.get('Telegram频道')}
</Link> </Link>
<Link <Link
href="https://github.com/whyour/qinglong/issues" href="https://github.com/whyour/qinglong/issues"
target="_blank" target="_blank"
> >
BUG {intl.get('提交BUG')}
</Link> </Link>
</div> </div>
</div> </div>
+14 -7
View File
@@ -1,3 +1,4 @@
import intl from 'react-intl-universal';
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { Modal, message, Input, Form, Select } from 'antd'; import { Modal, message, Input, Form, Select } from 'antd';
import { request } from '@/utils/http'; import { request } from '@/utils/http';
@@ -29,7 +30,9 @@ const AppModal = ({
); );
if (code === 200) { if (code === 200) {
message.success(app ? '更新应用成功' : '新建应用成功'); message.success(
app ? intl.get('更新应用成功') : intl.get('创建应用成功'),
);
handleCancel(data); handleCancel(data);
} }
setLoading(false); setLoading(false);
@@ -44,7 +47,7 @@ const AppModal = ({
return ( return (
<Modal <Modal
title={app ? '编辑应用' : '建应用'} title={app ? intl.get('编辑应用') : intl.get('建应用')}
open={visible} open={visible}
forceRender forceRender
centered centered
@@ -70,22 +73,26 @@ const AppModal = ({
> >
<Form.Item <Form.Item
name="name" name="name"
label="名称" label={intl.get('名称')}
rules={[ rules={[
{ {
validator: (_, value) => validator: (_, value) =>
['system'].includes(value) ['system'].includes(value)
? Promise.reject(new Error('名称不能为保留关键字')) ? Promise.reject(new Error(intl.get('名称不能为保留关键字')))
: Promise.resolve(), : Promise.resolve(),
}, },
]} ]}
> >
<Input placeholder="请输入应用名称" /> <Input placeholder={intl.get('请输入应用名称')} />
</Form.Item> </Form.Item>
<Form.Item name="scopes" label="权限" rules={[{ required: true }]}> <Form.Item
name="scopes"
label={intl.get('权限')}
rules={[{ required: true }]}
>
<Select <Select
mode="multiple" mode="multiple"
placeholder="请选择模块权限" placeholder={intl.get('请选择模块权限')}
allowClear allowClear
style={{ width: '100%' }} style={{ width: '100%' }}
> >
+18 -15
View File
@@ -1,3 +1,4 @@
import intl from 'react-intl-universal';
import React, { useEffect, useState, useRef } from 'react'; import React, { useEffect, useState, useRef } from 'react';
import { Statistic, Modal, Tag, Button, Spin, message } from 'antd'; import { Statistic, Modal, Tag, Button, Spin, message } from 'antd';
import { request } from '@/utils/http'; import { request } from '@/utils/http';
@@ -38,16 +39,17 @@ const CheckUpdate = ({ socketMessage, systemInfo }: any) => {
const showForceUpdateModal = (data: any) => { const showForceUpdateModal = (data: any) => {
Modal.confirm({ Modal.confirm({
width: 500, width: 500,
title: '更新', title: intl.get('更新'),
content: ( content: (
<> <>
<div></div> <div>{intl.get('已经是最新版了!')}</div>
<div style={{ fontSize: 12, fontWeight: 400, marginTop: 5 }}> <div style={{ fontSize: 12, fontWeight: 400, marginTop: 5 }}>
{data.lastVersion} {intl.get('青龙')} {data.lastVersion}{' '}
{intl.get('是目前检测到的最新可用版本了。')}
</div> </div>
</> </>
), ),
okText: '重新下载', okText: intl.get('重新下载'),
onOk() { onOk() {
showUpdatingModal(); showUpdatingModal();
request request
@@ -66,9 +68,10 @@ const CheckUpdate = ({ socketMessage, systemInfo }: any) => {
width: 500, width: 500,
title: ( title: (
<> <>
<div></div> <div>{intl.get('更新可用')}</div>
<div style={{ fontSize: 12, fontWeight: 400, marginTop: 5 }}> <div style={{ fontSize: 12, fontWeight: 400, marginTop: 5 }}>
{lastVersion} 使 {systemInfo.version} {intl.get('新版本')} {lastVersion}{' '}
{intl.get('可用,你使用的版本为')} {systemInfo.version}
</div> </div>
</> </>
), ),
@@ -82,8 +85,8 @@ const CheckUpdate = ({ socketMessage, systemInfo }: any) => {
{lastLog} {lastLog}
</pre> </pre>
), ),
okText: '下载更新', okText: intl.get('下载更新'),
cancelText: '以后再说', cancelText: intl.get('以后再说'),
onOk() { onOk() {
showUpdatingModal(); showUpdatingModal();
request request
@@ -104,7 +107,7 @@ const CheckUpdate = ({ socketMessage, systemInfo }: any) => {
closable: false, closable: false,
keyboard: false, keyboard: false,
okButtonProps: { disabled: true }, okButtonProps: { disabled: true },
title: '下载更新中...', title: intl.get('下载更新中...'),
centered: true, centered: true,
content: ( content: (
<pre <pre
@@ -123,10 +126,10 @@ const CheckUpdate = ({ socketMessage, systemInfo }: any) => {
Modal.confirm({ Modal.confirm({
width: 600, width: 600,
maskClosable: false, maskClosable: false,
title: '确认重启', title: intl.get('确认重启'),
centered: true, centered: true,
content: '系统安装包下载成功,确认重启', content: intl.get('系统安装包下载成功,确认重启'),
okText: '重启', okText: intl.get('重启'),
onOk() { onOk() {
request request
.put(`${config.apiPrefix}system/reload`, { type: 'system' }) .put(`${config.apiPrefix}system/reload`, { type: 'system' })
@@ -134,13 +137,13 @@ const CheckUpdate = ({ socketMessage, systemInfo }: any) => {
message.success({ message.success({
content: ( content: (
<span> <span>
{intl.get('系统将在')}
<Countdown <Countdown
className="inline-countdown" className="inline-countdown"
format="ss" format="ss"
value={Date.now() + 1000 * 30} value={Date.now() + 1000 * 30}
/> />
{intl.get('秒后自动刷新')}
</span> </span>
), ),
duration: 30, duration: 30,
@@ -216,7 +219,7 @@ const CheckUpdate = ({ socketMessage, systemInfo }: any) => {
return ( return (
<> <>
<Button type="primary" onClick={checkUpgrade}> <Button type="primary" onClick={checkUpgrade}>
{intl.get('检查更新')}
</Button> </Button>
</> </>
); );
+24 -21
View File
@@ -1,3 +1,4 @@
import intl from 'react-intl-universal';
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import { import {
Button, Button,
@@ -47,7 +48,7 @@ const Setting = () => {
} = useOutletContext<SharedContext>(); } = useOutletContext<SharedContext>();
const columns = [ const columns = [
{ {
title: '名称', title: intl.get('名称'),
dataIndex: 'name', dataIndex: 'name',
key: 'name', key: 'name',
}, },
@@ -68,7 +69,7 @@ const Setting = () => {
}, },
}, },
{ {
title: '权限', title: intl.get('权限'),
dataIndex: 'scopes', dataIndex: 'scopes',
key: 'scopes', key: 'scopes',
width: '40%', width: '40%',
@@ -79,23 +80,23 @@ const Setting = () => {
}, },
}, },
{ {
title: '操作', title: intl.get('操作'),
key: 'action', key: 'action',
render: (text: string, record: any, index: number) => { render: (text: string, record: any, index: number) => {
const isPc = !isPhone; const isPc = !isPhone;
return ( return (
<Space size="middle" style={{ paddingLeft: 8 }}> <Space size="middle" style={{ paddingLeft: 8 }}>
<Tooltip title={isPc ? '编辑' : ''}> <Tooltip title={isPc ? intl.get('编辑') : ''}>
<a onClick={() => editApp(record, index)}> <a onClick={() => editApp(record, index)}>
<EditOutlined /> <EditOutlined />
</a> </a>
</Tooltip> </Tooltip>
<Tooltip title={isPc ? '重置secret' : ''}> <Tooltip title={isPc ? intl.get('重置secret') : ''}>
<a onClick={() => resetSecret(record, index)}> <a onClick={() => resetSecret(record, index)}>
<ReloadOutlined /> <ReloadOutlined />
</a> </a>
</Tooltip> </Tooltip>
<Tooltip title={isPc ? '删除' : ''}> <Tooltip title={isPc ? intl.get('删除') : ''}>
<a onClick={() => deleteApp(record, index)}> <a onClick={() => deleteApp(record, index)}>
<DeleteOutlined /> <DeleteOutlined />
</a> </a>
@@ -138,14 +139,14 @@ const Setting = () => {
const deleteApp = (record: any, index: number) => { const deleteApp = (record: any, index: number) => {
Modal.confirm({ Modal.confirm({
title: '确认删除', title: intl.get('确认删除'),
content: ( content: (
<> <>
{' '} {intl.get('确认删除应用')}{' '}
<Text style={{ wordBreak: 'break-all' }} type="warning"> <Text style={{ wordBreak: 'break-all' }} type="warning">
{record.name} {record.name}
</Text>{' '} </Text>{' '}
{intl.get('吗')}
</> </>
), ),
onOk() { onOk() {
@@ -168,16 +169,18 @@ const Setting = () => {
const resetSecret = (record: any, index: number) => { const resetSecret = (record: any, index: number) => {
Modal.confirm({ Modal.confirm({
title: '确认重置', title: intl.get('确认重置'),
content: ( content: (
<> <>
{' '} {intl.get('确认重置应用')}{' '}
<Text style={{ wordBreak: 'break-all' }} type="warning"> <Text style={{ wordBreak: 'break-all' }} type="warning">
{record.name} {record.name}
</Text>{' '} </Text>{' '}
Secret吗 {intl.get('的Secret吗')}
<br /> <br />
<Text type="secondary">Secret会让当前应用所有token失效</Text> <Text type="secondary">
{intl.get('重置Secret会让当前应用所有token失效')}
</Text>
</> </>
), ),
onOk() { onOk() {
@@ -262,7 +265,7 @@ const Setting = () => {
return ( return (
<PageContainer <PageContainer
className="ql-container-wrapper ql-container-wrapper-has-tab ql-setting-container" className="ql-container-wrapper ql-container-wrapper-has-tab ql-setting-container"
title="系统设置" title={intl.get('系统设置')}
header={{ header={{
style: headerStyle, style: headerStyle,
}} }}
@@ -270,7 +273,7 @@ const Setting = () => {
tabActiveKey === 'app' tabActiveKey === 'app'
? [ ? [
<Button key="2" type="primary" onClick={() => addApp()}> <Button key="2" type="primary" onClick={() => addApp()}>
{intl.get('创建应用')}
</Button>, </Button>,
] ]
: [] : []
@@ -286,7 +289,7 @@ const Setting = () => {
? [ ? [
{ {
key: 'security', key: 'security',
label: '安全设置', label: intl.get('安全设置'),
children: ( children: (
<SecuritySettings user={user} userChange={reloadUser} /> <SecuritySettings user={user} userChange={reloadUser} />
), ),
@@ -295,7 +298,7 @@ const Setting = () => {
: []), : []),
{ {
key: 'app', key: 'app',
label: '应用设置', label: intl.get('应用设置'),
children: ( children: (
<Table <Table
columns={columns} columns={columns}
@@ -310,17 +313,17 @@ const Setting = () => {
}, },
{ {
key: 'notification', key: 'notification',
label: '通知设置', label: intl.get('通知设置'),
children: <NotificationSetting data={notificationInfo} />, children: <NotificationSetting data={notificationInfo} />,
}, },
{ {
key: 'login', key: 'login',
label: '登录日志', label: intl.get('登录日志'),
children: <LoginLog data={loginLogData} />, children: <LoginLog data={loginLogData} />,
}, },
{ {
key: 'other', key: 'other',
label: '其他设置', label: intl.get('其他设置'),
children: ( children: (
<Other <Other
reloadTheme={reloadTheme} reloadTheme={reloadTheme}
@@ -331,7 +334,7 @@ const Setting = () => {
}, },
{ {
key: 'about', key: 'about',
label: '关于', label: intl.get('关于'),
children: <About systemInfo={systemInfo} />, children: <About systemInfo={systemInfo} />,
}, },
]} ]}
+12 -8
View File
@@ -1,3 +1,4 @@
import intl from 'react-intl-universal';
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { Typography, Table, Tag, Button, Spin, message } from 'antd'; import { Typography, Table, Tag, Button, Spin, message } from 'antd';
import { request } from '@/utils/http'; import { request } from '@/utils/http';
@@ -17,45 +18,48 @@ enum LoginStatusColor {
const columns = [ const columns = [
{ {
title: '序号', title: intl.get('序号'),
width: 50, width: 40,
render: (text: string, record: any, index: number) => { render: (text: string, record: any, index: number) => {
return index + 1; return index + 1;
}, },
}, },
{ {
title: '登录时间', title: intl.get('登录时间'),
dataIndex: 'timestamp', dataIndex: 'timestamp',
key: 'timestamp', key: 'timestamp',
width: 120,
render: (text: string, record: any) => { render: (text: string, record: any) => {
return new Date(record.timestamp).toLocaleString(); return new Date(record.timestamp).toLocaleString();
}, },
}, },
{ {
title: '登录地址', title: intl.get('登录地址'),
dataIndex: 'address', dataIndex: 'address',
width: 120,
key: 'address', key: 'address',
}, },
{ {
title: '登录IP', title: intl.get('登录IP'),
dataIndex: 'ip', dataIndex: 'ip',
width: 100,
key: 'ip', key: 'ip',
}, },
{ {
title: '登录设备', title: intl.get('登录设备'),
dataIndex: 'platform', dataIndex: 'platform',
key: 'platform', key: 'platform',
width: 80, width: 80,
}, },
{ {
title: '登录状态', title: intl.get('登录状态'),
dataIndex: 'status', dataIndex: 'status',
key: 'status', key: 'status',
width: 80, width: 80,
render: (text: string, record: any) => { render: (text: string, record: any) => {
return ( return (
<Tag color={LoginStatusColor[record.status]} style={{ marginRight: 0 }}> <Tag color={LoginStatusColor[record.status]} style={{ marginRight: 0 }}>
{LoginStatus[record.status]} {intl.get(LoginStatus[record.status])}
</Tag> </Tag>
); );
}, },
+6 -3
View File
@@ -1,3 +1,4 @@
import intl from 'react-intl-universal';
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { Typography, Input, Form, Button, Select, message } from 'antd'; import { Typography, Input, Form, Button, Select, message } from 'antd';
import { request } from '@/utils/http'; import { request } from '@/utils/http';
@@ -22,7 +23,9 @@ const NotificationSetting = ({ data }: any) => {
.put(`${config.apiPrefix}user/notification`, values) .put(`${config.apiPrefix}user/notification`, values)
.then(({ code, data }) => { .then(({ code, data }) => {
if (code === 200) { if (code === 200) {
message.success(values.type ? '通知发送成功' : '通知关闭成功'); message.success(
values.type ? intl.get('通知发送成功') : intl.get('通知关闭成功'),
);
} }
}) })
.catch((error: any) => { .catch((error: any) => {
@@ -48,7 +51,7 @@ const NotificationSetting = ({ data }: any) => {
<div> <div>
<Form onFinish={handleOk} form={form} layout="vertical"> <Form onFinish={handleOk} form={form} layout="vertical">
<Form.Item <Form.Item
label="通知方式" label={intl.get('通知方式')}
name="type" name="type"
rules={[{ required: true }]} rules={[{ required: true }]}
style={{ maxWidth: 400 }} style={{ maxWidth: 400 }}
@@ -92,7 +95,7 @@ const NotificationSetting = ({ data }: any) => {
</Form.Item> </Form.Item>
))} ))}
<Button type="primary" htmlType="submit" disabled={loading}> <Button type="primary" htmlType="submit" disabled={loading}>
{loading ? '测试中...' : '保存'} {loading ? intl.get('测试中...') : intl.get('保存')}
</Button> </Button>
</Form> </Form>
</div> </div>
+27 -22
View File
@@ -1,3 +1,4 @@
import intl from 'react-intl-universal';
import React, { useState, useEffect, useRef } from 'react'; import React, { useState, useEffect, useRef } from 'react';
import { import {
Button, Button,
@@ -22,9 +23,9 @@ import Countdown from 'antd/lib/statistic/Countdown';
import useProgress from './progress'; import useProgress from './progress';
const optionsWithDisabled = [ const optionsWithDisabled = [
{ label: '亮色', value: 'light' }, { label: intl.get('亮色'), value: 'light' },
{ label: '暗色', value: 'dark' }, { label: intl.get('暗色'), value: 'dark' },
{ label: '跟随系统', value: 'auto' }, { label: intl.get('跟随系统'), value: 'auto' },
]; ];
const Other = ({ const Other = ({
@@ -121,10 +122,10 @@ const Other = ({
Modal.confirm({ Modal.confirm({
width: 600, width: 600,
maskClosable: false, maskClosable: false,
title: '确认重启', title: intl.get('确认重启'),
centered: true, centered: true,
content: '备份数据上传成功,确认覆盖数据', content: intl.get('备份数据上传成功,确认覆盖数据'),
okText: '重启', okText: intl.get('重启'),
onOk() { onOk() {
request request
.put(`${config.apiPrefix}system/reload`, { type: 'data' }) .put(`${config.apiPrefix}system/reload`, { type: 'data' })
@@ -132,13 +133,13 @@ const Other = ({
message.success({ message.success({
content: ( content: (
<span> <span>
{intl.get('系统将在')}
<Countdown <Countdown
className="inline-countdown" className="inline-countdown"
format="ss" format="ss"
value={Date.now() + 1000 * 30} value={Date.now() + 1000 * 30}
/> />
{intl.get('秒后自动刷新')}
</span> </span>
), ),
duration: 30, duration: 30,
@@ -160,7 +161,11 @@ const Other = ({
return ( return (
<Form layout="vertical" form={form}> <Form layout="vertical" form={form}>
<Form.Item label="主题设置" name="theme" initialValue={defaultTheme}> <Form.Item
label={intl.get('主题设置')}
name="theme"
initialValue={defaultTheme}
>
<Radio.Group <Radio.Group
options={optionsWithDisabled} options={optionsWithDisabled}
onChange={themeChange} onChange={themeChange}
@@ -170,15 +175,15 @@ const Other = ({
/> />
</Form.Item> </Form.Item>
<Form.Item <Form.Item
label="日志删除频率" label={intl.get('日志删除频率')}
name="frequency" name="frequency"
tooltip="每x天自动删除x天以前的日志" tooltip={intl.get('每x天自动删除x天以前的日志')}
> >
<Input.Group compact> <Input.Group compact>
<InputNumber <InputNumber
addonBefore="每" addonBefore={intl.get('每')}
addonAfter="天" addonAfter={intl.get('天')}
style={{ width: 142 }} style={{ width: 180 }}
min={0} min={0}
value={systemConfig?.logRemoveFrequency} value={systemConfig?.logRemoveFrequency}
onChange={(value) => { onChange={(value) => {
@@ -186,14 +191,14 @@ const Other = ({
}} }}
/> />
<Button type="primary" onClick={updateSystemConfig}> <Button type="primary" onClick={updateSystemConfig}>
{intl.get('确认')}
</Button> </Button>
</Input.Group> </Input.Group>
</Form.Item> </Form.Item>
<Form.Item label="定时任务并发数" name="frequency"> <Form.Item label={intl.get('定时任务并发数')} name="frequency">
<Input.Group compact> <Input.Group compact>
<InputNumber <InputNumber
style={{ width: 142 }} style={{ width: 150 }}
min={1} min={1}
value={systemConfig?.cronConcurrency} value={systemConfig?.cronConcurrency}
onChange={(value) => { onChange={(value) => {
@@ -201,13 +206,13 @@ const Other = ({
}} }}
/> />
<Button type="primary" onClick={updateSystemConfig}> <Button type="primary" onClick={updateSystemConfig}>
{intl.get('确认')}
</Button> </Button>
</Input.Group> </Input.Group>
</Form.Item> </Form.Item>
<Form.Item label="数据备份还原" name="frequency"> <Form.Item label={intl.get('数据备份还原')} name="frequency">
<Button type="primary" onClick={exportData} loading={exportLoading}> <Button type="primary" onClick={exportData} loading={exportLoading}>
{exportLoading ? '生成数据中...' : '备份'} {exportLoading ? intl.get('生成数据中...') : intl.get('备份')}
</Button> </Button>
<Upload <Upload
method="put" method="put"
@@ -228,11 +233,11 @@ const Other = ({
}} }}
> >
<Button icon={<UploadOutlined />} style={{ marginLeft: 8 }}> <Button icon={<UploadOutlined />} style={{ marginLeft: 8 }}>
{intl.get('还原数据')}
</Button> </Button>
</Upload> </Upload>
</Form.Item> </Form.Item>
<Form.Item label="检查更新" name="update"> <Form.Item label={intl.get('检查更新')} name="update">
<CheckUpdate systemInfo={systemInfo} socketMessage={socketMessage} /> <CheckUpdate systemInfo={systemInfo} socketMessage={socketMessage} />
</Form.Item> </Form.Item>
</Form> </Form>
+20 -18
View File
@@ -1,3 +1,4 @@
import intl from 'react-intl-universal';
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { Typography, Input, Form, Button, message, Avatar, Upload } from 'antd'; import { Typography, Input, Form, Button, message, Avatar, Upload } from 'antd';
import { request } from '@/utils/http'; import { request } from '@/utils/http';
@@ -110,8 +111,8 @@ const SecuritySettings = ({ user, userChange }: any) => {
<> <>
{twoFactorInfo ? ( {twoFactorInfo ? (
<div> <div>
<Title level={5}></Title> <Title level={5}>{intl.get('第一步')}</Title>
Google Authenticator {intl.get('下载两步验证手机应用,比如 Google Authenticator 、')}
<Link <Link
href="https://www.microsoft.com/en-us/security/mobile-authenticator-app" href="https://www.microsoft.com/en-us/security/mobile-authenticator-app"
target="_blank" target="_blank"
@@ -137,9 +138,10 @@ const SecuritySettings = ({ user, userChange }: any) => {
LastPass Authenticator LastPass Authenticator
</Link> </Link>
<Title style={{ marginTop: 5 }} level={5}> <Title style={{ marginTop: 5 }} level={5}>
{intl.get('第二步')}
</Title> </Title>
使 {twoFactorInfo?.secret} {intl.get('使用手机应用扫描二维码,或者输入秘钥')}{' '}
{twoFactorInfo?.secret}
<div style={{ marginTop: 10 }}> <div style={{ marginTop: 10 }}>
<QRCode <QRCode
style={{ border: '1px solid #21262d', borderRadius: 6 }} style={{ border: '1px solid #21262d', borderRadius: 6 }}
@@ -149,9 +151,9 @@ const SecuritySettings = ({ user, userChange }: any) => {
/> />
</div> </div>
<Title style={{ marginTop: 5 }} level={5}> <Title style={{ marginTop: 5 }} level={5}>
{intl.get('第三步')}
</Title> </Title>
6 {intl.get('输入手机应用上的6位数字')}
<Input <Input
style={{ margin: '10px 0 10px 0', display: 'block', maxWidth: 200 }} style={{ margin: '10px 0 10px 0', display: 'block', maxWidth: 200 }}
value={code} value={code}
@@ -159,7 +161,7 @@ const SecuritySettings = ({ user, userChange }: any) => {
placeholder="123456" placeholder="123456"
/> />
<Button type="primary" loading={loading} onClick={completeTowFactor}> <Button type="primary" loading={loading} onClick={completeTowFactor}>
{intl.get('完成设置')}
</Button> </Button>
</div> </div>
) : ( ) : (
@@ -176,35 +178,35 @@ const SecuritySettings = ({ user, userChange }: any) => {
paddingBottom: 4, paddingBottom: 4,
}} }}
> >
{intl.get('修改用户名密码')}
</div> </div>
<Form onFinish={handleOk} layout="vertical"> <Form onFinish={handleOk} layout="vertical">
<Form.Item <Form.Item
label="用户名" label={intl.get('用户名')}
name="username" name="username"
rules={[{ required: true }]} rules={[{ required: true }]}
hasFeedback hasFeedback
style={{ maxWidth: 300 }} style={{ maxWidth: 300 }}
> >
<Input placeholder="用户名" /> <Input placeholder={intl.get('用户名')} />
</Form.Item> </Form.Item>
<Form.Item <Form.Item
label="密码" label={intl.get('密码')}
name="password" name="password"
rules={[ rules={[
{ required: true }, { required: true },
{ {
pattern: /^(?!admin$).*$/, pattern: /^(?!admin$).*$/,
message: '密码不能为admin', message: intl.get('密码不能为admin'),
}, },
]} ]}
hasFeedback hasFeedback
style={{ maxWidth: 300 }} style={{ maxWidth: 300 }}
> >
<Input type="password" placeholder="密码" /> <Input type="password" placeholder={intl.get('密码')} />
</Form.Item> </Form.Item>
<Button type="primary" htmlType="submit"> <Button type="primary" htmlType="submit">
{intl.get('保存')}
</Button> </Button>
</Form> </Form>
@@ -217,14 +219,14 @@ const SecuritySettings = ({ user, userChange }: any) => {
marginTop: 16, marginTop: 16,
}} }}
> >
{intl.get('两步验证')}
</div> </div>
<Button <Button
type="primary" type="primary"
danger={twoFactorActivated} danger={twoFactorActivated}
onClick={activeOrDeactiveTwoFactor} onClick={activeOrDeactiveTwoFactor}
> >
{twoFactorActivated ? '禁用' : '启用'} {twoFactorActivated ? intl.get('禁用') : intl.get('启用')}
</Button> </Button>
<div <div
@@ -236,7 +238,7 @@ const SecuritySettings = ({ user, userChange }: any) => {
marginTop: 16, marginTop: 16,
}} }}
> >
{intl.get('头像')}
</div> </div>
<Avatar size={128} shape="square" icon={<UserOutlined />} src={avatar} /> <Avatar size={128} shape="square" icon={<UserOutlined />} src={avatar} />
<ImgCrop rotationSlider> <ImgCrop rotationSlider>
@@ -252,7 +254,7 @@ const SecuritySettings = ({ user, userChange }: any) => {
}} }}
> >
<Button icon={<UploadOutlined />} style={{ marginLeft: 8 }}> <Button icon={<UploadOutlined />} style={{ marginLeft: 8 }}>
{intl.get('更换头像')}
</Button> </Button>
</Upload> </Upload>
</ImgCrop> </ImgCrop>
+40 -35
View File
@@ -1,3 +1,4 @@
import intl from 'react-intl-universal';
import React, { useState, useEffect, useRef } from 'react'; import React, { useState, useEffect, useRef } from 'react';
import { import {
Button, Button,
@@ -64,7 +65,7 @@ const Subscription = () => {
const columns: any = [ const columns: any = [
{ {
title: '名称', title: intl.get('名称'),
dataIndex: 'name', dataIndex: 'name',
key: 'name', key: 'name',
width: 150, width: 150,
@@ -74,7 +75,7 @@ const Subscription = () => {
}, },
}, },
{ {
title: '链接', title: intl.get('链接'),
dataIndex: 'url', dataIndex: 'url',
key: 'url', key: 'url',
sorter: { sorter: {
@@ -96,7 +97,7 @@ const Subscription = () => {
}, },
}, },
{ {
title: '类型', title: intl.get('类型'),
dataIndex: 'type', dataIndex: 'type',
key: 'type', key: 'type',
width: 130, width: 130,
@@ -105,7 +106,7 @@ const Subscription = () => {
}, },
}, },
{ {
title: '分支', title: intl.get('分支'),
dataIndex: 'branch', dataIndex: 'branch',
key: 'branch', key: 'branch',
width: 130, width: 130,
@@ -114,7 +115,7 @@ const Subscription = () => {
}, },
}, },
{ {
title: '定时规则', title: intl.get('定时规则'),
width: 180, width: 180,
render: (text: string, record: any) => { render: (text: string, record: any) => {
if (record.schedule_type === 'interval') { if (record.schedule_type === 'interval') {
@@ -125,21 +126,21 @@ const Subscription = () => {
}, },
}, },
{ {
title: '状态', title: intl.get('状态'),
key: 'status', key: 'status',
dataIndex: 'status', dataIndex: 'status',
width: 110, width: 110,
filters: [ filters: [
{ {
text: '运行中', text: intl.get('运行中'),
value: 0, value: 0,
}, },
{ {
text: '空闲中', text: intl.get('空闲中'),
value: 1, value: 1,
}, },
{ {
text: '已禁用', text: intl.get('已禁用'),
value: 2, value: 2,
}, },
], ],
@@ -157,7 +158,7 @@ const Subscription = () => {
<> <>
{record.status === SubscriptionStatus.idle && ( {record.status === SubscriptionStatus.idle && (
<Tag icon={<ClockCircleOutlined />} color="default"> <Tag icon={<ClockCircleOutlined />} color="default">
{intl.get('空闲中')}
</Tag> </Tag>
)} )}
{record.status === SubscriptionStatus.running && ( {record.status === SubscriptionStatus.running && (
@@ -165,7 +166,7 @@ const Subscription = () => {
icon={<Loading3QuartersOutlined spin />} icon={<Loading3QuartersOutlined spin />}
color="processing" color="processing"
> >
{intl.get('运行中')}
</Tag> </Tag>
)} )}
</> </>
@@ -173,14 +174,14 @@ const Subscription = () => {
{record.is_disabled === 1 && {record.is_disabled === 1 &&
record.status === SubscriptionStatus.idle && ( record.status === SubscriptionStatus.idle && (
<Tag icon={<CloseCircleOutlined />} color="error"> <Tag icon={<CloseCircleOutlined />} color="error">
{intl.get('已禁用')}
</Tag> </Tag>
)} )}
</> </>
), ),
}, },
{ {
title: '操作', title: intl.get('操作'),
key: 'action', key: 'action',
width: 130, width: 130,
render: (text: string, record: any, index: number) => { render: (text: string, record: any, index: number) => {
@@ -188,7 +189,7 @@ const Subscription = () => {
return ( return (
<Space size="middle"> <Space size="middle">
{record.status === SubscriptionStatus.idle && ( {record.status === SubscriptionStatus.idle && (
<Tooltip title={isPc ? '运行' : ''}> <Tooltip title={isPc ? intl.get('运行') : ''}>
<a <a
onClick={(e) => { onClick={(e) => {
e.stopPropagation(); e.stopPropagation();
@@ -200,7 +201,7 @@ const Subscription = () => {
</Tooltip> </Tooltip>
)} )}
{record.status !== SubscriptionStatus.idle && ( {record.status !== SubscriptionStatus.idle && (
<Tooltip title={isPc ? '停止' : ''}> <Tooltip title={isPc ? intl.get('停止') : ''}>
<a <a
onClick={(e) => { onClick={(e) => {
e.stopPropagation(); e.stopPropagation();
@@ -211,7 +212,7 @@ const Subscription = () => {
</a> </a>
</Tooltip> </Tooltip>
)} )}
<Tooltip title={isPc ? '日志' : ''}> <Tooltip title={isPc ? intl.get('日志') : ''}>
<a <a
onClick={(e) => { onClick={(e) => {
e.stopPropagation(); e.stopPropagation();
@@ -242,14 +243,14 @@ const Subscription = () => {
const runSubscription = (record: any, index: number) => { const runSubscription = (record: any, index: number) => {
Modal.confirm({ Modal.confirm({
title: '确认运行', title: intl.get('确认运行'),
content: ( content: (
<> <>
{' '} {intl.get('确认运行定时任务')}{' '}
<Text style={{ wordBreak: 'break-all' }} type="warning"> <Text style={{ wordBreak: 'break-all' }} type="warning">
{record.name} {record.name}
</Text>{' '} </Text>{' '}
{intl.get('吗')}
</> </>
), ),
onOk() { onOk() {
@@ -277,14 +278,14 @@ const Subscription = () => {
const stopSubsciption = (record: any, index: number) => { const stopSubsciption = (record: any, index: number) => {
Modal.confirm({ Modal.confirm({
title: '确认停止', title: intl.get('确认停止'),
content: ( content: (
<> <>
{' '} {intl.get('确认停止定时任务')}{' '}
<Text style={{ wordBreak: 'break-all' }} type="warning"> <Text style={{ wordBreak: 'break-all' }} type="warning">
{record.name} {record.name}
</Text>{' '} </Text>{' '}
{intl.get('吗')}
</> </>
), ),
onOk() { onOk() {
@@ -336,14 +337,14 @@ const Subscription = () => {
const delSubscription = (record: any, index: number) => { const delSubscription = (record: any, index: number) => {
Modal.confirm({ Modal.confirm({
title: '确认删除', title: intl.get('确认删除'),
content: ( content: (
<> <>
{' '} {intl.get('确认删除定时订阅')}{' '}
<Text style={{ wordBreak: 'break-all' }} type="warning"> <Text style={{ wordBreak: 'break-all' }} type="warning">
{record.name} {record.name}
</Text>{' '} </Text>{' '}
{intl.get('吗')}
</> </>
), ),
onOk() { onOk() {
@@ -369,15 +370,18 @@ const Subscription = () => {
const enabledOrDisabledSubscription = (record: any, index: number) => { const enabledOrDisabledSubscription = (record: any, index: number) => {
Modal.confirm({ Modal.confirm({
title: `确认${record.is_disabled === 1 ? '启用' : '禁用'}`, title: `确认${
record.is_disabled === 1 ? intl.get('启用') : intl.get('禁用')
}`,
content: ( content: (
<> <>
{record.is_disabled === 1 ? '启用' : '禁用'} {intl.get('确认')}
{' '} {record.is_disabled === 1 ? intl.get('启用') : intl.get('禁用')}
{intl.get('定时订阅')}{' '}
<Text style={{ wordBreak: 'break-all' }} type="warning"> <Text style={{ wordBreak: 'break-all' }} type="warning">
{record.name} {record.name}
</Text>{' '} </Text>{' '}
{intl.get('吗')}
</> </>
), ),
onOk() { onOk() {
@@ -418,9 +422,10 @@ const Subscription = () => {
trigger={['click']} trigger={['click']}
menu={{ menu={{
items: [ items: [
{ label: '编辑', key: 'edit', icon: <EditOutlined /> }, { label: intl.get('编辑'), key: 'edit', icon: <EditOutlined /> },
{ {
label: record.is_disabled === 1 ? '启用' : '禁用', label:
record.is_disabled === 1 ? intl.get('启用') : intl.get('禁用'),
key: 'enableOrDisable', key: 'enableOrDisable',
icon: icon:
record.is_disabled === 1 ? ( record.is_disabled === 1 ? (
@@ -429,7 +434,7 @@ const Subscription = () => {
<StopOutlined /> <StopOutlined />
), ),
}, },
{ label: '删除', key: 'delete', icon: <DeleteOutlined /> }, { label: intl.get('删除'), key: 'delete', icon: <DeleteOutlined /> },
], ],
onClick: ({ key, domEvent }) => { onClick: ({ key, domEvent }) => {
domEvent.stopPropagation(); domEvent.stopPropagation();
@@ -531,10 +536,10 @@ const Subscription = () => {
return ( return (
<PageContainer <PageContainer
className="ql-container-wrapper subscriptiontab-wrapper" className="ql-container-wrapper subscriptiontab-wrapper"
title="订阅管理" title={intl.get('订阅管理')}
extra={[ extra={[
<Search <Search
placeholder="请输入名称或者关键词" placeholder={intl.get('请输入名称或者关键词')}
style={{ width: 'auto' }} style={{ width: 'auto' }}
enterButton enterButton
allowClear allowClear
@@ -542,7 +547,7 @@ const Subscription = () => {
onSearch={onSearch} onSearch={onSearch}
/>, />,
<Button key="2" type="primary" onClick={() => addSubscription()}> <Button key="2" type="primary" onClick={() => addSubscription()}>
{intl.get('创建订阅')}
</Button>, </Button>,
]} ]}
header={{ header={{
+3 -2
View File
@@ -1,3 +1,4 @@
import intl from 'react-intl-universal';
import React, { useEffect, useState } from 'react'; import React, { useEffect, useState } from 'react';
import { Modal, message, Input, Form, Statistic, Button } from 'antd'; import { Modal, message, Input, Form, Statistic, Button } from 'antd';
import { request } from '@/utils/http'; import { request } from '@/utils/http';
@@ -43,7 +44,7 @@ const SubscriptionLogModal = ({
localStorage.getItem('logSubscription') === String(subscription.id) localStorage.getItem('logSubscription') === String(subscription.id)
) { ) {
const log = data as string; const log = data as string;
setValue(log || '暂无日志'); setValue(log || intl.get('暂无日志'));
setExecuting(log && !logEnded(log)); setExecuting(log && !logEnded(log));
if (log && !logEnded(log)) { if (log && !logEnded(log)) {
setTimeout(() => { setTimeout(() => {
@@ -106,7 +107,7 @@ const SubscriptionLogModal = ({
onCancel={() => cancel()} onCancel={() => cancel()}
footer={[ footer={[
<Button type="primary" onClick={() => cancel()}> <Button type="primary" onClick={() => cancel()}>
{intl.get('知道了')}
</Button>, </Button>,
]} ]}
> >
+76 -55
View File
@@ -1,3 +1,4 @@
import intl from 'react-intl-universal';
import React, { useCallback, useEffect, useState } from 'react'; import React, { useCallback, useEffect, useState } from 'react';
import { import {
Modal, Modal,
@@ -50,7 +51,9 @@ const SubscriptionModal = ({
payload, payload,
); );
if (code === 200) { if (code === 200) {
message.success(subscription ? '更新订阅成功' : '新建订阅成功'); message.success(
subscription ? intl.get('更新订阅成功') : intl.get('创建订阅成功'),
);
handleCancel(data); handleCancel(data);
} }
setLoading(false); setLoading(false);
@@ -141,7 +144,7 @@ const SubscriptionModal = ({
return ( return (
<Input.Group compact> <Input.Group compact>
<InputNumber <InputNumber
addonBefore="每" addonBefore={intl.get('每')}
precision={0} precision={0}
min={1} min={1}
value={intervalNumber} value={intervalNumber}
@@ -149,10 +152,10 @@ const SubscriptionModal = ({
onChange={numberChange} onChange={numberChange}
/> />
<Select value={intervalType} onChange={intervalTypeChange}> <Select value={intervalType} onChange={intervalTypeChange}>
<Option value="days"></Option> <Option value="days">{intl.get('天')}</Option>
<Option value="hours"></Option> <Option value="hours">{intl.get('时')}</Option>
<Option value="minutes"></Option> <Option value="minutes">{intl.get('分')}</Option>
<Option value="seconds"></Option> <Option value="seconds">{intl.get('秒')}</Option>
</Select> </Select>
</Input.Group> </Input.Group>
); );
@@ -170,31 +173,31 @@ const SubscriptionModal = ({
return type === 'ssh-key' ? ( return type === 'ssh-key' ? (
<Form.Item <Form.Item
name={['pull_option', 'private_key']} name={['pull_option', 'private_key']}
label="私钥" label={intl.get('私钥')}
rules={[{ required: true }]} rules={[{ required: true }]}
> >
<Input.TextArea <Input.TextArea
rows={4} rows={4}
autoSize={{ minRows: 1, maxRows: 6 }} autoSize={{ minRows: 1, maxRows: 6 }}
placeholder="请输入私钥" placeholder={intl.get('请输入私钥')}
/> />
</Form.Item> </Form.Item>
) : ( ) : (
<> <>
<Form.Item <Form.Item
name={['pull_option', 'username']} name={['pull_option', 'username']}
label="用户名" label={intl.get('用户名')}
rules={[{ required: true }]} rules={[{ required: true }]}
> >
<Input placeholder="请输入认证用户名" /> <Input placeholder={intl.get('请输入认证用户名')} />
</Form.Item> </Form.Item>
<Form.Item <Form.Item
name={['pull_option', 'password']} name={['pull_option', 'password']}
tooltip="Github已不支持密码认证,请使用Token方式" tooltip={intl.get('Github已不支持密码认证,请使用Token方式')}
label="密码/Token" label={intl.get('密码/Token')}
rules={[{ required: true }]} rules={[{ required: true }]}
> >
<Input placeholder="请输入密码或者Token" /> <Input placeholder={intl.get('请输入密码或者Token')} />
</Form.Item> </Form.Item>
</> </>
); );
@@ -274,7 +277,7 @@ const SubscriptionModal = ({
return ( return (
<Modal <Modal
title={subscription ? '编辑订阅' : '建订阅'} title={subscription ? intl.get('编辑订阅') : intl.get('建订阅')}
open={visible} open={visible}
forceRender forceRender
centered centered
@@ -293,27 +296,31 @@ const SubscriptionModal = ({
confirmLoading={loading} confirmLoading={loading}
> >
<Form form={form} name="form_in_modal" layout="vertical"> <Form form={form} name="form_in_modal" layout="vertical">
<Form.Item name="name" label="名称" rules={[{ required: true }]}> <Form.Item
name="name"
label={intl.get('名称')}
rules={[{ required: true }]}
>
<Input <Input
placeholder="支持拷贝 ql repo/raw 命令,粘贴导入" placeholder={intl.get('支持拷贝 ql repo/raw 命令,粘贴导入')}
onPaste={onNamePaste} onPaste={onNamePaste}
/> />
</Form.Item> </Form.Item>
<Form.Item <Form.Item
name="type" name="type"
label="类型" label={intl.get('类型')}
rules={[{ required: true }]} rules={[{ required: true }]}
initialValue={'public-repo'} initialValue={'public-repo'}
> >
<Radio.Group onChange={typeChange}> <Radio.Group onChange={typeChange}>
<Radio value="public-repo"></Radio> <Radio value="public-repo">{intl.get('公开仓库')}</Radio>
<Radio value="private-repo"></Radio> <Radio value="private-repo">{intl.get('私有仓库')}</Radio>
<Radio value="file"></Radio> <Radio value="file">{intl.get('单文件')}</Radio>
</Radio.Group> </Radio.Group>
</Form.Item> </Form.Item>
<Form.Item <Form.Item
name="url" name="url"
label="链接" label={intl.get('链接')}
rules={[ rules={[
{ required: true }, { required: true },
{ pattern: type === 'file' ? fileUrlRegx : repoUrlRegx }, { pattern: type === 'file' ? fileUrlRegx : repoUrlRegx },
@@ -322,15 +329,15 @@ const SubscriptionModal = ({
<Input.TextArea <Input.TextArea
rows={4} rows={4}
autoSize={true} autoSize={true}
placeholder="请输入订阅链接" placeholder={intl.get('请输入订阅链接')}
onPaste={onUrlChange} onPaste={onUrlChange}
onChange={onUrlChange} onChange={onUrlChange}
/> />
</Form.Item> </Form.Item>
{type !== 'file' && ( {type !== 'file' && (
<Form.Item name="branch" label="分支"> <Form.Item name="branch" label={intl.get('分支')}>
<Input <Input
placeholder="请输入分支" placeholder={intl.get('请输入分支')}
onPaste={onBranchChange} onPaste={onBranchChange}
onChange={onBranchChange} onChange={onBranchChange}
/> />
@@ -338,23 +345,23 @@ const SubscriptionModal = ({
)} )}
<Form.Item <Form.Item
name="alias" name="alias"
label="唯一值" label={intl.get('唯一值')}
rules={[{ required: true, message: '' }]} rules={[{ required: true, message: '' }]}
tooltip="唯一值用于日志目录和私钥别名" tooltip={intl.get('唯一值用于日志目录和私钥别名')}
> >
<Input placeholder="自动生成" disabled /> <Input placeholder={intl.get('自动生成')} disabled />
</Form.Item> </Form.Item>
{type === 'private-repo' && ( {type === 'private-repo' && (
<> <>
<Form.Item <Form.Item
name="pull_type" name="pull_type"
label="拉取方式" label={intl.get('拉取方式')}
initialValue={'ssh-key'} initialValue={'ssh-key'}
rules={[{ required: true }]} rules={[{ required: true }]}
> >
<Radio.Group onChange={pullTypeChange}> <Radio.Group onChange={pullTypeChange}>
<Radio value="ssh-key"></Radio> <Radio value="ssh-key">{intl.get('私钥')}</Radio>
<Radio value="user-pwd">/Token</Radio> <Radio value="user-pwd">{intl.get('用户名密码/Token')}</Radio>
</Radio.Group> </Radio.Group>
</Form.Item> </Form.Item>
<PullOptions type={pullType} /> <PullOptions type={pullType} />
@@ -362,7 +369,7 @@ const SubscriptionModal = ({
)} )}
<Form.Item <Form.Item
name="schedule_type" name="schedule_type"
label="定时类型" label={intl.get('定时类型')}
initialValue={'crontab'} initialValue={'crontab'}
rules={[{ required: true }]} rules={[{ required: true }]}
> >
@@ -373,7 +380,7 @@ const SubscriptionModal = ({
</Form.Item> </Form.Item>
<Form.Item <Form.Item
name={scheduleType === 'crontab' ? 'schedule' : 'interval_schedule'} name={scheduleType === 'crontab' ? 'schedule' : 'interval_schedule'}
label="定时规则" label={intl.get('定时规则')}
rules={[ rules={[
{ required: true }, { required: true },
{ {
@@ -394,79 +401,93 @@ const SubscriptionModal = ({
{scheduleType === 'interval' ? ( {scheduleType === 'interval' ? (
<IntervalSelect /> <IntervalSelect />
) : ( ) : (
<Input placeholder="秒(可选) 分 时 天 月 周" /> <Input placeholder={intl.get('秒(可选) 分 时 天 月 周')} />
)} )}
</Form.Item> </Form.Item>
{type !== 'file' && ( {type !== 'file' && (
<> <>
<Form.Item <Form.Item
name="whitelist" name="whitelist"
label="白名单" label={intl.get('白名单')}
tooltip="多个关键词竖线分割,支持正则表达式" tooltip={intl.get('多个关键词竖线分割,支持正则表达式')}
> >
<Input.TextArea <Input.TextArea
rows={4} rows={4}
autoSize={true} autoSize={true}
placeholder="请输入脚本筛选白名单关键词,多个关键词竖线分割" placeholder={intl.get(
'请输入脚本筛选白名单关键词,多个关键词竖线分割',
)}
/> />
</Form.Item> </Form.Item>
<Form.Item <Form.Item
name="blacklist" name="blacklist"
label="黑名单" label={intl.get('黑名单')}
tooltip="多个关键词竖线分割,支持正则表达式" tooltip={intl.get('多个关键词竖线分割,支持正则表达式')}
> >
<Input.TextArea <Input.TextArea
rows={4} rows={4}
autoSize={true} autoSize={true}
placeholder="请输入脚本筛选黑名单关键词,多个关键词竖线分割" placeholder={intl.get(
'请输入脚本筛选黑名单关键词,多个关键词竖线分割',
)}
/> />
</Form.Item> </Form.Item>
<Form.Item <Form.Item
name="dependences" name="dependences"
label="依赖文件" label={intl.get('依赖文件')}
tooltip="多个关键词竖线分割,支持正则表达式" tooltip={intl.get('多个关键词竖线分割,支持正则表达式')}
> >
<Input.TextArea <Input.TextArea
rows={4} rows={4}
autoSize={true} autoSize={true}
placeholder="请输入脚本依赖文件关键词,多个关键词竖线分割" placeholder={intl.get(
'请输入脚本依赖文件关键词,多个关键词竖线分割',
)}
/> />
</Form.Item> </Form.Item>
<Form.Item <Form.Item
name="extensions" name="extensions"
label="文件后缀" label={intl.get('文件后缀')}
tooltip="仓库需要拉取的文件后缀,多个后缀空格分隔,默认使用配置文件中的RepoFileExtensions" tooltip={intl.get(
'仓库需要拉取的文件后缀,多个后缀空格分隔,默认使用配置文件中的RepoFileExtensions',
)}
> >
<Input placeholder="请输入文件后缀" /> <Input placeholder={intl.get('请输入文件后缀')} />
</Form.Item> </Form.Item>
<Form.Item <Form.Item
name="sub_before" name="sub_before"
label="执行前" label={intl.get('执行前')}
tooltip="运行订阅前执行的命令,比如 cp/mv/python3 xxx.py/node xxx.js" tooltip={intl.get(
'运行订阅前执行的命令,比如 cp/mv/python3 xxx.py/node xxx.js',
)}
> >
<Input.TextArea <Input.TextArea
rows={4} rows={4}
autoSize={true} autoSize={true}
placeholder="请输入运行订阅前要执行的命令" placeholder={intl.get('请输入运行订阅前要执行的命令')}
/> />
</Form.Item> </Form.Item>
<Form.Item <Form.Item
name="sub_after" name="sub_after"
label="执行后" label={intl.get('执行后')}
tooltip="运行订阅后执行的命令,比如 cp/mv/python3 xxx.py/node xxx.js" tooltip={intl.get(
'运行订阅后执行的命令,比如 cp/mv/python3 xxx.py/node xxx.js',
)}
> >
<Input.TextArea <Input.TextArea
rows={4} rows={4}
autoSize={true} autoSize={true}
placeholder="请输入运行订阅后要执行的命令" placeholder={intl.get('请输入运行订阅后要执行的命令')}
/> />
</Form.Item> </Form.Item>
</> </>
)} )}
<Form.Item <Form.Item
name="proxy" name="proxy"
label="代理" label={intl.get('代理')}
tooltip="公开仓库支持HTTP/SOCK5代理,私有仓库支持SOCK5代理" tooltip={intl.get(
'公开仓库支持HTTP/SOCK5代理,私有仓库支持SOCK5代理',
)}
> >
<Input <Input
placeholder={ placeholder={
@@ -479,7 +500,7 @@ const SubscriptionModal = ({
<Form.Item style={{ marginBottom: 0 }} className="inline-form-item"> <Form.Item style={{ marginBottom: 0 }} className="inline-form-item">
<Form.Item <Form.Item
name="autoAddCron" name="autoAddCron"
label="自动添加任务" label={intl.get('自动添加任务')}
valuePropName="checked" valuePropName="checked"
initialValue={true} initialValue={true}
> >
@@ -487,7 +508,7 @@ const SubscriptionModal = ({
</Form.Item> </Form.Item>
<Form.Item <Form.Item
name="autoDelCron" name="autoDelCron"
label="自动删除任务" label={intl.get('自动删除任务')}
valuePropName="checked" valuePropName="checked"
initialValue={true} initialValue={true}
> >
+140 -87
View File
@@ -1,7 +1,8 @@
import intl from 'react-intl-universal';
const baseUrl = window.__ENV__QlBaseUrl || '/'; const baseUrl = window.__ENV__QlBaseUrl || '/';
export default { export default {
siteName: '青龙', siteName: intl.get('青龙'),
apiPrefix: `${baseUrl}api/`, apiPrefix: `${baseUrl}api/`,
authKey: 'token', authKey: 'token',
@@ -30,7 +31,7 @@ export default {
}, },
{ {
key: 'zh', key: 'zh',
title: '中文', title: intl.get('中文'),
flag: '/china.svg', flag: '/china.svg',
}, },
], ],
@@ -38,254 +39,302 @@ export default {
}, },
scopes: [ scopes: [
{ {
name: '定时任务', name: intl.get('定时任务'),
value: 'crons', value: 'crons',
}, },
{ {
name: '环境变量', name: intl.get('环境变量'),
value: 'envs', value: 'envs',
}, },
{ {
name: '订阅管理', name: intl.get('订阅管理'),
value: 'subscriptions', value: 'subscriptions',
}, },
{ {
name: '配置文件', name: intl.get('配置文件'),
value: 'configs', value: 'configs',
}, },
{ {
name: '脚本管理', name: intl.get('脚本管理'),
value: 'scripts', value: 'scripts',
}, },
{ {
name: '日志管理', name: intl.get('日志管理'),
value: 'logs', value: 'logs',
}, },
{ {
name: '依赖管理', name: intl.get('依赖管理'),
value: 'dependencies', value: 'dependencies',
}, },
{ {
name: '系统信息', name: intl.get('系统信息'),
value: 'system', value: 'system',
}, },
], ],
scopesMap: { scopesMap: {
crons: '定时任务', crons: intl.get('定时任务'),
envs: '环境变量', envs: intl.get('环境变量'),
subscriptions: '订阅管理', subscriptions: intl.get('订阅管理'),
configs: '配置文件', configs: intl.get('配置文件'),
scripts: '脚本管理', scripts: intl.get('脚本管理'),
logs: '日志管理', logs: intl.get('日志管理'),
dependencies: '依赖管理', dependencies: intl.get('依赖管理'),
system: '系统信息', system: intl.get('系统信息'),
}, },
notificationModes: [ notificationModes: [
{ value: 'gotify', label: 'Gotify' }, { value: 'gotify', label: 'Gotify' },
{ value: 'goCqHttpBot', label: 'GoCqHttpBot' }, { value: 'goCqHttpBot', label: 'GoCqHttpBot' },
{ value: 'serverChan', label: 'Server酱' }, { value: 'serverChan', label: intl.get('Server酱') },
{ value: 'pushDeer', label: 'PushDeer' }, { value: 'pushDeer', label: 'PushDeer' },
{ value: 'bark', label: 'Bark' }, { value: 'bark', label: 'Bark' },
{ value: 'telegramBot', label: 'Telegram机器人' }, { value: 'telegramBot', label: intl.get('Telegram机器人') },
{ value: 'dingtalkBot', label: '钉钉机器人' }, { value: 'dingtalkBot', label: intl.get('钉钉机器人') },
{ value: 'weWorkBot', label: '企业微信机器人' }, { value: 'weWorkBot', label: intl.get('企业微信机器人') },
{ value: 'weWorkApp', label: '企业微信应用' }, { value: 'weWorkApp', label: intl.get('企业微信应用') },
{ value: 'aibotk', label: '智能微秘书' }, { value: 'aibotk', label: intl.get('智能微秘书') },
{ value: 'iGot', label: 'IGot' }, { value: 'iGot', label: 'IGot' },
{ value: 'pushPlus', label: 'PushPlus' }, { value: 'pushPlus', label: 'PushPlus' },
{ value: 'chat', label: '群晖chat' }, { value: 'chat', label: intl.get('群晖chat') },
{ value: 'email', label: '邮箱' }, { value: 'email', label: intl.get('邮箱') },
{ value: 'lark', label: '飞书机器人' }, { value: 'lark', label: intl.get('飞书机器人') },
{ value: 'pushMe', label: 'PushMe' }, { value: 'pushMe', label: 'PushMe' },
{ value: 'webhook', label: '自定义通知' }, { value: 'webhook', label: intl.get('自定义通知') },
{ value: 'closed', label: '已关闭' }, { value: 'closed', label: intl.get('已关闭') },
], ],
notificationModeMap: { notificationModeMap: {
gotify: [ gotify: [
{ {
label: 'gotifyUrl', label: 'gotifyUrl',
tip: 'gotify的url地址,例如 https://push.example.de:8080', tip: intl.get('gotify的url地址,例如 https://push.example.de:8080'),
required: true, required: true,
}, },
{ label: 'gotifyToken', tip: 'gotify的消息应用token码', required: true }, {
{ label: 'gotifyPriority', tip: '推送消息的优先级' }, label: 'gotifyToken',
tip: intl.get('gotify的消息应用token码'),
required: true,
},
{ label: 'gotifyPriority', tip: intl.get('推送消息的优先级') },
], ],
chat: [ chat: [
{ {
label: 'chatUrl', label: 'chatUrl',
tip: 'chat的url地址', tip: intl.get('chat的url地址'),
required: true, required: true,
}, },
{ label: 'chatToken', tip: 'chat的token码', required: true }, { label: 'chatToken', tip: intl.get('chat的token码'), required: true },
], ],
goCqHttpBot: [ goCqHttpBot: [
{ {
label: 'goCqHttpBotUrl', label: 'goCqHttpBotUrl',
tip: '推送到个人QQ: http://127.0.0.1/send_private_msg,群:http://127.0.0.1/send_group_msg', tip: intl.get(
'推送到个人QQ: http://127.0.0.1/send_private_msg,群:http://127.0.0.1/send_group_msg',
),
required: true, required: true,
}, },
{ label: 'goCqHttpBotToken', tip: '访问密钥', required: true }, { label: 'goCqHttpBotToken', tip: intl.get('访问密钥'), required: true },
{ {
label: 'goCqHttpBotQq', label: 'goCqHttpBotQq',
tip: '如果GOBOT_URL设置 /send_private_msg 则需要填入 user_id=个人QQ 相反如果是 /send_group_msg 则需要填入 group_id=QQ群', tip: intl.get(
'如果GOBOT_URL设置 /send_private_msg 则需要填入 user_id=个人QQ 相反如果是 /send_group_msg 则需要填入 group_id=QQ群',
),
required: true, required: true,
}, },
], ],
serverChan: [ serverChan: [
{ label: 'serverChanKey', tip: 'Server酱SENDKEY', required: true }, {
label: 'serverChanKey',
tip: intl.get('Server酱SENDKEY'),
required: true,
},
], ],
pushDeer: [ pushDeer: [
{ {
label: 'pushDeerKey', label: 'pushDeerKey',
tip: 'PushDeer的Keyhttps://github.com/easychen/pushdeer', tip: intl.get('PushDeer的Keyhttps://github.com/easychen/pushdeer'),
required: true, required: true,
}, },
{ {
label: 'pushDeerUrl', label: 'pushDeerUrl',
tip: 'PushDeer的自架API endpoint,默认是 https://api2.pushdeer.com/message/push', tip: intl.get(
'PushDeer的自架API endpoint,默认是 https://api2.pushdeer.com/message/push',
),
}, },
], ],
bark: [ bark: [
{ {
label: 'barkPush', label: 'barkPush',
tip: 'Bark的信息IP/设备码,例如:https://api.day.app/XXXXXXXX', tip: intl.get(
'Bark的信息IP/设备码,例如:https://api.day.app/XXXXXXXX',
),
required: true, required: true,
}, },
{ {
label: 'barkIcon', label: 'barkIcon',
tip: 'BARK推送图标,自定义推送图标 (需iOS15或以上才能显示)', tip: intl.get('BARK推送图标,自定义推送图标 (需iOS15或以上才能显示)'),
},
{
label: 'barkSound',
tip: intl.get('BARK推送铃声,铃声列表去APP查看复制填写'),
},
{
label: 'barkGroup',
tip: intl.get('BARK推送消息的分组, 默认为qinglong'),
}, },
{ label: 'barkSound', tip: 'BARK推送铃声,铃声列表去APP查看复制填写' },
{ label: 'barkGroup', tip: 'BARK推送消息的分组, 默认为qinglong' },
], ],
telegramBot: [ telegramBot: [
{ {
label: 'telegramBotToken', label: 'telegramBotToken',
tip: 'telegram机器人的token,例如:1077xxx4424:AAFjv0FcqxxxxxxgEMGfi22B4yh15R5uw', tip: intl.get(
'telegram机器人的token,例如:1077xxx4424:AAFjv0FcqxxxxxxgEMGfi22B4yh15R5uw',
),
required: true, required: true,
}, },
{ {
label: 'telegramBotUserId', label: 'telegramBotUserId',
tip: 'telegram用户的id,例如:129xxx206', tip: intl.get('telegram用户的id,例如:129xxx206'),
required: true, required: true,
}, },
{ label: 'telegramBotProxyHost', tip: '代理IP' }, { label: 'telegramBotProxyHost', tip: intl.get('代理IP') },
{ label: 'telegramBotProxyPort', tip: '代理端口' }, { label: 'telegramBotProxyPort', tip: intl.get('代理端口') },
{ {
label: 'telegramBotProxyAuth', label: 'telegramBotProxyAuth',
tip: 'telegram代理配置认证参数, 用户名与密码用英文冒号连接 user:password', tip: intl.get(
'telegram代理配置认证参数, 用户名与密码用英文冒号连接 user:password',
),
}, },
{ {
label: 'telegramBotApiHost', label: 'telegramBotApiHost',
tip: 'telegram api自建的反向代理地址,默认tg官方api', tip: intl.get('telegram api自建的反向代理地址,默认tg官方api'),
}, },
], ],
dingtalkBot: [ dingtalkBot: [
{ {
label: 'dingtalkBotToken', label: 'dingtalkBotToken',
tip: '钉钉机器人webhook token,例如:5a544165465465645d0f31dca676e7bd07415asdasd', tip: intl.get(
'钉钉机器人webhook token,例如:5a544165465465645d0f31dca676e7bd07415asdasd',
),
required: true, required: true,
}, },
{ {
label: 'dingtalkBotSecret', label: 'dingtalkBotSecret',
tip: '密钥,机器人安全设置页面,加签一栏下面显示的SEC开头的字符串', tip: intl.get(
'密钥,机器人安全设置页面,加签一栏下面显示的SEC开头的字符串',
),
}, },
], ],
weWorkBot: [ weWorkBot: [
{ {
label: 'weWorkBotKey', label: 'weWorkBotKey',
tip: '企业微信机器人的 webhook(详见文档 https://work.weixin.qq.com/api/doc/90000/90136/91770),例如:693a91f6-7xxx-4bc4-97a0-0ec2sifa5aaa', tip: intl.get(
'企业微信机器人的 webhook(详见文档 https://work.weixin.qq.com/api/doc/90000/90136/91770),例如:693a91f6-7xxx-4bc4-97a0-0ec2sifa5aaa',
),
required: true, required: true,
}, },
{ {
label: 'weWorkOrigin', label: 'weWorkOrigin',
tip: '企业微信代理地址', tip: intl.get('企业微信代理地址'),
}, },
], ],
weWorkApp: [ weWorkApp: [
{ {
label: 'weWorkAppKey', label: 'weWorkAppKey',
tip: 'corpid,corpsecret,touser(注:多个成员ID使用|隔开),agentid,消息类型(选填,不填默认文本消息类型) 注意用,号隔开(英文输入法的逗号),例如:wwcfrs,B-76WERQ,qinglong,1000001,2COat', tip: intl.get(
'corpid,corpsecret,touser(注:多个成员ID使用|隔开),agentid,消息类型(选填,不填默认文本消息类型) 注意用,号隔开(英文输入法的逗号),例如:wwcfrs,B-76WERQ,qinglong,1000001,2COat',
),
required: true, required: true,
}, },
{ {
label: 'weWorkOrigin', label: 'weWorkOrigin',
tip: '企业微信代理地址', tip: intl.get('企业微信代理地址'),
}, },
], ],
aibotk: [ aibotk: [
{ {
label: 'aibotkKey', label: 'aibotkKey',
tip: '密钥key,智能微秘书个人中心获取apikey,申请地址:https://wechat.aibotk.com/signup?from=ql', tip: intl.get(
'密钥key,智能微秘书个人中心获取apikey,申请地址:https://wechat.aibotk.com/signup?from=ql',
),
required: true, required: true,
}, },
{ {
label: 'aibotkType', label: 'aibotkType',
tip: '发送的目标,群组或者好友', tip: intl.get('发送的目标,群组或者好友'),
required: true, required: true,
placeholder: '请输入要发送的目标', placeholder: intl.get('请输入要发送的目标'),
items: [ items: [
{ value: 'room', label: '群聊' }, { value: 'room', label: intl.get('群聊') },
{ value: 'contact', label: '好友' }, { value: 'contact', label: intl.get('好友') },
], ],
}, },
{ {
label: 'aibotkName', label: 'aibotkName',
tip: '要发送的用户昵称或群名,如果目标是群,需要填群名,如果目标是好友,需要填好友昵称', tip: intl.get(
'要发送的用户昵称或群名,如果目标是群,需要填群名,如果目标是好友,需要填好友昵称',
),
required: true, required: true,
}, },
], ],
iGot: [ iGot: [
{ {
label: 'iGotPushKey', label: 'iGotPushKey',
tip: 'iGot的信息推送key,例如:https://push.hellyw.com/XXXXXXXX', tip: intl.get(
'iGot的信息推送key,例如:https://push.hellyw.com/XXXXXXXX',
),
required: true, required: true,
}, },
], ],
pushPlus: [ pushPlus: [
{ {
label: 'pushPlusToken', label: 'pushPlusToken',
tip: '微信扫码登录后一对一推送或一对多推送下面的token(您的Token),不提供PUSH_PLUS_USER则默认为一对一推送,参考 https://www.pushplus.plus/', tip: intl.get(
'微信扫码登录后一对一推送或一对多推送下面的token(您的Token),不提供PUSH_PLUS_USER则默认为一对一推送,参考 https://www.pushplus.plus/',
),
required: true, required: true,
}, },
{ {
label: 'pushPlusUser', label: 'pushPlusUser',
tip: '一对多推送的“群组编码”(一对多推送下面->您的群组(如无则新建)->群组编码,如果您是创建群组人。也需点击“查看二维码”扫描绑定,否则不能接受群组消息推送)', tip: intl.get(
'一对多推送的“群组编码”(一对多推送下面->您的群组(如无则新建)->群组编码,如果您是创建群组人。也需点击“查看二维码”扫描绑定,否则不能接受群组消息推送)',
),
}, },
], ],
lark: [ lark: [
{ {
label: 'larkKey', label: 'larkKey',
tip: '飞书群组机器人:https://www.feishu.cn/hc/zh-CN/articles/360024984973', tip: intl.get(
'飞书群组机器人:https://www.feishu.cn/hc/zh-CN/articles/360024984973',
),
required: true, required: true,
}, },
], ],
email: [ email: [
{ {
label: 'emailService', label: 'emailService',
tip: '邮箱服务名称,比如126、163、Gmail、QQ等,支持列表https://nodemailer.com/smtp/well-known/', tip: intl.get(
'邮箱服务名称,比如126、163、Gmail、QQ等,支持列表https://nodemailer.com/smtp/well-known/',
),
required: true, required: true,
}, },
{ label: 'emailUser', tip: '邮箱地址', required: true }, { label: 'emailUser', tip: intl.get('邮箱地址'), required: true },
{ label: 'emailPass', tip: '邮箱SMTP授权码', required: true }, { label: 'emailPass', tip: intl.get('邮箱SMTP授权码'), required: true },
], ],
pushMe: [ pushMe: [
{ {
label: 'pushMeKey', label: 'pushMeKey',
tip: 'PushMe的Keyhttps://push.i-i.me/', tip: intl.get('PushMe的Keyhttps://push.i-i.me/'),
required: true, required: true,
}, },
], ],
webhook: [ webhook: [
{ {
label: 'webhookMethod', label: 'webhookMethod',
tip: '请求方法', tip: intl.get('请求方法'),
required: true, required: true,
items: [{ value: 'GET' }, { value: 'POST' }, { value: 'PUT' }], items: [{ value: 'GET' }, { value: 'POST' }, { value: 'PUT' }],
}, },
{ {
label: 'webhookContentType', label: 'webhookContentType',
tip: '请求头Content-Type', tip: intl.get('请求头Content-Type'),
required: true, required: true,
items: [ items: [
{ value: 'application/json' }, { value: 'application/json' },
@@ -295,35 +344,39 @@ export default {
}, },
{ {
label: 'webhookUrl', label: 'webhookUrl',
tip: '请求链接以http或者https开头。url或者body中必须包含$title$content可选,对应api内容的位置', tip: intl.get(
'请求链接以http或者https开头。url或者body中必须包含$title$content可选,对应api内容的位置',
),
required: true, required: true,
placeholder: 'https://xxx.cn/api?content=$title\n', placeholder: 'https://xxx.cn/api?content=$title\n',
}, },
{ {
label: 'webhookHeaders', label: 'webhookHeaders',
tip: '请求头格式Custom-Header1: Header1,多个换行分割', tip: intl.get('请求头格式Custom-Header1: Header1,多个换行分割'),
placeholder: 'Custom-Header1: Header1\nCustom-Header2: Header2', placeholder: 'Custom-Header1: Header1\nCustom-Header2: Header2',
}, },
{ {
label: 'webhookBody', label: 'webhookBody',
tip: '请求体格式key1: value1,多个换行分割。url或者body中必须包含$title$content可选,对应api内容的位置', tip: intl.get(
'请求体格式key1: value1,多个换行分割。url或者body中必须包含$title$content可选,对应api内容的位置',
),
placeholder: 'key1: $title\nkey2: $content', placeholder: 'key1: $title\nkey2: $content',
}, },
], ],
}, },
documentTitleMap: { documentTitleMap: {
'/login': '登录', '/login': intl.get('登录'),
'/initialization': '初始化', '/initialization': intl.get('初始化'),
'/crontab': '定时任务', '/crontab': intl.get('定时任务'),
'/env': '环境变量', '/env': intl.get('环境变量'),
'/subscription': '订阅管理', '/subscription': intl.get('订阅管理'),
'/config': '配置文件', '/config': intl.get('配置文件'),
'/script': '脚本管理', '/script': intl.get('脚本管理'),
'/diff': '对比工具', '/diff': intl.get('对比工具'),
'/log': '日志管理', '/log': intl.get('日志管理'),
'/setting': '系统设置', '/setting': intl.get('系统设置'),
'/error': '错误日志', '/error': intl.get('错误日志'),
'/dependence': '依赖管理', '/dependence': intl.get('依赖管理'),
}, },
dependenceTypes: ['nodejs', 'python3', 'linux'], dependenceTypes: ['nodejs', 'python3', 'linux'],
}; };
+26 -29
View File
@@ -1,11 +1,7 @@
import { message } from 'antd'; import { message } from 'antd';
import config from './config'; import config from './config';
import { history } from '@umijs/max'; import { history } from '@umijs/max';
import axios, { import axios, { AxiosError, AxiosInstance, AxiosRequestConfig } from 'axios';
AxiosError,
AxiosInstance,
AxiosRequestConfig,
} from 'axios';
interface IResponseData { interface IResponseData {
code?: number; code?: number;
@@ -26,9 +22,7 @@ message.config({
}); });
const time = Date.now(); const time = Date.now();
const errorHandler = function ( const errorHandler = function (error: AxiosError) {
error: AxiosError,
) {
if (error.response) { if (error.response) {
const msg = error.response.data const msg = error.response.data
? error.response.data.message || error.message || error.response.data ? error.response.data.message || error.message || error.response.data
@@ -99,29 +93,32 @@ _request.interceptors.response.use(async (response) => {
}); });
} }
return res; return res;
} catch (error) { } } catch (error) {}
return response; return response;
} }
return response; return response;
}, errorHandler); }, errorHandler);
export const request = _request as Override<AxiosInstance, { export const request = _request as Override<
get<T = IResponseData, D = any>( AxiosInstance,
url: string, {
config?: AxiosRequestConfig<D>, get<T = IResponseData, D = any>(
): Promise<T>; url: string,
delete<T = IResponseData, D = any>( config?: AxiosRequestConfig<D>,
url: string, ): Promise<T>;
config?: AxiosRequestConfig<D>, delete<T = IResponseData, D = any>(
): Promise<T>; url: string,
post<T = IResponseData, D = any>( config?: AxiosRequestConfig<D>,
url: string, ): Promise<T>;
data?: D, post<T = IResponseData, D = any>(
config?: AxiosRequestConfig<D>, url: string,
): Promise<T>; data?: D,
put<T = IResponseData, D = any>( config?: AxiosRequestConfig<D>,
url: string, ): Promise<T>;
data?: D, put<T = IResponseData, D = any>(
config?: AxiosRequestConfig<D>, url: string,
): Promise<T>; data?: D,
}>; config?: AxiosRequestConfig<D>,
): Promise<T>;
}
>;
+2 -1
View File
@@ -1,3 +1,4 @@
import intl from 'react-intl-universal';
import { LOG_END_SYMBOL } from './const'; import { LOG_END_SYMBOL } from './const';
import cron_parser from 'cron-parser'; import cron_parser from 'cron-parser';
@@ -297,7 +298,7 @@ export function findNode<T extends Record<string, any> & { children?: T[] }>(
} }
export function logEnded(log: string): boolean { export function logEnded(log: string): boolean {
const endTips = [LOG_END_SYMBOL, '执行结束']; const endTips = [LOG_END_SYMBOL, intl.get('执行结束')];
return endTips.some((x) => log.includes(x)); return endTips.some((x) => log.includes(x));
} }