[#2599] added option to upload a backup file from the Admin UI

This commit is contained in:
Gani Georgiev
2023-08-28 20:06:48 +03:00
parent 2a6b891a9b
commit f7f8f09336
41 changed files with 621 additions and 182 deletions
@@ -6,6 +6,7 @@
import OverlayPanel from "@/components/base/OverlayPanel.svelte";
import Field from "@/components/base/Field.svelte";
import CopyIcon from "@/components/base/CopyIcon.svelte";
import { onDestroy } from "svelte";
const formId = "backup_restore_" + CommonHelper.randomString(5);
@@ -13,6 +14,7 @@
let name = "";
let nameConfirm = "";
let isSubmitting = false;
let reloadTimeoutId = null;
$: canSubmit = nameConfirm != "" && name == nameConfirm;
@@ -33,22 +35,30 @@
return;
}
clearTimeout(reloadTimeoutId);
isSubmitting = true;
try {
await ApiClient.backups.restore(name);
// slight delay just in case the application is still restarting
setTimeout(() => {
// optimistic restore page reload
reloadTimeoutId = setTimeout(() => {
window.location.reload();
}, 1000);
}, 2000);
} catch (err) {
clearTimeout(reloadTimeoutId);
if (!err?.isAbort) {
isSubmitting = false;
addErrorToast(err.response?.message || err.message);
}
}
}
onDestroy(() => {
clearTimeout(reloadTimeoutId);
});
</script>
<OverlayPanel
@@ -70,14 +80,16 @@
<i class="ri-alert-line" />
</div>
<div class="content">
<p>Please proceed with caution.</p>
<p>
The restore operation will replace your existing <code>pb_data</code> with the one from the backup
and will restart the application process!
</p>
<p class="txt-bold">
Please proceed with caution.
<br />
Backup restore is still experimental and currently works only on UNIX based systems.
</p>
<p>
The restore operation will attempt to replace your existing <code>pb_data</code> with the one from
the backup and will restart the application process.
</p>
<p>Nothing will happen if the backup file is invalid or incompatible.</p>
</div>
</div>