Add backup config download button
This commit is contained in:
@@ -200,6 +200,25 @@ angular.module('Application').controller('BackupsController', ['$scope', '$locat
|
||||
|| provider === 'linode-objectstorage';
|
||||
};
|
||||
|
||||
// https://stackoverflow.com/questions/3665115/how-to-create-a-file-in-memory-for-user-to-download-but-not-through-server#18197341
|
||||
function download(filename, text) {
|
||||
var element = document.createElement('a');
|
||||
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text));
|
||||
element.setAttribute('download', filename);
|
||||
|
||||
element.style.display = 'none';
|
||||
document.body.appendChild(element);
|
||||
|
||||
element.click();
|
||||
|
||||
document.body.removeChild(element);
|
||||
}
|
||||
|
||||
$scope.downloadConfig = function () {
|
||||
// secrets and tokens already come with placeholder characters
|
||||
download('cloudron_backup.json', JSON.stringify($scope.backupConfig));
|
||||
};
|
||||
|
||||
$scope.configureBackup = {
|
||||
busy: false,
|
||||
error: {},
|
||||
|
||||
Reference in New Issue
Block a user