From e03be9158b03b3ad3c880ace569d64b633d687d9 Mon Sep 17 00:00:00 2001 From: benshep Date: Thu, 26 Jan 2017 09:39:48 +0000 Subject: [PATCH] gui: Remaining sync bytes in folder header (fixes #3908) The progress indicator in the folder header in the GUI now shows the remaining bytes to sync as well as the percentage. GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3928 --- gui/default/index.html | 2 +- .../syncthing/core/syncthingController.js | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/gui/default/index.html b/gui/default/index.html index f4be9e91..5c9b10be 100644 --- a/gui/default/index.html +++ b/gui/default/index.html @@ -285,7 +285,7 @@ - ({{syncPercentage(folder.id)}}%) + ({{syncPercentage(folder.id)}}%, {{syncRemaining(folder.id) | binary}}B) diff --git a/gui/default/syncthing/core/syncthingController.js b/gui/default/syncthing/core/syncthingController.js index 255ff3f9..de5d6a9d 100755 --- a/gui/default/syncthing/core/syncthingController.js +++ b/gui/default/syncthing/core/syncthingController.js @@ -722,6 +722,22 @@ angular.module('syncthing.core') return Math.floor(pct); }; + $scope.syncRemaining = function (folder) { + // Remaining sync bytes + if (typeof $scope.model[folder] === 'undefined') { + return 0; + } + if ($scope.model[folder].globalBytes === 0) { + return 0; + } + + var bytes = $scope.model[folder].globalBytes - $scope.model[folder].inSyncBytes; + if (isNaN(bytes) || bytes < 0) { + return 0; + } + return bytes; + }; + $scope.scanPercentage = function (folder) { if (!$scope.scanProgress[folder]) { return undefined;