Prettify need table

This commit is contained in:
Jakob Borg
2014-01-06 06:10:53 +01:00
parent 60b00af0bb
commit ed675a61d7
2 changed files with 17 additions and 4 deletions

View File

@@ -28,10 +28,23 @@ syncthing.controller('SyncthingCtrl', function ($scope, $http) {
data[id].outbps = 0; data[id].outbps = 0;
} }
} }
$scope.connections = data; $scope.connections = data;
}); });
$http.get("/rest/need").success(function (data) { $http.get("/rest/need").success(function (data) {
var i, name;
for (i = 0; i < data.length; i++) {
name = data[i].Name.split("/");
data[i].ShortName = name[name.length-1];
}
data.sort(function (a, b) {
if (a.ShortName < b.ShortName) {
return -1;
}
if (a.ShortName > b.ShortName) {
return 1;
}
return 0;
});
$scope.need = data; $scope.need = data;
}); });
}; };

View File

@@ -56,10 +56,10 @@ body {
<div ng-show="model.needFiles > 0"> <div ng-show="model.needFiles > 0">
<h2>Files to Synchronize</h2> <h2>Files to Synchronize</h2>
<table class="table table-condesed table-striped"> <table class="table table-condensed table-striped">
<tr ng-repeat="file in need track by $index"> <tr ng-repeat="file in need track by $index">
<td>{{file.Name}}</td> <td><abbr title="{{file.Name}}">{{file.ShortName}}</abbr></td>
<td>{{file.Size | binary}}B</td> <td class="text-right">{{file.Size | binary}}B</td>
</tr> </tr>
</table> </table>
</div> </div>