diff --git a/public/scripts/components/MonitoringViewComponent.js b/public/scripts/components/MonitoringViewComponent.js index 32b2c4a..23023ea 100644 --- a/public/scripts/components/MonitoringViewComponent.js +++ b/public/scripts/components/MonitoringViewComponent.js @@ -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 = `