mirror of
https://github.com/zadam/trilium.git
synced 2025-11-16 10:15:52 +01:00
add translation for backend_log.js and
5 advanced options
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import NoteContextAwareWidget from "../../note_context_aware_widget.js";
|
||||
import server from "../../../services/server.js";
|
||||
import { t } from "../../../services/i18n.js";
|
||||
|
||||
const TPL = `<div style="height: 100%; display: flex; flex-direction: column;">
|
||||
<style>
|
||||
@@ -13,7 +14,7 @@ const TPL = `<div style="height: 100%; display: flex; flex-direction: column;">
|
||||
<textarea class="backend-log-textarea" readonly="readonly"></textarea>
|
||||
|
||||
<div style="display: flex; justify-content: space-around; margin-top: 10px;">
|
||||
<button class="refresh-backend-log-button btn btn-primary">Refresh</button>
|
||||
<button class="refresh-backend-log-button btn btn-primary">${t("backend_log.refresh")}</button>
|
||||
</div>
|
||||
</div>`;
|
||||
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
import OptionsWidget from "../options_widget.js";
|
||||
import toastService from "../../../../services/toast.js";
|
||||
import server from "../../../../services/server.js";
|
||||
import { t } from "../../../../services/i18n.js";
|
||||
|
||||
const TPL = `
|
||||
<div class="options-section">
|
||||
<h4>Consistency Checks</h4>
|
||||
<h4>${t("consistency_checks.title")}</h4>
|
||||
|
||||
<button class="find-and-fix-consistency-issues-button btn">Find and fix consistency issues</button>
|
||||
<button class="find-and-fix-consistency-issues-button btn">${t("consistency_checks.find_and_fix_button")}</button>
|
||||
</div>`;
|
||||
|
||||
export default class ConsistencyChecksOptions extends OptionsWidget {
|
||||
@@ -14,11 +15,11 @@ export default class ConsistencyChecksOptions extends OptionsWidget {
|
||||
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...");
|
||||
toastService.showMessage(t("consistency_checks.finding_and_fixing_message"));
|
||||
|
||||
await server.post('database/find-and-fix-consistency-issues');
|
||||
|
||||
toastService.showMessage("Consistency issues should be fixed.");
|
||||
toastService.showMessage(t("consistency_checks.issues_fixed_message"));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,27 +1,27 @@
|
||||
import OptionsWidget from "../options_widget.js";
|
||||
import toastService from "../../../../services/toast.js";
|
||||
import server from "../../../../services/server.js";
|
||||
import { t } from "../../../../services/i18n.js";
|
||||
|
||||
const TPL = `
|
||||
<div class="options-section">
|
||||
<h4>Database Anonymization</h4>
|
||||
<h4>${t("database_anonymization.title")}</h4>
|
||||
|
||||
<h5>Full Anonymization</h5>
|
||||
<h5>${t("database_anonymization.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>
|
||||
<p>${t("database_anonymization.full_anonymization_description")}</p>
|
||||
|
||||
<button class="anonymize-full-button btn">Save fully anonymized database</button>
|
||||
<button class="anonymize-full-button btn">${t("database_anonymization.save_fully_anonymized_database")}</button>
|
||||
|
||||
<h5>Light Anonymization</h5>
|
||||
<h5>${t("database_anonymization.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>${t("database_anonymization.light_anonymization_description")}</p>
|
||||
|
||||
<p>You can decide yourself if you want to provide a 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>
|
||||
<p>${t("database_anonymization.choose_anonymization")}</p>
|
||||
|
||||
<button class="anonymize-light-button btn">Save lightly anonymized database</button>
|
||||
<button class="anonymize-light-button btn">${t("database_anonymization.save_lightly_anonymized_database")}</button>
|
||||
|
||||
<h5>Existing anonymized databases</h5>
|
||||
<h5>${t("database_anonymization.existing_anonymized_databases")}</h5>
|
||||
|
||||
<ul class="existing-anonymized-databases"></ul>
|
||||
</div>`;
|
||||
@@ -32,30 +32,30 @@ export default class DatabaseAnonymizationOptions extends OptionsWidget {
|
||||
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...");
|
||||
toastService.showMessage(t("database_anonymization.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");
|
||||
toastService.showError(t("database_anonymization.error_creating_anonymized_database"));
|
||||
}
|
||||
else {
|
||||
toastService.showMessage(`Created fully anonymized database in ${resp.anonymizedFilePath}`, 10000);
|
||||
toastService.showMessage(t("database_anonymization.successfully_created_fully_anonymized_database", { anonymizedFilePath: resp.anonymizedFilePath }), 10000);
|
||||
}
|
||||
|
||||
this.refresh();
|
||||
});
|
||||
|
||||
this.$anonymizeLightButton.on('click', async () => {
|
||||
toastService.showMessage("Creating lightly anonymized database...");
|
||||
toastService.showMessage(t("database_anonymization.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");
|
||||
toastService.showError(t("database_anonymization.error_creating_anonymized_database"));
|
||||
}
|
||||
else {
|
||||
toastService.showMessage(`Created lightly anonymized database in ${resp.anonymizedFilePath}`, 10000);
|
||||
toastService.showMessage(t("database_anonymization.successfully_created_lightly_anonymized_database", { anonymizedFilePath: resp.anonymizedFilePath }), 10000);
|
||||
}
|
||||
|
||||
this.refresh();
|
||||
@@ -69,7 +69,7 @@ export default class DatabaseAnonymizationOptions extends OptionsWidget {
|
||||
this.$existingAnonymizedDatabases.empty();
|
||||
|
||||
if (!anonymizedDatabases.length) {
|
||||
anonymizedDatabases = [{filePath: "no anonymized database yet"}];
|
||||
anonymizedDatabases = [{filePath: t("database_anonymization.no_anonymized_database_yet")}];
|
||||
}
|
||||
|
||||
for (const {filePath} of anonymizedDatabases) {
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
import OptionsWidget from "../options_widget.js";
|
||||
import toastService from "../../../../services/toast.js";
|
||||
import server from "../../../../services/server.js";
|
||||
import { t } from "../../../../services/i18n.js";
|
||||
|
||||
const TPL = `
|
||||
<div class="options-section">
|
||||
<h4>Database Integrity Check</h4>
|
||||
<h4>${t("database_integrity_check.title")}</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>
|
||||
<p>${t("database_integrity_check.description")}</p>
|
||||
|
||||
<button class="check-integrity-button btn">Check database integrity</button>
|
||||
<button class="check-integrity-button btn">${t("database_integrity_check.check_button")}</button>
|
||||
</div>`;
|
||||
|
||||
export default class DatabaseIntegrityCheckOptions extends OptionsWidget {
|
||||
@@ -16,15 +17,15 @@ export default class DatabaseIntegrityCheckOptions extends OptionsWidget {
|
||||
this.$widget = $(TPL);
|
||||
this.$checkIntegrityButton = this.$widget.find(".check-integrity-button");
|
||||
this.$checkIntegrityButton.on('click', async () => {
|
||||
toastService.showMessage("Checking database integrity...");
|
||||
toastService.showMessage(t("database_integrity_check.checking_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.");
|
||||
toastService.showMessage(t("database_integrity_check.integrity_check_succeeded"));
|
||||
}
|
||||
else {
|
||||
toastService.showMessage(`Integrity check failed: ${JSON.stringify(results, null, 2)}`, 15000);
|
||||
toastService.showMessage(t("database_integrity_check.integrity_check_failed", { results: JSON.stringify(results, null, 2) }), 15000);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
import OptionsWidget from "../options_widget.js";
|
||||
import server from "../../../../services/server.js";
|
||||
import toastService from "../../../../services/toast.js";
|
||||
import { t } from "../../../../services/i18n.js";
|
||||
|
||||
const TPL = `
|
||||
<div class="options-section">
|
||||
<h4>Sync</h4>
|
||||
<button class="force-full-sync-button btn">Force full sync</button>
|
||||
<h4>${t("sync.title")}</h4>
|
||||
<button class="force-full-sync-button btn">${t("sync.force_full_sync_button")}</button>
|
||||
|
||||
<button class="fill-entity-changes-button btn">Fill entity changes records</button>
|
||||
<button class="fill-entity-changes-button btn">${t("sync.fill_entity_changes_button")}</button>
|
||||
</div>`;
|
||||
|
||||
export default class AdvancedSyncOptions extends OptionsWidget {
|
||||
@@ -18,15 +19,15 @@ export default class AdvancedSyncOptions extends OptionsWidget {
|
||||
this.$forceFullSyncButton.on('click', async () => {
|
||||
await server.post('sync/force-full-sync');
|
||||
|
||||
toastService.showMessage("Full sync triggered");
|
||||
toastService.showMessage(t("sync.full_sync_triggered"));
|
||||
});
|
||||
|
||||
this.$fillEntityChangesButton.on('click', async () => {
|
||||
toastService.showMessage("Filling entity changes rows...");
|
||||
toastService.showMessage(t("sync.filling_entity_changes"));
|
||||
|
||||
await server.post('sync/fill-entity-changes');
|
||||
|
||||
toastService.showMessage("Sync rows filled successfully");
|
||||
toastService.showMessage(t("sync.sync_rows_filled_successfully"));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
import OptionsWidget from "../options_widget.js";
|
||||
import toastService from "../../../../services/toast.js";
|
||||
import server from "../../../../services/server.js";
|
||||
import { t } from "../../../../services/i18n.js";
|
||||
|
||||
const TPL = `
|
||||
<div class="options-section">
|
||||
<h4>Vacuum Database</h4>
|
||||
<h4>${t("vacuum_database.title")}</h4>
|
||||
|
||||
<p>This will rebuild the database which will typically result in a smaller database file. No data will be actually changed.</p>
|
||||
<p>${t("vacuum_database.description")}</p>
|
||||
|
||||
<button class="vacuum-database-button btn">Vacuum database</button>
|
||||
<button class="vacuum-database-button btn">${t("vacuum_database.button_text")}</button>
|
||||
</div>`;
|
||||
|
||||
export default class VacuumDatabaseOptions extends OptionsWidget {
|
||||
@@ -16,11 +17,11 @@ export default class VacuumDatabaseOptions extends OptionsWidget {
|
||||
this.$widget = $(TPL);
|
||||
this.$vacuumDatabaseButton = this.$widget.find(".vacuum-database-button");
|
||||
this.$vacuumDatabaseButton.on('click', async () => {
|
||||
toastService.showMessage("Vacuuming database...");
|
||||
toastService.showMessage(t("vacuum_database.vacuuming_database"));
|
||||
|
||||
await server.post('database/vacuum-database');
|
||||
|
||||
toastService.showMessage("Database has been vacuumed");
|
||||
toastService.showMessage(t("vacuum_database.database_vacuumed"));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user