diff --git a/LTEMvcApp/Views/Home/Logs.cshtml b/LTEMvcApp/Views/Home/Logs.cshtml
index b9d7f53..20e3c41 100644
--- a/LTEMvcApp/Views/Home/Logs.cshtml
+++ b/LTEMvcApp/Views/Home/Logs.cshtml
@@ -1385,17 +1385,20 @@
});
});
- connectionStatusBtn.addEventListener('click', function() {
- fetch('/api/log/connection-status')
- .then(response => response.json())
- .then(data => {
- console.log('SSE连接状态:', data);
- showInfo('连接状态信息已输出到控制台');
- })
- .catch(error => {
- showError('获取连接状态失败: ' + error.message);
- });
- });
+ var connectionStatusBtn = document.getElementById('connectionStatusBtn');
+ if (connectionStatusBtn) {
+ connectionStatusBtn.addEventListener('click', function() {
+ fetch('/api/log/connection-status')
+ .then(response => response.json())
+ .then(data => {
+ console.log('SSE连接状态:', data);
+ showInfo('连接状态信息已输出到控制台');
+ })
+ .catch(error => {
+ showError('获取连接状态失败: ' + error.message);
+ });
+ });
+ }
testConnectionBtn.addEventListener('click', function() {
fetch('/api/log/test-connection')