From 837f3a68abd0d2ad6a920e04f8086e7a8230176a Mon Sep 17 00:00:00 2001 From: Jakob Borg Date: Sun, 11 May 2014 15:25:06 -0300 Subject: Sort repos on directory (fixes #178) --- gui/app.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'gui') diff --git a/gui/app.js b/gui/app.js index ca92178a75..926a52cfef 100644 --- a/gui/app.js +++ b/gui/app.js @@ -77,6 +77,13 @@ syncthing.controller('SyncthingCtrl', function ($scope, $http) { return a.NodeID > b.NodeID; } + function repoCompare(a, b) { + if (a.Directory < b.Directory) { + return -1; + } + return a.Directory > b.Directory; + } + $scope.refresh = function () { $http.get(urlbase + '/system').success(function (data) { getSucceeded(); @@ -437,11 +444,11 @@ syncthing.controller('SyncthingCtrl', function ($scope, $http) { $scope.config = data; $scope.config.Options.ListenStr = $scope.config.Options.ListenAddress.join(', '); - var nodes = $scope.config.Nodes; - nodes.sort(nodeCompare); - $scope.nodes = nodes; + $scope.nodes = $scope.config.Nodes; + $scope.nodes.sort(nodeCompare); $scope.repos = $scope.config.Repositories; + $scope.repos.sort(repoCompare); $scope.refresh(); }); -- cgit v1.2.3