editFolderModalView.html 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. <modal id="editFolder" status="default" icon="{{editingExisting ? 'pencil' : 'folder'}}" heading="{{editingExisting ? 'Edit Folder' : 'Add Folder' | translate}}" large="yes" closeable="yes">
  2. <div class="modal-body">
  3. <form role="form" name="folderEditor">
  4. <div class="row" ng-init="loadFormIntoScope(folderEditor)">
  5. <div class="col-md-12">
  6. <div class="form-group" ng-class="{'has-error': folderEditor.folderLabel.$invalid && folderEditor.folderLabel.$dirty}">
  7. <label for="folderLabel"><span translate>Folder Label</span></label>
  8. <input name="folderLabel" id="folderLabel" class="form-control" type="text" ng-model="currentFolder.label" value="{{currentFolder.label}}"/>
  9. <p class="help-block">
  10. <span translate ng-if="folderEditor.folderLabel.$valid || folderEditor.folderLabel.$pristine">Optional descriptive label for the folder. Can be different on each device.</span>
  11. </p>
  12. </div>
  13. <div class="form-group" ng-class="{'has-error': folderEditor.folderID.$invalid && folderEditor.folderID.$dirty}">
  14. <label for="folderID"><span translate>Folder ID</span></label>
  15. <input name="folderID" ng-readonly="editingExisting || (!editingExisting && currentFolder.viewFlags.importFromOtherDevice)" id="folderID" class="form-control" type="text" ng-model="currentFolder.id" required="" aria-required="true" unique-folder value="{{currentFolder.id}}"/>
  16. <p class="help-block">
  17. <span translate ng-if="folderEditor.folderID.$valid || folderEditor.folderID.$pristine">Required identifier for the folder. Must be the same on all cluster devices.</span>
  18. <span translate ng-if="folderEditor.folderID.$error.uniqueFolder">The folder ID must be unique.</span>
  19. <span translate ng-if="folderEditor.folderID.$error.required && folderEditor.folderID.$dirty">The folder ID cannot be blank.</span>
  20. </p>
  21. </div>
  22. <div class="form-group" ng-class="{'has-error': folderEditor.folderPath.$invalid && folderEditor.folderPath.$dirty}">
  23. <label translate for="folderPath">Folder Path</label>
  24. <input name="folderPath" ng-readonly="editingExisting" id="folderPath" class="form-control" type="text" ng-model="currentFolder.path" list="directory-list" required="" aria-required="true" path-is-sub-dir/>
  25. <datalist id="directory-list">
  26. <option ng-repeat="directory in directoryList" value="{{ directory }}" />
  27. </datalist>
  28. <p class="help-block">
  29. <span ng-if="folderEditor.folderPath.$valid || folderEditor.folderPath.$pristine"><span translate>Path to the folder on the local computer. Will be created if it does not exist. The tilde character (~) can be used as a shortcut for</span> <code>{{system.tilde}}</code>.</br></span>
  30. <span translate ng-if="folderEditor.folderPath.$error.required && folderEditor.folderPath.$dirty">The folder path cannot be blank.</span>
  31. <span class="text-danger" translate translate-value-other-folder="{{folderPathErrors.otherID}}" ng-if="folderPathErrors.isSub && folderPathErrors.otherLabel.length == 0">Warning, this path is a subdirectory of an existing folder "{%otherFolder%}".</span>
  32. <span class="text-danger" translate translate-value-other-folder="{{folderPathErrors.otherID}}" translate-value-other-folder-label="{{folderPathErrors.otherLabel}}" ng-if="folderPathErrors.isSub && folderPathErrors.otherLabel.length != 0">Warning, this path is a subdirectory of an existing folder "{%otherFolderLabel%}" ({%otherFolder%}).</span>
  33. <span class="text-danger" translate translate-value-other-folder="{{folderPathErrors.otherID}}" ng-if="folderPathErrors.isParent && folderPathErrors.otherLabel.length == 0">Warning, this path is a parent directory of an existing folder "{%otherFolder%}".</span>
  34. <span class="text-danger" translate translate-value-other-folder="{{folderPathErrors.otherID}}" translate-value-other-folder-label="{{folderPathErrors.otherLabel}}" ng-if="folderPathErrors.isParent && folderPathErrors.otherLabel.length != 0">Warning, this path is a parent directory of an existing folder "{%otherFolderLabel%}" ({%otherFolder%}).</span>
  35. </p>
  36. </div>
  37. </div>
  38. </div>
  39. <div class="row">
  40. <div class="col-md-12">
  41. <div class="form-group">
  42. <label translate for="devices">Share With Devices</label>
  43. <p translate class="help-block">Select the devices to share this folder with.</p>
  44. <div class="row">
  45. <div class="col-md-4" ng-repeat="device in otherDevices()">
  46. <div class="checkbox">
  47. <label>
  48. <input type="checkbox" ng-model="currentFolder.selectedDevices[device.deviceID]"/> {{deviceName(device)}}
  49. </label>
  50. </div>
  51. </div>
  52. </div>
  53. </div>
  54. </div>
  55. </div>
  56. <div translate ng-show="!editingExisting" class="help-block">When adding a new folder, keep in mind that the Folder ID is used to tie folders together between devices. They are case sensitive and must match exactly between all devices.</div>
  57. <div class="row">
  58. <div class="col-md-12">
  59. <label data-target="#folder-advanced" class="folder-advanced-toggle collapsed" data-toggle="collapse">
  60. <span translate>Advanced settings</span>&nbsp;
  61. <i class="expand fa fa-plus-square"></i>
  62. <i class="collapse fa fa-minus-square"></i>
  63. </label>
  64. </div>
  65. </div>
  66. <div id="folder-advanced" class="folder-advanced collapse">
  67. <div class="row">
  68. <div class="col-md-6">
  69. <div class="form-group" ng-class="{'has-error': folderEditor.rescanIntervalS.$invalid && folderEditor.rescanIntervalS.$dirty}">
  70. <label for="rescanIntervalS"><span translate>Rescan Interval</span> (s)</label><br/>
  71. <input name="rescanIntervalS" id="rescanIntervalS" class="form-control" type="number" ng-model="currentFolder.rescanIntervalS" required="" aria-required="true" min="0"/>
  72. <p class="help-block">
  73. <span translate ng-if="!folderEditor.rescanIntervalS.$valid && folderEditor.rescanIntervalS.$dirty">The rescan interval must be a non-negative number of seconds.</span>
  74. </p>
  75. </div>
  76. </div>
  77. <div class="col-md-6 form-horizontal">
  78. <div class="form-group" ng-class="{'has-error': folderEditor.minDiskFree.$invalid && folderEditor.minDiskFree.$dirty}">
  79. <label class="col-xs-12" for="minDiskFree"><span translate>Minimum Free Disk Space</span></label><br/>
  80. <div class="col-xs-9"><input name="minDiskFree" id="minDiskFree" class="form-control" type="number" ng-model="currentFolder.minDiskFree.value" required="" aria-required="true" min="0" step="0.01"/></div>
  81. <div class="col-xs-3"><select class="col-sm-3 form-control" ng-model="currentFolder.minDiskFree.unit">
  82. <option value="%">%</option>
  83. <option value="kB">kB</option>
  84. <option value="MB">MB</option>
  85. <option value="GB">GB</option>
  86. <option value="TB">TB</option>
  87. </select></div>
  88. <p class="col-xs-12 help-block" ng-show="folderEditor.minDiskFree.$invalid">
  89. <span translate>Enter a non-negative number (e.g., "2.35") and select a unit. Percentages are as part of the total disk size.</span>
  90. </p>
  91. </div>
  92. </div>
  93. </div>
  94. <div class="row">
  95. <!-- Left column -->
  96. <div class="col-md-6">
  97. <div class="form-group">
  98. <label translate>Folder Type</label>
  99. &nbsp;<a href="https://docs.syncthing.net/users/foldertypes.html" target="_blank"><span class="fa fa-book"></span>&nbsp;<span translate>Help</span></a>
  100. <select class="form-control" ng-model="currentFolder.type">
  101. <option value="readwrite" translate>Send &amp; Receive</option>
  102. <option value="readonly" translate>Send Only</option>
  103. </select>
  104. <p ng-if="currentFolder.type == 'readonly'" translate class="help-block">Files are protected from changes made on other devices, but changes made on this device will be sent to the rest of the cluster.</p>
  105. </div>
  106. <div class="form-group">
  107. <div class="checkbox">
  108. <label>
  109. <input type="checkbox" ng-model="currentFolder.ignorePerms"/> <span translate>Ignore Permissions</span>
  110. </label>
  111. </div>
  112. <p translate class="help-block">File permission bits are ignored when looking for changes. Use on FAT file systems.</p>
  113. </div>
  114. </div>
  115. <!-- Right column-->
  116. <div class="col-md-6">
  117. <div class="form-group">
  118. <label translate>File Pull Order</label>
  119. <select class="form-control" ng-model="currentFolder.order">
  120. <option value="random" translate>Random</option>
  121. <option value="alphabetic" translate>Alphabetic</option>
  122. <option value="smallestFirst" translate>Smallest First</option>
  123. <option value="largestFirst" translate>Largest First</option>
  124. <option value="oldestFirst" translate>Oldest First</option>
  125. <option value="newestFirst" translate>Newest First</option>
  126. </select>
  127. </div>
  128. <div class="form-group">
  129. <label translate>File Versioning</label>&emsp;<a href="https://docs.syncthing.net/users/versioning.html" target="_blank"><span class="fa fa-book"></span>&nbsp;<span translate>Help</span></a>
  130. <select class="form-control" ng-model="currentFolder.fileVersioningSelector">
  131. <option value="none" translate>No File Versioning</option>
  132. <option value="trashcan" translate>Trash Can File Versioning</option>
  133. <option value="simple" translate>Simple File Versioning</option>
  134. <option value="staggered" translate>Staggered File Versioning</option>
  135. <option value="external" translate>External File Versioning</option>
  136. </select>
  137. </div>
  138. <div class="form-group" ng-if="currentFolder.fileVersioningSelector=='trashcan'" ng-class="{'has-error': folderEditor.trashcanClean.$invalid && folderEditor.trashcanClean.$dirty}">
  139. <p translate class="help-block">Files are moved to .stversions directory when replaced or deleted by Syncthing.</p>
  140. <label translate for="trashcanClean">Clean out after</label>
  141. <div class="input-group">
  142. <input name="trashcanClean" id="trashcanClean" class="form-control text-right" type="number" ng-model="currentFolder.trashcanClean" required="" aria-required="true" min="0"/>
  143. <div class="input-group-addon" translate>days</div>
  144. </div>
  145. <p class="help-block">
  146. <span translate ng-if="folderEditor.trashcanClean.$valid || folderEditor.trashcanClean.$pristine">The number of days to keep files in the trash can. Zero means forever.</span>
  147. <span translate ng-if="folderEditor.trashcanClean.$error.required && folderEditor.trashcanClean.$dirty">The number of days must be a number and cannot be blank.</span>
  148. <span translate ng-if="folderEditor.trashcanClean.$error.min && folderEditor.trashcanClean.$dirty">A negative number of days doesn't make sense.</span>
  149. </p>
  150. </div>
  151. <div class="form-group" ng-if="currentFolder.fileVersioningSelector=='simple'" ng-class="{'has-error': folderEditor.simpleKeep.$invalid && folderEditor.simpleKeep.$dirty}">
  152. <p translate class="help-block">Files are moved to date stamped versions in a .stversions directory when replaced or deleted by Syncthing.</p>
  153. <label translate for="simpleKeep">Keep Versions</label>
  154. <input name="simpleKeep" id="simpleKeep" class="form-control" type="number" ng-model="currentFolder.simpleKeep" required="" aria-required="true" min="1"/>
  155. <p class="help-block">
  156. <span translate ng-if="folderEditor.simpleKeep.$valid || folderEditor.simpleKeep.$pristine">The number of old versions to keep, per file.</span>
  157. <span translate ng-if="folderEditor.simpleKeep.$error.required && folderEditor.simpleKeep.$dirty">The number of versions must be a number and cannot be blank.</span>
  158. <span translate ng-if="folderEditor.simpleKeep.$error.min && folderEditor.simpleKeep.$dirty">You must keep at least one version.</span>
  159. </p>
  160. </div>
  161. <div class="form-group" ng-if="currentFolder.fileVersioningSelector=='staggered'" ng-class="{'has-error': folderEditor.staggeredMaxAge.$invalid && folderEditor.staggeredMaxAge.$dirty}">
  162. <p class="help-block"><span translate>Files are moved to date stamped versions in a .stversions directory when replaced or deleted by Syncthing.</span> <span translate>Versions are automatically deleted if they are older than the maximum age or exceed the number of files allowed in an interval.</span></p>
  163. <p translate class="help-block">The following intervals are used: for the first hour a version is kept every 30 seconds, for the first day a version is kept every hour, for the first 30 days a version is kept every day, until the maximum age a version is kept every week.</p>
  164. <label translate for="staggeredMaxAge">Maximum Age</label>
  165. <input name="staggeredMaxAge" id="staggeredMaxAge" class="form-control" type="number" ng-model="currentFolder.staggeredMaxAge" required="" aria-required="true" min="0"/>
  166. <p class="help-block">
  167. <span translate ng-if="folderEditor.staggeredMaxAge.$valid || folderEditor.staggeredMaxAge.$pristine">The maximum time to keep a version (in days, set to 0 to keep versions forever).</span>
  168. <span translate ng-if="folderEditor.staggeredMaxAge.$error.required && folderEditor.staggeredMaxAge.$dirty">The maximum age must be a number and cannot be blank.</span>
  169. <span translate ng-if="folderEditor.staggeredMaxAge.$error.min && folderEditor.staggeredMaxAge.$dirty">A negative number of days doesn't make sense.</span>
  170. </p>
  171. </div>
  172. <div class="form-group" ng-if="currentFolder.fileVersioningSelector == 'staggered'">
  173. <label translate for="staggeredVersionsPath">Versions Path</label>
  174. <input name="staggeredVersionsPath" id="staggeredVersionsPath" class="form-control" type="text" ng-model="currentFolder.staggeredVersionsPath"/>
  175. <p translate class="help-block">Path where versions should be stored (leave empty for the default .stversions directory in the shared folder).</p>
  176. </div>
  177. <div class="form-group" ng-if="currentFolder.fileVersioningSelector=='external'" ng-class="{'has-error': folderEditor.externalCommand.$invalid && folderEditor.externalCommand.$dirty}">
  178. <p translate class="help-block">An external command handles the versioning. It has to remove the file from the shared folder.</p>
  179. <label translate for="externalCommand">Command</label>
  180. <input name="externalCommand" id="externalCommand" class="form-control" type="text" ng-model="currentFolder.externalCommand" required="" aria-required="true" />
  181. <p class="help-block">
  182. <span translate ng-if="folderEditor.externalCommand.$valid || folderEditor.externalCommand.$pristine">The first command line parameter is the folder path and the second parameter is the relative path in the folder.</span>
  183. <span translate ng-if="folderEditor.externalCommand.$error.required && folderEditor.externalCommand.$dirty">The path cannot be blank.</span>
  184. </p>
  185. </div>
  186. </div>
  187. </div>
  188. </div>
  189. </form>
  190. </div>
  191. <div class="modal-footer">
  192. <button type="button" class="btn btn-primary btn-sm" ng-click="saveFolder()" ng-disabled="folderEditor.$invalid">
  193. <span class="fa fa-check"></span>&nbsp;<span translate>Save</span>
  194. </button>
  195. <button type="button" class="btn btn-default btn-sm" id="editIgnoresButton" ng-click="editingExisting ? editIgnores() : editIgnoresOnAddingFolder()" ng-disabled="folderEditor.$invalid">
  196. <span class="fa fa-eye-slash"></span>&nbsp;<span translate>Ignore Patterns</span>
  197. </button>
  198. <button type="button" class="btn btn-default btn-sm" data-dismiss="modal">
  199. <span class="fa fa-times"></span>&nbsp;<span translate>Close</span>
  200. </button>
  201. <button type="button" class="btn btn-warning pull-left btn-sm" ng-click="deleteFolder(currentFolder.id)" ng-if="editingExisting">
  202. <span class="fa fa-minus-circle"></span>&nbsp;<span translate>Remove</span>
  203. </button>
  204. </div>
  205. </modal>