mirror of
https://github.com/zadam/trilium.git
synced 2025-01-31 03:19:11 +08:00
raw conversion of all options tabs
This commit is contained in:
parent
5f6a10ef22
commit
2a68bdb690
18 changed files with 335 additions and 253 deletions
|
@ -12,6 +12,21 @@ import VimKeyBindingsOptions from "./options/code_notes/vim_key_bindings.js";
|
|||
import WrapLinesOptions from "./options/code_notes/wrap_lines.js";
|
||||
import CodeAutoReadOnlySizeOptions from "./options/code_notes/code_auto_read_only_size.js";
|
||||
import CodeMimeTypesOptions from "./options/code_notes/code_mime_types.js";
|
||||
import ImageOptions from "./options/images.js";
|
||||
import SpellcheckOptions from "./options/spellcheck.js";
|
||||
import PasswordOptions from "./options/password.js";
|
||||
import EtapiOptions from "./options/etapi.js";
|
||||
import BackupOptions from "./options/backup.js";
|
||||
import SyncOptions from "./options/sync.js";
|
||||
import TrayOptions from "./options/other/tray.js";
|
||||
import NoteErasureTimeoutOptions from "./options/other/note_erasure_timeout.js";
|
||||
import NoteRevisionsSnapshotIntervalOptions from "./options/other/note_revisions_snapshot_interval.js";
|
||||
import NetworkConnectionsOptions from "./options/other/network_connections.js";
|
||||
import AdvancedSyncOptions from "./options/advanced/sync.js";
|
||||
import DatabaseIntegrityCheckOptions from "./options/advanced/database_integrity_check.js";
|
||||
import ConsistencyChecksOptions from "./options/advanced/consistency_checks.js";
|
||||
import VacuumDatabaseOptions from "./options/advanced/vacuum_database.js";
|
||||
import DatabaseAnonymizationOptions from "./options/advanced/database_anonymization.js";
|
||||
|
||||
const TPL = `<div class="note-detail-content-widget note-detail-printable">
|
||||
<style>
|
||||
|
@ -42,6 +57,25 @@ const CONTENT_WIDGETS = {
|
|||
WrapLinesOptions,
|
||||
CodeAutoReadOnlySizeOptions,
|
||||
CodeMimeTypesOptions
|
||||
],
|
||||
optionsImages: [ ImageOptions ],
|
||||
optionsSpellcheck: [ SpellcheckOptions ],
|
||||
optionsPassword: [ PasswordOptions ],
|
||||
optionsEtapi: [ EtapiOptions ],
|
||||
optionsBackup: [ BackupOptions ],
|
||||
optionsSync: [ SyncOptions ],
|
||||
optionsOther: [
|
||||
TrayOptions,
|
||||
NoteErasureTimeoutOptions,
|
||||
NoteRevisionsSnapshotIntervalOptions,
|
||||
NetworkConnectionsOptions
|
||||
],
|
||||
optionsAdvanced: [
|
||||
DatabaseIntegrityCheckOptions,
|
||||
ConsistencyChecksOptions,
|
||||
DatabaseAnonymizationOptions,
|
||||
AdvancedSyncOptions,
|
||||
VacuumDatabaseOptions
|
||||
]
|
||||
};
|
||||
|
||||
|
|
|
@ -1,137 +0,0 @@
|
|||
import server from "../../../services/server.js";
|
||||
import toastService from "../../../services/toast.js";
|
||||
import OptionsWidget from "./options_widget.js";
|
||||
|
||||
const TPL = `
|
||||
<div class="options-section">
|
||||
<h4>Sync</h4>
|
||||
<button class="force-full-sync-button btn">Force full sync</button>
|
||||
|
||||
<button class="fill-entity-changes-button btn">Fill entity changes records</button>
|
||||
</div>
|
||||
|
||||
<div class="options-section">
|
||||
<h4>Database integrity check</h4>
|
||||
|
||||
<p>This will check that the database is not corrupted on the SQLite level. It might take some time, depending on the DB size.</p>
|
||||
|
||||
<button class="check-integrity-button btn">Check database integrity</button>
|
||||
</div>
|
||||
|
||||
<div class="options-section">
|
||||
<h4>Consistency checks</h4>
|
||||
|
||||
<button class="find-and-fix-consistency-issues-button btn">Find and fix consistency issues</button>
|
||||
</div>
|
||||
|
||||
<div class="options-section">
|
||||
<h4>Anonymize database</h4>
|
||||
|
||||
<h5>Full anonymization</h5>
|
||||
|
||||
<p>This action will create a new copy of the database and anonymize it (remove all note content and leave only structure and some non-sensitive metadata)
|
||||
for sharing online for debugging purposes without fear of leaking your personal data.</p>
|
||||
|
||||
<button class="anonymize-full-button btn">Save fully anonymized database</button>
|
||||
|
||||
<h5>Light anonymization</h5>
|
||||
|
||||
<p>This action will create a new copy of the database and do a light anonymization on it - specifically only content of all notes will be removed, but titles and attributes will remain. Additionally, custom JS frontend/backend script notes and custom widgets will remain. This provides more context to debug the issues.</p>
|
||||
|
||||
<p>You can decide yourself if you want to provide fully or lightly anonymized database. Even fully anonymized DB is very useful, however in some cases lightly anonymized database can speed up the process of bug identification and fixing.</p>
|
||||
|
||||
<button class="anonymize-light-button btn">Save lightly anonymized database</button>
|
||||
</div>
|
||||
|
||||
<div class="options-section">
|
||||
<h4>Vacuum database</h4>
|
||||
|
||||
<p>This will rebuild the database which will typically result in a smaller database file. No data will be actually changed.</p>
|
||||
|
||||
<button class="vacuum-database-button btn">Vacuum database</button>
|
||||
</div>`;
|
||||
|
||||
export default class AdvancedOptions extends OptionsWidget {
|
||||
get tabTitle() { return "Advanced" }
|
||||
|
||||
lazyRender() {
|
||||
this.$widget = $(TPL);
|
||||
|
||||
this.$forceFullSyncButton = this.$widget.find(".force-full-sync-button");
|
||||
this.$fillEntityChangesButton = this.$widget.find(".fill-entity-changes-button");
|
||||
this.$anonymizeFullButton = this.$widget.find(".anonymize-full-button");
|
||||
this.$anonymizeLightButton = this.$widget.find(".anonymize-light-button");
|
||||
this.$vacuumDatabaseButton = this.$widget.find(".vacuum-database-button");
|
||||
this.$findAndFixConsistencyIssuesButton = this.$widget.find(".find-and-fix-consistency-issues-button");
|
||||
this.$checkIntegrityButton = this.$widget.find(".check-integrity-button");
|
||||
|
||||
this.$forceFullSyncButton.on('click', async () => {
|
||||
await server.post('sync/force-full-sync');
|
||||
|
||||
toastService.showMessage("Full sync triggered");
|
||||
});
|
||||
|
||||
this.$fillEntityChangesButton.on('click', async () => {
|
||||
toastService.showMessage("Filling entity changes rows...");
|
||||
|
||||
await server.post('sync/fill-entity-changes');
|
||||
|
||||
toastService.showMessage("Sync rows filled successfully");
|
||||
});
|
||||
|
||||
this.$anonymizeFullButton.on('click', async () => {
|
||||
toastService.showMessage("Creating fully anonymized database...");
|
||||
|
||||
const resp = await server.post('database/anonymize/full');
|
||||
|
||||
if (!resp.success) {
|
||||
toastService.showError("Could not create anonymized database, check backend logs for details");
|
||||
}
|
||||
else {
|
||||
toastService.showMessage(`Created fully anonymized database in ${resp.anonymizedFilePath}`, 10000);
|
||||
}
|
||||
});
|
||||
|
||||
this.$anonymizeLightButton.on('click', async () => {
|
||||
toastService.showMessage("Creating lightly anonymized database...");
|
||||
|
||||
const resp = await server.post('database/anonymize/light');
|
||||
|
||||
if (!resp.success) {
|
||||
toastService.showError("Could not create anonymized database, check backend logs for details");
|
||||
}
|
||||
else {
|
||||
toastService.showMessage(`Created lightly anonymized database in ${resp.anonymizedFilePath}`, 10000);
|
||||
}
|
||||
});
|
||||
|
||||
this.$vacuumDatabaseButton.on('click', async () => {
|
||||
toastService.showMessage("Vacuuming database...");
|
||||
|
||||
await server.post('database/vacuum-database');
|
||||
|
||||
toastService.showMessage("Database has been vacuumed");
|
||||
});
|
||||
|
||||
this.$findAndFixConsistencyIssuesButton.on('click', async () => {
|
||||
toastService.showMessage("Finding and fixing consistency issues...");
|
||||
|
||||
await server.post('database/find-and-fix-consistency-issues');
|
||||
|
||||
toastService.showMessage("Consistency issues should be fixed.");
|
||||
});
|
||||
|
||||
this.$checkIntegrityButton.on('click', async () => {
|
||||
toastService.showMessage("Checking database integrity...");
|
||||
|
||||
const {results} = await server.get('database/check-integrity');
|
||||
|
||||
if (results.length === 1 && results[0].integrity_check === "ok") {
|
||||
toastService.showMessage("Integrity check succeeded - no problems found.");
|
||||
}
|
||||
else {
|
||||
toastService.showMessage("Integrity check failed: " + JSON.stringify(results, null, 2), 15000);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
import OptionsWidget from "../options_widget.js";
|
||||
import toastService from "../../../../services/toast.js";
|
||||
import server from "../../../../services/server.js";
|
||||
|
||||
const TPL = `
|
||||
<div class="options-section">
|
||||
<h4>Consistency checks</h4>
|
||||
|
||||
<button class="find-and-fix-consistency-issues-button btn">Find and fix consistency issues</button>
|
||||
</div>`;
|
||||
|
||||
export default class ConsistencyChecksOptions extends OptionsWidget {
|
||||
doRender() {
|
||||
this.$widget = $(TPL);
|
||||
this.$findAndFixConsistencyIssuesButton = this.$widget.find(".find-and-fix-consistency-issues-button");
|
||||
this.$findAndFixConsistencyIssuesButton.on('click', async () => {
|
||||
toastService.showMessage("Finding and fixing consistency issues...");
|
||||
|
||||
await server.post('database/find-and-fix-consistency-issues');
|
||||
|
||||
toastService.showMessage("Consistency issues should be fixed.");
|
||||
});
|
||||
}
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
import OptionsWidget from "../options_widget.js";
|
||||
import toastService from "../../../../services/toast.js";
|
||||
import server from "../../../../services/server.js";
|
||||
|
||||
const TPL = `
|
||||
<div class="options-section">
|
||||
<h4>Database anonymization</h4>
|
||||
|
||||
<h5>Full anonymization</h5>
|
||||
|
||||
<p>This action will create a new copy of the database and anonymize it (remove all note content and leave only structure and some non-sensitive metadata)
|
||||
for sharing online for debugging purposes without fear of leaking your personal data.</p>
|
||||
|
||||
<button class="anonymize-full-button btn">Save fully anonymized database</button>
|
||||
|
||||
<h5>Light anonymization</h5>
|
||||
|
||||
<p>This action will create a new copy of the database and do a light anonymization on it - specifically only content of all notes will be removed, but titles and attributes will remain. Additionally, custom JS frontend/backend script notes and custom widgets will remain. This provides more context to debug the issues.</p>
|
||||
|
||||
<p>You can decide yourself if you want to provide fully or lightly anonymized database. Even fully anonymized DB is very useful, however in some cases lightly anonymized database can speed up the process of bug identification and fixing.</p>
|
||||
|
||||
<button class="anonymize-light-button btn">Save lightly anonymized database</button>
|
||||
</div>`;
|
||||
|
||||
export default class DatabaseAnonymizationOptions extends OptionsWidget {
|
||||
doRender() {
|
||||
this.$widget = $(TPL);
|
||||
this.$anonymizeFullButton = this.$widget.find(".anonymize-full-button");
|
||||
this.$anonymizeLightButton = this.$widget.find(".anonymize-light-button");
|
||||
this.$anonymizeFullButton.on('click', async () => {
|
||||
toastService.showMessage("Creating fully anonymized database...");
|
||||
|
||||
const resp = await server.post('database/anonymize/full');
|
||||
|
||||
if (!resp.success) {
|
||||
toastService.showError("Could not create anonymized database, check backend logs for details");
|
||||
}
|
||||
else {
|
||||
toastService.showMessage(`Created fully anonymized database in ${resp.anonymizedFilePath}`, 10000);
|
||||
}
|
||||
});
|
||||
|
||||
this.$anonymizeLightButton.on('click', async () => {
|
||||
toastService.showMessage("Creating lightly anonymized database...");
|
||||
|
||||
const resp = await server.post('database/anonymize/light');
|
||||
|
||||
if (!resp.success) {
|
||||
toastService.showError("Could not create anonymized database, check backend logs for details");
|
||||
}
|
||||
else {
|
||||
toastService.showMessage(`Created lightly anonymized database in ${resp.anonymizedFilePath}`, 10000);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
import OptionsWidget from "../options_widget.js";
|
||||
import toastService from "../../../../services/toast.js";
|
||||
import server from "../../../../services/server.js";
|
||||
|
||||
const TPL = `
|
||||
<div class="options-section">
|
||||
<h4>Database integrity check</h4>
|
||||
|
||||
<p>This will check that the database is not corrupted on the SQLite level. It might take some time, depending on the DB size.</p>
|
||||
|
||||
<button class="check-integrity-button btn">Check database integrity</button>
|
||||
</div>`;
|
||||
|
||||
export default class DatabaseIntegrityCheckOptions extends OptionsWidget {
|
||||
doRender() {
|
||||
this.$widget = $(TPL);
|
||||
this.$checkIntegrityButton = this.$widget.find(".check-integrity-button");
|
||||
this.$checkIntegrityButton.on('click', async () => {
|
||||
toastService.showMessage("Checking database integrity...");
|
||||
|
||||
const {results} = await server.get('database/check-integrity');
|
||||
|
||||
if (results.length === 1 && results[0].integrity_check === "ok") {
|
||||
toastService.showMessage("Integrity check succeeded - no problems found.");
|
||||
}
|
||||
else {
|
||||
toastService.showMessage("Integrity check failed: " + JSON.stringify(results, null, 2), 15000);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
36
src/public/app/widgets/type_widgets/options/advanced/sync.js
Normal file
36
src/public/app/widgets/type_widgets/options/advanced/sync.js
Normal file
|
@ -0,0 +1,36 @@
|
|||
import OptionsWidget from "../options_widget.js";
|
||||
import server from "../../../../services/server.js";
|
||||
import toastService from "../../../../services/toast.js";
|
||||
|
||||
const TPL = `
|
||||
<div class="options-section">
|
||||
<h4>Sync</h4>
|
||||
<button class="force-full-sync-button btn">Force full sync</button>
|
||||
|
||||
<button class="fill-entity-changes-button btn">Fill entity changes records</button>
|
||||
</div>`;
|
||||
|
||||
export default class AdvancedSyncOptions extends OptionsWidget {
|
||||
doRender() {
|
||||
this.$widget = $(TPL);
|
||||
this.$forceFullSyncButton = this.$widget.find(".force-full-sync-button");
|
||||
this.$fillEntityChangesButton = this.$widget.find(".fill-entity-changes-button");
|
||||
this.$forceFullSyncButton.on('click', async () => {
|
||||
await server.post('sync/force-full-sync');
|
||||
|
||||
toastService.showMessage("Full sync triggered");
|
||||
});
|
||||
|
||||
this.$fillEntityChangesButton.on('click', async () => {
|
||||
toastService.showMessage("Filling entity changes rows...");
|
||||
|
||||
await server.post('sync/fill-entity-changes');
|
||||
|
||||
toastService.showMessage("Sync rows filled successfully");
|
||||
});
|
||||
}
|
||||
|
||||
async optionsLoaded(options) {
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
import OptionsWidget from "../options_widget.js";
|
||||
import toastService from "../../../../services/toast.js";
|
||||
import server from "../../../../services/server.js";
|
||||
|
||||
const TPL = `
|
||||
<div class="options-section">
|
||||
<h4>Vacuum database</h4>
|
||||
|
||||
<p>This will rebuild the database which will typically result in a smaller database file. No data will be actually changed.</p>
|
||||
|
||||
<button class="vacuum-database-button btn">Vacuum database</button>
|
||||
</div>`;
|
||||
|
||||
export default class VacuumDatabaseOptions extends OptionsWidget {
|
||||
doRender() {
|
||||
this.$widget = $(TPL);
|
||||
this.$vacuumDatabaseButton = this.$widget.find(".vacuum-database-button");
|
||||
this.$vacuumDatabaseButton.on('click', async () => {
|
||||
toastService.showMessage("Vacuuming database...");
|
||||
|
||||
await server.post('database/vacuum-database');
|
||||
|
||||
toastService.showMessage("Database has been vacuumed");
|
||||
});
|
||||
}
|
||||
}
|
|
@ -36,9 +36,7 @@ const TPL = `
|
|||
`;
|
||||
|
||||
export default class BackupOptions extends OptionsWidget {
|
||||
get tabTitle() { return "Backup" }
|
||||
|
||||
lazyRender() {
|
||||
doRender() {
|
||||
this.$widget = $(TPL);
|
||||
|
||||
this.$backupDatabaseButton = this.$widget.find(".backup-database-button");
|
||||
|
|
|
@ -47,9 +47,7 @@ const TPL = `
|
|||
</style>`;
|
||||
|
||||
export default class EtapiOptions extends OptionsWidget {
|
||||
get tabTitle() { return "ETAPI" }
|
||||
|
||||
lazyRender() {
|
||||
doRender() {
|
||||
this.$widget = $(TPL);
|
||||
|
||||
this.$widget.find(".create-etapi-token").on("click", async () => {
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
import OptionsWidget from "./options_widget.js";
|
||||
|
||||
const TPL = `
|
||||
<style>
|
||||
.options-section .disabled-field {
|
||||
opacity: 0.5;
|
||||
pointer-events: none;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div class="options-section">
|
||||
<style>
|
||||
.options-section .disabled-field {
|
||||
opacity: 0.5;
|
||||
pointer-events: none;
|
||||
}
|
||||
</style>
|
||||
|
||||
<h4>Images</h4>
|
||||
|
||||
<div class="form-group">
|
||||
|
@ -37,9 +37,7 @@ const TPL = `
|
|||
`;
|
||||
|
||||
export default class ImageOptions extends OptionsWidget {
|
||||
get tabTitle() { return "Images" }
|
||||
|
||||
lazyRender() {
|
||||
doRender() {
|
||||
this.$widget = $(TPL);
|
||||
|
||||
this.$imageMaxWidthHeight = this.$widget.find(".image-max-width-height");
|
||||
|
|
|
@ -1,91 +0,0 @@
|
|||
import server from "../../../services/server.js";
|
||||
import toastService from "../../../services/toast.js";
|
||||
import OptionsWidget from "./options_widget.js";
|
||||
|
||||
const TPL = `
|
||||
<div class="options-section">
|
||||
<h4>Tray</h4>
|
||||
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox" class="tray-enabled custom-control-input">
|
||||
<label class="custom-control-label">Enable tray (Trilium needs to be restarted for this change to take effect)</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="options-section">
|
||||
<h4>Note erasure timeout</h4>
|
||||
|
||||
<p>Deleted notes (and attributes, revisions...) are at first only marked as deleted and it is possible to recover them
|
||||
from Recent Notes dialog. After a period of time, deleted notes are "erased" which means
|
||||
their content is not recoverable anymore. This setting allows you to configure the length
|
||||
of the period between deleting and erasing the note.</p>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Erase notes after X seconds</label>
|
||||
<input class="erase-entities-after-time-in-seconds form-control" type="number" min="0">
|
||||
</div>
|
||||
|
||||
<p>You can also trigger erasing manually:</p>
|
||||
|
||||
<button class="erase-deleted-notes-now-button btn">Erase deleted notes now</button>
|
||||
</div>
|
||||
|
||||
<div class="options-section">
|
||||
<h4>Note revisions snapshot interval</h4>
|
||||
|
||||
<p>Note revision snapshot time interval is time in seconds after which a new note revision will be created for the note. See <a href="https://github.com/zadam/trilium/wiki/Note-revisions" class="external">wiki</a> for more info.</p>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Note revision snapshot time interval (in seconds)</label>
|
||||
<input class="note-revision-snapshot-time-interval-in-seconds form-control" type="number" min="10">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="options-section">
|
||||
<h4>Network connections</h4>
|
||||
|
||||
<div class="form-group">
|
||||
<input class="check-for-updates" type="checkbox" name="check-for-updates">
|
||||
<label>Check for updates automatically</label>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
export default class OtherOptions extends OptionsWidget {
|
||||
get tabTitle() { return "Other" }
|
||||
|
||||
lazyRender() {
|
||||
this.$widget = $(TPL);
|
||||
|
||||
this.$trayEnabled = this.$widget.find(".tray-enabled");
|
||||
this.$trayEnabled.on('change', () =>
|
||||
this.updateOption('disableTray', !this.$trayEnabled.is(":checked") ? "true" : "false"));
|
||||
|
||||
this.$eraseEntitiesAfterTimeInSeconds = this.$widget.find(".erase-entities-after-time-in-seconds");
|
||||
this.$eraseEntitiesAfterTimeInSeconds.on('change', () => this.updateOption('eraseEntitiesAfterTimeInSeconds', this.$eraseEntitiesAfterTimeInSeconds.val()));
|
||||
|
||||
this.$eraseDeletedNotesButton = this.$widget.find(".erase-deleted-notes-now-button");
|
||||
this.$eraseDeletedNotesButton.on('click', () => {
|
||||
server.post('notes/erase-deleted-notes-now').then(() => {
|
||||
toastService.showMessage("Deleted notes have been erased.");
|
||||
});
|
||||
});
|
||||
|
||||
this.$noteRevisionsTimeInterval = this.$widget.find(".note-revision-snapshot-time-interval-in-seconds");
|
||||
|
||||
this.$noteRevisionsTimeInterval.on('change', () =>
|
||||
this.updateOption('noteRevisionSnapshotTimeInterval', this.$noteRevisionsTimeInterval.val()));
|
||||
|
||||
this.$checkForUpdates = this.$widget.find(".check-for-updates");
|
||||
this.$checkForUpdates.on("change", () =>
|
||||
this.updateCheckboxOption('checkForUpdates', this.$checkForUpdates));
|
||||
}
|
||||
|
||||
optionsLoaded(options) {
|
||||
this.$trayEnabled.prop("checked", options.disableTray !== 'true');
|
||||
|
||||
this.$eraseEntitiesAfterTimeInSeconds.val(options.eraseEntitiesAfterTimeInSeconds);
|
||||
this.$noteRevisionsTimeInterval.val(options.noteRevisionSnapshotTimeInterval);
|
||||
|
||||
this.setCheckboxState(this.$checkForUpdates, options.checkForUpdates);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
import OptionsWidget from "../options_widget.js";
|
||||
|
||||
const TPL = `
|
||||
<div class="options-section">
|
||||
<h4>Network connections</h4>
|
||||
|
||||
<div class="form-group">
|
||||
<input class="check-for-updates" type="checkbox" name="check-for-updates">
|
||||
<label>Check for updates automatically</label>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
export default class NetworkConnectionsOptions extends OptionsWidget {
|
||||
doRender() {
|
||||
this.$widget = $(TPL);
|
||||
this.$checkForUpdates = this.$widget.find(".check-for-updates");
|
||||
this.$checkForUpdates.on("change", () =>
|
||||
this.updateCheckboxOption('checkForUpdates', this.$checkForUpdates));
|
||||
}
|
||||
|
||||
async optionsLoaded(options) {
|
||||
this.setCheckboxState(this.$checkForUpdates, options.checkForUpdates);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
import OptionsWidget from "../options_widget.js";
|
||||
import server from "../../../../services/server.js";
|
||||
import toastService from "../../../../services/toast.js";
|
||||
|
||||
const TPL = `
|
||||
<div class="options-section">
|
||||
<h4>Note erasure timeout</h4>
|
||||
|
||||
<p>Deleted notes (and attributes, revisions...) are at first only marked as deleted and it is possible to recover them
|
||||
from Recent Notes dialog. After a period of time, deleted notes are "erased" which means
|
||||
their content is not recoverable anymore. This setting allows you to configure the length
|
||||
of the period between deleting and erasing the note.</p>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Erase notes after X seconds</label>
|
||||
<input class="erase-entities-after-time-in-seconds form-control" type="number" min="0">
|
||||
</div>
|
||||
|
||||
<p>You can also trigger erasing manually:</p>
|
||||
|
||||
<button class="erase-deleted-notes-now-button btn">Erase deleted notes now</button>
|
||||
</div>`;
|
||||
|
||||
export default class NoteErasureTimeoutOptions extends OptionsWidget {
|
||||
doRender() {
|
||||
this.$widget = $(TPL);
|
||||
this.$eraseEntitiesAfterTimeInSeconds = this.$widget.find(".erase-entities-after-time-in-seconds");
|
||||
this.$eraseEntitiesAfterTimeInSeconds.on('change', () => this.updateOption('eraseEntitiesAfterTimeInSeconds', this.$eraseEntitiesAfterTimeInSeconds.val()));
|
||||
|
||||
this.$eraseDeletedNotesButton = this.$widget.find(".erase-deleted-notes-now-button");
|
||||
this.$eraseDeletedNotesButton.on('click', () => {
|
||||
server.post('notes/erase-deleted-notes-now').then(() => {
|
||||
toastService.showMessage("Deleted notes have been erased.");
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
async optionsLoaded(options) {
|
||||
this.$eraseEntitiesAfterTimeInSeconds.val(options.eraseEntitiesAfterTimeInSeconds);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
import OptionsWidget from "../options_widget.js";
|
||||
|
||||
const TPL = `
|
||||
<div class="options-section">
|
||||
<h4>Note revisions snapshot interval</h4>
|
||||
|
||||
<p>Note revision snapshot time interval is time in seconds after which a new note revision will be created for the note. See <a href="https://github.com/zadam/trilium/wiki/Note-revisions" class="external">wiki</a> for more info.</p>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Note revision snapshot time interval (in seconds)</label>
|
||||
<input class="note-revision-snapshot-time-interval-in-seconds form-control" type="number" min="10">
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
export default class NoteRevisionsSnapshotIntervalOptions extends OptionsWidget {
|
||||
doRender() {
|
||||
this.$widget = $(TPL);
|
||||
this.$noteRevisionsTimeInterval = this.$widget.find(".note-revision-snapshot-time-interval-in-seconds");
|
||||
this.$noteRevisionsTimeInterval.on('change', () =>
|
||||
this.updateOption('noteRevisionSnapshotTimeInterval', this.$noteRevisionsTimeInterval.val()));
|
||||
}
|
||||
|
||||
async optionsLoaded(options) {
|
||||
this.$noteRevisionsTimeInterval.val(options.noteRevisionSnapshotTimeInterval);
|
||||
}
|
||||
}
|
24
src/public/app/widgets/type_widgets/options/other/tray.js
Normal file
24
src/public/app/widgets/type_widgets/options/other/tray.js
Normal file
|
@ -0,0 +1,24 @@
|
|||
import OptionsWidget from "../options_widget.js";
|
||||
|
||||
const TPL = `
|
||||
<div class="options-section">
|
||||
<h4>Tray</h4>
|
||||
|
||||
<div class="custom-control custom-checkbox">
|
||||
<input type="checkbox" class="tray-enabled custom-control-input">
|
||||
<label class="custom-control-label">Enable tray (Trilium needs to be restarted for this change to take effect)</label>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
export default class TrayOptions extends OptionsWidget {
|
||||
doRender() {
|
||||
this.$widget = $(TPL);
|
||||
this.$trayEnabled = this.$widget.find(".tray-enabled");
|
||||
this.$trayEnabled.on('change', () =>
|
||||
this.updateOption('disableTray', !this.$trayEnabled.is(":checked") ? "true" : "false"));
|
||||
}
|
||||
|
||||
async optionsLoaded(options) {
|
||||
this.$trayEnabled.prop("checked", options.disableTray !== 'true');
|
||||
}
|
||||
}
|
|
@ -46,9 +46,7 @@ const TPL = `
|
|||
</div>`;
|
||||
|
||||
export default class PasswordOptions extends OptionsWidget {
|
||||
get tabTitle() { return "Password" }
|
||||
|
||||
lazyRender() {
|
||||
doRender() {
|
||||
this.$widget = $(TPL);
|
||||
|
||||
this.$passwordHeading = this.$widget.find(".password-heading");
|
||||
|
|
|
@ -25,9 +25,7 @@ const TPL = `
|
|||
</div>`;
|
||||
|
||||
export default class SpellcheckOptions extends OptionsWidget {
|
||||
get tabTitle() { return "Spellcheck" }
|
||||
|
||||
lazyRender() {
|
||||
doRender() {
|
||||
this.$widget = $(TPL);
|
||||
|
||||
this.$spellCheckEnabled = this.$widget.find(".spell-check-enabled");
|
||||
|
|
|
@ -41,9 +41,7 @@ const TPL = `
|
|||
</div>`;
|
||||
|
||||
export default class SyncOptions extends OptionsWidget {
|
||||
get tabTitle() { return "Sync" }
|
||||
|
||||
lazyRender() {
|
||||
doRender() {
|
||||
this.$widget = $(TPL);
|
||||
|
||||
this.$form = this.$widget.find(".sync-setup-form");
|
||||
|
|
Loading…
Reference in a new issue