diff --git a/IncBackups/static/IncBackups/IncBackups.js b/IncBackups/static/IncBackups/IncBackups.js index ae9d2f765..37ee906ff 100644 --- a/IncBackups/static/IncBackups/IncBackups.js +++ b/IncBackups/static/IncBackups/IncBackups.js @@ -1296,6 +1296,7 @@ app.controller('restorev2backupoage', function ($scope, $http, $timeout, $compil } $scope.RestorePathV2Model = function (SnapshotId, Path) { + $('#RestoreSnapshotPath').modal('show'); document.getElementById('Snapshot_id').innerText = SnapshotId @@ -1304,6 +1305,14 @@ app.controller('restorev2backupoage', function ($scope, $http, $timeout, $compil } + $scope.DeleteSnapshotBackupsv2 = function (SnapshotId, Path) { + $('#DeleteSnapshotmodelv2').modal('show'); + + document.getElementById('Snapshot_id_delete').innerText = SnapshotId; + //alert(document.getElementById('Snapshot_id_delete').innerText); + + } + function getCreationStatus() { url = "/IncrementalBackups/CreateV2BackupStatus"; @@ -1443,6 +1452,61 @@ app.controller('restorev2backupoage', function ($scope, $http, $timeout, $compil } + $scope.DeleteSnapshotV2Final = function (SnapshotId, Path) { + + $scope.backupLoading = false; + + SnapshotId = document.getElementById('Snapshot_id_delete').innerText + console.log("SnapshotId: " + SnapshotId) + var url = "/IncrementalBackups/DeleteSnapshotV2Final"; + var data = { + snapshotid: SnapshotId, + selwebsite: $scope.selwebsite, + selectedrepo: $scope.testhabbi + } + + var config = { + headers: { + 'X-CSRFToken': getCookie('csrftoken') + } + }; + + + $http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas); + + + function ListInitialDatas(response) { + $scope.backupLoading = true; + if (response.data.status === 1) { + new PNotify({ + title: 'Success!', + text: 'Snapshot Deleted.', + type: 'success' + }); + + } 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: 'Error!', + text: response.data.error_message, + type: 'error' + }); + } + + } + + function cantLoadInitialDatas(response) { + } + + + } $scope.selectrepo = function () { $scope.backupLoading = false; @@ -1479,7 +1543,7 @@ app.controller('restorev2backupoage', function ($scope, $http, $timeout, $compil var tml = '\n' + ' ' + snapshots[i][1][j].id + '' + ' ' + snapshots[i][1][j].time + '' + - ' \n' + + ' \n' + '' + ' \n' + ' \n' + diff --git a/IncBackups/templates/IncBackups/RestoreV2Backup.html b/IncBackups/templates/IncBackups/RestoreV2Backup.html index 10d251f5c..92a2e95dc 100644 --- a/IncBackups/templates/IncBackups/RestoreV2Backup.html +++ b/IncBackups/templates/IncBackups/RestoreV2Backup.html @@ -162,6 +162,88 @@ + diff --git a/IncBackups/urls.py b/IncBackups/urls.py index 846ccdf28..90845cf33 100644 --- a/IncBackups/urls.py +++ b/IncBackups/urls.py @@ -30,6 +30,7 @@ urlpatterns = [ url(r'^selectwebsiteRetorev2$', views.selectwebsiteRetorev2, name='selectwebsiteRetorev2'), url(r'^selectreporestorev2$', views.selectreporestorev2, name='selectreporestorev2'), url(r'^RestorePathV2$', views.RestorePathV2, name='RestorePathV2'), + url(r'^DeleteSnapshotV2Final$', views.DeleteSnapshotV2Final, name='DeleteSnapshotV2Final'), url(r'^CreateV2BackupButton$', views.CreateV2BackupButton, name='CreateV2BackupButton'), url(r'^selectwebsiteCreatev2$', views.selectwebsiteCreatev2, name='selectwebsiteCreatev2'), url(r'^CreateV2BackupStatus$', views.CreateV2BackupStatus, name='CreateV2BackupStatus'), diff --git a/IncBackups/views.py b/IncBackups/views.py index 0f52781c3..6e5455e75 100644 --- a/IncBackups/views.py +++ b/IncBackups/views.py @@ -895,6 +895,49 @@ def RestorePathV2(request): json_data = json.dumps(data_ret) return HttpResponse(json_data) +def DeleteSnapshotV2Final(request): + try: + userID = request.session['userID'] + data = json.loads(request.body) + SnapShotId = data['snapshotid'] + Selectedwebsite = data['selwebsite'] + Selectedrepo = data['selectedrepo'] + + currentACL = ACLManager.loadedACL(userID) + admin = Administrator.objects.get(pk=userID) + + if ACLManager.checkOwnership(str(Selectedwebsite), admin, currentACL) == 1: + pass + else: + return ACLManager.loadError() + + extra_args = {} + extra_args['function'] = 'InitiateRestore' + extra_args['website'] = Selectedwebsite + extra_args['domain'] = Selectedwebsite + extra_args['BasePath'] = '/home/backup' + extra_args['BackendName'] = Selectedrepo + extra_args['snapshotid'] = SnapShotId + # extra_args['BackupData'] = data['websiteData'] if 'websiteData' in data else False + # extra_args['BackupEmails'] = data['websiteEmails'] if 'websiteEmails' in data else False + # extra_args['BackupDatabase'] = data['websiteDatabases'] if 'websiteDatabases' in data else False + + + background = CPBackupsV2(extra_args) + background.DeleteSnapshots(SnapShotId) + + # vm = CPBackupsV2({'domain': Selectedwebsite, 'BackendName': Selectedrepo, "function": "", 'BasePath': '/home/backup'}) + # status = vm.InitiateRestore(SnapShotId, Path) + + data_ret = {'status': 1, 'installStatus': 1, 'error_message': 'None',} + json_data = json.dumps(data_ret) + return HttpResponse(json_data) + + except BaseException as msg: + data_ret = {'status': 0, 'installStatus': 0, 'error_message': str(msg)} + json_data = json.dumps(data_ret) + return HttpResponse(json_data) + def selectwebsiteRetorev2(request): import re try: diff --git a/mailServer/templates/mailServer/createEmailAccount.html b/mailServer/templates/mailServer/createEmailAccount.html index 7b9bacecb..9e1326f27 100755 --- a/mailServer/templates/mailServer/createEmailAccount.html +++ b/mailServer/templates/mailServer/createEmailAccount.html @@ -18,7 +18,7 @@

{% trans "Create Email Account" %} - - Test Email Delivery Test Email Delivery

diff --git a/plogical/Backupsv2.py b/plogical/Backupsv2.py index 4ea24277d..b0166be79 100644 --- a/plogical/Backupsv2.py +++ b/plogical/Backupsv2.py @@ -45,7 +45,6 @@ class CPBackupsV2(multi.Thread): multi.Thread.__init__(self) self.data = data try: - self.function = data['function'] except: pass @@ -141,6 +140,12 @@ class CPBackupsV2(multi.Thread): if os.path.exists(self.StatusFile): os.remove(self.StatusFile) + # ### delete repo function + # try: + # self.repo = data['BackendName'] + # except: + # pass + def run(self): try: if self.function == 'InitiateBackup':