mirror of
https://github.com/whyour/qinglong.git
synced 2026-08-07 09:14:32 +08:00
Compare commits
19 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5efc3d2228 | |||
| 8ac3f83c79 | |||
| b31b054d0c | |||
| fb4a87f5ce | |||
| 049c73880b | |||
| 7b2c54f6a6 | |||
| 23bda39812 | |||
| 90af5801ee | |||
| 543c241bc6 | |||
| 19a58a3510 | |||
| 73c6fd18ed | |||
| 409297c6aa | |||
| 4272b9ea35 | |||
| 3c5c5b0bbc | |||
| 802b2d722e | |||
| 8f90d3f8ff | |||
| f93cbbf508 | |||
| 2ba8756bd3 | |||
| 8013de56c9 |
@@ -109,7 +109,6 @@ export default (app: Router) => {
|
||||
}),
|
||||
}),
|
||||
async (req: Request<{ id: number }>, res: Response, next: NextFunction) => {
|
||||
const logger: Logger = Container.get('logger');
|
||||
try {
|
||||
const envService = Container.get(EnvService);
|
||||
const data = await envService.move(req.params.id, req.body);
|
||||
|
||||
@@ -7,6 +7,8 @@ import SystemService from '../services/system';
|
||||
import { celebrate, Joi } from 'celebrate';
|
||||
import UserService from '../services/user';
|
||||
import { EnvModel } from '../data/env';
|
||||
import { promiseExec } from '../config/util';
|
||||
|
||||
const route = Router();
|
||||
|
||||
export default (app: Router) => {
|
||||
@@ -22,6 +24,15 @@ export default (app: Router) => {
|
||||
|
||||
const currentVersionFile = fs.readFileSync(config.versionFile, 'utf8');
|
||||
const version = currentVersionFile.match(versionRegx)![1];
|
||||
const lastCommitTime = (
|
||||
await promiseExec('git show -s --format=%ai')
|
||||
).replace('\n', '');
|
||||
const lastCommitId = (
|
||||
await promiseExec('git rev-parse --short HEAD')
|
||||
).replace('\n', '');
|
||||
const branch = (
|
||||
await promiseExec('git symbolic-ref --short HEAD')
|
||||
).replace('\n', '');
|
||||
|
||||
let isInitialized = true;
|
||||
if (
|
||||
@@ -37,6 +48,9 @@ export default (app: Router) => {
|
||||
data: {
|
||||
isInitialized,
|
||||
version,
|
||||
lastCommitTime,
|
||||
lastCommitId,
|
||||
branch,
|
||||
},
|
||||
});
|
||||
} catch (e) {
|
||||
|
||||
@@ -14,7 +14,7 @@ if (!process.env.QL_DIR) {
|
||||
process.env.QL_DIR = qlHomePath.replace(/\/$/g, '');
|
||||
}
|
||||
|
||||
const lastVersionFile = `http://qn.whyour.cn/version.ts?v=${Date.now()}`;
|
||||
const lastVersionFile = `https://qn.whyour.cn/version.ts`;
|
||||
|
||||
const rootPath = process.env.QL_DIR as string;
|
||||
const envFound = dotenv.config({ path: path.join(rootPath, '.env') });
|
||||
|
||||
+4
-1
@@ -26,7 +26,10 @@ export enum EnvStatus {
|
||||
'disabled',
|
||||
}
|
||||
|
||||
export const initEnvPosition = 9999999999;
|
||||
export const maxPosition = 9000000000000000;
|
||||
export const initPosition = 4500000000000000;
|
||||
export const stepPosition = 10000000;
|
||||
export const minPosition = 100;
|
||||
|
||||
interface EnvInstance extends Model<Env, Env>, Env {}
|
||||
export const EnvModel = sequelize.define<EnvInstance>('Env', {
|
||||
|
||||
+12
-5
@@ -1,15 +1,22 @@
|
||||
import { Sequelize } from 'sequelize';
|
||||
import { Sequelize, Transaction } from 'sequelize';
|
||||
import config from '../config/index';
|
||||
|
||||
export const sequelize = new Sequelize({
|
||||
dialect: 'sqlite',
|
||||
storage: `${config.dbPath}database.sqlite`,
|
||||
logging: false,
|
||||
pool: {
|
||||
max: 6,
|
||||
min: 0,
|
||||
idle: 30000,
|
||||
retry: {
|
||||
max: 10,
|
||||
match: ['SQLITE_BUSY: database is locked'],
|
||||
},
|
||||
pool: {
|
||||
max: 5,
|
||||
min: 2,
|
||||
idle: 30000,
|
||||
acquire: 30000,
|
||||
evict: 10000,
|
||||
},
|
||||
transactionType: Transaction.TYPES.IMMEDIATE,
|
||||
});
|
||||
|
||||
export type ResponseType<T> = { code: number; data?: T; message?: string };
|
||||
|
||||
+1
-1
@@ -50,7 +50,7 @@ export class ChatNotification extends NotificationBaseInfo {
|
||||
|
||||
export class BarkNotification extends NotificationBaseInfo {
|
||||
public barkPush = '';
|
||||
public barkIcon = 'http://qn.whyour.cn/logo.png';
|
||||
public barkIcon = 'https://qn.whyour.cn/logo.png';
|
||||
public barkSound = '';
|
||||
public barkGroup = 'qinglong';
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import { Container } from 'typedi';
|
||||
import { Crontab, CrontabModel, CrontabStatus } from '../data/cron';
|
||||
import CronService from '../services/cron';
|
||||
import EnvService from '../services/env';
|
||||
import _ from 'lodash';
|
||||
import groupBy from 'lodash/groupBy';
|
||||
import { DependenceModel } from '../data/dependence';
|
||||
import { Op } from 'sequelize';
|
||||
import config from '../config';
|
||||
@@ -26,7 +26,7 @@ export default async () => {
|
||||
order: [['type', 'DESC']],
|
||||
raw: true,
|
||||
}).then(async (docs) => {
|
||||
const groups = _.groupBy(docs, 'type');
|
||||
const groups = groupBy(docs, 'type');
|
||||
const keys = Object.keys(groups).sort((a, b) => parseInt(b) - parseInt(a));
|
||||
for (const key of keys) {
|
||||
const group = groups[key];
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { Container } from 'typedi';
|
||||
import _ from 'lodash';
|
||||
import SystemService from '../services/system';
|
||||
import ScheduleService from '../services/schedule';
|
||||
import SubscriptionService from '../services/subscription';
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import { Service, Inject } from 'typedi';
|
||||
import winston from 'winston';
|
||||
import { CrontabView, CrontabViewModel } from '../data/cronView';
|
||||
import { initEnvPosition } from '../data/env';
|
||||
import { initPosition } from '../data/env';
|
||||
|
||||
@Service()
|
||||
export default class CronViewService {
|
||||
constructor(@Inject('logger') private logger: winston.Logger) {}
|
||||
|
||||
public async create(payload: CrontabView): Promise<CrontabView> {
|
||||
let position = initEnvPosition;
|
||||
let position = initPosition;
|
||||
const views = await this.list();
|
||||
if (views && views.length > 0 && views[views.length - 1].position) {
|
||||
position = views[views.length - 1].position as number;
|
||||
|
||||
@@ -9,7 +9,6 @@ import {
|
||||
unInstallDependenceCommandTypes,
|
||||
DependenceModel,
|
||||
} from '../data/dependence';
|
||||
import _ from 'lodash';
|
||||
import { spawn } from 'child_process';
|
||||
import SockService from './sock';
|
||||
import { Op } from 'sequelize';
|
||||
|
||||
+49
-23
@@ -1,10 +1,17 @@
|
||||
import { Service, Inject } from 'typedi';
|
||||
import winston from 'winston';
|
||||
import { getFileContentByName } from '../config/util';
|
||||
import config from '../config';
|
||||
import * as fs from 'fs';
|
||||
import { Env, EnvModel, EnvStatus, initEnvPosition } from '../data/env';
|
||||
import _ from 'lodash';
|
||||
import {
|
||||
Env,
|
||||
EnvModel,
|
||||
EnvStatus,
|
||||
initPosition,
|
||||
maxPosition,
|
||||
minPosition,
|
||||
stepPosition,
|
||||
} from '../data/env';
|
||||
import groupBy from 'lodash/groupBy';
|
||||
import { Op } from 'sequelize';
|
||||
|
||||
@Service()
|
||||
@@ -13,17 +20,22 @@ export default class EnvService {
|
||||
|
||||
public async create(payloads: Env[]): Promise<Env[]> {
|
||||
const envs = await this.envs();
|
||||
let position = initEnvPosition;
|
||||
if (envs && envs.length > 0 && envs[envs.length - 1].position) {
|
||||
position = envs[envs.length - 1].position as number;
|
||||
let position = initPosition;
|
||||
if (
|
||||
envs &&
|
||||
envs.length > 0 &&
|
||||
typeof envs[envs.length - 1].position === 'number'
|
||||
) {
|
||||
position = envs[envs.length - 1].position!;
|
||||
}
|
||||
const tabs = payloads.map((x) => {
|
||||
position = position / 2;
|
||||
position = position - stepPosition;
|
||||
const tab = new Env({ ...x, position });
|
||||
return tab;
|
||||
});
|
||||
const docs = await this.insert(tabs);
|
||||
await this.set_envs();
|
||||
await this.checkPosition(tabs[tabs.length - 1].position!);
|
||||
return docs;
|
||||
}
|
||||
|
||||
@@ -67,25 +79,40 @@ export default class EnvService {
|
||||
const envs = await this.envs();
|
||||
if (toIndex === 0 || toIndex === envs.length - 1) {
|
||||
targetPosition = isUpward
|
||||
? envs[0].position! * 2
|
||||
: envs[toIndex].position! / 2;
|
||||
? envs[0].position! + stepPosition
|
||||
: envs[toIndex].position! - stepPosition;
|
||||
} else {
|
||||
targetPosition = isUpward
|
||||
? (envs[toIndex].position! + envs[toIndex - 1].position!) / 2
|
||||
: (envs[toIndex].position! + envs[toIndex + 1].position!) / 2;
|
||||
}
|
||||
|
||||
const newDoc = await this.update({
|
||||
id,
|
||||
position: targetPosition,
|
||||
position: this.getPrecisionPosition(targetPosition),
|
||||
});
|
||||
|
||||
await this.checkPosition(targetPosition);
|
||||
return newDoc;
|
||||
}
|
||||
|
||||
public async envs(
|
||||
searchText: string = '',
|
||||
sort: any = { position: -1 },
|
||||
query: any = {},
|
||||
): Promise<Env[]> {
|
||||
private async checkPosition(position: number) {
|
||||
const precisionPosition = parseFloat(position.toPrecision(16));
|
||||
if (precisionPosition < minPosition || precisionPosition > maxPosition) {
|
||||
const envs = await this.envs();
|
||||
let position = initPosition;
|
||||
for (const env of envs) {
|
||||
position = position - stepPosition;
|
||||
await this.updateDb({ id: env.id, position });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private getPrecisionPosition(position: number): number {
|
||||
return parseFloat(position.toPrecision(16));
|
||||
}
|
||||
|
||||
public async envs(searchText: string = '', query: any = {}): Promise<Env[]> {
|
||||
let condition = { ...query };
|
||||
if (searchText) {
|
||||
const encodeText = encodeURIComponent(searchText);
|
||||
@@ -155,12 +182,11 @@ export default class EnvService {
|
||||
}
|
||||
|
||||
public async set_envs() {
|
||||
const envs = await this.envs(
|
||||
'',
|
||||
{ position: -1 },
|
||||
{ name: { [Op.not]: null }, status: EnvStatus.normal },
|
||||
);
|
||||
const groups = _.groupBy(envs, 'name');
|
||||
const envs = await this.envs('', {
|
||||
name: { [Op.not]: null },
|
||||
status: EnvStatus.normal,
|
||||
});
|
||||
const groups = groupBy(envs, 'name');
|
||||
let env_string = '';
|
||||
for (const key in groups) {
|
||||
if (Object.prototype.hasOwnProperty.call(groups, key)) {
|
||||
@@ -168,8 +194,8 @@ export default class EnvService {
|
||||
|
||||
// 忽略不符合bash要求的环境变量名称
|
||||
if (/^[a-zA-Z_][0-9a-zA-Z_]*$/.test(key)) {
|
||||
let value = _(group)
|
||||
.map('value')
|
||||
let value = group
|
||||
.map((x) => x.value)
|
||||
.join('&')
|
||||
.replace(/(\\)[^n]/g, '\\\\')
|
||||
.replace(/(\\$)/, '\\\\')
|
||||
|
||||
@@ -2,7 +2,6 @@ import { Service, Inject } from 'typedi';
|
||||
import winston from 'winston';
|
||||
import config from '../config';
|
||||
import * as fs from 'fs';
|
||||
import _ from 'lodash';
|
||||
import { AuthDataType, AuthInfo, AuthModel, LoginStatus } from '../data/auth';
|
||||
import { NotificationInfo } from '../data/notify';
|
||||
import NotificationService from './notify';
|
||||
@@ -10,6 +9,7 @@ import ScheduleService from './schedule';
|
||||
import { spawn } from 'child_process';
|
||||
import SockService from './sock';
|
||||
import got from 'got';
|
||||
import { promiseExec } from '../config/util';
|
||||
|
||||
@Service()
|
||||
export default class SystemService {
|
||||
@@ -88,10 +88,9 @@ export default class SystemService {
|
||||
let lastVersion = '';
|
||||
let lastLog = '';
|
||||
try {
|
||||
const result = await got.get(config.lastVersionFile, {
|
||||
timeout: 30000,
|
||||
});
|
||||
const lastVersionFileContent = result.body;
|
||||
const lastVersionFileContent = await promiseExec(
|
||||
`curl ${config.lastVersionFile}?t=${Date.now()}`,
|
||||
);
|
||||
lastVersion = lastVersionFileContent.match(versionRegx)![1];
|
||||
lastLog = lastVersionFileContent.match(logRegx)
|
||||
? lastVersionFileContent.match(logRegx)![1]
|
||||
|
||||
@@ -3,7 +3,6 @@ import winston from 'winston';
|
||||
import { createRandomString, getNetIp, getPlatform } from '../config/util';
|
||||
import config from '../config';
|
||||
import * as fs from 'fs';
|
||||
import _ from 'lodash';
|
||||
import jwt from 'jsonwebtoken';
|
||||
import { authenticator } from '@otplib/preset-default';
|
||||
import { AuthDataType, AuthInfo, AuthModel, LoginStatus } from '../data/auth';
|
||||
|
||||
+3
-2
@@ -77,7 +77,7 @@
|
||||
"nodemailer": "^6.7.2",
|
||||
"p-queue": "7.2.0",
|
||||
"reflect-metadata": "^0.1.13",
|
||||
"sequelize": "^6.20.1",
|
||||
"sequelize": "^6.25.3",
|
||||
"serve-handler": "^6.1.3",
|
||||
"sockjs": "^0.3.24",
|
||||
"sqlite3": "npm:@louislam/sqlite3@^15.0.6",
|
||||
@@ -91,13 +91,14 @@
|
||||
"@ant-design/icons": "^4.7.0",
|
||||
"@ant-design/pro-layout": "^6.33.1",
|
||||
"@monaco-editor/react": "4.2.1",
|
||||
"@react-hook/resize-observer": "^1.2.6",
|
||||
"@sentry/react": "^7.12.1",
|
||||
"@types/body-parser": "^1.19.2",
|
||||
"@types/cors": "^2.8.12",
|
||||
"@types/express": "^4.17.13",
|
||||
"@types/express-jwt": "^6.0.4",
|
||||
"@types/jsonwebtoken": "^8.5.8",
|
||||
"@types/lodash": "^4.14.179",
|
||||
"@types/lodash": "^4.14.185",
|
||||
"@types/multer": "^1.4.7",
|
||||
"@types/nedb": "^1.8.12",
|
||||
"@types/node": "^17.0.21",
|
||||
|
||||
@@ -67,7 +67,7 @@ export PUSH_KEY=""
|
||||
## 下方填写app提供的设备码,例如:https://api.day.app/123 那么此处的设备码就是123
|
||||
export BARK_PUSH=""
|
||||
## 下方填写推送图标设置,自定义推送图标(需iOS15或以上)
|
||||
export BARK_ICON="http://qn.whyour.cn/logo.png"
|
||||
export BARK_ICON="https://qn.whyour.cn/logo.png"
|
||||
## 下方填写推送声音设置,例如choo,具体值请在bark-推送铃声-查看所有铃声
|
||||
export BARK_SOUND=""
|
||||
## 下方填写推送消息分组,默认为"QingLong"
|
||||
|
||||
+2
-2
@@ -49,7 +49,7 @@ let CHAT_TOKEN = '';
|
||||
//此处填你BarkAPP的信息(IP/设备码,例如:https://api.day.app/XXXXXXXX)
|
||||
let BARK_PUSH = '';
|
||||
//BARK app推送图标,自定义推送图标(需iOS15或以上)
|
||||
let BARK_ICON = 'http://qn.whyour.cn/logo.png';
|
||||
let BARK_ICON = 'https://qn.whyour.cn/logo.png';
|
||||
//BARK app推送铃声,铃声列表去APP查看复制填写
|
||||
let BARK_SOUND = '';
|
||||
//BARK app推送消息的分组, 默认为"QingLong"
|
||||
@@ -987,7 +987,7 @@ function fsBotNotify(text, desp) {
|
||||
if (FSKEY) {
|
||||
const options = {
|
||||
url: `https://open.feishu.cn/open-apis/bot/v2/hook/${FSKEY}`,
|
||||
json: { msg_type: 'text', content: { text: `${title}\n\n${content}` } },
|
||||
json: { msg_type: 'text', content: { text: `${text}\n\n${desp}` } },
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
|
||||
+2
-3
@@ -84,7 +84,7 @@ check_server() {
|
||||
disk_use=$(df -P | grep /dev | grep -v -E '(tmp|boot|shm)' | awk '{print $5}' | cut -f 1 -d "%" | head -n 1)
|
||||
|
||||
if [[ $cpu_use -gt $cpu_warn ]] || [[ $mem_free -lt $mem_warn ]] || [[ $disk_use -gt $disk_warn ]]; then
|
||||
local resource=$(top -b -n 1 | grep -v -E 'grep|Mem|idle|Load' | awk '{$2="";$3="";$4="";$5="";$7="";print $0}' | head -n 10)
|
||||
local resource=$(top -b -n 1 | grep -v -E 'grep|Mem|idle|Load|tr' | awk '{$2="";$3="";$4="";$5="";$7="";print $0}' | head -n 10 | tr '\n' '|' | sed s/\|/\\\\n/g)
|
||||
notify_api "服务器资源异常警告" "当前CPU占用 $cpu_use% 内存占用 $mem_use% 磁盘占用 $disk_use% \n资源占用详情 \n\n $resource"
|
||||
fi
|
||||
}
|
||||
@@ -232,8 +232,7 @@ run_else() {
|
||||
|
||||
shift
|
||||
|
||||
local params=$(echo "$@" | sed 's/ /\" \"/g')
|
||||
$timeoutCmd $which_program $file_param \"$params\"
|
||||
$timeoutCmd $which_program $file_param "$@"
|
||||
}
|
||||
|
||||
## 命令检测
|
||||
|
||||
+4
-2
@@ -58,6 +58,7 @@ format_params() {
|
||||
if type timeout &>/dev/null; then
|
||||
timeoutCmd="timeout -k 10s $command_timeout_time "
|
||||
fi
|
||||
params=$(echo "$@" | sed -E 's/([^ ])&([^ ])/\1\\\&\2/g')
|
||||
}
|
||||
|
||||
show_log="false"
|
||||
@@ -70,10 +71,11 @@ while getopts ":l" opt; do
|
||||
done
|
||||
[[ "$show_log" == "true" ]] && shift $(($OPTIND - 1))
|
||||
|
||||
format_params
|
||||
format_params "$@"
|
||||
define_program "$@"
|
||||
handle_log_path "$@"
|
||||
eval . $dir_shell/otask.sh "$@" "$cmd"
|
||||
|
||||
eval . $dir_shell/otask.sh "$params" "$cmd"
|
||||
[[ -f "$dir_log/$log_path" ]] && cat "$dir_log/$log_path"
|
||||
|
||||
exit 0
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
import { MutableRefObject, useLayoutEffect, useState } from 'react';
|
||||
import useResizeObserver from '@react-hook/resize-observer'
|
||||
import { getTableScroll } from '@/utils';
|
||||
|
||||
export default <T extends HTMLElement>(target: MutableRefObject<T>, extraHeight?: number) => {
|
||||
const [height, setHeight] = useState<number>()
|
||||
|
||||
useResizeObserver(target, (entry) => {
|
||||
let _targe = entry.target as any
|
||||
if (!_targe.classList.contains('ant-table-wrapper')) {
|
||||
_targe = entry.target.querySelector('.ant-table-wrapper')
|
||||
}
|
||||
setHeight(getTableScroll({ extraHeight, target: _targe as HTMLElement }))
|
||||
})
|
||||
return height
|
||||
}
|
||||
@@ -179,8 +179,8 @@
|
||||
|
||||
.Resizer {
|
||||
background: @component-background;
|
||||
opacity: 0.2;
|
||||
z-index: 1;
|
||||
opacity: 0.8;
|
||||
z-index: 100;
|
||||
-moz-box-sizing: border-box;
|
||||
-webkit-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
@@ -342,3 +342,8 @@ select:-webkit-autofill:focus {
|
||||
width: auto !important;
|
||||
}
|
||||
}
|
||||
|
||||
pre {
|
||||
word-break: break-all !important;
|
||||
white-space: break-spaces !important;
|
||||
}
|
||||
|
||||
+40
-13
@@ -15,7 +15,18 @@ import './index.less';
|
||||
import vhCheck from 'vh-check';
|
||||
import { version, changeLogLink, changeLog } from '../version';
|
||||
import { useCtx, useTheme } from '@/utils/hooks';
|
||||
import { message, Badge, Modal, Avatar, Dropdown, Menu, Image } from 'antd';
|
||||
import {
|
||||
message,
|
||||
Badge,
|
||||
Modal,
|
||||
Avatar,
|
||||
Dropdown,
|
||||
Menu,
|
||||
Image,
|
||||
Popover,
|
||||
Descriptions,
|
||||
Tooltip,
|
||||
} from 'antd';
|
||||
// @ts-ignore
|
||||
import SockJS from 'sockjs-client';
|
||||
import * as Sentry from '@sentry/react';
|
||||
@@ -32,6 +43,15 @@ export interface SharedContext {
|
||||
reloadUser: (needLoading?: boolean) => void;
|
||||
reloadTheme: () => void;
|
||||
socketMessage: any;
|
||||
systemInfo: TSystemInfo;
|
||||
}
|
||||
|
||||
interface TSystemInfo {
|
||||
branch: 'develop' | 'master';
|
||||
isInitialized: boolean;
|
||||
lastCommitId: string;
|
||||
lastCommitTime: string;
|
||||
version: string;
|
||||
}
|
||||
|
||||
export default function () {
|
||||
@@ -40,7 +60,7 @@ export default function () {
|
||||
const { theme, reloadTheme } = useTheme();
|
||||
const [user, setUser] = useState<any>({});
|
||||
const [loading, setLoading] = useState<boolean>(true);
|
||||
const [systemInfo, setSystemInfo] = useState<{ isInitialized: boolean }>();
|
||||
const [systemInfo, setSystemInfo] = useState<TSystemInfo>();
|
||||
const ws = useRef<any>(null);
|
||||
const [socketMessage, setSocketMessage] = useState<any>();
|
||||
const [collapsed, setCollapsed] = useState(false);
|
||||
@@ -244,7 +264,7 @@ export default function () {
|
||||
selectedKeys={[location.pathname]}
|
||||
loading={loading}
|
||||
ErrorBoundary={Sentry.ErrorBoundary}
|
||||
logo={<Image preview={false} src="http://qn.whyour.cn/logo.png" />}
|
||||
logo={<Image preview={false} src="https://qn.whyour.cn/logo.png" />}
|
||||
title={
|
||||
<>
|
||||
<span style={{ fontSize: 16 }}>控制面板</span>
|
||||
@@ -256,17 +276,23 @@ export default function () {
|
||||
e.stopPropagation();
|
||||
}}
|
||||
>
|
||||
<span
|
||||
style={{
|
||||
fontSize: isFirefox ? 9 : 12,
|
||||
color: '#666',
|
||||
marginLeft: 2,
|
||||
zoom: isSafari ? 0.66 : 0.8,
|
||||
letterSpacing: isQQBrowser ? -2 : 0,
|
||||
}}
|
||||
<Tooltip
|
||||
title={systemInfo?.branch === 'develop' ? '开发版' : '正式版'}
|
||||
>
|
||||
v{version}
|
||||
</span>
|
||||
<Badge size="small" dot={systemInfo?.branch === 'develop'}>
|
||||
<span
|
||||
style={{
|
||||
fontSize: isFirefox ? 9 : 12,
|
||||
color: '#666',
|
||||
marginLeft: 2,
|
||||
zoom: isSafari ? 0.66 : 0.8,
|
||||
letterSpacing: isQQBrowser ? -2 : 0,
|
||||
}}
|
||||
>
|
||||
v{version}
|
||||
</span>
|
||||
</Badge>
|
||||
</Tooltip>
|
||||
</a>
|
||||
</>
|
||||
}
|
||||
@@ -342,6 +368,7 @@ export default function () {
|
||||
reloadUser,
|
||||
reloadTheme,
|
||||
socketMessage,
|
||||
systemInfo,
|
||||
}}
|
||||
/>
|
||||
</ProLayout>
|
||||
|
||||
+96
-126
@@ -43,14 +43,13 @@ import CronLogModal from './logModal';
|
||||
import CronDetailModal from './detail';
|
||||
import cron_parser from 'cron-parser';
|
||||
import { diffTime } from '@/utils/date';
|
||||
import { getTableScroll } from '@/utils/index';
|
||||
import { history, useOutletContext } from '@umijs/max';
|
||||
import './index.less';
|
||||
import ViewCreateModal from './viewCreateModal';
|
||||
import ViewManageModal from './viewManageModal';
|
||||
import pagination from 'antd/lib/pagination';
|
||||
import { FilterValue, SorterResult } from 'antd/lib/table/interface';
|
||||
import { SharedContext } from '@/layouts';
|
||||
import useTableScrollHeight from '@/hooks/useTableScrollHeight';
|
||||
|
||||
const { Text, Paragraph } = Typography;
|
||||
const { Search } = Input;
|
||||
@@ -202,10 +201,10 @@ const Crontab = () => {
|
||||
>
|
||||
{record.last_execution_time
|
||||
? new Date(record.last_execution_time * 1000)
|
||||
.toLocaleString(language, {
|
||||
hour12: false,
|
||||
})
|
||||
.replace(' 24:', ' 00:')
|
||||
.toLocaleString(language, {
|
||||
hour12: false,
|
||||
})
|
||||
.replace(' 24:', ' 00:')
|
||||
: '-'}
|
||||
</span>
|
||||
);
|
||||
@@ -376,7 +375,6 @@ const Crontab = () => {
|
||||
filters: any;
|
||||
}>({} as any);
|
||||
const [viewConf, setViewConf] = useState<any>();
|
||||
const [tableScrollHeight, setTableScrollHeight] = useState<number>();
|
||||
const [isDetailModalVisible, setIsDetailModalVisible] = useState(false);
|
||||
const [detailCron, setDetailCron] = useState<any>();
|
||||
const [searchValue, setSearchValue] = useState('');
|
||||
@@ -389,6 +387,7 @@ const Crontab = () => {
|
||||
const [enabledCronViews, setEnabledCronViews] = useState<any[]>([]);
|
||||
const [moreMenuActive, setMoreMenuActive] = useState(false);
|
||||
const tableRef = useRef<any>();
|
||||
const tableScrollHeight = useTableScrollHeight(tableRef)
|
||||
|
||||
const goToScriptManager = (record: any) => {
|
||||
const cmd = record.command.split(' ') as string[];
|
||||
@@ -415,11 +414,10 @@ const Crontab = () => {
|
||||
const getCrons = () => {
|
||||
setLoading(true);
|
||||
const { page, size, sorter, filters } = pageConf;
|
||||
let url = `${
|
||||
config.apiPrefix
|
||||
}crons?searchValue=${searchText}&page=${page}&size=${size}&filters=${JSON.stringify(
|
||||
filters,
|
||||
)}`;
|
||||
let url = `${config.apiPrefix
|
||||
}crons?searchValue=${searchText}&page=${page}&size=${size}&filters=${JSON.stringify(
|
||||
filters,
|
||||
)}`;
|
||||
if (sorter && sorter.field) {
|
||||
url += `&sorter=${JSON.stringify({
|
||||
field: sorter.field,
|
||||
@@ -584,8 +582,7 @@ const Crontab = () => {
|
||||
onOk() {
|
||||
request
|
||||
.put(
|
||||
`${config.apiPrefix}crons/${
|
||||
record.isDisabled === 1 ? 'enable' : 'disable'
|
||||
`${config.apiPrefix}crons/${record.isDisabled === 1 ? 'enable' : 'disable'
|
||||
}`,
|
||||
{
|
||||
data: [record.id],
|
||||
@@ -628,8 +625,7 @@ const Crontab = () => {
|
||||
onOk() {
|
||||
request
|
||||
.put(
|
||||
`${config.apiPrefix}crons/${
|
||||
record.isPinned === 1 ? 'unpin' : 'pin'
|
||||
`${config.apiPrefix}crons/${record.isPinned === 1 ? 'unpin' : 'pin'
|
||||
}`,
|
||||
{
|
||||
data: [record.id],
|
||||
@@ -770,16 +766,10 @@ const Crontab = () => {
|
||||
|
||||
const onSelectChange = (selectedIds: any[]) => {
|
||||
setSelectedRowIds(selectedIds);
|
||||
|
||||
setTimeout(() => {
|
||||
if (selectedRowIds.length === 0 || selectedIds.length === 0) {
|
||||
setTableScrollHeight(getTableScroll());
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const rowSelection = {
|
||||
selectedRowIds,
|
||||
selectedRowKeys: selectedRowIds,
|
||||
onChange: onSelectChange,
|
||||
};
|
||||
|
||||
@@ -878,97 +868,6 @@ const Crontab = () => {
|
||||
getCronViews();
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (tableRef.current) {
|
||||
setTableScrollHeight(getTableScroll());
|
||||
}
|
||||
}, [tableRef.current]);
|
||||
|
||||
const panelContent = (
|
||||
<>
|
||||
{selectedRowIds.length > 0 && (
|
||||
<div style={{ marginBottom: 16 }}>
|
||||
<Button type="primary" style={{ marginBottom: 5 }} onClick={delCrons}>
|
||||
批量删除
|
||||
</Button>
|
||||
<Button
|
||||
type="primary"
|
||||
onClick={() => operateCrons(0)}
|
||||
style={{ marginLeft: 8, marginBottom: 5 }}
|
||||
>
|
||||
批量启用
|
||||
</Button>
|
||||
<Button
|
||||
type="primary"
|
||||
onClick={() => operateCrons(1)}
|
||||
style={{ marginLeft: 8, marginRight: 8 }}
|
||||
>
|
||||
批量禁用
|
||||
</Button>
|
||||
<Button
|
||||
type="primary"
|
||||
style={{ marginRight: 8 }}
|
||||
onClick={() => operateCrons(2)}
|
||||
>
|
||||
批量运行
|
||||
</Button>
|
||||
<Button type="primary" onClick={() => operateCrons(3)}>
|
||||
批量停止
|
||||
</Button>
|
||||
<Button
|
||||
type="primary"
|
||||
onClick={() => operateCrons(4)}
|
||||
style={{ marginLeft: 8, marginRight: 8 }}
|
||||
>
|
||||
批量置顶
|
||||
</Button>
|
||||
<Button
|
||||
type="primary"
|
||||
onClick={() => operateCrons(5)}
|
||||
style={{ marginLeft: 8, marginRight: 8 }}
|
||||
>
|
||||
批量取消置顶
|
||||
</Button>
|
||||
<Button
|
||||
type="primary"
|
||||
onClick={() => setIsLabelModalVisible(true)}
|
||||
style={{ marginLeft: 8, marginRight: 8 }}
|
||||
>
|
||||
批量修改标签
|
||||
</Button>
|
||||
<span style={{ marginLeft: 8 }}>
|
||||
已选择
|
||||
<a>{selectedRowIds?.length}</a>项
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
<Table
|
||||
ref={tableRef}
|
||||
columns={columns}
|
||||
pagination={{
|
||||
current: pageConf.page,
|
||||
pageSize: pageConf.size,
|
||||
showSizeChanger: true,
|
||||
simple: isPhone,
|
||||
total,
|
||||
showTotal: (total: number, range: number[]) =>
|
||||
`第 ${range[0]}-${range[1]} 条/总共 ${total} 条`,
|
||||
pageSizeOptions: [10, 20, 50, 100, 200, 500, total || 10000].sort(
|
||||
(a, b) => a - b,
|
||||
),
|
||||
}}
|
||||
dataSource={value}
|
||||
rowKey="id"
|
||||
size="middle"
|
||||
scroll={{ x: 1000, y: tableScrollHeight }}
|
||||
loading={loading}
|
||||
rowSelection={rowSelection}
|
||||
rowClassName={getRowClassName}
|
||||
onChange={onPageChange}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
|
||||
const viewAction = (key: string) => {
|
||||
switch (key) {
|
||||
case 'new':
|
||||
@@ -1037,6 +936,7 @@ const Crontab = () => {
|
||||
|
||||
const tabClick = (key: string) => {
|
||||
const view = enabledCronViews.find((x) => x.id == key);
|
||||
setSelectedRowIds([]);
|
||||
setPageConf({ ...pageConf, page: 1 });
|
||||
setViewConf(view ? view : null);
|
||||
};
|
||||
@@ -1089,24 +989,94 @@ const Crontab = () => {
|
||||
{
|
||||
key: 'all',
|
||||
label: '全部任务',
|
||||
children: panelContent,
|
||||
},
|
||||
...[...enabledCronViews].slice(0, 2).map((x) => ({
|
||||
key: x.id,
|
||||
label: x.name,
|
||||
children: panelContent,
|
||||
})),
|
||||
]}
|
||||
>
|
||||
<Tabs.TabPane tab="全部任务" key="all">
|
||||
{panelContent}
|
||||
</Tabs.TabPane>
|
||||
{[...enabledCronViews].slice(0, 2).map((x) => (
|
||||
<Tabs.TabPane tab={x.name} key={x.id}>
|
||||
{panelContent}
|
||||
</Tabs.TabPane>
|
||||
))}
|
||||
</Tabs>
|
||||
/>
|
||||
<div ref={tableRef}>
|
||||
{selectedRowIds.length > 0 && (
|
||||
<div style={{ marginBottom: 16 }}>
|
||||
<Button type="primary" style={{ marginBottom: 5 }} onClick={delCrons}>
|
||||
批量删除
|
||||
</Button>
|
||||
<Button
|
||||
type="primary"
|
||||
onClick={() => operateCrons(0)}
|
||||
style={{ marginLeft: 8, marginBottom: 5 }}
|
||||
>
|
||||
批量启用
|
||||
</Button>
|
||||
<Button
|
||||
type="primary"
|
||||
onClick={() => operateCrons(1)}
|
||||
style={{ marginLeft: 8, marginRight: 8 }}
|
||||
>
|
||||
批量禁用
|
||||
</Button>
|
||||
<Button
|
||||
type="primary"
|
||||
style={{ marginRight: 8 }}
|
||||
onClick={() => operateCrons(2)}
|
||||
>
|
||||
批量运行
|
||||
</Button>
|
||||
<Button type="primary" onClick={() => operateCrons(3)}>
|
||||
批量停止
|
||||
</Button>
|
||||
<Button
|
||||
type="primary"
|
||||
onClick={() => operateCrons(4)}
|
||||
style={{ marginLeft: 8, marginRight: 8 }}
|
||||
>
|
||||
批量置顶
|
||||
</Button>
|
||||
<Button
|
||||
type="primary"
|
||||
onClick={() => operateCrons(5)}
|
||||
style={{ marginLeft: 8, marginRight: 8 }}
|
||||
>
|
||||
批量取消置顶
|
||||
</Button>
|
||||
<Button
|
||||
type="primary"
|
||||
onClick={() => setIsLabelModalVisible(true)}
|
||||
style={{ marginLeft: 8, marginRight: 8 }}
|
||||
>
|
||||
批量修改标签
|
||||
</Button>
|
||||
<span style={{ marginLeft: 8 }}>
|
||||
已选择
|
||||
<a>{selectedRowIds?.length}</a>项
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
<Table
|
||||
columns={columns}
|
||||
pagination={{
|
||||
current: pageConf.page,
|
||||
pageSize: pageConf.size,
|
||||
showSizeChanger: true,
|
||||
simple: isPhone,
|
||||
total,
|
||||
showTotal: (total: number, range: number[]) =>
|
||||
`第 ${range[0]}-${range[1]} 条/总共 ${total} 条`,
|
||||
pageSizeOptions: [10, 20, 50, 100, 200, 500, total || 10000].sort(
|
||||
(a, b) => a - b,
|
||||
),
|
||||
}}
|
||||
dataSource={value}
|
||||
rowKey="id"
|
||||
size="middle"
|
||||
scroll={{ x: 1000, y: tableScrollHeight }}
|
||||
loading={loading}
|
||||
rowSelection={rowSelection}
|
||||
rowClassName={getRowClassName}
|
||||
onChange={onPageChange}
|
||||
/>
|
||||
</div>
|
||||
<CronLogModal
|
||||
visible={isLogModalVisible}
|
||||
handleCancel={() => {
|
||||
|
||||
@@ -27,10 +27,11 @@ import DependenceModal from './modal';
|
||||
import { DndProvider, useDrag, useDrop } from 'react-dnd';
|
||||
import { HTML5Backend } from 'react-dnd-html5-backend';
|
||||
import './index.less';
|
||||
import { getTableScroll } from '@/utils/index';
|
||||
import DependenceLogModal from './logModal';
|
||||
import { useOutletContext } from '@umijs/max';
|
||||
import { SharedContext } from '@/layouts';
|
||||
import useTableScrollHeight from '@/hooks/useTableScrollHeight';
|
||||
|
||||
|
||||
const { Text } = Typography;
|
||||
const { Search } = Input;
|
||||
@@ -164,11 +165,11 @@ const Dependence = () => {
|
||||
const [editedDependence, setEditedDependence] = useState();
|
||||
const [selectedRowIds, setSelectedRowIds] = useState<string[]>([]);
|
||||
const [searchText, setSearchText] = useState('');
|
||||
const [tableScrollHeight, setTableScrollHeight] = useState<number>();
|
||||
const [logDependence, setLogDependence] = useState<any>();
|
||||
const [isLogModalVisible, setIsLogModalVisible] = useState(false);
|
||||
const [type, setType] = useState('nodejs');
|
||||
const tableRef = useRef<any>();
|
||||
const tableScrollHeight = useTableScrollHeight(tableRef, 59)
|
||||
|
||||
const getDependencies = () => {
|
||||
setLoading(true);
|
||||
@@ -283,16 +284,10 @@ const Dependence = () => {
|
||||
|
||||
const onSelectChange = (selectedIds: any[]) => {
|
||||
setSelectedRowIds(selectedIds);
|
||||
|
||||
setTimeout(() => {
|
||||
if (selectedRowIds.length === 0 || selectedIds.length === 0) {
|
||||
setTableScrollHeight(getTableScroll({ extraHeight: 87 }));
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const rowSelection = {
|
||||
selectedRowIds,
|
||||
selectedRowKeys: selectedRowIds,
|
||||
onChange: onSelectChange,
|
||||
};
|
||||
|
||||
@@ -368,12 +363,6 @@ const Dependence = () => {
|
||||
getDependencies();
|
||||
}, [searchText, type]);
|
||||
|
||||
useEffect(() => {
|
||||
if (tableRef.current) {
|
||||
setTableScrollHeight(getTableScroll({ extraHeight: 87 }));
|
||||
}
|
||||
}, [tableRef.current]);
|
||||
|
||||
useEffect(() => {
|
||||
if (logDependence) {
|
||||
localStorage.setItem('logDependence', logDependence.id);
|
||||
@@ -422,54 +411,8 @@ const Dependence = () => {
|
||||
}
|
||||
}, [socketMessage]);
|
||||
|
||||
const panelContent = () => (
|
||||
<>
|
||||
{selectedRowIds.length > 0 && (
|
||||
<div style={{ marginBottom: 16 }}>
|
||||
<Button
|
||||
type="primary"
|
||||
style={{ marginBottom: 5, marginLeft: 8 }}
|
||||
onClick={() => handlereInstallDependencies()}
|
||||
>
|
||||
批量安装
|
||||
</Button>
|
||||
<Button
|
||||
type="primary"
|
||||
style={{ marginBottom: 5, marginLeft: 8 }}
|
||||
onClick={() => delDependencies(false)}
|
||||
>
|
||||
批量删除
|
||||
</Button>
|
||||
<Button
|
||||
type="primary"
|
||||
style={{ marginBottom: 5, marginLeft: 8 }}
|
||||
onClick={() => delDependencies(true)}
|
||||
>
|
||||
批量强制删除
|
||||
</Button>
|
||||
<span style={{ marginLeft: 8 }}>
|
||||
已选择
|
||||
<a>{selectedRowIds?.length}</a>项
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
<DndProvider backend={HTML5Backend}>
|
||||
<Table
|
||||
ref={tableRef}
|
||||
columns={columns}
|
||||
rowSelection={rowSelection}
|
||||
pagination={false}
|
||||
dataSource={value}
|
||||
rowKey="id"
|
||||
size="middle"
|
||||
scroll={{ x: 768, y: tableScrollHeight }}
|
||||
loading={loading}
|
||||
/>
|
||||
</DndProvider>
|
||||
</>
|
||||
);
|
||||
|
||||
const onTabChange = (activeKey: string) => {
|
||||
setSelectedRowIds([]);
|
||||
setType(activeKey);
|
||||
};
|
||||
|
||||
@@ -502,20 +445,60 @@ const Dependence = () => {
|
||||
{
|
||||
key: 'nodejs',
|
||||
label: 'NodeJs',
|
||||
children: panelContent(),
|
||||
},
|
||||
{
|
||||
key: 'python3',
|
||||
label: 'Python3',
|
||||
children: panelContent(),
|
||||
},
|
||||
{
|
||||
key: 'linux',
|
||||
label: 'Linux',
|
||||
children: panelContent(),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
<div ref={tableRef}>
|
||||
{selectedRowIds.length > 0 && (
|
||||
<div style={{ marginBottom: 16 }}>
|
||||
<Button
|
||||
type="primary"
|
||||
style={{ marginBottom: 5, marginLeft: 8 }}
|
||||
onClick={() => handlereInstallDependencies()}
|
||||
>
|
||||
批量安装
|
||||
</Button>
|
||||
<Button
|
||||
type="primary"
|
||||
style={{ marginBottom: 5, marginLeft: 8 }}
|
||||
onClick={() => delDependencies(false)}
|
||||
>
|
||||
批量删除
|
||||
</Button>
|
||||
<Button
|
||||
type="primary"
|
||||
style={{ marginBottom: 5, marginLeft: 8 }}
|
||||
onClick={() => delDependencies(true)}
|
||||
>
|
||||
批量强制删除
|
||||
</Button>
|
||||
<span style={{ marginLeft: 8 }}>
|
||||
已选择
|
||||
<a>{selectedRowIds?.length}</a>项
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
<DndProvider backend={HTML5Backend}>
|
||||
<Table
|
||||
columns={columns}
|
||||
rowSelection={rowSelection}
|
||||
pagination={false}
|
||||
dataSource={value}
|
||||
rowKey="id"
|
||||
size="middle"
|
||||
scroll={{ x: 768, y: tableScrollHeight }}
|
||||
loading={loading}
|
||||
/>
|
||||
</DndProvider>
|
||||
</div>
|
||||
<DependenceModal
|
||||
visible={isModalVisible}
|
||||
handleCancel={handleCancel}
|
||||
|
||||
Vendored
+7
-18
@@ -28,9 +28,10 @@ import EditNameModal from './editNameModal';
|
||||
import { DndProvider, useDrag, useDrop } from 'react-dnd';
|
||||
import { HTML5Backend } from 'react-dnd-html5-backend';
|
||||
import './index.less';
|
||||
import { exportJson, getTableScroll } from '@/utils/index';
|
||||
import { exportJson } from '@/utils/index';
|
||||
import { useOutletContext } from '@umijs/max';
|
||||
import { SharedContext } from '@/layouts';
|
||||
import useTableScrollHeight from '@/hooks/useTableScrollHeight';
|
||||
|
||||
const { Text, Paragraph } = Typography;
|
||||
const { Search } = Input;
|
||||
@@ -134,6 +135,7 @@ const Env = () => {
|
||||
textAlign: 'left',
|
||||
}}
|
||||
ellipsis={{ tooltip: text, rows: 2 }}
|
||||
copyable
|
||||
>
|
||||
{text}
|
||||
</Paragraph>
|
||||
@@ -252,9 +254,9 @@ const Env = () => {
|
||||
const [editedEnv, setEditedEnv] = useState();
|
||||
const [selectedRowIds, setSelectedRowIds] = useState<string[]>([]);
|
||||
const [searchText, setSearchText] = useState('');
|
||||
const [tableScrollHeight, setTableScrollHeight] = useState<number>();
|
||||
const [importLoading, setImportLoading] = useState(false);
|
||||
const tableRef = useRef<any>();
|
||||
const tableScrollHeight = useTableScrollHeight(tableRef, 59)
|
||||
|
||||
const getEnvs = () => {
|
||||
setLoading(true);
|
||||
@@ -284,8 +286,7 @@ const Env = () => {
|
||||
onOk() {
|
||||
request
|
||||
.put(
|
||||
`${config.apiPrefix}envs/${
|
||||
record.status === Status.已禁用 ? 'enable' : 'disable'
|
||||
`${config.apiPrefix}envs/${record.status === Status.已禁用 ? 'enable' : 'disable'
|
||||
}`,
|
||||
{
|
||||
data: [record.id],
|
||||
@@ -407,16 +408,10 @@ const Env = () => {
|
||||
|
||||
const onSelectChange = (selectedIds: any[]) => {
|
||||
setSelectedRowIds(selectedIds);
|
||||
|
||||
setTimeout(() => {
|
||||
if (selectedRowIds.length === 0 || selectedIds.length === 0) {
|
||||
setTableScrollHeight(getTableScroll({ extraHeight: 87 }));
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
const rowSelection = {
|
||||
selectedRowIds,
|
||||
selectedRowKeys: selectedRowIds,
|
||||
onChange: onSelectChange,
|
||||
};
|
||||
|
||||
@@ -508,12 +503,6 @@ const Env = () => {
|
||||
getEnvs();
|
||||
}, [searchText]);
|
||||
|
||||
useEffect(() => {
|
||||
if (tableRef.current) {
|
||||
setTableScrollHeight(getTableScroll({ extraHeight: 87 }));
|
||||
}
|
||||
}, [tableRef.current]);
|
||||
|
||||
return (
|
||||
<PageContainer
|
||||
className="ql-container-wrapper env-wrapper"
|
||||
@@ -598,7 +587,7 @@ const Env = () => {
|
||||
scroll={{ x: 1000, y: tableScrollHeight }}
|
||||
components={components}
|
||||
loading={loading}
|
||||
onRow={(record: any, index: number) => {
|
||||
onRow={(record: any, index: number | undefined) => {
|
||||
return {
|
||||
index,
|
||||
moveRow,
|
||||
|
||||
@@ -232,7 +232,7 @@ const Initialization = () => {
|
||||
<img
|
||||
alt="logo"
|
||||
className={styles.logo}
|
||||
src="http://qn.whyour.cn/logo.png"
|
||||
src="https://qn.whyour.cn/logo.png"
|
||||
/>
|
||||
<span className={styles.title}>初始化配置</span>
|
||||
</div>
|
||||
|
||||
@@ -21,7 +21,8 @@ import { useOutletContext } from '@umijs/max';
|
||||
import { SharedContext } from '@/layouts';
|
||||
import { DeleteOutlined } from '@ant-design/icons';
|
||||
import { depthFirstSearch } from '@/utils';
|
||||
import { debounce, uniq } from 'lodash';
|
||||
import debounce from 'lodash/groupBy';
|
||||
import uniq from 'lodash/uniq';
|
||||
import useFilterTreeData from '@/hooks/useFilterTreeData';
|
||||
|
||||
const { Text } = Typography;
|
||||
|
||||
@@ -129,7 +129,7 @@ const Login = () => {
|
||||
<img
|
||||
alt="logo"
|
||||
className={styles.logo}
|
||||
src="http://qn.whyour.cn/logo.png"
|
||||
src="https://qn.whyour.cn/logo.png"
|
||||
/>
|
||||
<span className={styles.title}>
|
||||
{twoFactor ? '两步验证' : config.siteName}
|
||||
|
||||
@@ -253,7 +253,14 @@ const EditModal = ({
|
||||
editorRef.current = editor;
|
||||
}}
|
||||
/>
|
||||
<pre style={{ height: '100%', whiteSpace: 'break-spaces' }}>{log}</pre>
|
||||
<pre
|
||||
style={{
|
||||
height: '100%',
|
||||
padding: '0 15px',
|
||||
}}
|
||||
>
|
||||
{log}
|
||||
</pre>
|
||||
</SplitPane>
|
||||
<SaveModal
|
||||
visible={saveModalVisible}
|
||||
|
||||
@@ -38,7 +38,7 @@ import { parse } from 'query-string';
|
||||
import { depthFirstSearch } from '@/utils';
|
||||
import { SharedContext } from '@/layouts';
|
||||
import useFilterTreeData from '@/hooks/useFilterTreeData';
|
||||
import { uniq } from 'lodash';
|
||||
import uniq from 'lodash/uniq';
|
||||
|
||||
const { Text } = Typography;
|
||||
|
||||
|
||||
@@ -1,16 +1,23 @@
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { Typography, Input, Form, Button, message } from 'antd';
|
||||
import { Typography, Input, Form, Button, message, Descriptions } from 'antd';
|
||||
import styles from './index.less';
|
||||
import { SharedContext } from '@/layouts';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
const { Link } = Typography;
|
||||
|
||||
const About = () => {
|
||||
enum TVersion {
|
||||
'develop' = '开发版',
|
||||
'master' = '正式版',
|
||||
}
|
||||
|
||||
const About = ({ systemInfo }: { systemInfo: SharedContext['systemInfo'] }) => {
|
||||
return (
|
||||
<div className={styles.container}>
|
||||
<img
|
||||
alt="logo"
|
||||
style={{ width: 140, marginRight: 20 }}
|
||||
src="http://qn.whyour.cn/logo.png"
|
||||
src="https://qn.whyour.cn/logo.png"
|
||||
/>
|
||||
<div className={styles.right}>
|
||||
<span className={styles.title}>青龙</span>
|
||||
@@ -19,6 +26,17 @@ const About = () => {
|
||||
task management panel that supports typescript, javaScript, python3,
|
||||
and shell.)
|
||||
</span>
|
||||
<Descriptions>
|
||||
<Descriptions.Item label="版本" span={3}>
|
||||
{TVersion[systemInfo.branch]} v{systemInfo.version}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="更新时间" span={3}>
|
||||
{dayjs(systemInfo.lastCommitTime).format('YYYY-MM-DD HH:mm:ss')}
|
||||
</Descriptions.Item>
|
||||
<Descriptions.Item label="更新ID" span={3}>
|
||||
{systemInfo.lastCommitId}
|
||||
</Descriptions.Item>
|
||||
</Descriptions>
|
||||
<div>
|
||||
<Link
|
||||
href="https://github.com/whyour/qinglong"
|
||||
|
||||
@@ -77,8 +77,6 @@ const CheckUpdate = ({ socketMessage }: any) => {
|
||||
content: (
|
||||
<pre
|
||||
style={{
|
||||
wordBreak: 'break-all',
|
||||
whiteSpace: 'pre-wrap',
|
||||
paddingTop: 15,
|
||||
fontSize: 12,
|
||||
fontWeight: 400,
|
||||
@@ -111,16 +109,14 @@ const CheckUpdate = ({ socketMessage }: any) => {
|
||||
title: '更新中...',
|
||||
centered: true,
|
||||
content: (
|
||||
<pre
|
||||
style={{
|
||||
wordBreak: 'break-all',
|
||||
whiteSpace: 'pre-wrap',
|
||||
fontSize: 12,
|
||||
fontWeight: 400,
|
||||
}}
|
||||
>
|
||||
{value}
|
||||
</pre>
|
||||
<pre
|
||||
style={{
|
||||
fontSize: 12,
|
||||
fontWeight: 400,
|
||||
}}
|
||||
>
|
||||
{value}
|
||||
</pre>
|
||||
),
|
||||
});
|
||||
};
|
||||
@@ -146,8 +142,6 @@ const CheckUpdate = ({ socketMessage }: any) => {
|
||||
<>
|
||||
<pre
|
||||
style={{
|
||||
wordBreak: 'break-all',
|
||||
whiteSpace: 'pre-wrap',
|
||||
fontSize: 12,
|
||||
fontWeight: 400,
|
||||
}}
|
||||
|
||||
@@ -18,5 +18,12 @@
|
||||
.desc {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
:global {
|
||||
.ant-descriptions-row > th,
|
||||
.ant-descriptions-row > td {
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,8 +40,15 @@ const optionsWithDisabled = [
|
||||
];
|
||||
|
||||
const Setting = () => {
|
||||
const { headerStyle, isPhone, user, reloadUser, reloadTheme, socketMessage } =
|
||||
useOutletContext<SharedContext>();
|
||||
const {
|
||||
headerStyle,
|
||||
isPhone,
|
||||
user,
|
||||
reloadUser,
|
||||
reloadTheme,
|
||||
socketMessage,
|
||||
systemInfo,
|
||||
} = useOutletContext<SharedContext>();
|
||||
const columns = [
|
||||
{
|
||||
title: '名称',
|
||||
@@ -411,7 +418,7 @@ const Setting = () => {
|
||||
{
|
||||
key: 'about',
|
||||
label: '关于',
|
||||
children: <About />,
|
||||
children: <About systemInfo={systemInfo} />,
|
||||
},
|
||||
]}
|
||||
></Tabs>
|
||||
|
||||
@@ -29,11 +29,11 @@ import config from '@/utils/config';
|
||||
import { PageContainer } from '@ant-design/pro-layout';
|
||||
import { request } from '@/utils/http';
|
||||
import SubscriptionModal from './modal';
|
||||
import { getTableScroll } from '@/utils/index';
|
||||
import { history, useOutletContext } from '@umijs/max';
|
||||
import './index.less';
|
||||
import SubscriptionLogModal from './logModal';
|
||||
import { SharedContext } from '@/layouts';
|
||||
import useTableScrollHeight from '@/hooks/useTableScrollHeight';
|
||||
|
||||
const { Text, Paragraph } = Typography;
|
||||
const { Search } = Input;
|
||||
@@ -243,11 +243,11 @@ const Subscription = () => {
|
||||
const [searchText, setSearchText] = useState('');
|
||||
const [currentPage, setCurrentPage] = useState(1);
|
||||
const [pageSize, setPageSize] = useState(20);
|
||||
const [tableScrollHeight, setTableScrollHeight] = useState<number>();
|
||||
const [searchValue, setSearchValue] = useState('');
|
||||
const [isLogModalVisible, setIsLogModalVisible] = useState(false);
|
||||
const [logSubscription, setLogSubscription] = useState<any>();
|
||||
const tableRef = useRef<any>();
|
||||
const tableScrollHeight = useTableScrollHeight(tableRef)
|
||||
|
||||
const runSubscription = (record: any, index: number) => {
|
||||
Modal.confirm({
|
||||
@@ -542,12 +542,6 @@ const Subscription = () => {
|
||||
setPageSize(parseInt(localStorage.getItem('pageSize') || '20'));
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (tableRef.current) {
|
||||
setTableScrollHeight(getTableScroll());
|
||||
}
|
||||
}, [tableRef.current]);
|
||||
|
||||
return (
|
||||
<PageContainer
|
||||
className="ql-container-wrapper subscriptiontab-wrapper"
|
||||
|
||||
+5
-9
@@ -180,19 +180,15 @@ export default function browserType() {
|
||||
*/
|
||||
export function getTableScroll({
|
||||
extraHeight,
|
||||
id,
|
||||
}: { extraHeight?: number; id?: string } = {}) {
|
||||
target,
|
||||
}: { extraHeight?: number; target?: HTMLElement } = {}) {
|
||||
if (typeof extraHeight == 'undefined') {
|
||||
// 47 + 40 + 12
|
||||
extraHeight = 99;
|
||||
}
|
||||
let tHeader = null;
|
||||
if (id) {
|
||||
tHeader = document.getElementById(id)
|
||||
? document
|
||||
.getElementById(id)!
|
||||
.getElementsByClassName('ant-table-thead')[0]
|
||||
: null;
|
||||
if (target) {
|
||||
tHeader = target;
|
||||
} else {
|
||||
tHeader = document.querySelector('.ant-table-wrapper');
|
||||
}
|
||||
@@ -202,7 +198,7 @@ export function getTableScroll({
|
||||
if (tHeader) {
|
||||
mainTop = tHeader.getBoundingClientRect().top;
|
||||
}
|
||||
|
||||
|
||||
//窗体高度-表格内容顶部的高度-表格内容底部的高度
|
||||
let height = document.body.clientHeight - mainTop - extraHeight;
|
||||
return height;
|
||||
|
||||
+4
-8
@@ -1,9 +1,5 @@
|
||||
export const version = '2.14.9';
|
||||
export const changeLogLink = 'https://t.me/jiao_long/336';
|
||||
export const changeLog = `2.14.9 版本说明
|
||||
1. 通知支持飞书和智能微秘书,感谢 https://github.com/leochen-g
|
||||
2. webhook通知body支持嵌套json
|
||||
3. 修复shell获取磁盘占用
|
||||
4. 修复定时任务移动端滚动
|
||||
5. 其他bug修复
|
||||
export const version = '2.14.12';
|
||||
export const changeLogLink = 'https://t.me/jiao_long/339';
|
||||
export const changeLog = `2.14.12 版本说明
|
||||
1. 修复可能出现移动或者创建环境变量出错
|
||||
`;
|
||||
|
||||
Reference in New Issue
Block a user