From a669242d39a929da4ef2ed1e4b13fc428b8bd516 Mon Sep 17 00:00:00 2001 From: hubian <908234780@qq.com> Date: Fri, 17 Apr 2026 22:02:01 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20Web=E6=9C=8D=E5=8A=A1=E6=B4=BB=E8=B7=83?= =?UTF-8?q?=E5=BC=80=E5=85=B3=EF=BC=8C=E5=BD=92=E6=A1=A3=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E5=8D=95=E7=8B=AC=E6=98=BE=E7=A4=BA=E5=8C=BA=E5=9F=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app.py | 109 +++++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 86 insertions(+), 23 deletions(-) diff --git a/app.py b/app.py index afde96e..1ef4f94 100644 --- a/app.py +++ b/app.py @@ -439,6 +439,9 @@ HTML_TEMPLATE = ''' return; } + // 获取服务活跃状态 + const activeStatus = getActiveStatus(); + // 按类型分组 const grouped = {}; filtered.forEach(p => { @@ -456,27 +459,82 @@ HTML_TEMPLATE = ''' for (const [type, projs] of Object.entries(grouped)) { const typeInfo = typeNames[type] || { name: type, icon: 'ri-folder-line', color: 'gray' }; - html += ` -
-

- - ${typeInfo.name} - (${projs.length}) -

-
- `; - projs.forEach(p => { - html += renderProjectCard(p); - }); - - html += `
`; + // Web服务需要分成活跃和归档两组 + if (type === 'web') { + const activeProjs = projs.filter(p => activeStatus[p.id] !== false); + const archivedProjs = projs.filter(p => activeStatus[p.id] === false); + + // 活跃服务 + if (activeProjs.length > 0) { + html += ` +
+

+ + ${typeInfo.name} + (${activeProjs.length}) +

+
+ `; + activeProjs.forEach(p => { + html += renderProjectCard(p, true); + }); + html += `
`; + } + + // 归档服务 + if (archivedProjs.length > 0) { + html += ` +
+

+ + 归档服务 + (${archivedProjs.length}) +

+
+ `; + archivedProjs.forEach(p => { + html += renderProjectCard(p, false); + }); + html += `
`; + } + } else { + // 其他类型正常显示 + html += ` +
+

+ + ${typeInfo.name} + (${projs.length}) +

+
+ `; + projs.forEach(p => { + html += renderProjectCard(p, true); + }); + html += `
`; + } } list.innerHTML = html; } - function renderProjectCard(p) { + function getActiveStatus() { + const stored = localStorage.getItem('serviceActiveStatus'); + if (stored) { + return JSON.parse(stored); + } + return {}; + } + + function toggleServiceActive(id) { + const status = getActiveStatus(); + status[id] = status[id] === false ? true : false; + localStorage.setItem('serviceActiveStatus', JSON.stringify(status)); + renderProjects(); + } + + function renderProjectCard(p, isActive = true) { const statusInfo = getStatusInfo(p.status?.status); const typeColors = { 'web': 'bg-blue-500/20 text-blue-400', @@ -592,14 +650,19 @@ HTML_TEMPLATE = ''' ` : ''} ${p.type === 'web' ? ` -
- ${(p.status?.status === 'running' || p.status?.status === 'partial') ? ` - - - ` : ` - - `} - +
+
+ ${(p.status?.status === 'running' || p.status?.status === 'partial') ? ` + + + ` : ` + + `} + +
+
` : ''} ${p.type === 'cron' ? `