refactor(settings): merge consistency checks with integrity checks

This commit is contained in:
Elian Doran 2024-11-30 01:56:55 +02:00
parent eba605fa49
commit 8f12103106
No known key found for this signature in database
3 changed files with 20 additions and 34 deletions

View File

@ -28,7 +28,6 @@ import NetworkConnectionsOptions from "./options/other/network_connections.js";
import HtmlImportTagsOptions from "./options/other/html_import_tags.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";
import BackendLogWidget from "./content/backend_log.js";
@ -100,7 +99,6 @@ const CONTENT_WIDGETS = {
],
_optionsAdvanced: [
DatabaseIntegrityCheckOptions,
ConsistencyChecksOptions,
DatabaseAnonymizationOptions,
AdvancedSyncOptions,
VacuumDatabaseOptions

View File

@ -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"));
});
}
}

View File

@ -4,13 +4,17 @@ import server from "../../../../services/server.js";
import { t } from "../../../../services/i18n.js";
const TPL = `
<div class="row">
<div class="options-section">
<h4>${t("database_integrity_check.title")}</h4>
<p>${t("database_integrity_check.description")}</p>
<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 {
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);
}
});
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"));
});
}
}