阿弥诺斯

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

View File

@ -41,7 +41,13 @@ export const api = {
* @param text 文本 * @param text 文本
* @returns {Promise<axios.AxiosResponse<any>>} * @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;
},
/** /**
* 应用配置 * 应用配置