diff --git a/src/js/client.js b/src/js/client.js index 70e6b81b4..64d80ad42 100644 --- a/src/js/client.js +++ b/src/js/client.js @@ -1225,9 +1225,9 @@ angular.module('Application').service('Client', ['$http', '$interval', '$timeout }); }; - Client.prototype.importBackup = function (appId, backupId, backupFormat, backupConfig, callback) { + Client.prototype.importBackup = function (appId, remotePath, backupFormat, backupConfig, callback) { var data = { - backupId: backupId, + remotePath: remotePath, backupFormat: backupFormat, backupConfig: backupConfig, }; @@ -3321,7 +3321,7 @@ angular.module('Application').service('Client', ['$http', '$interval', '$timeout return 'Cloudron was setup'; case ACTION_RESTORE: - return 'Cloudron was restored using backup ' + data.backupId; + return 'Cloudron was restored using backup ' + data.remotePath; case ACTION_APP_CONFIGURE: { if (!data.app) return ''; @@ -3410,14 +3410,14 @@ angular.module('Application').service('Client', ['$http', '$interval', '$timeout // older versions (<3.5) did not have these fields if (data.fromManifest) details += ' from version ' + data.fromManifest.version; if (data.toManifest) details += ' to version ' + data.toManifest.version; - if (data.backupId) details += ' using backup ' + data.backupId; + if (data.remotePath) details += ' using backup ' + data.remotePath; return details; case ACTION_APP_IMPORT: if (!data.app) return ''; details = appName('', data.app, 'App') + 'was imported'; if (data.toManifest) details += ' to version ' + data.toManifest.version; - if (data.backupId) details += ' using backup ' + data.backupId; + if (data.remotePath) details += ' using backup ' + data.remotePath; return details; case ACTION_APP_UNINSTALL: @@ -3441,16 +3441,16 @@ angular.module('Application').service('Client', ['$http', '$interval', '$timeout if (data.errorMessage) { return 'Backup ' + appName('of', data.app) + ' failed: ' + data.errorMessage; } else { - return 'Backup ' + appName('of', data.app) + ' succeeded with backup id ' + data.backupId; + return 'Backup ' + appName('of', data.app) + ' succeeded with backup id ' + data.backupId + ' at ' + data.remotePath; } case ACTION_APP_CLONE: if (appIdContext === data.oldAppId) { - return 'App was cloned to ' + data.newApp.fqdn + ' using backup ' + data.backupId; + return 'App was cloned to ' + data.newApp.fqdn + ' using backup ' + data.remotePath; } else if (appIdContext === data.appId) { - return 'App was cloned from ' + data.oldApp.fqdn + ' using backup ' + data.backupId; + return 'App was cloned from ' + data.oldApp.fqdn + ' using backup ' + data.remotePath; } else { - return appName('', data.newApp, 'App') + ' was cloned ' + appName('from', data.oldApp) + ' using backup ' + data.backupId; + return appName('', data.newApp, 'App') + ' was cloned ' + appName('from', data.oldApp) + ' using backup ' + data.remotePath; } case ACTION_APP_REPAIR: @@ -3491,7 +3491,7 @@ angular.module('Application').service('Client', ['$http', '$interval', '$timeout case ACTION_BACKUP_FINISH: if (!errorMessage) { - return 'Cloudron backup created with Id ' + data.backupId; + return 'Cloudron backup created at ' + data.remotePath; } else { return 'Cloudron backup errored with error: ' + errorMessage; } diff --git a/src/js/restore.js b/src/js/restore.js index 9d18af0f4..3bf8c0aa4 100644 --- a/src/js/restore.js +++ b/src/js/restore.js @@ -30,7 +30,7 @@ app.controller('RestoreController', ['$scope', 'Client', function ($scope, Clien $scope.region = ''; $scope.endpoint = ''; $scope.backupFolder = ''; - $scope.backupId = ''; + $scope.remotePath = ''; $scope.instanceId = ''; $scope.acceptSelfSignedCerts = false; $scope.format = 'tgz'; @@ -290,24 +290,24 @@ app.controller('RestoreController', ['$scope', 'Client', function ($scope, Clien backupConfig.backupFolder = $scope.backupFolder; } - if ($scope.backupId.indexOf('/') === -1) { + if ($scope.remotePath.indexOf('/') === -1) { $scope.error.generic = 'Backup id must include the directory path'; - $scope.error.backupId = true; + $scope.error.remotePath = true; $scope.busy = false; return; } - if ($scope.backupId.indexOf('box') === -1) { + if ($scope.remotePath.indexOf('box') === -1) { $scope.error.generic = 'Backup id must contain "box"'; - $scope.error.backupId = true; + $scope.error.remotePath = true; $scope.busy = false; return; } - var version = $scope.backupId.match(/_v(\d+.\d+.\d+)/); + var version = $scope.remotePath.match(/_v(\d+.\d+.\d+)/); if (!version) { $scope.error.generic = 'Backup id is missing version information'; - $scope.error.backupId = true; + $scope.error.remotePath = true; $scope.busy = false; return; } @@ -321,7 +321,7 @@ app.controller('RestoreController', ['$scope', 'Client', function ($scope, Clien sysinfoConfig.ifname = $scope.sysinfo.ifname; } - Client.restore(backupConfig, $scope.backupId.replace(/\.tar\.gz(\.enc)?$/, ''), version ? version[1] : '', sysinfoConfig, $scope.skipDnsSetup, $scope.setupToken, function (error) { + Client.restore(backupConfig, $scope.remotePath.replace(/\.tar\.gz(\.enc)?$/, ''), version ? version[1] : '', sysinfoConfig, $scope.skipDnsSetup, $scope.setupToken, function (error) { $scope.busy = false; if (error) { diff --git a/src/restore.html b/src/restore.html index 5f19e072b..6b8d1ba89 100644 --- a/src/restore.html +++ b/src/restore.html @@ -261,10 +261,10 @@ -
- +
+ - +
diff --git a/src/views/app.html b/src/views/app.html index a3b55b51e..49f29595a 100644 --- a/src/views/app.html +++ b/src/views/app.html @@ -208,10 +208,10 @@
-
- +
+ - +
diff --git a/src/views/app.js b/src/views/app.js index aebd48934..af10eff9d 100644 --- a/src/views/app.js +++ b/src/views/app.js @@ -1246,7 +1246,7 @@ angular.module('Application').controller('AppController', ['$scope', '$location' endpoint: '', acceptSelfSignedCerts: false, format: 'tgz', - backupId: '', + remotePath: '', password: '', mountOptions: {}, encrypted: false, // helps with ng-required when backupConfig is read from file @@ -1265,7 +1265,7 @@ angular.module('Application').controller('AppController', ['$scope', '$location' $scope.importBackup.format = 'tgz'; $scope.importBackup.acceptSelfSignedCerts = false; $scope.importBackup.password = ''; - $scope.importBackup.backupId = ''; + $scope.importBackup.remotePath = ''; $scope.importBackup.mountOptions = {}; }, @@ -1278,7 +1278,7 @@ angular.module('Application').controller('AppController', ['$scope', '$location' }; if ($scope.importBackup.password) backupConfig.password = $scope.importBackup.password; - var backupId = $scope.importBackup.backupId; + var remotePath = $scope.importBackup.remotePath; // only set provider specific fields, this will clear them in the db if ($scope.s3like(backupConfig.provider)) { @@ -1348,20 +1348,20 @@ angular.module('Application').controller('AppController', ['$scope', '$location' backupConfig.mountOptions = $scope.importBackup.mountOptions; backupConfig.prefix = $scope.importBackup.prefix; } else if (backupConfig.provider === 'filesystem') { - var parts = backupId.split('/'); - backupId = parts.pop() || parts.pop(); // removes any trailing slash. this is basename() + var parts = remotePath.split('/'); + remotePath = parts.pop() || parts.pop(); // removes any trailing slash. this is basename() backupConfig.backupFolder = parts.join('/'); // this is dirname() } if ($scope.importBackup.format === 'tgz') { - if (backupId.substring(backupId.length - '.tar.gz'.length, backupId.length) === '.tar.gz') { // endsWith - backupId = backupId.replace(/.tar.gz$/, ''); - } else if (backupId.substring(backupId.length - '.tar.gz.enc'.length, backupId.length) === '.tar.gz.enc') { // endsWith - backupId = backupId.replace(/.tar.gz.enc$/, ''); + if (remotePath.substring(remotePath.length - '.tar.gz'.length, remotePath.length) === '.tar.gz') { // endsWith + remotePath = remotePath.replace(/.tar.gz$/, ''); + } else if (remotePath.substring(remotePath.length - '.tar.gz.enc'.length, remotePath.length) === '.tar.gz.enc') { // endsWith + remotePath = remotePath.replace(/.tar.gz.enc$/, ''); } } - Client.importBackup($scope.app.id, backupId, $scope.importBackup.format, backupConfig, function (error) { + Client.importBackup($scope.app.id, remotePath, $scope.importBackup.format, backupConfig, function (error) { if (error) { $scope.importBackup.busy = false; @@ -1923,7 +1923,7 @@ angular.module('Application').controller('AppController', ['$scope', '$location' $scope.downloadConfig = function (backup) { // secrets and tokens already come with placeholder characters we remove them var tmp = { - backupId: backup.id, + remotePath: backup.remotePath, encrypted: !!$scope.backupConfig.password // we add this just to help the import UI }; diff --git a/src/views/backups.js b/src/views/backups.js index 0c9500291..6a2ca170d 100644 --- a/src/views/backups.js +++ b/src/views/backups.js @@ -356,7 +356,7 @@ angular.module('Application').controller('BackupsController', ['$scope', '$locat $scope.downloadConfig = function (backup) { // secrets and tokens already come with placeholder characters we remove them var tmp = { - backupId: backup.id, + remotePath: backup.remotePath, encrypted: !!$scope.backupConfig.password // we add this just to help the import UI };