소스 수정

This commit is contained in:
2025-12-28 16:35:14 +09:00
parent 1fc6a9ccd9
commit c2733ca3da
2 changed files with 168 additions and 45 deletions

View File

@@ -288,8 +288,24 @@ async function getServerDashboard() {
})
}
// 서버 정렬: 이름
serverStatuses.sort((a, b) => a.server_name.localeCompare(b.server_name))
// 서버 정렬: 장애 우선 → 컨테이너 많은 순 → 이름순
serverStatuses.sort((a, b) => {
// 1. 장애 여부 (서버 장애 또는 컨테이너에 장애)
const aHasIssue = a.level !== 'normal' ||
(a.container_summary.stopped > 0 || a.container_summary.critical > 0 || a.container_summary.warning > 0)
const bHasIssue = b.level !== 'normal' ||
(b.container_summary.stopped > 0 || b.container_summary.critical > 0 || b.container_summary.warning > 0)
if (aHasIssue !== bHasIssue) return aHasIssue ? -1 : 1
// 2. 컨테이너 수 (많은 순)
const aContainers = a.container_summary.total || 0
const bContainers = b.container_summary.total || 0
if (aContainers !== bContainers) return bContainers - aContainers
// 3. 서버 이름순
return a.server_name.localeCompare(b.server_name)
})
return {
summary: { servers: summaryServers, containers: summaryContainers },