修复脚本管理和日志管理树字段

This commit is contained in:
whyour 2022-06-05 18:44:35 +08:00
parent 15678b029c
commit be76ff4675
4 changed files with 11 additions and 8 deletions

View File

@ -63,10 +63,10 @@
"nodemailer": "^6.7.2", "nodemailer": "^6.7.2",
"p-queue": "7.2.0", "p-queue": "7.2.0",
"reflect-metadata": "^0.1.13", "reflect-metadata": "^0.1.13",
"sequelize": "^6.17.0", "sequelize": "^6.20.1",
"serve-handler": "^6.1.3", "serve-handler": "^6.1.3",
"sockjs": "^0.3.24", "sockjs": "^0.3.24",
"sqlite3": "npm:@louislam/sqlite3@^15.0.3", "sqlite3": "npm:@louislam/sqlite3@^15.0.6",
"toad-scheduler": "^1.6.0", "toad-scheduler": "^1.6.0",
"typedi": "^0.10.0", "typedi": "^0.10.0",
"uuid": "^8.3.2", "uuid": "^8.3.2",

View File

@ -60,7 +60,7 @@ const Log = ({ headerStyle, isPhone, theme }: any) => {
const getLog = (node: any) => { const getLog = (node: any) => {
request request
.get(`${config.apiPrefix}logs/${node.value}?path=${node.parent || ''}`) .get(`${config.apiPrefix}logs/${node.title}?path=${node.parent || ''}`)
.then((data) => { .then((data) => {
setValue(data.data); setValue(data.data);
}); });
@ -113,6 +113,7 @@ const Log = ({ headerStyle, isPhone, theme }: any) => {
dropdownStyle={{ maxHeight: 400, overflow: 'auto' }} dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
treeData={data} treeData={data}
placeholder="请选择日志" placeholder="请选择日志"
fieldNames={{ value: 'key', label: 'title' }}
showSearch showSearch
onSelect={onSelect} onSelect={onSelect}
/>, />,

View File

@ -66,7 +66,7 @@ const EditModal = ({
const getDetail = (node: any) => { const getDetail = (node: any) => {
request request
.get(`${config.apiPrefix}scripts/${node.value}?path=${node.parent || ''}`) .get(`${config.apiPrefix}scripts/${node.title}?path=${node.parent || ''}`)
.then((data) => { .then((data) => {
setValue(data.data); setValue(data.data);
}); });
@ -77,7 +77,7 @@ const EditModal = ({
request request
.put(`${config.apiPrefix}scripts/run`, { .put(`${config.apiPrefix}scripts/run`, {
data: { data: {
filename: cNode.value, filename: cNode.title,
path: cNode.parent || '', path: cNode.parent || '',
}, },
}) })
@ -87,13 +87,13 @@ const EditModal = ({
}; };
const stop = () => { const stop = () => {
if (!cNode || !cNode.value) { if (!cNode || !cNode.title) {
return; return;
} }
request request
.put(`${config.apiPrefix}scripts/stop`, { .put(`${config.apiPrefix}scripts/stop`, {
data: { data: {
filename: cNode.value, filename: cNode.title,
path: cNode.parent || '', path: cNode.parent || '',
}, },
}) })
@ -146,6 +146,7 @@ const EditModal = ({
dropdownStyle={{ maxHeight: 400, overflow: 'auto' }} dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
treeData={treeData} treeData={treeData}
placeholder="请选择脚本文件" placeholder="请选择脚本文件"
fieldNames={{ value: 'key', label: 'title' }}
showSearch showSearch
onSelect={onSelect} onSelect={onSelect}
/> />
@ -243,7 +244,7 @@ const EditModal = ({
content: content:
editorRef.current && editorRef.current &&
editorRef.current.getValue().replace(/\r\n/g, '\n'), editorRef.current.getValue().replace(/\r\n/g, '\n'),
filename: cNode?.value, filename: cNode?.title,
}} }}
/> />
<SettingModal <SettingModal

View File

@ -451,6 +451,7 @@ const Script = ({ headerStyle, isPhone, theme, socketMessage }: any) => {
dropdownStyle={{ maxHeight: 400, overflow: 'auto' }} dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
treeData={data} treeData={data}
placeholder="请选择脚本" placeholder="请选择脚本"
fieldNames={{ value: 'key', label: 'title' }}
showSearch showSearch
onSelect={onSelect} onSelect={onSelect}
/>, />,