mirror of
https://github.com/whyour/qinglong.git
synced 2025-05-23 14:56:07 +08:00
修改定时任务置顶样式
This commit is contained in:
parent
0b9066525a
commit
5907553670
|
@ -174,7 +174,10 @@ export default (app: Router) => {
|
||||||
async (req: Request, res: Response, next: NextFunction) => {
|
async (req: Request, res: Response, next: NextFunction) => {
|
||||||
try {
|
try {
|
||||||
const systemService = Container.get(SystemService);
|
const systemService = Container.get(SystemService);
|
||||||
const uniqPath = await getUniqPath(req.body.command);
|
const command = req.body.command
|
||||||
|
const idStr = `cat ${config.crontabFile} | grep -E "${command}" | perl -pe "s|.*ID=(.*) ${command}.*|\\1|" | head -1 | awk -F " " '{print $1}' | xargs echo -n`;
|
||||||
|
let id = await promiseExec(idStr);
|
||||||
|
const uniqPath = await getUniqPath(command, id);
|
||||||
const logTime = dayjs().format('YYYY-MM-DD-HH-mm-ss-SSS');
|
const logTime = dayjs().format('YYYY-MM-DD-HH-mm-ss-SSS');
|
||||||
const logPath = `${uniqPath}/${logTime}.log`;
|
const logPath = `${uniqPath}/${logTime}.log`;
|
||||||
res.setHeader('Content-type', 'application/octet-stream');
|
res.setHeader('Content-type', 'application/octet-stream');
|
||||||
|
|
|
@ -314,7 +314,7 @@ interface IFile {
|
||||||
export function dirSort(a: IFile, b: IFile): number {
|
export function dirSort(a: IFile, b: IFile): number {
|
||||||
if (a.type !== b.type) {
|
if (a.type !== b.type) {
|
||||||
return FileType[a.type] < FileType[b.type] ? -1 : 1
|
return FileType[a.type] < FileType[b.type] ? -1 : 1
|
||||||
}else if (a.mtime !== b.mtime) {
|
} else if (a.mtime !== b.mtime) {
|
||||||
return a.mtime > b.mtime ? -1 : 1
|
return a.mtime > b.mtime ? -1 : 1
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -529,11 +529,8 @@ export async function parseContentVersion(content: string): Promise<IVersion> {
|
||||||
return load(content) as IVersion;
|
return load(content) as IVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getUniqPath(command: string): Promise<string> {
|
export async function getUniqPath(command: string, id: string): Promise<string> {
|
||||||
const idStr = `cat ${config.crontabFile} | grep -E "${command}" | perl -pe "s|.*ID=(.*) ${command}.*|\\1|" | head -1 | awk -F " " '{print $1}' | xargs echo -n`;
|
if (/^\d+$/.test(id)) {
|
||||||
let id = await promiseExec(idStr);
|
|
||||||
|
|
||||||
if (/^\d\d*\d$/.test(id)) {
|
|
||||||
id = `_${id}`;
|
id = `_${id}`;
|
||||||
} else {
|
} else {
|
||||||
id = '';
|
id = '';
|
||||||
|
|
|
@ -392,10 +392,10 @@ export default class CronService {
|
||||||
}
|
}
|
||||||
|
|
||||||
let { id, command, log_path } = cron;
|
let { id, command, log_path } = cron;
|
||||||
const uniqPath = await getUniqPath(command);
|
const uniqPath = await getUniqPath(command, `${id}`);
|
||||||
const logTime = dayjs().format('YYYY-MM-DD-HH-mm-ss-SSS');
|
const logTime = dayjs().format('YYYY-MM-DD-HH-mm-ss-SSS');
|
||||||
const logDirPath = path.resolve(config.logPath, `${uniqPath}`);
|
const logDirPath = path.resolve(config.logPath, `${uniqPath}`);
|
||||||
if (!log_path?.includes(uniqPath)) {
|
if (log_path?.split('/')?.every(x => x !== uniqPath)) {
|
||||||
fs.mkdirSync(logDirPath, { recursive: true });
|
fs.mkdirSync(logDirPath, { recursive: true });
|
||||||
}
|
}
|
||||||
const logPath = `${uniqPath}/${logTime}.log`;
|
const logPath = `${uniqPath}/${logTime}.log`;
|
||||||
|
|
|
@ -193,3 +193,7 @@ body[data-mode='desktop'] {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.cron.pinned-cron > td {
|
||||||
|
background: #fafafa;
|
||||||
|
}
|
|
@ -71,50 +71,22 @@ const Crontab = () => {
|
||||||
fixed: 'left',
|
fixed: 'left',
|
||||||
width: 120,
|
width: 120,
|
||||||
render: (text: string, record: any) => (
|
render: (text: string, record: any) => (
|
||||||
<>
|
<Paragraph
|
||||||
|
style={{
|
||||||
|
wordBreak: 'break-all',
|
||||||
|
marginBottom: 0,
|
||||||
|
}}
|
||||||
|
ellipsis={{ tooltip: text, rows: 2 }}
|
||||||
|
>
|
||||||
<a
|
<a
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setDetailCron(record);
|
setDetailCron(record);
|
||||||
setIsDetailModalVisible(true);
|
setIsDetailModalVisible(true);
|
||||||
}}
|
}}
|
||||||
>
|
|
||||||
{record.labels?.length > 0 && record.labels[0] !== '' && false ? (
|
|
||||||
<Popover
|
|
||||||
placement="right"
|
|
||||||
trigger={isPhone ? 'click' : 'hover'}
|
|
||||||
content={
|
|
||||||
<div>
|
|
||||||
{record.labels?.map((label: string) => (
|
|
||||||
<Tag
|
|
||||||
color="blue"
|
|
||||||
key={label}
|
|
||||||
style={{ cursor: 'point' }}
|
|
||||||
onClick={(e) => {
|
|
||||||
e.stopPropagation();
|
|
||||||
setSearchValue(`label:${label}`);
|
|
||||||
setSearchText(`label:${label}`);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<a>{label}</a>
|
|
||||||
</Tag>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
>
|
>
|
||||||
{record.name || '-'}
|
{record.name || '-'}
|
||||||
</Popover>
|
|
||||||
) : (
|
|
||||||
record.name || '-'
|
|
||||||
)}
|
|
||||||
{record.isPinned ? (
|
|
||||||
<span>
|
|
||||||
<PushpinOutlined />
|
|
||||||
</span>
|
|
||||||
) : (
|
|
||||||
''
|
|
||||||
)}
|
|
||||||
</a>
|
</a>
|
||||||
</>
|
</Paragraph>
|
||||||
),
|
),
|
||||||
sorter: {
|
sorter: {
|
||||||
compare: (a, b) => a?.name?.localeCompare(b?.name),
|
compare: (a, b) => a?.name?.localeCompare(b?.name),
|
||||||
|
|
Loading…
Reference in New Issue
Block a user