mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-02 14:07:04 +03:00
Example code for #1042
This commit is contained in:
parent
5effa242ae
commit
5412348a65
3 changed files with 108 additions and 0 deletions
40
plugins/backup/js/BackupAdminSettings.js
Normal file
40
plugins/backup/js/BackupAdminSettings.js
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
|
||||
(rl => { if (rl) {
|
||||
|
||||
class BackupAdminSettings
|
||||
{
|
||||
constructor()
|
||||
{
|
||||
this.loading = ko.observable(false);
|
||||
}
|
||||
|
||||
backup()
|
||||
{
|
||||
this.loading(true);
|
||||
rl.pluginRemoteRequest((iError, oData) => {
|
||||
|
||||
this.loading(false);
|
||||
|
||||
if (iError) {
|
||||
console.error({
|
||||
iError: iError,
|
||||
oData: oData
|
||||
});
|
||||
} else {
|
||||
var link = document.createElement("a");
|
||||
link.download = 'backup.zip';
|
||||
link.href = 'data:application/zip;base64,' + oData.Result.zip;
|
||||
link.textContent = 'backup.zip';
|
||||
this.viewModelDom.append(link);
|
||||
link.click();
|
||||
link.remove();
|
||||
}
|
||||
|
||||
}, 'JsonAdminGetData');
|
||||
}
|
||||
}
|
||||
|
||||
rl.addSettingsViewModelForAdmin(BackupAdminSettings, 'BackupAdminSettingsTab',
|
||||
'Backup and Restore', 'Backup');
|
||||
|
||||
}})(window.rl);
|
||||
Loading…
Add table
Add a link
Reference in a new issue