Fix restore code path to use remotePath

This commit is contained in:
Girish Ramakrishnan
2022-04-05 09:41:09 -07:00
parent 9c6b3a9825
commit 9540a0606c
6 changed files with 36 additions and 36 deletions
+8 -8
View File
@@ -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) {