From 7e85f4e23aeaadfb29f6e8419ed54a709446a458 Mon Sep 17 00:00:00 2001 From: jinchao <383321154@qq.com> Date: Wed, 14 May 2025 16:42:09 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=B2=E5=AE=8C=E6=88=90=E4=BB=BF=E7=9C=9F?= =?UTF-8?q?=E7=9B=91=E6=8E=A7=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Release/database/XNSim.db | Bin 200704 -> 200704 bytes XNSimHtml/components/run-simulation.js | 5 - XNSimHtml/components/simulation-monitor.js | 159 +++++++++++++++------ 3 files changed, 119 insertions(+), 45 deletions(-) diff --git a/Release/database/XNSim.db b/Release/database/XNSim.db index 031aa438dcbf65c4587e5083dca75a2f476d59dc..c852265664c6f7e3ae169d621e6146c2208fdd31 100644 GIT binary patch delta 75 zcmZozz|*jRXM!~2i-|JMj4v7!S`!#s6PUIpFi+=W+Nm}DCm*weqOpOIp|OEpPJX(P ffsv`MfvK*cNr-`km7$@PiLsucnc?&(e&%HWq8}Cp delta 75 zcmZozz|*jRXM!~2vxzd!jL#YqS`!#s6PUIpFi+=W+FUyQCm*weqLHD6fw_rZPJX(P ffsv`MfvK*cNr-`km7#%^p{1Uok?Hg(e&%HWuLc%Y diff --git a/XNSimHtml/components/run-simulation.js b/XNSimHtml/components/run-simulation.js index 2c6185f..9e83259 100644 --- a/XNSimHtml/components/run-simulation.js +++ b/XNSimHtml/components/run-simulation.js @@ -519,7 +519,6 @@ class RunSimulation extends HTMLElement { this.eventSource.addEventListener('status', (event) => { try { const data = JSON.parse(event.data); - console.log('收到状态事件:', data); if (data.running === false) { // 仿真已经不存在或已结束 @@ -548,7 +547,6 @@ class RunSimulation extends HTMLElement { this.eventSource.addEventListener('completed', (event) => { try { const data = JSON.parse(event.data); - console.log('收到完成事件:', data); // 添加日志 if (data.success) { this.showSuccess('仿真执行成功'); @@ -567,7 +565,6 @@ class RunSimulation extends HTMLElement { this.eventSource.addEventListener('error', (event) => { try { const data = JSON.parse(event.data); - console.log('收到错误事件:', data); // 添加日志 this.showError(`仿真错误: ${data.message}`); // 重置UI @@ -581,7 +578,6 @@ class RunSimulation extends HTMLElement { this.eventSource.addEventListener('terminated', (event) => { try { const data = JSON.parse(event.data); - console.log('收到终止事件:', data); // 添加日志 this.showMessage(`仿真已终止: ${data.message}`); // 在输出框中添加终止信息 @@ -599,7 +595,6 @@ class RunSimulation extends HTMLElement { this.eventSource.addEventListener('timeout', (event) => { try { const data = JSON.parse(event.data); - console.log('收到超时事件:', data); // 添加日志 this.showError(`仿真超时: ${data.message}`); // 在输出框中添加超时信息 diff --git a/XNSimHtml/components/simulation-monitor.js b/XNSimHtml/components/simulation-monitor.js index d7fcd0d..cf4fcef 100644 --- a/XNSimHtml/components/simulation-monitor.js +++ b/XNSimHtml/components/simulation-monitor.js @@ -63,7 +63,6 @@ class SimulationMonitor extends HTMLElement { const systemResponse = await fetch('/api/system-monitor/system-info'); const systemData = await systemResponse.json(); this.systemInfo = systemData.data; - console.log('系统信息:', this.systemInfo); // 获取线程信息 const threadResponse = await fetch('/api/system-monitor/thread-info'); @@ -79,6 +78,51 @@ class SimulationMonitor extends HTMLElement { } } + getStatusDisplay(status) { + switch (status) { + case 0: + return { text: '未运行', color: '#999999' }; + case 1: + return { text: '运行中', color: '#4CAF50' }; + case 2: + return { text: '暂停中', color: '#FF9800' }; + case 3: + return { text: '错误', color: '#f44336' }; + default: + return { text: '未知状态', color: '#f44336' }; + } + } + + getCoreStatusDisplay(status) { + switch (status) { + case 0: + return { text: '未加载', color: '#999999' }; + case 1: + return { text: '初始化完成', color: '#FFC107' }; + case 2: + return { text: '正常', color: '#4CAF50' }; + case 3: + return { text: '异常', color: '#f44336' }; + default: + return { text: '未知状态', color: '#f44336' }; + } + } + + getThreadStatusDisplay(status) { + switch (status) { + case 0: + return { text: '未运行', color: '#999999' }; + case 1: + return { text: '运行中', color: '#4CAF50' }; + case 2: + return { text: '暂停中', color: '#FF9800' }; + case 3: + return { text: '错误', color: '#f44336' }; + default: + return { text: '未知状态', color: '#f44336' }; + } + } + updateUI() { const input = this.shadowRoot.querySelector('.domain-input'); const startButton = this.shadowRoot.querySelector('.start-button'); @@ -115,27 +159,45 @@ class SimulationMonitor extends HTMLElement { engineInfo.innerHTML = `