mirror of
https://github.com/whyour/qinglong.git
synced 2026-08-14 21:24:58 +08:00
修复创建脚本可能失败
This commit is contained in:
@@ -25,11 +25,9 @@ const EditModal = ({
|
||||
currentNode,
|
||||
content,
|
||||
handleCancel,
|
||||
visible,
|
||||
}: {
|
||||
treeData?: any;
|
||||
content?: string;
|
||||
visible: boolean;
|
||||
currentNode: any;
|
||||
handleCancel: () => void;
|
||||
}) => {
|
||||
@@ -223,7 +221,7 @@ const EditModal = ({
|
||||
width={'100%'}
|
||||
headerStyle={{ padding: '11px 24px' }}
|
||||
onClose={cancel}
|
||||
open={visible}
|
||||
open={true}
|
||||
>
|
||||
{/* @ts-ignore */}
|
||||
<SplitPane
|
||||
@@ -256,24 +254,26 @@ const EditModal = ({
|
||||
<Ansi>{log}</Ansi>
|
||||
</pre>
|
||||
</SplitPane>
|
||||
<SaveModal
|
||||
visible={saveModalVisible}
|
||||
handleCancel={() => {
|
||||
setSaveModalVisible(false);
|
||||
}}
|
||||
file={{
|
||||
content:
|
||||
editorRef.current &&
|
||||
editorRef.current.getValue().replace(/\r\n/g, '\n'),
|
||||
...cNode,
|
||||
}}
|
||||
/>
|
||||
<SettingModal
|
||||
visible={settingModalVisible}
|
||||
handleCancel={() => {
|
||||
setSettingModalVisible(false);
|
||||
}}
|
||||
/>
|
||||
{saveModalVisible && (
|
||||
<SaveModal
|
||||
handleCancel={() => {
|
||||
setSaveModalVisible(false);
|
||||
}}
|
||||
file={{
|
||||
content:
|
||||
editorRef.current &&
|
||||
editorRef.current.getValue().replace(/\r\n/g, '\n'),
|
||||
...cNode,
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
{settingModalVisible && (
|
||||
<SettingModal
|
||||
handleCancel={() => {
|
||||
setSettingModalVisible(false);
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</Drawer>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -19,9 +19,7 @@ const { Option } = Select;
|
||||
const EditScriptNameModal = ({
|
||||
handleCancel,
|
||||
treeData,
|
||||
visible,
|
||||
}: {
|
||||
visible: boolean;
|
||||
treeData: any[];
|
||||
handleCancel: (file?: {
|
||||
filename: string;
|
||||
@@ -53,7 +51,7 @@ const EditScriptNameModal = ({
|
||||
directory ? intl.get('创建文件夹成功') : intl.get('创建文件成功'),
|
||||
);
|
||||
const key = path ? `${path}/` : '';
|
||||
const filename = file ? file.name : (directory || inputFilename);
|
||||
const filename = file ? file.name : directory || inputFilename;
|
||||
handleCancel({
|
||||
filename,
|
||||
path,
|
||||
@@ -95,14 +93,10 @@ const EditScriptNameModal = ({
|
||||
setDirs(dirs);
|
||||
}, [treeData]);
|
||||
|
||||
useEffect(() => {
|
||||
form.resetFields();
|
||||
}, [visible]);
|
||||
|
||||
return (
|
||||
<Modal
|
||||
title={intl.get('创建')}
|
||||
open={visible}
|
||||
open={true}
|
||||
forceRender
|
||||
centered
|
||||
maskClosable={false}
|
||||
|
||||
+13
-12
@@ -710,9 +710,8 @@ const Script = () => {
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
{isLogModalVisible && (
|
||||
{isLogModalVisible && isLogModalVisible && (
|
||||
<EditModal
|
||||
visible={isLogModalVisible}
|
||||
treeData={data}
|
||||
currentNode={currentNode}
|
||||
content={value}
|
||||
@@ -721,16 +720,18 @@ const Script = () => {
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
<EditScriptNameModal
|
||||
visible={isAddFileModalVisible}
|
||||
treeData={data}
|
||||
handleCancel={addFileModalClose}
|
||||
/>
|
||||
<RenameModal
|
||||
visible={isRenameFileModalVisible}
|
||||
handleCancel={handleRenameFileCancel}
|
||||
currentNode={currentNode}
|
||||
/>
|
||||
{isAddFileModalVisible && (
|
||||
<EditScriptNameModal
|
||||
treeData={data}
|
||||
handleCancel={addFileModalClose}
|
||||
/>
|
||||
)}
|
||||
{isRenameFileModalVisible && (
|
||||
<RenameModal
|
||||
handleCancel={handleRenameFileCancel}
|
||||
currentNode={currentNode}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
</PageContainer>
|
||||
);
|
||||
|
||||
@@ -7,10 +7,8 @@ import config from '@/utils/config';
|
||||
const RenameModal = ({
|
||||
currentNode,
|
||||
handleCancel,
|
||||
visible,
|
||||
}: {
|
||||
currentNode?: any;
|
||||
visible: boolean;
|
||||
handleCancel: () => void;
|
||||
}) => {
|
||||
const [form] = Form.useForm();
|
||||
@@ -38,14 +36,10 @@ const RenameModal = ({
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
form.resetFields();
|
||||
}, [currentNode, visible]);
|
||||
|
||||
return (
|
||||
<Modal
|
||||
title={intl.get('重命名')}
|
||||
open={visible}
|
||||
open={true}
|
||||
forceRender
|
||||
centered
|
||||
maskClosable={false}
|
||||
|
||||
@@ -7,10 +7,8 @@ import config from '@/utils/config';
|
||||
const SaveModal = ({
|
||||
file,
|
||||
handleCancel,
|
||||
visible,
|
||||
}: {
|
||||
file?: any;
|
||||
visible: boolean;
|
||||
handleCancel: (cks?: any[]) => void;
|
||||
}) => {
|
||||
const [form] = Form.useForm();
|
||||
@@ -32,15 +30,10 @@ const SaveModal = ({
|
||||
});
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
form.resetFields();
|
||||
setLoading(false);
|
||||
}, [file, visible]);
|
||||
|
||||
return (
|
||||
<Modal
|
||||
title={intl.get('保存文件')}
|
||||
open={visible}
|
||||
open={true}
|
||||
forceRender
|
||||
centered
|
||||
maskClosable={false}
|
||||
|
||||
@@ -7,10 +7,8 @@ import config from '@/utils/config';
|
||||
const SettingModal = ({
|
||||
file,
|
||||
handleCancel,
|
||||
visible,
|
||||
}: {
|
||||
file?: any;
|
||||
visible: boolean;
|
||||
handleCancel: (cks?: any[]) => void;
|
||||
}) => {
|
||||
const [form] = Form.useForm();
|
||||
@@ -30,15 +28,10 @@ const SettingModal = ({
|
||||
});
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
form.resetFields();
|
||||
setLoading(false);
|
||||
}, [file, visible]);
|
||||
|
||||
return (
|
||||
<Modal
|
||||
title={intl.get('运行设置')}
|
||||
open={visible}
|
||||
open={true}
|
||||
forceRender
|
||||
centered
|
||||
onCancel={() => handleCancel()}
|
||||
|
||||
Reference in New Issue
Block a user