阿弥诺斯

This commit is contained in:
Jerry 2025-07-09 18:44:59 +08:00
parent 17db64cd02
commit a57e4d4b46
2 changed files with 12 additions and 4 deletions

View File

@ -96,7 +96,7 @@ const ConfigPage = () => {
};
const handleApply = async () => {
if (!editableConfig.trim()) {
if (!editableConfig) {
Notification.warn({
title: '配置为空',
description: '请先解析或编辑有效配置',
@ -213,13 +213,15 @@ const ConfigPage = () => {
生成配置:
</Text>
<Textarea
value={editableConfig}
value={JSON.stringify(editableConfig)}
rows={12}
onChange={(e) => setEditableConfig(e.target.value)}
fontFamily={'monospace'}
size={'sm'}
bg={'blackAlpha.200'}
whiteSpace="pre-wrap"
/>
<HStack mt={4} spacing={3} justify={'flex-end'}>
<Button
variant={'outline'}
@ -240,7 +242,7 @@ const ConfigPage = () => {
size={'sm'}
onClick={handleApply}
isLoading={applying}
isDisabled={!editableConfig.trim()}
isDisabled={!editableConfig}
>
应用到交换机
</Button>

View File

@ -41,7 +41,13 @@ export const api = {
* @param text 文本
* @returns {Promise<axios.AxiosResponse<any>>}
*/
parseCommand: (text) => axios.post(buildUrl('/api/parse_command'), { command: text }),
//parseCommand: async (text) => await axios.post(buildUrl('/api/parse_command'), { command: text }),
async parseCommand(text) {
const res = await axios.post(buildUrl('/api/parse_command', { command: text }));
if (res) {
return res;
} else return null;
},
/**
* 应用配置