2019-08-22 02:24:37 +08:00
|
|
|
import server from "../../services/server.js";
|
2019-10-20 16:00:18 +08:00
|
|
|
import toastService from "../../services/toast.js";
|
2019-08-22 02:24:37 +08:00
|
|
|
|
|
|
|
export default class AdvancedOptions {
|
|
|
|
constructor() {
|
|
|
|
this.$forceFullSyncButton = $("#force-full-sync-button");
|
|
|
|
this.$fillSyncRowsButton = $("#fill-sync-rows-button");
|
|
|
|
this.$anonymizeButton = $("#anonymize-button");
|
|
|
|
this.$cleanupSoftDeletedButton = $("#cleanup-soft-deleted-items-button");
|
|
|
|
this.$cleanupUnusedImagesButton = $("#cleanup-unused-images-button");
|
|
|
|
this.$vacuumDatabaseButton = $("#vacuum-database-button");
|
|
|
|
|
|
|
|
this.$forceFullSyncButton.click(async () => {
|
|
|
|
await server.post('sync/force-full-sync');
|
|
|
|
|
2019-10-20 16:00:18 +08:00
|
|
|
toastService.showMessage("Full sync triggered");
|
2019-08-22 02:24:37 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
this.$fillSyncRowsButton.click(async () => {
|
|
|
|
await server.post('sync/fill-sync-rows');
|
|
|
|
|
2019-10-20 16:00:18 +08:00
|
|
|
toastService.showMessage("Sync rows filled successfully");
|
2019-08-22 02:24:37 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
this.$anonymizeButton.click(async () => {
|
|
|
|
await server.post('anonymization/anonymize');
|
|
|
|
|
2019-10-20 16:00:18 +08:00
|
|
|
toastService.showMessage("Created anonymized database");
|
2019-08-22 02:24:37 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
this.$cleanupSoftDeletedButton.click(async () => {
|
|
|
|
if (confirm("Do you really want to clean up soft-deleted items?")) {
|
|
|
|
await server.post('cleanup/cleanup-soft-deleted-items');
|
|
|
|
|
2019-10-20 16:00:18 +08:00
|
|
|
toastService.showMessage("Soft deleted items have been cleaned up");
|
2019-08-22 02:24:37 +08:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
this.$cleanupUnusedImagesButton.click(async () => {
|
|
|
|
if (confirm("Do you really want to clean up unused images?")) {
|
|
|
|
await server.post('cleanup/cleanup-unused-images');
|
|
|
|
|
2019-10-20 16:00:18 +08:00
|
|
|
toastService.showMessage("Unused images have been cleaned up");
|
2019-08-22 02:24:37 +08:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
this.$vacuumDatabaseButton.click(async () => {
|
|
|
|
await server.post('cleanup/vacuum-database');
|
|
|
|
|
2019-10-20 16:00:18 +08:00
|
|
|
toastService.showMessage("Database has been vacuumed");
|
2019-08-22 02:24:37 +08:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|