mirror of
https://github.com/zadam/trilium.git
synced 2025-10-20 23:29:02 +02:00
feat(react/settings): port vacuum database
This commit is contained in:
parent
a04f6e3858
commit
7e03774b8e
@ -10,6 +10,7 @@ export default function AdvancedSettings() {
|
|||||||
return <>
|
return <>
|
||||||
<AdvancedSyncOptions />
|
<AdvancedSyncOptions />
|
||||||
<DatabaseIntegrityOptions />
|
<DatabaseIntegrityOptions />
|
||||||
|
<VacuumDatabaseOptions />
|
||||||
</>;
|
</>;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,4 +67,21 @@ function DatabaseIntegrityOptions() {
|
|||||||
/>
|
/>
|
||||||
</OptionsSection>
|
</OptionsSection>
|
||||||
)
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
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>
|
||||||
|
)
|
||||||
}
|
}
|
@ -1,29 +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 = /*html*/`
|
|
||||||
<div class="options-section">
|
|
||||||
<h4>${t("vacuum_database.title")}</h4>
|
|
||||||
|
|
||||||
<p class="form-text">${t("vacuum_database.description")}</p>
|
|
||||||
|
|
||||||
<button class="vacuum-database-button btn btn-secondary">${t("vacuum_database.button_text")}</button>
|
|
||||||
</div>`;
|
|
||||||
|
|
||||||
export default class VacuumDatabaseOptions extends OptionsWidget {
|
|
||||||
private $vacuumDatabaseButton!: JQuery<HTMLElement>;
|
|
||||||
|
|
||||||
doRender() {
|
|
||||||
this.$widget = $(TPL);
|
|
||||||
this.$vacuumDatabaseButton = this.$widget.find(".vacuum-database-button");
|
|
||||||
this.$vacuumDatabaseButton.on("click", async () => {
|
|
||||||
toastService.showMessage(t("vacuum_database.vacuuming_database"));
|
|
||||||
|
|
||||||
await server.post("database/vacuum-database");
|
|
||||||
|
|
||||||
toastService.showMessage(t("vacuum_database.database_vacuumed"));
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user