mirror of
https://github.com/octoleo/syncthing.git
synced 2024-11-10 15:20:56 +00:00
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:
parent
916ec63af6
commit
f1c73999be
@ -665,14 +665,17 @@ func (s *apiService) getDBCompletion(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
comp := s.model.Completion(device, folder)
|
sendJSON(w, jsonCompletion(s.model.Completion(device, folder)))
|
||||||
sendJSON(w, map[string]interface{}{
|
}
|
||||||
|
|
||||||
|
func jsonCompletion(comp model.FolderCompletion) map[string]interface{} {
|
||||||
|
return map[string]interface{}{
|
||||||
"completion": comp.CompletionPct,
|
"completion": comp.CompletionPct,
|
||||||
"needBytes": comp.NeedBytes,
|
"needBytes": comp.NeedBytes,
|
||||||
"needItems": comp.NeedItems,
|
"needItems": comp.NeedItems,
|
||||||
"globalBytes": comp.GlobalBytes,
|
"globalBytes": comp.GlobalBytes,
|
||||||
"needDeletes": comp.NeedDeletes,
|
"needDeletes": comp.NeedDeletes,
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *apiService) getDBStatus(w http.ResponseWriter, r *http.Request) {
|
func (s *apiService) getDBStatus(w http.ResponseWriter, r *http.Request) {
|
||||||
|
@ -205,15 +205,10 @@ func (c *folderSummaryService) sendSummary(folder string) {
|
|||||||
|
|
||||||
// Get completion percentage of this folder for the
|
// Get completion percentage of this folder for the
|
||||||
// remote device.
|
// remote device.
|
||||||
comp := c.model.Completion(devCfg.DeviceID, folder)
|
comp := jsonCompletion(c.model.Completion(devCfg.DeviceID, folder))
|
||||||
events.Default.Log(events.FolderCompletion, map[string]interface{}{
|
comp["folder"] = folder
|
||||||
"folder": folder,
|
comp["device"] = devCfg.DeviceID.String()
|
||||||
"device": devCfg.DeviceID.String(),
|
events.Default.Log(events.FolderCompletion, comp)
|
||||||
"completion": comp.CompletionPct,
|
|
||||||
"needBytes": comp.NeedBytes,
|
|
||||||
"needItems": comp.NeedItems,
|
|
||||||
"globalBytes": comp.GlobalBytes,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -495,7 +495,7 @@ angular.module('syncthing.core')
|
|||||||
} else {
|
} else {
|
||||||
$scope.completion[device]._total = Math.floor(100 * (1 - needed / total));
|
$scope.completion[device]._total = Math.floor(100 * (1 - needed / total));
|
||||||
$scope.completion[device]._needBytes = needed
|
$scope.completion[device]._needBytes = needed
|
||||||
$scope.completion[device]._needItems = items;
|
$scope.completion[device]._needItems = items + deletes;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (needed == 0 && deletes > 0) {
|
if (needed == 0 && deletes > 0) {
|
||||||
@ -2054,7 +2054,8 @@ angular.module('syncthing.core')
|
|||||||
resetRemoteNeed();
|
resetRemoteNeed();
|
||||||
$scope.remoteNeedDevice = device;
|
$scope.remoteNeedDevice = device;
|
||||||
$scope.deviceFolders(device).forEach(function(folder) {
|
$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;
|
return;
|
||||||
}
|
}
|
||||||
$scope.remoteNeedFolders.push(folder);
|
$scope.remoteNeedFolders.push(folder);
|
||||||
|
Loading…
Reference in New Issue
Block a user