2 Commits

Author SHA1 Message Date
cd5bdb5938 fix: 修复内存使用率图标不显示问题
- ri-memory-card-line 不是有效的 Remix Icon
- 替换为 ri-database-2-line 图标
2026-04-24 10:42:29 +08:00
69ade8dcbb feat: 进程列表显示开关(默认不显示) 2026-04-24 00:20:20 +08:00
2 changed files with 30118 additions and 42 deletions

36
app.py
View File

@@ -1155,7 +1155,7 @@ HTML_TEMPLATE = '''<!DOCTYPE html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>项目服务管理面板 v3.3</title>
<title>项目服务管理面板 v3.3.1</title>
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>📊</text></svg>">
<script src="https://cdn.tailwindcss.com"></script>
<link href="https://cdn.jsdelivr.net/npm/remixicon@3.5.0/fonts/remixicon.css" rel="stylesheet">
@@ -1446,7 +1446,7 @@ HTML_TEMPLATE = '''<!DOCTYPE html>
</div>
<div class="threshold-item">
<div class="threshold-label">
<i class="ri-memory-card-line threshold-icon text-green-400"></i>
<i class="ri-database-2-line threshold-icon text-green-400"></i>
<span class="text-gray-300 text-sm">内存使用率</span>
</div>
<div class="flex items-center gap-2">
@@ -1516,6 +1516,10 @@ HTML_TEMPLATE = '''<!DOCTYPE html>
</select>
<span id="realtimeIndicator" class="text-xs text-green-400 ml-1 hidden">●</span>
</div>
<div class="flex items-center gap-2 ml-4">
<input type="checkbox" id="showProcessListCheck" class="w-4 h-4 cursor-pointer" onchange="toggleProcessList()">
<label for="showProcessListCheck" class="text-gray-300 text-xs cursor-pointer">显示进程列表</label>
</div>
</div>
<!-- 进程列表(实时监控时显示) -->
@@ -1908,6 +1912,7 @@ HTML_TEMPLATE = '''<!DOCTYPE html>
clearInterval(realtimeTimer);
realtimeTimer = null;
document.getElementById('realtimeCheck').checked = false;
document.getElementById('showProcessListCheck').checked = false;
document.getElementById('realtimeToggle').classList.remove('active');
document.getElementById('realtimeIndicator').classList.add('hidden');
document.getElementById('processListSection').classList.add('hidden');
@@ -2134,8 +2139,8 @@ HTML_TEMPLATE = '''<!DOCTYPE html>
// 检查阈值
checkThresholds(data);
// 如果实时监控开启,加载进程列表
if (document.getElementById('realtimeCheck').checked) {
// 如果实时监控和进程列表都开启,加载进程列表
if (document.getElementById('realtimeCheck').checked && document.getElementById('showProcessListCheck').checked) {
loadTopProcesses();
}
@@ -2195,21 +2200,23 @@ HTML_TEMPLATE = '''<!DOCTYPE html>
const checked = document.getElementById('realtimeCheck').checked;
const toggle = document.getElementById('realtimeToggle');
const indicator = document.getElementById('realtimeIndicator');
const processSection = document.getElementById('processListSection');
if (checked) {
toggle.classList.add('active');
indicator.classList.remove('hidden');
processSection.classList.remove('hidden');
// 立即加载一次
loadSystemStats();
loadTopProcesses();
// 启动定时器
realtimeTimer = setInterval(loadSystemStats, realtimeInterval * 1000);
// 如果进程列表开关也开启,则显示并加载
if (document.getElementById('showProcessListCheck').checked) {
document.getElementById('processListSection').classList.remove('hidden');
loadTopProcesses();
}
} else {
toggle.classList.remove('active');
indicator.classList.add('hidden');
processSection.classList.add('hidden');
document.getElementById('processListSection').classList.add('hidden');
// 停止定时器
if (realtimeTimer) {
clearInterval(realtimeTimer);
@@ -2217,6 +2224,19 @@ HTML_TEMPLATE = '''<!DOCTYPE html>
}
}
}
function toggleProcessList() {
const checked = document.getElementById('showProcessListCheck').checked;
const realtimeChecked = document.getElementById('realtimeCheck').checked;
const processSection = document.getElementById('processListSection');
if (checked && realtimeChecked) {
processSection.classList.remove('hidden');
loadTopProcesses();
} else {
processSection.classList.add('hidden');
}
}
// IP 保存
function saveExternalIp() {

30124
logs/app.log

File diff suppressed because it is too large Load Diff