#766: setting for no/unlimited history

This commit is contained in:
antelle 2020-03-15 15:54:06 +01:00
parent 85e9a4c4c6
commit 42833accc0
7 changed files with 33 additions and 8 deletions

View File

@ -466,6 +466,10 @@
"setFileNames": "Names",
"setFileDefUser": "Default user",
"setFileEnableTrash": "Enable trash",
"setFileHistMode": "Entry history",
"setFileHistLimited": "Delete old history records automatically",
"setFileHistDisabled": "Don't save history",
"setFileHistUnlimited": "Keep history records forever",
"setFileHistLen": "History length, keep last records per entry",
"setFileHistSize": "History size, total MB per file",
"setFileBackups": "Backups",

View File

@ -176,7 +176,9 @@ class EntryModel extends Model {
_entryModified() {
if (!this.unsaved) {
this.unsaved = true;
this.entry.pushHistory();
if (this.file.historyMaxItems !== 0) {
this.entry.pushHistory();
}
this.file.setModified();
}
if (this.isJustCreated) {

View File

@ -45,6 +45,7 @@ class SettingsFileView extends View {
'change #settings__file-backup-schedule': 'changeBackupSchedule',
'click .settings__file-button-backup': 'backupFile',
'change #settings__file-trash': 'changeTrash',
'change #settings__file-hist-type': 'changeHistoryMode',
'input #settings__file-hist-len': 'changeHistoryLength',
'input #settings__file-hist-size': 'changeHistorySize',
'change #settings__file-format-version': 'changeFormatVersion',
@ -613,6 +614,15 @@ class SettingsFileView extends View {
this.model.setHistoryMaxItems(value);
}
changeHistoryMode(e) {
let value = +e.target.value;
if (value > 0) {
value = 10;
}
this.model.setHistoryMaxItems(value);
this.render();
}
changeHistorySize(e) {
if (!e.target.validity.valid) {
return;

View File

@ -122,8 +122,16 @@
<input type="checkbox" class="settings__input input-base" id="settings__file-trash" {{#if recycleBinEnabled}}checked{{/if}} />
<label for="settings__file-trash">{{res 'setFileEnableTrash'}}</label>
</div>
<label for="settings__file-hist-len">{{res 'setFileHistLen'}}:</label>
<input type="text" pattern="\d+" required class="settings__input input-base" id="settings__file-hist-len" value="{{historyMaxItems}}" maxlength="6" />
<label for="settings__file-hist-type">{{res 'setFileHistMode'}}</label>
<select class="settings__select input-base" id="settings__file-hist-type">
<option value="1" {{#cmp historyMaxItems 0 '>'}}selected{{/cmp}}>{{res 'setFileHistLimited'}}</option>
<option value="0" {{#ifeq historyMaxItems 0}}selected{{/ifeq}}>{{res 'setFileHistDisabled'}}</option>
<option value="-1" {{#ifeq historyMaxItems -1}}selected{{/ifeq}}>{{res 'setFileHistUnlimited'}}</option>
</select>
{{#cmp historyMaxItems 0 '>'}}
<label for="settings__file-hist-len">{{res 'setFileHistLen'}}:</label>
<input type="text" pattern="\d+" required class="settings__input input-base" id="settings__file-hist-len" value="{{historyMaxItems}}" maxlength="6" />
{{/cmp}}
<label for="settings__file-hist-size">{{res 'setFileHistSize'}}:</label>
<input type="text" pattern="\d+" required class="settings__input input-base" id="settings__file-hist-size" value="{{historyMaxSize}}" maxlength="3" />

6
package-lock.json generated
View File

@ -7919,9 +7919,9 @@
"integrity": "sha512-pBxcB3LFc8QVgdggvZWyeys+hnrNWg4OcZIU/1X59k5jQdLBlCsYGRQaz234SqoRLTCgMH00fY0xRJH+F9METQ=="
},
"kdbxweb": {
"version": "1.5.7",
"resolved": "https://registry.npmjs.org/kdbxweb/-/kdbxweb-1.5.7.tgz",
"integrity": "sha512-+3YKYprvdM1Ot88dN0sqq7+DImP8cY4JjHAwSpQYBkNTVRzHm6gDV5UCa/WNPNx3p7POI14AiFpMlp1U8AdaoQ==",
"version": "1.5.8",
"resolved": "https://registry.npmjs.org/kdbxweb/-/kdbxweb-1.5.8.tgz",
"integrity": "sha512-YYdSg/v0d/4Y15/a4kRWTtStKFtB/8HK6xLVTxdjFGfWo3xsmJ0WRRqyNksxBKvt6sw3eNQqf1QH2p0QMzXBug==",
"requires": {
"pako": "github:keeweb/pako#653c0b00d8941c89d09ed4546d2179001ec44efc",
"text-encoding": "github:keeweb/text-encoding#4dfb7cb0954c222852092f8b06ae4f6b4f60bfbb",

View File

@ -59,7 +59,7 @@
"jquery": "3.4.1",
"json-loader": "^0.5.7",
"jsqrcode": "github:antelle/jsqrcode#0.1.3",
"kdbxweb": "1.5.7",
"kdbxweb": "1.5.8",
"load-grunt-tasks": "5.1.0",
"lodash": "^4.17.15",
"marked": "^0.8.0",

View File

@ -7,7 +7,8 @@ Release notes
`+` #1393: option to disable saving and exporting (canSaveTo)
`+` #1006: password generator patterns
`+` #1309: back button in attachment preview
`+` #1142: submit button on mobile password input
`+` #1142: submit button on mobile password input
`+` #766: setting for no/unlimited history
`-` fix #1396: fixed hyperlinks in notes
`-` fix #1323: version in the About dialog
`-` fix #734: OTP secrets with spaces