mirror of
https://github.com/whyour/qinglong.git
synced 2025-05-22 22:36:06 +08:00
修复退出调试自动删除调试日志目录
This commit is contained in:
parent
a8174e89be
commit
40e8041401
|
@ -265,9 +265,11 @@ export default (app: Router) => {
|
||||||
let { filename, path, pid } = req.body;
|
let { filename, path, pid } = req.body;
|
||||||
const { name, ext } = parse(filename);
|
const { name, ext } = parse(filename);
|
||||||
const filePath = join(config.scriptPath, path, `${name}.swap${ext}`);
|
const filePath = join(config.scriptPath, path, `${name}.swap${ext}`);
|
||||||
|
const logPath = join(config.logPath, path, `${name}.swap`);
|
||||||
|
|
||||||
const scriptService = Container.get(ScriptService);
|
const scriptService = Container.get(ScriptService);
|
||||||
const result = await scriptService.stopScript(filePath, pid);
|
const result = await scriptService.stopScript(filePath, pid);
|
||||||
|
emptyDir(logPath);
|
||||||
res.send(result);
|
res.send(result);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return next(e);
|
return next(e);
|
||||||
|
|
|
@ -53,10 +53,9 @@ export default class ScriptService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public async stopScript(filePath: string, pid: number) {
|
public async stopScript(filePath: string, pid: number) {
|
||||||
let str = '';
|
|
||||||
if (!pid) {
|
if (!pid) {
|
||||||
const relativePath = path.relative(config.scriptPath, filePath);
|
const relativePath = path.relative(config.scriptPath, filePath);
|
||||||
pid = await getPid(`${TASK_COMMAND} -l ${relativePath} now`);
|
pid = await getPid(`${TASK_COMMAND} -l ${relativePath} now`) as number;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
await killTask(pid);
|
await killTask(pid);
|
||||||
|
|
|
@ -195,7 +195,7 @@ body {
|
||||||
}
|
}
|
||||||
|
|
||||||
.ant-tooltip {
|
.ant-tooltip {
|
||||||
max-width: 250px !important;
|
max-width: 300px !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,7 @@ const CronModal = ({
|
||||||
>
|
>
|
||||||
<Input.TextArea
|
<Input.TextArea
|
||||||
rows={4}
|
rows={4}
|
||||||
autoSize={true}
|
autoSize={{ minRows: 1, maxRows: 5 }}
|
||||||
placeholder={intl.get(
|
placeholder={intl.get(
|
||||||
'支持输入脚本路径/任意系统可执行命令/task 脚本路径',
|
'支持输入脚本路径/任意系统可执行命令/task 脚本路径',
|
||||||
)}
|
)}
|
||||||
|
|
|
@ -56,8 +56,8 @@ const DependenceLogModal = ({
|
||||||
) {
|
) {
|
||||||
const log = (data.log || []).join('') as string;
|
const log = (data.log || []).join('') as string;
|
||||||
setValue(log);
|
setValue(log);
|
||||||
setExecuting(!log.includes(intl.get('结束时间')));
|
setExecuting(!log.includes('结束时间'));
|
||||||
setIsRemoveFailed(log.includes(intl.get('删除失败')));
|
setIsRemoveFailed(log.includes('删除失败'));
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.finally(() => {
|
.finally(() => {
|
||||||
|
|
|
@ -130,7 +130,7 @@ const DependenceModal = ({
|
||||||
>
|
>
|
||||||
<Input.TextArea
|
<Input.TextArea
|
||||||
rows={4}
|
rows={4}
|
||||||
autoSize={true}
|
autoSize={{ minRows: 1, maxRows: 5 }}
|
||||||
placeholder={intl.get('请输入依赖名称')}
|
placeholder={intl.get('请输入依赖名称')}
|
||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
6
src/pages/env/index.tsx
vendored
6
src/pages/env/index.tsx
vendored
|
@ -91,7 +91,11 @@ const Env = () => {
|
||||||
render: (text: string, record: any) => {
|
render: (text: string, record: any) => {
|
||||||
return (
|
return (
|
||||||
<div style={{ display: 'flex', alignItems: 'center' }}>
|
<div style={{ display: 'flex', alignItems: 'center' }}>
|
||||||
<Tooltip title={text} placement="topLeft">
|
<Tooltip
|
||||||
|
title={text}
|
||||||
|
placement="topLeft"
|
||||||
|
overlayInnerStyle={{ maxHeight: 400, overflowY: 'auto' }}
|
||||||
|
>
|
||||||
<div className="text-ellipsis">{text}</div>
|
<div className="text-ellipsis">{text}</div>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
<Copy text={text} />
|
<Copy text={text} />
|
||||||
|
|
21
src/pages/env/modal.tsx
vendored
21
src/pages/env/modal.tsx
vendored
|
@ -1,4 +1,4 @@
|
||||||
import intl from 'react-intl-universal'
|
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';
|
||||||
|
@ -44,7 +44,9 @@ const EnvModal = ({
|
||||||
);
|
);
|
||||||
|
|
||||||
if (code === 200) {
|
if (code === 200) {
|
||||||
message.success(env ? intl.get('更新变量成功') : intl.get('创建变量成功'));
|
message.success(
|
||||||
|
env ? intl.get('更新变量成功') : intl.get('创建变量成功'),
|
||||||
|
);
|
||||||
handleCancel(data);
|
handleCancel(data);
|
||||||
}
|
}
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
|
@ -82,7 +84,11 @@ const EnvModal = ({
|
||||||
name="name"
|
name="name"
|
||||||
label={intl.get('名称')}
|
label={intl.get('名称')}
|
||||||
rules={[
|
rules={[
|
||||||
{ required: true, message: intl.get('请输入环境变量名称'), 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: intl.get('只能输入字母数字下划线,且不能以数字开头'),
|
message: intl.get('只能输入字母数字下划线,且不能以数字开头'),
|
||||||
|
@ -108,12 +114,15 @@ const EnvModal = ({
|
||||||
name="value"
|
name="value"
|
||||||
label={intl.get('值')}
|
label={intl.get('值')}
|
||||||
rules={[
|
rules={[
|
||||||
{ required: true, message: intl.get('请输入环境变量值'), whitespace: true },
|
{
|
||||||
|
required: true,
|
||||||
|
message: intl.get('请输入环境变量值'),
|
||||||
|
whitespace: true,
|
||||||
|
},
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<Input.TextArea
|
<Input.TextArea
|
||||||
rows={4}
|
autoSize={{ minRows: 1, maxRows: 8 }}
|
||||||
autoSize={true}
|
|
||||||
placeholder={intl.get('请输入环境变量值')}
|
placeholder={intl.get('请输入环境变量值')}
|
||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
|
@ -185,7 +185,7 @@ const Initialization = () => {
|
||||||
style={{ maxWidth: 400 }}
|
style={{ maxWidth: 400 }}
|
||||||
>
|
>
|
||||||
<Input.TextArea
|
<Input.TextArea
|
||||||
autoSize={true}
|
autoSize={{ minRows: 1, maxRows: 5 }}
|
||||||
placeholder={`请输入${x.label}`}
|
placeholder={`请输入${x.label}`}
|
||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
|
@ -88,7 +88,7 @@ const NotificationSetting = ({ data }: any) => {
|
||||||
) : (
|
) : (
|
||||||
<Input.TextArea
|
<Input.TextArea
|
||||||
disabled={loading}
|
disabled={loading}
|
||||||
autoSize={true}
|
autoSize={{ minRows: 1, maxRows: 5 }}
|
||||||
placeholder={x.placeholder || `请输入${x.label}`}
|
placeholder={x.placeholder || `请输入${x.label}`}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
|
@ -326,8 +326,7 @@ const SubscriptionModal = ({
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<Input.TextArea
|
<Input.TextArea
|
||||||
rows={4}
|
autoSize={{ minRows: 1, maxRows: 5 }}
|
||||||
autoSize={true}
|
|
||||||
placeholder={intl.get('请输入订阅链接')}
|
placeholder={intl.get('请输入订阅链接')}
|
||||||
onPaste={onNamePaste}
|
onPaste={onNamePaste}
|
||||||
onChange={onUrlChange}
|
onChange={onUrlChange}
|
||||||
|
@ -415,7 +414,7 @@ const SubscriptionModal = ({
|
||||||
>
|
>
|
||||||
<Input.TextArea
|
<Input.TextArea
|
||||||
rows={4}
|
rows={4}
|
||||||
autoSize={true}
|
autoSize={{ minRows: 1, maxRows: 5 }}
|
||||||
placeholder={intl.get(
|
placeholder={intl.get(
|
||||||
'请输入脚本筛选白名单关键词,多个关键词竖线分割',
|
'请输入脚本筛选白名单关键词,多个关键词竖线分割',
|
||||||
)}
|
)}
|
||||||
|
@ -429,7 +428,7 @@ const SubscriptionModal = ({
|
||||||
>
|
>
|
||||||
<Input.TextArea
|
<Input.TextArea
|
||||||
rows={4}
|
rows={4}
|
||||||
autoSize={true}
|
autoSize={{ minRows: 1, maxRows: 5 }}
|
||||||
placeholder={intl.get(
|
placeholder={intl.get(
|
||||||
'请输入脚本筛选黑名单关键词,多个关键词竖线分割',
|
'请输入脚本筛选黑名单关键词,多个关键词竖线分割',
|
||||||
)}
|
)}
|
||||||
|
@ -443,7 +442,7 @@ const SubscriptionModal = ({
|
||||||
>
|
>
|
||||||
<Input.TextArea
|
<Input.TextArea
|
||||||
rows={4}
|
rows={4}
|
||||||
autoSize={true}
|
autoSize={{ minRows: 1, maxRows: 5 }}
|
||||||
placeholder={intl.get(
|
placeholder={intl.get(
|
||||||
'请输入脚本依赖文件关键词,多个关键词竖线分割',
|
'请输入脚本依赖文件关键词,多个关键词竖线分割',
|
||||||
)}
|
)}
|
||||||
|
@ -472,7 +471,7 @@ const SubscriptionModal = ({
|
||||||
<Input.TextArea
|
<Input.TextArea
|
||||||
onPaste={onNamePaste}
|
onPaste={onNamePaste}
|
||||||
rows={4}
|
rows={4}
|
||||||
autoSize={true}
|
autoSize={{ minRows: 1, maxRows: 5 }}
|
||||||
placeholder={intl.get('请输入运行订阅前要执行的命令')}
|
placeholder={intl.get('请输入运行订阅前要执行的命令')}
|
||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
@ -486,7 +485,7 @@ const SubscriptionModal = ({
|
||||||
<Input.TextArea
|
<Input.TextArea
|
||||||
onPaste={onNamePaste}
|
onPaste={onNamePaste}
|
||||||
rows={4}
|
rows={4}
|
||||||
autoSize={true}
|
autoSize={{ minRows: 1, maxRows: 5 }}
|
||||||
placeholder={intl.get('请输入运行订阅后要执行的命令')}
|
placeholder={intl.get('请输入运行订阅后要执行的命令')}
|
||||||
/>
|
/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user