mirror of
https://github.com/whyour/qinglong.git
synced 2025-11-08 15:06:08 +08:00
Merge 70d7099abe into 73f8f3c5fa
This commit is contained in:
commit
ffc78c2e3d
|
|
@ -3,7 +3,7 @@ import { Container } from 'typedi';
|
|||
import { Logger } from 'winston';
|
||||
import SubscriptionService from '../services/subscription';
|
||||
import { celebrate, Joi } from 'celebrate';
|
||||
import cron_parser from 'cron-parser';
|
||||
import { parseExpression } from 'cron-parser';
|
||||
const route = Router();
|
||||
|
||||
export default (app: Router) => {
|
||||
|
|
@ -60,7 +60,7 @@ export default (app: Router) => {
|
|||
try {
|
||||
if (
|
||||
!req.body.schedule ||
|
||||
cron_parser.parseExpression(req.body.schedule).hasNext()
|
||||
parseExpression(req.body.schedule).hasNext()
|
||||
) {
|
||||
const subscriptionService = Container.get(SubscriptionService);
|
||||
const data = await subscriptionService.create(req.body);
|
||||
|
|
@ -193,7 +193,7 @@ export default (app: Router) => {
|
|||
if (
|
||||
!req.body.schedule ||
|
||||
typeof req.body.schedule === 'object' ||
|
||||
cron_parser.parseExpression(req.body.schedule).hasNext()
|
||||
parseExpression(req.body.schedule).hasNext()
|
||||
) {
|
||||
const subscriptionService = Container.get(SubscriptionService);
|
||||
const data = await subscriptionService.update(req.body);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import path from 'path';
|
||||
import fs from 'fs/promises';
|
||||
import chokidar from 'chokidar';
|
||||
import chokidar, { FSWatcher } from 'chokidar';
|
||||
import config from '../config/index';
|
||||
import { fileExist, promiseExec, rmPath } from '../config/util';
|
||||
|
||||
|
|
@ -55,9 +55,9 @@ export default async (src: string = 'deps') => {
|
|||
const watcher = chokidar.watch(source, {
|
||||
ignored: /(^|[\/\\])\../, // ignore dotfiles
|
||||
persistent: true,
|
||||
});
|
||||
}) as any;
|
||||
|
||||
watcher
|
||||
.on('add', (path) => linkToNodeModule(src))
|
||||
.on('change', (path) => linkToNodeModule(src));
|
||||
.on('add', (_path: string) => linkToNodeModule(src))
|
||||
.on('change', (_path: string) => linkToNodeModule(src));
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import config from '../config';
|
|||
import { Crontab, CrontabModel, CrontabStatus } from '../data/cron';
|
||||
import { exec, execSync } from 'child_process';
|
||||
import fs from 'fs/promises';
|
||||
import cron_parser from 'cron-parser';
|
||||
import { parseExpression } from 'cron-parser';
|
||||
import {
|
||||
getFileContentByName,
|
||||
fileExist,
|
||||
|
|
@ -670,7 +670,7 @@ export default class CronService {
|
|||
if (
|
||||
command &&
|
||||
schedule &&
|
||||
cron_parser.parseExpression(schedule).hasNext()
|
||||
parseExpression(schedule).hasNext()
|
||||
) {
|
||||
const name = namePrefix + '_' + index;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import { Joi } from 'celebrate';
|
||||
import cron_parser from 'cron-parser';
|
||||
import { parseExpression } from 'cron-parser';
|
||||
import { ScheduleType } from '../interface/schedule';
|
||||
|
||||
const validateSchedule = (value: string, helpers: any) => {
|
||||
|
|
@ -11,7 +11,7 @@ const validateSchedule = (value: string, helpers: any) => {
|
|||
}
|
||||
|
||||
try {
|
||||
if (cron_parser.parseExpression(value).hasNext()) {
|
||||
if (parseExpression(value).hasNext()) {
|
||||
return value;
|
||||
}
|
||||
} catch (e) {
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import {
|
|||
} from 'antd';
|
||||
import { request } from '@/utils/http';
|
||||
import config from '@/utils/config';
|
||||
import cron_parser from 'cron-parser';
|
||||
import { parseExpression } from 'cron-parser';
|
||||
import isNil from 'lodash/isNil';
|
||||
|
||||
const { Option } = Select;
|
||||
|
|
@ -381,7 +381,7 @@ const SubscriptionModal = ({
|
|||
if (
|
||||
scheduleType === 'interval' ||
|
||||
!value ||
|
||||
cron_parser.parseExpression(value).hasNext()
|
||||
parseExpression(value).hasNext()
|
||||
) {
|
||||
return Promise.resolve();
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import intl from 'react-intl-universal';
|
||||
import { LANG_MAP, LOG_END_SYMBOL } from './const';
|
||||
import cron_parser from 'cron-parser';
|
||||
import { parseExpression } from 'cron-parser';
|
||||
import { ICrontab } from '@/pages/crontab/type';
|
||||
|
||||
export default function browserType() {
|
||||
|
|
@ -333,7 +333,7 @@ export function getCommandScript(
|
|||
|
||||
export function parseCrontab(schedule: string): Date | null {
|
||||
try {
|
||||
const time = cron_parser.parseExpression(schedule);
|
||||
const time = parseExpression(schedule);
|
||||
if (time) {
|
||||
return time.next().toDate();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user