From 194c857c46e358451b13fd72bc26c9de4891eee9 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 20 Mar 2023 14:07:39 +0500 Subject: [PATCH] remotewpbackupv2 configer and create --- IncBackups/static/IncBackups/IncBackups.js | 24 +++++++++++++------ .../IncBackups/ConfigureV2Backup.html | 8 +++++++ .../templates/IncBackups/CreateV2Backup.html | 2 +- IncBackups/views.py | 18 ++++++-------- backup/backupManager.py | 2 +- 5 files changed, 34 insertions(+), 20 deletions(-) diff --git a/IncBackups/static/IncBackups/IncBackups.js b/IncBackups/static/IncBackups/IncBackups.js index 153de3aa5..5d84499b9 100644 --- a/IncBackups/static/IncBackups/IncBackups.js +++ b/IncBackups/static/IncBackups/IncBackups.js @@ -1527,6 +1527,12 @@ app.controller('CreateV2Backup', function ($scope, $http, $timeout, $compile) { $scope.CreateV2BackupButton = function () { $scope.backupLoading = false; + $scope.installationDetailsForm = true; + $scope.installationProgress = false; + $scope.errorMessageBox = true; + $scope.success = true; + $scope.couldNotConnect = true; + $scope.goBackDisable = true; var url = "/IncrementalBackups/CreateV2BackupButton"; @@ -1554,12 +1560,15 @@ app.controller('CreateV2Backup', function ($scope, $http, $timeout, $compile) { } else { + $scope.backupLoading = true; + $scope.installationDetailsForm = true; + $scope.installationProgress = false; + $scope.errorMessageBox = false; + $scope.success = true; + $scope.couldNotConnect = true; $scope.goBackDisable = false; - new PNotify({ - title: 'Operation Failed!', - text: response.data.error_message, - type: 'error' - }); + + $scope.errorMessage = response.data.error_message; } } @@ -1612,8 +1621,8 @@ app.controller('CreateV2Backup', function ($scope, $http, $timeout, $compile) { $scope.currentStatus = response.data.currentStatus; $timeout.cancel(); - } else { - + } + else { $scope.webSiteCreationLoading = true; $scope.installationDetailsForm = true; $scope.installationProgress = false; @@ -1691,6 +1700,7 @@ app.controller('ConfigureV2Backup', function ($scope, $http, $timeout){ Selectedwebsite: $scope.selwebsite, sfptpasswd: $scope.sfptpasswd, hostName: $scope.hostName, + UserName: $scope.UserName, }; var config = { diff --git a/IncBackups/templates/IncBackups/ConfigureV2Backup.html b/IncBackups/templates/IncBackups/ConfigureV2Backup.html index f79c562c1..389944cbb 100644 --- a/IncBackups/templates/IncBackups/ConfigureV2Backup.html +++ b/IncBackups/templates/IncBackups/ConfigureV2Backup.html @@ -108,6 +108,14 @@ +
+ +
+ +
+
+
diff --git a/IncBackups/templates/IncBackups/CreateV2Backup.html b/IncBackups/templates/IncBackups/CreateV2Backup.html index 59c17e4ac..ac3d7b2f6 100644 --- a/IncBackups/templates/IncBackups/CreateV2Backup.html +++ b/IncBackups/templates/IncBackups/CreateV2Backup.html @@ -73,7 +73,7 @@
-

{% trans "Website succesfully created." %}

+

{% trans "Backup succesfully." %}

diff --git a/IncBackups/views.py b/IncBackups/views.py index 5255196a8..a19791780 100644 --- a/IncBackups/views.py +++ b/IncBackups/views.py @@ -775,21 +775,16 @@ def CreateV2BackupButton(request): Selectedwebsite = data['Selectedwebsite'] Selectedrepo = data['Selectedrepo'] - extraArgs = {} - extraArgs['function'] = 'InitiateBackup' - extraArgs['BackendName'] = Selectedrepo - extraArgs['domain'] = Selectedwebsite - extraArgs['BasePath']= '/home/backup' - extraArgs['tempStatusPath'] = "/home/cyberpanel/" + str(randint(1000, 9999)) - background = CPBackupsV2(extraArgs) + + background = CPBackupsV2({'domain': Selectedwebsite, 'BasePath': '/home/backup', 'BackupDatabase': 1, 'BackupData': 1, + 'BackupEmails': 1, 'BackendName': Selectedrepo, 'function': 'InitiateBackup', }) background.start() time.sleep(2) - data_ret = {'status': 1, 'installStatus': 1, 'error_message': 'None', - 'tempStatusPath': extraArgs['tempStatusPath']} + data_ret = {'status': 1, 'installStatus': 1, 'error_message': 'None',} json_data = json.dumps(data_ret) return HttpResponse(json_data) @@ -873,12 +868,13 @@ def ConfigureSftpV2Backup(request): Selectedwebsite = data['Selectedwebsite'] sfptpasswd = data['sfptpasswd'] hostName = data['hostName'] + UserName = data['UserName'] admin = Administrator.objects.get(pk=userID) req_data = {} req_data['name'] = 'SFTP' - req_data['host'] = Selectedwebsite - req_data['user'] = hostName + req_data['host'] = hostName + req_data['user'] = UserName req_data['password'] = sfptpasswd diff --git a/backup/backupManager.py b/backup/backupManager.py index d69de1561..8e0ca7c08 100755 --- a/backup/backupManager.py +++ b/backup/backupManager.py @@ -1820,7 +1820,7 @@ class BackupManager: command = 'rm -f ' + statusFile subprocess.call(shlex.split(command)) data_ret = {'abort': 1, 'installStatus': 1, 'installationProgress': "100", - 'currentStatus': 'Successfully Installed.'} + 'currentStatus': 'Successfully Created.'} json_data = json.dumps(data_ret) return HttpResponse(json_data) elif lastLine.find('[404]') > -1: