diff --git a/.idea/AI-powered-switches.iml b/.idea/AI-powered-switches.iml
index f438690..35bb02e 100644
--- a/.idea/AI-powered-switches.iml
+++ b/.idea/AI-powered-switches.iml
@@ -9,7 +9,7 @@
-
+
-
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 0ce539e..062b743 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -3,5 +3,5 @@
-
+
\ No newline at end of file
diff --git a/src/frontend/src/pages/ConfigPage.jsx b/src/frontend/src/pages/ConfigPage.jsx
index ac1450c..9db0eb0 100644
--- a/src/frontend/src/pages/ConfigPage.jsx
+++ b/src/frontend/src/pages/ConfigPage.jsx
@@ -118,13 +118,15 @@ const ConfigPage = () => {
Common.sleep(1000).then(() => ({ success: true }));
} else {
let commands = JSON.parse(editableConfig)?.config?.commands;
+ console.log(`commands:${JSON.stringify(commands)}`);
const deviceConfig = JSON.parse(selectedDeviceConfig);
+ console.log(`deviceConfig:${JSON.stringify(deviceConfig)}`);
if (!deviceConfig.username || !deviceConfig.password) {
Notification.warn({
title: '所选交换机暂未配置用户名和密码',
description: '请前往交换机设备处配置username和password',
});
- return;
+ return false;
}
commands.push({
username: deviceConfig.username,
@@ -171,8 +173,10 @@ const ConfigPage = () => {
collection={deviceCollection}
value={selectedDevice ? [selectedDevice] : []}
onValueChange={({ value }) => {
- setSelectedDevice(value[0] ?? '');
- setSelectedDeviceConfig(JSON.stringify(value));
+ const selectedIp = value[0] ?? '';
+ setSelectedDevice(selectedIp);
+ const fullDeviceConfig = devices.find((device) => device.ip === selectedIp);
+ setSelectedDeviceConfig(JSON.stringify(fullDeviceConfig));
}}
placeholder={'请选择交换机设备'}
size={'sm'}