From b53c1b9a0414b48f5d554e746fd5d467a9d06f31 Mon Sep 17 00:00:00 2001 From: tomasz1986 Date: Fri, 10 Mar 2023 13:41:15 +0100 Subject: [PATCH] gui: Disable Restore Versions filters when no versioned files exist (fixes #5408) (#8539) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently, the name and date filters in the Restore Versions modal are always enabled, even if there are no versioned files present. With this change, they are enabled only when there are no errors and versioned files actually exist. In addition to disabling the filters, also completely skip date picker generation, as it serves no function while still displaying a non-sense date range, which starts today and ends in the past. Signed-off-by: Tomasz WilczyƄski --- gui/default/syncthing/core/syncthingController.js | 4 +++- .../syncthing/folder/restoreVersionsModalView.html | 12 +++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/gui/default/syncthing/core/syncthingController.js b/gui/default/syncthing/core/syncthingController.js index 495e4e1b0..6a39f3158 100755 --- a/gui/default/syncthing/core/syncthingController.js +++ b/gui/default/syncthing/core/syncthingController.js @@ -2686,6 +2686,8 @@ angular.module('syncthing.core') if (closed) { resetRestoreVersions(); return; + } else if ($scope.sizeOf($scope.restoreVersions.versions) === '0') { + return; } $scope.restoreVersions.tree = $("#restoreTree").fancytree({ @@ -2702,7 +2704,7 @@ angular.module('syncthing.core') indentation: 24, }, strings: { - loading: $translate.instant("Loading..."), + loading: $translate.instant("Loading data..."), loadError: $translate.instant("Failed to load file versions."), noData: $translate.instant("There are no file versions to restore.") }, diff --git a/gui/default/syncthing/folder/restoreVersionsModalView.html b/gui/default/syncthing/folder/restoreVersionsModalView.html index f9f4da92d..bde8e49a6 100644 --- a/gui/default/syncthing/folder/restoreVersionsModalView.html +++ b/gui/default/syncthing/folder/restoreVersionsModalView.html @@ -1,12 +1,14 @@