feat: always sort nodes by hostname in monitoring view

This commit is contained in:
2025-09-20 22:41:40 +02:00
parent 9d4b68e7fc
commit 85505586ac

View File

@@ -343,9 +343,16 @@ class MonitoringViewComponent extends Component {
return;
}
const nodesHtml = Array.from(nodeResources.values()).map(nodeData => {
return this.renderNodeCard(nodeData);
}).join('');
const nodesHtml = Array.from(nodeResources.values())
.sort((a, b) => {
// Sort by hostname, fallback to IP if hostname is not available
const hostnameA = a.hostname || a.ip || '';
const hostnameB = b.hostname || b.ip || '';
return hostnameA.localeCompare(hostnameB);
})
.map(nodeData => {
return this.renderNodeCard(nodeData);
}).join('');
container.innerHTML = `
<div class="nodes-monitoring-content">