Repository: syncthing/syncthing (language: go)

Issue:
Selection of time in versions GUI not possible without editing the string inside the textfield
Steps to reproduce:
- Create a folder with versioning 
- Click on the folder and click the versions button
- click on the date textfield
- select Custom Range
- click on one of the drop down selectors for time
- The list of numbers appears and disappears a very short time after it --> no time for choose an other time

I'm using the latest Firefox and ST v0.14.54 on Linux


Discussion / hints:
I can reproduce it on Mac with Safari Version 12.0.2 (12606.3.4.1.4) and Waterfox 56.2.6 (64-bit) with Syncthing  v1.0.0, macOS (64 bit) 

This is how it looks like:
<img width="925" alt="bildschirmfoto 2019-01-14 um 00 07 58" src="https://user-images.githubusercontent.com/12977080/51091903-7872d880-1791-11e9-9674-901b03e40157.png">


Does the same thing on Windows in Opera, Vivaldi and Chrome.

I temporarily fixed this by adding top:200px in the dev console to move it down. I then discovered that the date picker doesn't work at all and is stuck on 1969 and 1970!

![figure-1](https://user-images.githubusercontent.com/25500388/55552365-11502a80-56d5-11e9-952f-aa5a996bf1a0.png)
There is also a ticket for that but the later is I think browser related.
Yep, still broken, firefox nightly.
Is this actually a bug?

I mean, this only happens if there are no files in `.stversions` (as you can see by the cut-off "No data." string in the screenshots). Obviously, the date picker does not work in such a case. I guess that maybe the filter input fields should be disabled if there are no files to restore?

**Edit**:

Not a bug per se, but really the Versions button should be disabled if the versions folder is empty. Now, it seems the button becomes available as soon as the folder has been created, regardless of whether there are actually any files inside it.

Fix patch:
diff --git a/gui/default/syncthing/core/syncthingController.js b/gui/default/syncthing/core/syncthingController.js
index f61f0b0cf7a..0fde4a4b3fd 100755
--- a/gui/default/syncthing/core/syncthingController.js
+++ b/gui/default/syncthing/core/syncthingController.js
@@ -2685,6 +2685,8 @@ angular.module('syncthing.core')
                             if (closed) {
                                 resetRestoreVersions();
                                 return;
+                            } else if ($scope.sizeOf($scope.restoreVersions.versions) === '0') {
+                                return;
                             }
 
                             $scope.restoreVersions.tree = $("#restoreTree").fancytree({
@@ -2701,7 +2703,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 f9f4da92d76..bde8e49a60e 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>:&nbsp</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>:&nbsp</label>
-            <input id="restoreVersionDateRange" class="form-control">
+            <input id="restoreVersionDateRange" class="form-control" ng-disabled="sizeOf(restoreVersions.versions) == 0">
           </div>
         </div>
       </div>


Test patch: