Browse Source

Display Last Seen value in the UI

Audrius Butkevicius 11 years ago
parent
commit
c66b24feeb
3 changed files with 21 additions and 0 deletions
  1. 0 0
      auto/gui.files.go
  2. 16 0
      gui/app.js
  3. 5 0
      gui/index.html

File diff suppressed because it is too large
+ 0 - 0
auto/gui.files.go


+ 16 - 0
gui/app.js

@@ -80,6 +80,7 @@ syncthing.controller('SyncthingCtrl', function ($scope, $http, $translate, $loca
     $scope.repos = {};
     $scope.seenError = '';
     $scope.upgradeInfo = {};
+    $scope.stats = {};
 
     $http.get(urlbase+"/lang").success(function (langs) {
         // Find the first language in the list provided by the user's browser
@@ -175,6 +176,7 @@ syncthing.controller('SyncthingCtrl', function ($scope, $http, $translate, $loca
 
     $scope.$on('NodeDisconnected', function (event, arg) {
         delete $scope.connections[arg.data.id];
+        refreshNodeStats();
     });
 
     $scope.$on('NodeConnected', function (event, arg) {
@@ -332,10 +334,18 @@ syncthing.controller('SyncthingCtrl', function ($scope, $http, $translate, $loca
         });
     }
 
+    var refreshNodeStats = debounce(function () {
+        $http.get(urlbase+"/stats/node").success(function (data) {
+            $scope.stats = data;
+            console.log("refreshNodeStats", data);
+        });
+    }, 500);
+
     $scope.init = function() {
         refreshSystem();
         refreshConfig();
         refreshConnectionStats();
+        refreshNodeStats();
 
         $http.get(urlbase + '/version').success(function (data) {
             $scope.version = data;
@@ -1049,6 +1059,12 @@ syncthing.filter('clean', function () {
     };
 });
 
+syncthing.filter('asDate', function() {
+    return function (input) {
+        return new Date(input);
+    }
+})
+
 syncthing.directive('optionEditor', function () {
     return {
         restrict: 'C',

+ 5 - 0
gui/index.html

@@ -342,6 +342,11 @@
                         <th><span class="glyphicon glyphicon-tag"></span>&emsp;<span translate>Version</span></th>
                         <td class="text-right">{{nodeVer(nodeCfg)}}</td>
                       </tr>
+                      <tr ng-if="!connections[nodeCfg.NodeID]">
+                        <th><span class="glyphicon glyphicon-eye-open"></span>&emsp;<span translate>Last seen</span></th>
+                        <td translate ng-if="stats[nodeCfg.NodeID].LastSeen.indexOf('1970') > -1" class="text-right">Never</td>
+                        <td ng-if="stats[nodeCfg.NodeID].LastSeen.indexOf('1970') < 0" class="text-right">{{stats[nodeCfg.NodeID].LastSeen | asDate | date:'short'}}</td>
+                      </tr>
                     </tbody>
                   </table>
                 </div>

Some files were not shown because too many files changed in this diff