mirror of
https://github.com/whyour/qinglong.git
synced 2025-07-07 11:56:08 +08:00
修复定时任务状态筛选
This commit is contained in:
parent
1718120623
commit
f970322f0a
|
@ -267,7 +267,7 @@ export default class CronService {
|
||||||
let q: any = {};
|
let q: any = {};
|
||||||
if (!filterQuery[key]) continue;
|
if (!filterQuery[key]) continue;
|
||||||
if (key === 'status') {
|
if (key === 'status') {
|
||||||
if (filterQuery[key].includes(2)) {
|
if (filterQuery[key].includes(CrontabStatus.disabled)) {
|
||||||
q = { [Op.or]: [{ [key]: filterQuery[key] }, { isDisabled: 1 }] };
|
q = { [Op.or]: [{ [key]: filterQuery[key] }, { isDisabled: 1 }] };
|
||||||
} else {
|
} else {
|
||||||
q = { [Op.and]: [{ [key]: filterQuery[key] }, { isDisabled: 0 }] };
|
q = { [Op.and]: [{ [key]: filterQuery[key] }, { isDisabled: 0 }] };
|
||||||
|
|
|
@ -22,7 +22,7 @@ import {
|
||||||
PauseCircleOutlined,
|
PauseCircleOutlined,
|
||||||
FullscreenOutlined,
|
FullscreenOutlined,
|
||||||
} from '@ant-design/icons';
|
} from '@ant-design/icons';
|
||||||
import { CrontabStatus } from './index';
|
import { CrontabStatus } from './type';
|
||||||
import { diffTime } from '@/utils/date';
|
import { diffTime } from '@/utils/date';
|
||||||
import { request } from '@/utils/http';
|
import { request } from '@/utils/http';
|
||||||
import config from '@/utils/config';
|
import config from '@/utils/config';
|
||||||
|
|
|
@ -54,51 +54,11 @@ import useTableScrollHeight from '@/hooks/useTableScrollHeight';
|
||||||
import { getCommandScript, parseCrontab } from '@/utils';
|
import { getCommandScript, parseCrontab } from '@/utils';
|
||||||
import { ColumnProps } from 'antd/lib/table';
|
import { ColumnProps } from 'antd/lib/table';
|
||||||
import { useVT } from 'virtualizedtableforantd4';
|
import { useVT } from 'virtualizedtableforantd4';
|
||||||
|
import { ICrontab, OperationName, OperationPath, CrontabStatus } from './type';
|
||||||
|
|
||||||
const { Text, Paragraph } = Typography;
|
const { Text, Paragraph } = Typography;
|
||||||
const { Search } = Input;
|
const { Search } = Input;
|
||||||
|
|
||||||
export enum CrontabStatus {
|
|
||||||
'running',
|
|
||||||
'queued',
|
|
||||||
'idle',
|
|
||||||
'disabled',
|
|
||||||
}
|
|
||||||
|
|
||||||
const CrontabSort: any = { 0: 0, 5: 1, 3: 2, 1: 3, 4: 4 };
|
|
||||||
|
|
||||||
enum OperationName {
|
|
||||||
'启用',
|
|
||||||
'禁用',
|
|
||||||
'运行',
|
|
||||||
'停止',
|
|
||||||
'置顶',
|
|
||||||
'取消置顶',
|
|
||||||
}
|
|
||||||
|
|
||||||
enum OperationPath {
|
|
||||||
'enable',
|
|
||||||
'disable',
|
|
||||||
'run',
|
|
||||||
'stop',
|
|
||||||
'pin',
|
|
||||||
'unpin',
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ICrontab {
|
|
||||||
name: string;
|
|
||||||
command: string;
|
|
||||||
schedule: string;
|
|
||||||
id: number;
|
|
||||||
status: number;
|
|
||||||
isDisabled?: 1 | 0;
|
|
||||||
isPinned?: 1 | 0;
|
|
||||||
labels?: string[];
|
|
||||||
last_running_time?: number;
|
|
||||||
last_execution_time?: number;
|
|
||||||
nextRunTime: Date;
|
|
||||||
}
|
|
||||||
|
|
||||||
const Crontab = () => {
|
const Crontab = () => {
|
||||||
const { headerStyle, isPhone, theme } = useOutletContext<SharedContext>();
|
const { headerStyle, isPhone, theme } = useOutletContext<SharedContext>();
|
||||||
const columns: ColumnProps<ICrontab>[] = [
|
const columns: ColumnProps<ICrontab>[] = [
|
||||||
|
@ -264,19 +224,19 @@ const Crontab = () => {
|
||||||
filters: [
|
filters: [
|
||||||
{
|
{
|
||||||
text: '运行中',
|
text: '运行中',
|
||||||
value: 0,
|
value: CrontabStatus.running,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: '空闲中',
|
text: '空闲中',
|
||||||
value: 1,
|
value: CrontabStatus.idle,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: '已禁用',
|
text: '已禁用',
|
||||||
value: 2,
|
value: CrontabStatus.disabled,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: '队列中',
|
text: '队列中',
|
||||||
value: 3,
|
value: CrontabStatus.queued,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
render: (text, record) => (
|
render: (text, record) => (
|
||||||
|
|
|
@ -8,13 +8,8 @@ import {
|
||||||
} from '@ant-design/icons';
|
} from '@ant-design/icons';
|
||||||
import { PageLoading } from '@ant-design/pro-layout';
|
import { PageLoading } from '@ant-design/pro-layout';
|
||||||
import { logEnded } from '@/utils';
|
import { logEnded } from '@/utils';
|
||||||
|
import { CrontabStatus } from './type';
|
||||||
|
|
||||||
enum CrontabStatus {
|
|
||||||
'running',
|
|
||||||
'idle',
|
|
||||||
'disabled',
|
|
||||||
'queued',
|
|
||||||
}
|
|
||||||
const { Countdown } = Statistic;
|
const { Countdown } = Statistic;
|
||||||
|
|
||||||
const CronLogModal = ({
|
const CronLogModal = ({
|
||||||
|
|
38
src/pages/crontab/type.ts
Normal file
38
src/pages/crontab/type.ts
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
export enum CrontabStatus {
|
||||||
|
'running',
|
||||||
|
'queued',
|
||||||
|
'idle',
|
||||||
|
'disabled',
|
||||||
|
}
|
||||||
|
|
||||||
|
export enum OperationName {
|
||||||
|
'启用',
|
||||||
|
'禁用',
|
||||||
|
'运行',
|
||||||
|
'停止',
|
||||||
|
'置顶',
|
||||||
|
'取消置顶',
|
||||||
|
}
|
||||||
|
|
||||||
|
export enum OperationPath {
|
||||||
|
'enable',
|
||||||
|
'disable',
|
||||||
|
'run',
|
||||||
|
'stop',
|
||||||
|
'pin',
|
||||||
|
'unpin',
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ICrontab {
|
||||||
|
name: string;
|
||||||
|
command: string;
|
||||||
|
schedule: string;
|
||||||
|
id: number;
|
||||||
|
status: number;
|
||||||
|
isDisabled?: 1 | 0;
|
||||||
|
isPinned?: 1 | 0;
|
||||||
|
labels?: string[];
|
||||||
|
last_running_time?: number;
|
||||||
|
last_execution_time?: number;
|
||||||
|
nextRunTime: Date;
|
||||||
|
}
|
|
@ -14,6 +14,7 @@ import config from '@/utils/config';
|
||||||
import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons';
|
import { MinusCircleOutlined, PlusOutlined } from '@ant-design/icons';
|
||||||
import IconFont from '@/components/iconfont';
|
import IconFont from '@/components/iconfont';
|
||||||
import get from 'lodash/get';
|
import get from 'lodash/get';
|
||||||
|
import { CrontabStatus } from './type';
|
||||||
|
|
||||||
const PROPERTIES = [
|
const PROPERTIES = [
|
||||||
{ name: '命令', value: 'command' },
|
{ name: '命令', value: 'command' },
|
||||||
|
@ -47,9 +48,9 @@ const SORTTYPES = [
|
||||||
|
|
||||||
const STATUS_MAP = {
|
const STATUS_MAP = {
|
||||||
status: [
|
status: [
|
||||||
{ name: '运行中', value: 0 },
|
{ name: '运行中', value: CrontabStatus.running },
|
||||||
{ name: '空闲中', value: 1 },
|
{ name: '空闲中', value: CrontabStatus.idle },
|
||||||
{ name: '已禁用', value: 2 },
|
{ name: '已禁用', value: CrontabStatus.disabled },
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user