chore(options/advanced): merge database-related options

This commit is contained in:
Elian Doran
2026-04-13 15:01:51 +03:00
parent c352d46a5b
commit 3dc0d25c4d
2 changed files with 18 additions and 20 deletions

View File

@@ -1167,8 +1167,13 @@
"finished-successfully": "Sync finished successfully.",
"failed": "Sync failed: {{message}}"
},
"database": {
"title": "Database"
},
"vacuum_database": {
"title": "Vacuum Database",
"vacuum_label": "Vacuum database",
"vacuum_description": "Rebuild the database to reduce file size. No data will be changed.",
"description": "This will rebuild the database which will typically result in a smaller database file. No data will be actually changed.",
"button_text": "Vacuum database",
"vacuuming_database": "Vacuuming database...",

View File

@@ -15,9 +15,8 @@ import OptionsSection from "./components/OptionsSection";
export default function AdvancedSettings() {
return <>
<AdvancedSyncOptions />
<DatabaseIntegrityOptions />
<DatabaseOptions />
<DatabaseAnonymizationOptions />
<VacuumDatabaseOptions />
<ExperimentalOptions />
</>;
}
@@ -47,9 +46,9 @@ function AdvancedSyncOptions() {
);
}
function DatabaseIntegrityOptions() {
function DatabaseOptions() {
return (
<OptionsSection title={t("database_integrity_check.title")}>
<OptionsSection title={t("database.title")}>
<OptionsRowWithButton
label={t("database_integrity_check.check_integrity_label")}
description={t("database_integrity_check.check_integrity_description")}
@@ -75,6 +74,16 @@ function DatabaseIntegrityOptions() {
toast.showMessage(t("consistency_checks.issues_fixed_message"));
}}
/>
<OptionsRowWithButton
label={t("vacuum_database.vacuum_label")}
description={t("vacuum_database.vacuum_description")}
onClick={async () => {
toast.showMessage(t("vacuum_database.vacuuming_database"));
await server.post("database/vacuum-database");
toast.showMessage(t("vacuum_database.database_vacuumed"));
}}
/>
</OptionsSection>
);
}
@@ -164,22 +173,6 @@ function ExistingAnonymizedDatabases({ databases }: { databases: AnonymizedDbRes
);
}
function VacuumDatabaseOptions() {
return (
<OptionsSection title={t("vacuum_database.title")}>
<FormText>{t("vacuum_database.description")}</FormText>
<Button
text={t("vacuum_database.button_text")}
onClick={async () => {
toast.showMessage(t("vacuum_database.vacuuming_database"));
await server.post("database/vacuum-database");
toast.showMessage(t("vacuum_database.database_vacuumed"));
}}
/>
</OptionsSection>
);
}
function ExperimentalOptions() {
const [enabledFeatures, setEnabledFeatures] = useTriliumOptionJson<ExperimentalFeatureId[]>("experimentalFeatures", true);