|
|
|
|
@ -1,8 +1,17 @@
|
|
|
|
|
import utils from "../../../services/utils.js";
|
|
|
|
|
import server from "../../../services/server.js";
|
|
|
|
|
import toastService from "../../../services/toast.js";
|
|
|
|
|
|
|
|
|
|
const TPL = `
|
|
|
|
|
<div>
|
|
|
|
|
<h4>Tray</h4>
|
|
|
|
|
|
|
|
|
|
<div class="custom-control custom-checkbox">
|
|
|
|
|
<input type="checkbox" class="custom-control-input" id="tray-enabled">
|
|
|
|
|
<label class="custom-control-label" for="tray-enabled">Enable tray (Trilium needs to be restarted for this change to take effect)</label>
|
|
|
|
|
</div>
|
|
|
|
|
<br/>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div>
|
|
|
|
|
<h4>Note erasure timeout</h4>
|
|
|
|
|
|
|
|
|
|
@ -35,27 +44,33 @@ const TPL = `
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div>
|
|
|
|
|
<h4>Network connections</h4>
|
|
|
|
|
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
<input id="check-for-updates" type="checkbox" name="check-for-updates">
|
|
|
|
|
<label for="check-for-updates">Check for updates automatically</label>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
`;
|
|
|
|
|
<h4>Network connections</h4>
|
|
|
|
|
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
<input id="check-for-updates" type="checkbox" name="check-for-updates">
|
|
|
|
|
<label for="check-for-updates">Check for updates automatically</label>
|
|
|
|
|
</div>
|
|
|
|
|
</div>`;
|
|
|
|
|
|
|
|
|
|
export default class OtherOptions {
|
|
|
|
|
constructor() {
|
|
|
|
|
$("#options-other").html(TPL);
|
|
|
|
|
|
|
|
|
|
this.$trayEnabled = $("#tray-enabled");
|
|
|
|
|
this.$trayEnabled.on('change', () => {
|
|
|
|
|
const opts = { 'disableTray': !this.$trayEnabled.is(":checked") ? "true" : "false" };
|
|
|
|
|
server.put('options', opts).then(() => toastService.showMessage("Options change have been saved."));
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.$eraseEntitiesAfterTimeInSeconds = $("#erase-entities-after-time-in-seconds");
|
|
|
|
|
|
|
|
|
|
this.$eraseEntitiesAfterTimeInSeconds.on('change', () => {
|
|
|
|
|
const eraseEntitiesAfterTimeInSeconds = this.$eraseEntitiesAfterTimeInSeconds.val();
|
|
|
|
|
|
|
|
|
|
server.put('options', { 'eraseEntitiesAfterTimeInSeconds': eraseEntitiesAfterTimeInSeconds }).then(() => {
|
|
|
|
|
toastService.showMessage("Options changed have been saved.");
|
|
|
|
|
toastService.showMessage("Options change have been saved.");
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
@ -72,7 +87,7 @@ export default class OtherOptions {
|
|
|
|
|
|
|
|
|
|
this.$noteRevisionsTimeInterval.on('change', () => {
|
|
|
|
|
const opts = { 'noteRevisionSnapshotTimeInterval': this.$noteRevisionsTimeInterval.val() };
|
|
|
|
|
server.put('options', opts).then(() => toastService.showMessage("Options changed have been saved."));
|
|
|
|
|
server.put('options', opts).then(() => toastService.showMessage("Options change have been saved."));
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
});
|
|
|
|
|
@ -82,11 +97,13 @@ export default class OtherOptions {
|
|
|
|
|
const isChecked = this.$checkForUpdates.prop("checked");
|
|
|
|
|
const opts = { 'checkForUpdates': isChecked ? 'true' : 'false' };
|
|
|
|
|
|
|
|
|
|
server.put('options', opts).then(() => toastService.showMessage("Options changed have been saved."));
|
|
|
|
|
server.put('options', opts).then(() => toastService.showMessage("Options change have been saved."));
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
optionsLoaded(options) {
|
|
|
|
|
this.$trayEnabled.prop("checked", options['disableTray'] !== 'true');
|
|
|
|
|
|
|
|
|
|
this.$eraseEntitiesAfterTimeInSeconds.val(options['eraseEntitiesAfterTimeInSeconds']);
|
|
|
|
|
this.$noteRevisionsTimeInterval.val(options['noteRevisionSnapshotTimeInterval']);
|
|
|
|
|
|
|
|
|
|
|