修复任务详情查看脚本错误

This commit is contained in:
whyour 2024-05-25 18:22:01 +08:00
parent e77d4c4337
commit 805a716033
5 changed files with 32 additions and 30 deletions

View File

@ -41,7 +41,7 @@ export default class ScriptService {
const relativePath = path.relative(config.scriptPath, filePath);
const command = `${TASK_COMMAND} ${relativePath} now`;
const pid = await this.scheduleService.runTask(
command,
`real_time=true ${command}`,
this.taskCallbacks(filePath),
{ command },
'start',
@ -63,7 +63,10 @@ export default class ScriptService {
}
public async getFile(filePath: string, fileName: string) {
const _filePath = join(config.scriptPath, filePath, fileName);
let _filePath = join(config.scriptPath, filePath, fileName);
if (filePath.startsWith(config.dataPath)) {
_filePath = join(filePath, fileName);
}
const content = await getFileContentByName(_filePath);
return content;
}

View File

@ -808,12 +808,13 @@ function pushPlusNotify(text, desp) {
function wePlusBotNotify(text, desp) {
return new Promise((resolve) => {
const { WE_PLUS_BOT_TOKEN, WE_PLUS_BOT_RECEIVER, WE_PLUS_BOT_VERSION } = push_config;
const { WE_PLUS_BOT_TOKEN, WE_PLUS_BOT_RECEIVER, WE_PLUS_BOT_VERSION } =
push_config;
if (WE_PLUS_BOT_TOKEN) {
const template = 'txt';
if(desp.length>800){
desp = desp.replace(/[\n\r]/g, '<br>');
template = 'html';
if (desp.length > 800) {
desp = desp.replace(/[\n\r]/g, '<br>');
template = 'html';
}
const body = {
token: `${WE_PLUS_BOT_TOKEN}`,
@ -834,19 +835,12 @@ function wePlusBotNotify(text, desp) {
$.post(options, (err, resp, data) => {
try {
if (err) {
console.log(
`微加机器人 发送通知消息失败😞\n`,
err,
);
console.log(`微加机器人发送通知消息失败😞\n`, err);
} else {
if (data.code === 200) {
console.log(
`微加机器人 发送通知消息完成🎉\n`,
);
console.log(`微加机器人发送通知消息完成🎉\n`);
} else {
console.log(
`微加机器人 发送通知消息异常 ${data.msg}\n`,
);
console.log(`微加机器人发送通知消息异常 ${data.msg}\n`);
}
}
} catch (e) {

View File

@ -110,7 +110,7 @@ const CronDetailModal = ({
minimap: { enabled: false },
lineNumbersMinChars: 3,
glyphMargin: false,
accessibilitySupport: 'off'
accessibilitySupport: 'off',
}}
onMount={(editor, monaco) => {
editorRef.current = editor;
@ -162,8 +162,9 @@ const CronDetailModal = ({
setValue(data);
}
});
} else if (result) {
} else {
setValidTabs([validTabs[0]]);
setActiveTabKey('log');
}
};
@ -359,10 +360,15 @@ const CronDetailModal = ({
<Modal
title={
<div className="crontab-title-wrapper">
<div style={{ minWidth: 0 }}>
<div style={{ minWidth: 0, display: 'flex', alignItems: 'center' }}>
<Typography.Text
style={{ width: '100%' }}
ellipsis={{ tooltip: currentCron.name }}
style={{ width: 200, boxSizing: 'content-box' }}
ellipsis={{
onEllipsis(ellipsis) {
return ellipsis;
},
tooltip: currentCron.name,
}}
>
{currentCron.name}
</Typography.Text>

View File

@ -81,6 +81,7 @@
display: flex;
align-items: center;
justify-content: space-between;
gap: 24px;
.operations {
display: flex;

View File

@ -75,18 +75,16 @@ const Crontab = () => {
style={{
wordBreak: 'break-all',
marginBottom: 0,
color: '#1890ff'
color: '#1890ff',
cursor: 'pointer'
}}
ellipsis={{ tooltip: text, rows: 2 }}
onClick={() => {
setDetailCron(record);
setIsDetailModalVisible(true);
}}
>
<Link
onClick={() => {
setDetailCron(record);
setIsDetailModalVisible(true);
}}
>
{record.name || '-'}
</Link>
<Link>{record.name || '-'}</Link>
</Paragraph>
),
sorter: {