diff --git a/src/translation/en.json b/src/translation/en.json index 0020c971f..f8b8954d7 100644 --- a/src/translation/en.json +++ b/src/translation/en.json @@ -1625,7 +1625,8 @@ "title": "Import Backup", "description": "Any data generated between now and the last known backup will be irrevocably lost. It is recommended to create a backup of the current data before attempting an import.", "uploadAction": "Upload Backup Config", - "importAction": "Import" + "importAction": "Import", + "remotePath": "Backup Path" }, "updateDialog": { "title": "Update {{ app }}", diff --git a/src/views/app.html b/src/views/app.html index ebbbbe2c0..961fbf81c 100644 --- a/src/views/app.html +++ b/src/views/app.html @@ -241,12 +241,6 @@ -
- - - -
-
@@ -276,12 +270,30 @@
+ +
+ + +
+
+ +
+ + +
+ + +
+ + +
+
@@ -294,18 +306,6 @@
- -
- - -
- - -
- - -
-
@@ -318,12 +318,6 @@
- -
- - -
-
diff --git a/src/views/app.js b/src/views/app.js index fb2ea730c..a122e75c4 100644 --- a/src/views/app.js +++ b/src/views/app.js @@ -1288,7 +1288,6 @@ angular.module('Application').controller('AppController', ['$scope', '$location' clearForm: function () { // $scope.importBackup.provider = ''; // do not clear since we call this function on provider change $scope.importBackup.bucket = ''; - $scope.importBackup.prefix = ''; $scope.importBackup.mountPoint = ''; $scope.importBackup.accessKeyId = ''; $scope.importBackup.secretAccessKey = ''; @@ -1321,7 +1320,7 @@ angular.module('Application').controller('AppController', ['$scope', '$location' // only set provider specific fields, this will clear them in the db if ($scope.s3like(backupConfig.provider)) { backupConfig.bucket = $scope.importBackup.bucket; - backupConfig.prefix = $scope.importBackup.prefix; + backupConfig.prefix = ''; backupConfig.accessKeyId = $scope.importBackup.accessKeyId; backupConfig.secretAccessKey = $scope.importBackup.secretAccessKey; @@ -1364,7 +1363,7 @@ angular.module('Application').controller('AppController', ['$scope', '$location' } } else if (backupConfig.provider === 'gcs') { backupConfig.bucket = $scope.importBackup.bucket; - backupConfig.prefix = $scope.importBackup.prefix; + backupConfig.prefix = ''; try { var serviceAccountKey = JSON.parse($scope.importBackup.gcsKey.content); backupConfig.projectId = serviceAccountKey.project_id; @@ -1384,7 +1383,7 @@ angular.module('Application').controller('AppController', ['$scope', '$location' } } else if (backupConfig.provider === 'sshfs' || backupConfig.provider === 'cifs' || backupConfig.provider === 'nfs' || backupConfig.provider === 'ext4' || backupConfig.provider === 'xfs') { backupConfig.mountOptions = $scope.importBackup.mountOptions; - backupConfig.prefix = $scope.importBackup.prefix; + backupConfig.prefix = ''; } else if (backupConfig.provider === 'mountpoint') { backupConfig.mountOptions = {}; backupConfig.mountPoint = $scope.mountPoint; @@ -2053,9 +2052,13 @@ angular.module('Application').controller('AppController', ['$scope', '$location' var backupConfig; try { backupConfig = JSON.parse(result.target.result); + let prefix = backupConfig.prefix; + backupConfig.prefix = ''; // so it can clear the form as well when we apply keys below if (backupConfig.provider === 'filesystem') { // patch the remotePath to have the full path - backupConfig.remotePath = backupConfig.backupFolder + '/' + backupConfig.remotePath; + backupConfig.remotePath = (prefix ? prefix + '/' : '') + backupConfig.backupFolder + '/' + backupConfig.remotePath; delete backupConfig.backupFolder; + } else { + backupConfig.remotePath = (prefix ? prefix + '/' : '') + backupConfig.remotePath; } } catch (e) { console.error('Unable to parse backup config');