mirror of
https://github.com/octoleo/syncthing.git
synced 2025-02-02 03:48:26 +00:00
gui: Show remaining bytes in remote device panel (fixes #4227)
GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4246 LGTM: AudriusButkevicius, calmh
This commit is contained in:
parent
487655b365
commit
322bedbb04
@ -564,7 +564,7 @@
|
||||
<span ng-switch="deviceStatus(deviceCfg)" class="pull-right text-{{deviceClass(deviceCfg)}}">
|
||||
<span ng-switch-when="insync"><span class="hidden-xs" translate>Up to Date</span><span class="visible-xs">◼</span></span>
|
||||
<span ng-switch-when="syncing">
|
||||
<span class="hidden-xs" translate>Syncing</span> ({{completion[deviceCfg.deviceID]._total | number:0}}%)
|
||||
<span class="hidden-xs" translate>Syncing</span> ({{completion[deviceCfg.deviceID]._total | number:0}}%, {{completion[deviceCfg.deviceID]._needBytes | binary}}B)
|
||||
</span>
|
||||
<span ng-switch-when="paused"><span class="hidden-xs" translate>Paused</span><span class="visible-xs">◼</span></span>
|
||||
<span ng-switch-when="disconnected"><span class="hidden-xs" translate>Disconnected</span><span class="visible-xs">◼</span></span>
|
||||
|
@ -232,7 +232,8 @@ angular.module('syncthing.core')
|
||||
address: arg.data.addr
|
||||
};
|
||||
$scope.completion[arg.data.id] = {
|
||||
_total: 100
|
||||
_total: 100,
|
||||
_needBytes: 0
|
||||
};
|
||||
}
|
||||
});
|
||||
@ -378,7 +379,8 @@ angular.module('syncthing.core')
|
||||
$scope.devices = $scope.config.devices;
|
||||
$scope.devices.forEach(function (deviceCfg) {
|
||||
$scope.completion[deviceCfg.deviceID] = {
|
||||
_total: 100
|
||||
_total: 100,
|
||||
_needBytes: 0
|
||||
};
|
||||
});
|
||||
$scope.devices.sort(deviceCompare);
|
||||
@ -463,7 +465,7 @@ angular.module('syncthing.core')
|
||||
function recalcCompletion(device) {
|
||||
var total = 0, needed = 0, deletes = 0;
|
||||
for (var folder in $scope.completion[device]) {
|
||||
if (folder === "_total") {
|
||||
if (folder === "_total" || folder === '_needBytes') {
|
||||
continue;
|
||||
}
|
||||
total += $scope.completion[device][folder].globalBytes;
|
||||
@ -472,8 +474,10 @@ angular.module('syncthing.core')
|
||||
}
|
||||
if (total == 0) {
|
||||
$scope.completion[device]._total = 100;
|
||||
$scope.completion[device]._needBytes = 0;
|
||||
} else {
|
||||
$scope.completion[device]._total = 100 * (1 - needed / total);
|
||||
$scope.completion[device]._needBytes = needed
|
||||
}
|
||||
|
||||
if (needed == 0 && deletes > 0) {
|
||||
@ -481,6 +485,7 @@ angular.module('syncthing.core')
|
||||
// to do. Drop down the completion percentage to indicate
|
||||
// that we have stuff to do.
|
||||
$scope.completion[device]._total = 95;
|
||||
$scope.completion[device]._needBytes = 0;
|
||||
}
|
||||
|
||||
console.log("recalcCompletion", device, $scope.completion[device]);
|
||||
|
Loading…
x
Reference in New Issue
Block a user