Browse Source

gui: Add detailed file versioning information to folder info (ref #963) (#8348)

tomasz1986 3 years ago
parent
commit
de2d7c33a3

+ 4 - 0
gui/default/assets/lang/lang-en.json

@@ -130,6 +130,7 @@
    "Enter ignore patterns, one per line.": "Enter ignore patterns, one per line.",
    "Enter up to three octal digits.": "Enter up to three octal digits.",
    "Error": "Error",
+   "External": "External",
    "External File Versioning": "External File Versioning",
    "Failed Items": "Failed Items",
    "Failed to load file versions.": "Failed to load file versions.",
@@ -318,6 +319,7 @@
    "Shown instead of Device ID in the cluster status. Will be updated to the name the device advertises if left empty.": "Shown instead of Device ID in the cluster status. Will be updated to the name the device advertises if left empty.",
    "Shutdown": "Shutdown",
    "Shutdown Complete": "Shutdown Complete",
+   "Simple": "Simple",
    "Simple File Versioning": "Simple File Versioning",
    "Single level wildcard (matches within a directory only)": "Single level wildcard (matches within a directory only)",
    "Size": "Size",
@@ -329,6 +331,7 @@
    "Stable releases and release candidates": "Stable releases and release candidates",
    "Stable releases are delayed by about two weeks. During this time they go through testing as release candidates.": "Stable releases are delayed by about two weeks. During this time they go through testing as release candidates.",
    "Stable releases only": "Stable releases only",
+   "Staggered": "Staggered",
    "Staggered File Versioning": "Staggered File Versioning",
    "Start Browser": "Start Browser",
    "Statistics": "Statistics",
@@ -395,6 +398,7 @@
    "Time": "Time",
    "Time the item was last modified": "Time the item was last modified",
    "Today": "Today",
+   "Trash Can": "Trash Can",
    "Trash Can File Versioning": "Trash Can File Versioning",
    "Twitter": "Twitter",
    "Type": "Type",

+ 26 - 6
gui/default/index.html

@@ -522,12 +522,32 @@
                         </td>
                       </tr>
                       <tr ng-if="folder.versioning.type">
-                        <th><span class="far fa-fw fa-copy"></span>&nbsp;<span translate>File Versioning</span></th>
-                        <td class="text-right" ng-switch="folder.versioning.type">
-                          <span ng-switch-when="trashcan" translate>Trash Can File Versioning</span>
-                          <span ng-switch-when="staggered" translate>Staggered File Versioning</span>
-                          <span ng-switch-when="simple" translate>Simple File Versioning</span>
-                          <span ng-switch-when="external" translate>External File Versioning</span>
+                        <th><span class="fa fa-fw fa-file"></span>&nbsp;<span translate>File Versioning</span></th>
+                        <td class="text-right">
+                          <span ng-switch="folder.versioning.type">
+                            <span ng-switch-when="trashcan" translate>Trash Can</span>
+                            <span ng-switch-when="simple" translate>Simple</span>
+                            <span ng-switch-when="staggered" translate>Staggered</span>
+                            <span ng-switch-when="external" tooltip data-original-title="<span class='text-monospace'>{{folder.versioning.params.command}}</span>" translate>External</span>
+                          </span>
+                          <span ng-if="folder.versioning.type != 'external'">
+                            <span ng-if="(folder.versioning.type == 'trashcan' || folder.versioning.type == 'simple') && folder.versioning.params.cleanoutDays != versioningDefaults.trashcanClean" tooltip data-original-title="{{'Clean out after' | translate}}">
+                              &ensp;<span class="fa fa-calendar"></span>&nbsp;{{folder.versioning.params.cleanoutDays * 86400 | duration:"d"}}
+                            </span>
+                            <span ng-if="folder.versioning.type == 'simple' && folder.versioning.params.keep != versioningDefaults.simpleKeep" tooltip data-original-title="{{'Keep Versions' | translate}}">
+                              &ensp;<span class="fa fa-file-archive-o"></span>&nbsp;{{folder.versioning.params.keep}}
+                            </span>
+                            <span ng-if="folder.versioning.type == 'staggered' && folder.versioning.params.maxAge != versioningDefaults.staggeredMaxAge" tooltip data-original-title="{{'Maximum Age' | translate}}">
+                              &ensp;<span class="fa fa-calendar"></span>&nbsp;{{folder.versioning.params.maxAge | duration}}
+                            </span>
+                            <span ng-if="folder.versioning.cleanupIntervalS != versioningDefaults.cleanupIntervalS" tooltip data-original-title="{{'Cleanup Interval' | translate}}">
+                              &ensp;<span class="fa fa-recycle"></span>&nbsp;<span ng-if="folder.versioning.cleanupIntervalS == 0" translate>Disabled</span><span ng-if="folder.versioning.cleanupIntervalS > 0">{{folder.versioning.cleanupIntervalS | duration}}</span>
+                            </span>
+                            <!-- Keep the path last, so that it truncates without pushing other information out of the screen. -->
+                            <span ng-if="folder.versioning.fsPath != ''" tooltip data-original-title="{{folder.versioning.fsPath}}">
+                              &ensp;<span class="fa fa-folder-open-o"></span>&nbsp;{{folder.versioning.fsPath}}
+                            </span>
+                          </span>
                         </td>
                       </tr>
                       <tr>

+ 5 - 1
gui/default/syncthing/core/durationFilter.js

@@ -21,7 +21,11 @@ angular.module('syncthing.core')
                 var t = (input / SECONDS_IN[k] | 0); // Math.floor
 
                 if (t > 0) {
-                    result += " " + t + k;
+                    if (!result) {
+                        result = t + k;
+                    } else {
+                        result += " " + t + k;
+                    }
                 }
 
                 if (precision == k) {