Browse Source

Prettify need table

Jakob Borg 12 years ago
parent
commit
ed675a61d7
2 changed files with 17 additions and 4 deletions
  1. 14 1
      gui/app.js
  2. 3 3
      gui/index.html

+ 14 - 1
gui/app.js

@@ -28,10 +28,23 @@ syncthing.controller('SyncthingCtrl', function ($scope, $http) {
                     data[id].outbps = 0;
                 }
             }
-
             $scope.connections = 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;
         });
     };

+ 3 - 3
gui/index.html

@@ -56,10 +56,10 @@ body {
 
             <div ng-show="model.needFiles > 0">
                 <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">
-                        <td>{{file.Name}}</td>
-                        <td>{{file.Size | binary}}B</td>
+                        <td><abbr title="{{file.Name}}">{{file.ShortName}}</abbr></td>
+                        <td class="text-right">{{file.Size | binary}}B</td>
                     </tr>
                 </table>
             </div>