浏览代码

Merge pull request #1616 from syncthing/rates

Fix total transfer rates (fixes #1615)
Jakob Borg 10 年之前
父节点
当前提交
509e2411bf
共有 3 个文件被更改,包括 13 次插入5 次删除
  1. 2 2
      gui/index.html
  2. 10 2
      gui/scripts/syncthing/core/controllers/syncthingController.js
  3. 1 1
      internal/auto/gui.files.go

+ 2 - 2
gui/index.html

@@ -293,11 +293,11 @@
                 <tbody>
                 <tbody>
                   <tr>
                   <tr>
                     <th><span class="glyphicon glyphicon-cloud-download"></span>&emsp;<span translate>Download Rate</span></th>
                     <th><span class="glyphicon glyphicon-cloud-download"></span>&emsp;<span translate>Download Rate</span></th>
-                    <td class="text-right">{{connections_total.inbps | binary}}B/s ({{connections_total.inBytesTotal | binary}}B)</td>
+                    <td class="text-right">{{connectionsTotal.inbps | binary}}B/s ({{connectionsTotal.inBytesTotal | binary}}B)</td>
                   </tr>
                   </tr>
                   <tr>
                   <tr>
                     <th><span class="glyphicon glyphicon-cloud-upload"></span>&emsp;<span translate>Upload Rate</span></th>
                     <th><span class="glyphicon glyphicon-cloud-upload"></span>&emsp;<span translate>Upload Rate</span></th>
-                    <td class="text-right">{{connections_total.outbps | binary}}B/s ({{connections_total.outBytesTotal | binary}}B)</td>
+                    <td class="text-right">{{connectionsTotal.outbps | binary}}B/s ({{connectionsTotal.outBytesTotal | binary}}B)</td>
                   </tr>
                   </tr>
                   <tr>
                   <tr>
                     <th><span class="glyphicon glyphicon-th"></span>&emsp;<span translate>RAM Utilization</span></th>
                     <th><span class="glyphicon glyphicon-th"></span>&emsp;<span translate>RAM Utilization</span></th>

+ 10 - 2
gui/scripts/syncthing/core/controllers/syncthingController.js

@@ -24,7 +24,6 @@ angular.module('syncthing.core')
         $scope.config = {};
         $scope.config = {};
         $scope.configInSync = true;
         $scope.configInSync = true;
         $scope.connections = {};
         $scope.connections = {};
-        $scope.connections_total = {};
         $scope.errors = [];
         $scope.errors = [];
         $scope.model = {};
         $scope.model = {};
         $scope.myID = '';
         $scope.myID = '';
@@ -368,7 +367,16 @@ angular.module('syncthing.core')
                     id;
                     id;
 
 
                 prevDate = now;
                 prevDate = now;
-                $scope.connections_total = data['total'];
+
+                try {
+                    data.total.inbps = Math.max(0, (data.total.inBytesTotal - $scope.connectionsTotal.inBytesTotal) / td);
+                    data.total.outbps = Math.max(0, (data.total.outBytesTotal - $scope.connectionsTotal.outBytesTotal) / td);
+                } catch (e) {
+                    data.total.inbps = 0;
+                    data.total.outbps = 0;
+                }
+                $scope.connectionsTotal = data.total;
+
                 data = data.connections;
                 data = data.connections;
                 for (id in data) {
                 for (id in data) {
                     if (!data.hasOwnProperty(id)) {
                     if (!data.hasOwnProperty(id)) {

文件差异内容过多而无法显示
+ 1 - 1
internal/auto/gui.files.go


部分文件因为文件数量过多而无法显示