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' ? `