mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-08-11 11:02:27 +08:00
refactor(settings): merge consistency checks with integrity checks
This commit is contained in:
parent
eba605fa49
commit
8f12103106
@ -28,7 +28,6 @@ import NetworkConnectionsOptions from "./options/other/network_connections.js";
|
|||||||
import HtmlImportTagsOptions from "./options/other/html_import_tags.js";
|
import HtmlImportTagsOptions from "./options/other/html_import_tags.js";
|
||||||
import AdvancedSyncOptions from "./options/advanced/sync.js";
|
import AdvancedSyncOptions from "./options/advanced/sync.js";
|
||||||
import DatabaseIntegrityCheckOptions from "./options/advanced/database_integrity_check.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 VacuumDatabaseOptions from "./options/advanced/vacuum_database.js";
|
||||||
import DatabaseAnonymizationOptions from "./options/advanced/database_anonymization.js";
|
import DatabaseAnonymizationOptions from "./options/advanced/database_anonymization.js";
|
||||||
import BackendLogWidget from "./content/backend_log.js";
|
import BackendLogWidget from "./content/backend_log.js";
|
||||||
@ -100,7 +99,6 @@ const CONTENT_WIDGETS = {
|
|||||||
],
|
],
|
||||||
_optionsAdvanced: [
|
_optionsAdvanced: [
|
||||||
DatabaseIntegrityCheckOptions,
|
DatabaseIntegrityCheckOptions,
|
||||||
ConsistencyChecksOptions,
|
|
||||||
DatabaseAnonymizationOptions,
|
DatabaseAnonymizationOptions,
|
||||||
AdvancedSyncOptions,
|
AdvancedSyncOptions,
|
||||||
VacuumDatabaseOptions
|
VacuumDatabaseOptions
|
||||||
|
@ -1,25 +0,0 @@
|
|||||||
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>${t("consistency_checks.title")}</h4>
|
|
||||||
|
|
||||||
<button class="find-and-fix-consistency-issues-button btn">${t("consistency_checks.find_and_fix_button")}</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(t("consistency_checks.finding_and_fixing_message"));
|
|
||||||
|
|
||||||
await server.post('database/find-and-fix-consistency-issues');
|
|
||||||
|
|
||||||
toastService.showMessage(t("consistency_checks.issues_fixed_message"));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
@ -4,13 +4,17 @@ import server from "../../../../services/server.js";
|
|||||||
import { t } from "../../../../services/i18n.js";
|
import { t } from "../../../../services/i18n.js";
|
||||||
|
|
||||||
const TPL = `
|
const TPL = `
|
||||||
<div class="options-section">
|
<div class="row">
|
||||||
|
<div class="options-section">
|
||||||
<h4>${t("database_integrity_check.title")}</h4>
|
<h4>${t("database_integrity_check.title")}</h4>
|
||||||
|
|
||||||
<p>${t("database_integrity_check.description")}</p>
|
<p>${t("database_integrity_check.description")}</p>
|
||||||
|
|
||||||
<button class="check-integrity-button btn">${t("database_integrity_check.check_button")}</button>
|
<button class="check-integrity-button btn">${t("database_integrity_check.check_button")}</button>
|
||||||
</div>`;
|
<button class="find-and-fix-consistency-issues-button btn">${t("consistency_checks.find_and_fix_button")}</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
|
||||||
export default class DatabaseIntegrityCheckOptions extends OptionsWidget {
|
export default class DatabaseIntegrityCheckOptions extends OptionsWidget {
|
||||||
doRender() {
|
doRender() {
|
||||||
@ -28,5 +32,14 @@ export default class DatabaseIntegrityCheckOptions extends OptionsWidget {
|
|||||||
toastService.showMessage(t("database_integrity_check.integrity_check_failed", { results: JSON.stringify(results, null, 2) }), 15000);
|
toastService.showMessage(t("database_integrity_check.integrity_check_failed", { results: JSON.stringify(results, null, 2) }), 15000);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.$findAndFixConsistencyIssuesButton = this.$widget.find(".find-and-fix-consistency-issues-button");
|
||||||
|
this.$findAndFixConsistencyIssuesButton.on('click', async () => {
|
||||||
|
toastService.showMessage(t("consistency_checks.finding_and_fixing_message"));
|
||||||
|
|
||||||
|
await server.post('database/find-and-fix-consistency-issues');
|
||||||
|
|
||||||
|
toastService.showMessage(t("consistency_checks.issues_fixed_message"));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user