From 40e8041401a9ac1689c826bb759ae1a667f4cf54 Mon Sep 17 00:00:00 2001 From: whyour Date: Tue, 22 Aug 2023 22:18:18 +0800 Subject: [PATCH] =?UTF-8?q?=20=E4=BF=AE=E5=A4=8D=E9=80=80=E5=87=BA?= =?UTF-8?q?=E8=B0=83=E8=AF=95=E8=87=AA=E5=8A=A8=E5=88=A0=E9=99=A4=E8=B0=83?= =?UTF-8?q?=E8=AF=95=E6=97=A5=E5=BF=97=E7=9B=AE=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- back/api/script.ts | 2 ++ back/services/script.ts | 3 +-- src/layouts/index.less | 2 +- src/pages/crontab/modal.tsx | 2 +- src/pages/dependence/logModal.tsx | 4 ++-- src/pages/dependence/modal.tsx | 2 +- src/pages/env/index.tsx | 6 +++++- src/pages/env/modal.tsx | 21 +++++++++++++++------ src/pages/initialization/index.tsx | 2 +- src/pages/setting/notification.tsx | 2 +- src/pages/subscription/modal.tsx | 13 ++++++------- 11 files changed, 36 insertions(+), 23 deletions(-) diff --git a/back/api/script.ts b/back/api/script.ts index 7ec05651..58a40a53 100644 --- a/back/api/script.ts +++ b/back/api/script.ts @@ -265,9 +265,11 @@ export default (app: Router) => { let { filename, path, pid } = req.body; const { name, ext } = parse(filename); const filePath = join(config.scriptPath, path, `${name}.swap${ext}`); + const logPath = join(config.logPath, path, `${name}.swap`); const scriptService = Container.get(ScriptService); const result = await scriptService.stopScript(filePath, pid); + emptyDir(logPath); res.send(result); } catch (e) { return next(e); diff --git a/back/services/script.ts b/back/services/script.ts index a7aa1e07..95681549 100644 --- a/back/services/script.ts +++ b/back/services/script.ts @@ -53,10 +53,9 @@ export default class ScriptService { } public async stopScript(filePath: string, pid: number) { - let str = ''; if (!pid) { 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 { await killTask(pid); diff --git a/src/layouts/index.less b/src/layouts/index.less index 3bb6050b..8569d568 100644 --- a/src/layouts/index.less +++ b/src/layouts/index.less @@ -195,7 +195,7 @@ body { } .ant-tooltip { - max-width: 250px !important; + max-width: 300px !important; } } diff --git a/src/pages/crontab/modal.tsx b/src/pages/crontab/modal.tsx index 2dbbc254..dfba1484 100644 --- a/src/pages/crontab/modal.tsx +++ b/src/pages/crontab/modal.tsx @@ -83,7 +83,7 @@ const CronModal = ({ > { diff --git a/src/pages/dependence/modal.tsx b/src/pages/dependence/modal.tsx index cab283bc..d32a64ad 100644 --- a/src/pages/dependence/modal.tsx +++ b/src/pages/dependence/modal.tsx @@ -130,7 +130,7 @@ const DependenceModal = ({ > diff --git a/src/pages/env/index.tsx b/src/pages/env/index.tsx index 65d148bc..f9010650 100644 --- a/src/pages/env/index.tsx +++ b/src/pages/env/index.tsx @@ -91,7 +91,11 @@ const Env = () => { render: (text: string, record: any) => { return (
- +
{text}
diff --git a/src/pages/env/modal.tsx b/src/pages/env/modal.tsx index 0a051b0e..d7645e2f 100644 --- a/src/pages/env/modal.tsx +++ b/src/pages/env/modal.tsx @@ -1,4 +1,4 @@ -import intl from 'react-intl-universal' +import intl from 'react-intl-universal'; import React, { useEffect, useState } from 'react'; import { Modal, message, Input, Form, Radio } from 'antd'; import { request } from '@/utils/http'; @@ -44,7 +44,9 @@ const EnvModal = ({ ); if (code === 200) { - message.success(env ? intl.get('更新变量成功') : intl.get('创建变量成功')); + message.success( + env ? intl.get('更新变量成功') : intl.get('创建变量成功'), + ); handleCancel(data); } setLoading(false); @@ -82,7 +84,11 @@ const EnvModal = ({ name="name" label={intl.get('名称')} rules={[ - { required: true, message: intl.get('请输入环境变量名称'), whitespace: true }, + { + required: true, + message: intl.get('请输入环境变量名称'), + whitespace: true, + }, { pattern: /^[a-zA-Z_][0-9a-zA-Z_]*$/, message: intl.get('只能输入字母数字下划线,且不能以数字开头'), @@ -108,12 +114,15 @@ const EnvModal = ({ name="value" label={intl.get('值')} rules={[ - { required: true, message: intl.get('请输入环境变量值'), whitespace: true }, + { + required: true, + message: intl.get('请输入环境变量值'), + whitespace: true, + }, ]} > diff --git a/src/pages/initialization/index.tsx b/src/pages/initialization/index.tsx index 6952b5d8..61cc90d2 100644 --- a/src/pages/initialization/index.tsx +++ b/src/pages/initialization/index.tsx @@ -185,7 +185,7 @@ const Initialization = () => { style={{ maxWidth: 400 }} > diff --git a/src/pages/setting/notification.tsx b/src/pages/setting/notification.tsx index a679b84b..af781729 100644 --- a/src/pages/setting/notification.tsx +++ b/src/pages/setting/notification.tsx @@ -88,7 +88,7 @@ const NotificationSetting = ({ data }: any) => { ) : ( )} diff --git a/src/pages/subscription/modal.tsx b/src/pages/subscription/modal.tsx index bac0cf9c..adeb47bd 100644 --- a/src/pages/subscription/modal.tsx +++ b/src/pages/subscription/modal.tsx @@ -326,8 +326,7 @@ const SubscriptionModal = ({ ]} > @@ -486,7 +485,7 @@ const SubscriptionModal = ({