remotewpbackupv2 configer and create

This commit is contained in:
unknown
2023-03-20 14:07:39 +05:00
parent 8d10af9f75
commit 194c857c46
5 changed files with 34 additions and 20 deletions

View File

@@ -1527,6 +1527,12 @@ app.controller('CreateV2Backup', function ($scope, $http, $timeout, $compile) {
$scope.CreateV2BackupButton = function () { $scope.CreateV2BackupButton = function () {
$scope.backupLoading = false; $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"; var url = "/IncrementalBackups/CreateV2BackupButton";
@@ -1554,12 +1560,15 @@ app.controller('CreateV2Backup', function ($scope, $http, $timeout, $compile) {
} }
else { else {
$scope.backupLoading = true;
$scope.installationDetailsForm = true;
$scope.installationProgress = false;
$scope.errorMessageBox = false;
$scope.success = true;
$scope.couldNotConnect = true;
$scope.goBackDisable = false; $scope.goBackDisable = false;
new PNotify({
title: 'Operation Failed!', $scope.errorMessage = response.data.error_message;
text: response.data.error_message,
type: 'error'
});
} }
} }
@@ -1612,8 +1621,8 @@ app.controller('CreateV2Backup', function ($scope, $http, $timeout, $compile) {
$scope.currentStatus = response.data.currentStatus; $scope.currentStatus = response.data.currentStatus;
$timeout.cancel(); $timeout.cancel();
} else { }
else {
$scope.webSiteCreationLoading = true; $scope.webSiteCreationLoading = true;
$scope.installationDetailsForm = true; $scope.installationDetailsForm = true;
$scope.installationProgress = false; $scope.installationProgress = false;
@@ -1691,6 +1700,7 @@ app.controller('ConfigureV2Backup', function ($scope, $http, $timeout){
Selectedwebsite: $scope.selwebsite, Selectedwebsite: $scope.selwebsite,
sfptpasswd: $scope.sfptpasswd, sfptpasswd: $scope.sfptpasswd,
hostName: $scope.hostName, hostName: $scope.hostName,
UserName: $scope.UserName,
}; };
var config = { var config = {

View File

@@ -108,6 +108,14 @@
</div> </div>
</div> </div>
<div ng-hide="installationDetailsForm" class="form-group">
<label class="col-sm-3 control-label">{% trans "Username" %}</label>
<div class="col-sm-6">
<input name="accountName" type="text" class="form-control"
ng-model="UserName">
</div>
</div>
<div ng-hide="installationDetailsForm" class="form-group"> <div ng-hide="installationDetailsForm" class="form-group">
<label class="col-sm-3 control-label">{% trans "Password" %}</label> <label class="col-sm-3 control-label">{% trans "Password" %}</label>
<div class="col-sm-6"> <div class="col-sm-6">

View File

@@ -73,7 +73,7 @@
</div> </div>
<div ng-hide="success" class="alert alert-success"> <div ng-hide="success" class="alert alert-success">
<p>{% trans "Website succesfully created." %}</p> <p>{% trans "Backup succesfully." %}</p>
</div> </div>

View File

@@ -775,21 +775,16 @@ def CreateV2BackupButton(request):
Selectedwebsite = data['Selectedwebsite'] Selectedwebsite = data['Selectedwebsite']
Selectedrepo = data['Selectedrepo'] 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() background.start()
time.sleep(2) time.sleep(2)
data_ret = {'status': 1, 'installStatus': 1, 'error_message': 'None', data_ret = {'status': 1, 'installStatus': 1, 'error_message': 'None',}
'tempStatusPath': extraArgs['tempStatusPath']}
json_data = json.dumps(data_ret) json_data = json.dumps(data_ret)
return HttpResponse(json_data) return HttpResponse(json_data)
@@ -873,12 +868,13 @@ def ConfigureSftpV2Backup(request):
Selectedwebsite = data['Selectedwebsite'] Selectedwebsite = data['Selectedwebsite']
sfptpasswd = data['sfptpasswd'] sfptpasswd = data['sfptpasswd']
hostName = data['hostName'] hostName = data['hostName']
UserName = data['UserName']
admin = Administrator.objects.get(pk=userID) admin = Administrator.objects.get(pk=userID)
req_data = {} req_data = {}
req_data['name'] = 'SFTP' req_data['name'] = 'SFTP'
req_data['host'] = Selectedwebsite req_data['host'] = hostName
req_data['user'] = hostName req_data['user'] = UserName
req_data['password'] = sfptpasswd req_data['password'] = sfptpasswd

View File

@@ -1820,7 +1820,7 @@ class BackupManager:
command = 'rm -f ' + statusFile command = 'rm -f ' + statusFile
subprocess.call(shlex.split(command)) subprocess.call(shlex.split(command))
data_ret = {'abort': 1, 'installStatus': 1, 'installationProgress': "100", data_ret = {'abort': 1, 'installStatus': 1, 'installationProgress': "100",
'currentStatus': 'Successfully Installed.'} 'currentStatus': 'Successfully Created.'}
json_data = json.dumps(data_ret) json_data = json.dumps(data_ret)
return HttpResponse(json_data) return HttpResponse(json_data)
elif lastLine.find('[404]') > -1: elif lastLine.find('[404]') > -1: