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; return;
} }
const nodesHtml = Array.from(nodeResources.values()).map(nodeData => { const nodesHtml = Array.from(nodeResources.values())
return this.renderNodeCard(nodeData); .sort((a, b) => {
}).join(''); // 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 = ` container.innerHTML = `
<div class="nodes-monitoring-content"> <div class="nodes-monitoring-content">