diff options
author | tomasz1986 <twilczynski@naver.com> | 2023-03-10 13:41:15 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-10 13:41:15 +0100 |
commit | b53c1b9a0414b48f5d554e746fd5d467a9d06f31 (patch) | |
tree | 29082d0c7bb6e65c7f18593d1b6537a42a687ee6 | |
parent | b00976781c9cded60c56163660813997e39b64b7 (diff) |
gui: Disable Restore Versions filters when no versioned files exist (fixes #5408) (#8539)
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 <twilczynski@naver.com>
-rwxr-xr-x | gui/default/syncthing/core/syncthingController.js | 4 | ||||
-rw-r--r-- | gui/default/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 495e4e1b07..6a39f31580 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 f9f4da92d7..bde8e49a60 100644 --- a/gui/default/syncthing/folder/restoreVersionsModalView.html +++ b/gui/default/syncthing/folder/restoreVersionsModalView.html @@ -1,12 +1,14 @@ <modal id="restoreVersions" status="default" icon="fas fa-undo" heading="{{'Restore Versions' | translate}} ({{folderLabel(restoreVersions.folder)}})" large="yes" closeable="yes"> <div class="modal-body"> - <span translate ng-if="!restoreVersions.versions && !restoreVersions.errors">Loading data...</span> - <div ng-if="restoreVersions.versions"> + <div ng-if="restoreVersions.versions && !restoreVersions.errors"> <div id="restoreTree-container"> <table id="restoreTree"> <tbody> <tr> - <td></td> + <td> + <span ng-if="sizeOf(restoreVersions.versions) > 0" translate>Loading data...</span> + <span ng-if="sizeOf(restoreVersions.versions) == 0" translate>There are no file versions to restore.</span> + </td> <td></td> </tr> </tbody> @@ -17,13 +19,13 @@ <div class="col-md-6"> <div class="form-group"> <label for="restoreVersionSearch"><span translate>Filter by name</span>: </label> - <input id="restoreVersionSearch" class="form-control" type="text" ng-model="restoreVersions.filters.text"> + <input id="restoreVersionSearch" class="form-control" type="text" ng-model="restoreVersions.filters.text" ng-disabled="sizeOf(restoreVersions.versions) == 0"> </div> </div> <div class="col-md-6"> <div class="form-group"> <label for="restoreVersionDate"><span translate>Filter by date</span>: </label> - <input id="restoreVersionDateRange" class="form-control"> + <input id="restoreVersionDateRange" class="form-control" ng-disabled="sizeOf(restoreVersions.versions) == 0"> </div> </div> </div> |