修改排序策略

This commit is contained in:
CN-JS-HuiBai
2026-04-04 23:24:39 +08:00
parent f6fa253a11
commit 755bd45a0b

View File

@@ -395,10 +395,12 @@
filtered = allServersData.filter(s => s.source === currentSourceFilter);
}
// Sort before paginating
// Sort servers: online first, then alphabetically by name (job)
filtered.sort((a, b) => {
if (a.up !== b.up) return b.up ? 1 : -1;
return b.cpuPercent - a.cpuPercent;
if (a.up !== b.up) return a.up ? -1 : 1;
const nameA = a.job || '';
const nameB = b.job || '';
return nameA.localeCompare(nameB);
});
const totalFiltered = filtered.length;