gui: Count deleted items for remote out of sync items display (fixes #4668)

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4669
LGTM: calmh, AudriusButkevicius
This commit is contained in:
Simon Frei 2018-01-14 12:08:40 +00:00 committed by Audrius Butkevicius
parent 916ec63af6
commit f1c73999be
3 changed files with 13 additions and 14 deletions

View File

@ -665,14 +665,17 @@ func (s *apiService) getDBCompletion(w http.ResponseWriter, r *http.Request) {
return
}
comp := s.model.Completion(device, folder)
sendJSON(w, map[string]interface{}{
sendJSON(w, jsonCompletion(s.model.Completion(device, folder)))
}
func jsonCompletion(comp model.FolderCompletion) map[string]interface{} {
return map[string]interface{}{
"completion": comp.CompletionPct,
"needBytes": comp.NeedBytes,
"needItems": comp.NeedItems,
"globalBytes": comp.GlobalBytes,
"needDeletes": comp.NeedDeletes,
})
}
}
func (s *apiService) getDBStatus(w http.ResponseWriter, r *http.Request) {

View File

@ -205,15 +205,10 @@ func (c *folderSummaryService) sendSummary(folder string) {
// Get completion percentage of this folder for the
// remote device.
comp := c.model.Completion(devCfg.DeviceID, folder)
events.Default.Log(events.FolderCompletion, map[string]interface{}{
"folder": folder,
"device": devCfg.DeviceID.String(),
"completion": comp.CompletionPct,
"needBytes": comp.NeedBytes,
"needItems": comp.NeedItems,
"globalBytes": comp.GlobalBytes,
})
comp := jsonCompletion(c.model.Completion(devCfg.DeviceID, folder))
comp["folder"] = folder
comp["device"] = devCfg.DeviceID.String()
events.Default.Log(events.FolderCompletion, comp)
}
}

View File

@ -495,7 +495,7 @@ angular.module('syncthing.core')
} else {
$scope.completion[device]._total = Math.floor(100 * (1 - needed / total));
$scope.completion[device]._needBytes = needed
$scope.completion[device]._needItems = items;
$scope.completion[device]._needItems = items + deletes;
}
if (needed == 0 && deletes > 0) {
@ -2054,7 +2054,8 @@ angular.module('syncthing.core')
resetRemoteNeed();
$scope.remoteNeedDevice = device;
$scope.deviceFolders(device).forEach(function(folder) {
if ($scope.completion[device.deviceID][folder] !== undefined && $scope.completion[device.deviceID][folder].needItems === 0) {
var comp = $scope.completion[device.deviceID][folder];
if (comp !== undefined && comp.needItems + comp.needDeletes === 0) {
return;
}
$scope.remoteNeedFolders.push(folder);