From 935a8eb9a770b9b2379a594fa384eecf3f0c89f7 Mon Sep 17 00:00:00 2001 From: Jakob Borg Date: Tue, 15 Apr 2014 10:57:17 +0200 Subject: [PATCH] Sort nodes on name if set, otherwise ID (fixes #119) --- gui/app.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/gui/app.js b/gui/app.js index 98dfbd57..572d2b82 100644 --- a/gui/app.js +++ b/gui/app.js @@ -54,11 +54,10 @@ syncthing.controller('SyncthingCtrl', function ($scope, $http) { } function nodeCompare(a, b) { - if (a.NodeID === $scope.myID) { - return -1; - } - if (b.NodeID === $scope.myID) { - return 1; + if (typeof a.Name !== 'undefined' && typeof b.Name !== 'undefined') { + if (a.Name < b.Name) + return -1; + return a.Name > b.Name; } if (a.NodeID < b.NodeID) { return -1;