diff --git a/gui/default/assets/css/overrides.css b/gui/default/assets/css/overrides.css index 853e5a322..ea0839cb9 100644 --- a/gui/default/assets/css/overrides.css +++ b/gui/default/assets/css/overrides.css @@ -221,6 +221,13 @@ identicon { height: 1em; } +a.toggler { + color: inherit; +} +a.toggler:hover { + border-bottom: 1px dashed; + text-decoration: none; +} /** * Progress bars with centered text diff --git a/gui/default/index.html b/gui/default/index.html index 2e613c295..7f0027458 100644 --- a/gui/default/index.html +++ b/gui/default/index.html @@ -473,11 +473,23 @@  Download Rate - {{connectionsTotal.inbps | binary}}B/s ({{connectionsTotal.inBytesTotal | binary}}B) + + + {{connectionsTotal.inbps | binary}}B/s + {{connectionsTotal.inbps*8 | metric}}bps + ({{connectionsTotal.inBytesTotal | binary}}B) + +  Upload Rate - {{connectionsTotal.outbps | binary}}B/s ({{connectionsTotal.outBytesTotal | binary}}B) + + + {{connectionsTotal.outbps | binary}}B/s + {{connectionsTotal.outbps*8 | metric}}bps + ({{connectionsTotal.outBytesTotal | binary}}B) + +  Local State (Total) @@ -705,6 +717,7 @@ + diff --git a/gui/default/syncthing/core/binaryFilter.js b/gui/default/syncthing/core/binaryFilter.js index ae14fcfe4..e9e30e06f 100644 --- a/gui/default/syncthing/core/binaryFilter.js +++ b/gui/default/syncthing/core/binaryFilter.js @@ -1,7 +1,7 @@ angular.module('syncthing.core') .filter('binary', function () { return function (input) { - if (input === undefined) { + if (input === undefined || isNaN(input)) { return '0 '; } if (input > 1024 * 1024 * 1024) { diff --git a/gui/default/syncthing/core/metricFilter.js b/gui/default/syncthing/core/metricFilter.js new file mode 100644 index 000000000..8d40e28eb --- /dev/null +++ b/gui/default/syncthing/core/metricFilter.js @@ -0,0 +1,21 @@ +angular.module('syncthing.core') + .filter('metric', function () { + return function (input) { + if (input === undefined || isNaN(input)) { + return '0 '; + } + if (input > 1000 * 1000 * 1000) { + input /= 1000 * 1000 * 1000; + return input.toFixed(decimals(input, 2)) + ' G'; + } + if (input > 1000 * 1000) { + input /= 1000 * 1000; + return input.toFixed(decimals(input, 2)) + ' M'; + } + if (input > 1000) { + input /= 1000; + return input.toFixed(decimals(input, 2)) + ' k'; + } + return Math.round(input) + ' '; + }; + }); diff --git a/gui/default/syncthing/core/syncthingController.js b/gui/default/syncthing/core/syncthingController.js index 8bb387214..f1717681e 100755 --- a/gui/default/syncthing/core/syncthingController.js +++ b/gui/default/syncthing/core/syncthingController.js @@ -52,6 +52,11 @@ angular.module('syncthing.core') $scope.scanProgress = {}; $scope.themes = []; $scope.globalChangeEvents = {}; + $scope.metricRates = false; + + try { + $scope.metricRates = (window.localStorage["metricRates"] == "true"); + } catch (exception) { } $scope.localStateTotal = { bytes: 0, @@ -1759,7 +1764,6 @@ angular.module('syncthing.core') }; $scope.modalLoaded = function () { - // once all modal elements have been processed if ($('modal').length === 0) { @@ -1768,4 +1772,10 @@ angular.module('syncthing.core') } } + $scope.toggleUnits = function () { + $scope.metricRates = !$scope.metricRates; + try { + window.localStorage["metricRates"] = $scope.metricRates; + } catch (exception) { } + } });