mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2026-03-14 08:10:14 +01:00
selectboxbackupv2
This commit is contained in:
@@ -1535,10 +1535,23 @@ app.controller('CreateV2Backup', function ($scope, $http, $timeout, $compile) {
|
||||
$scope.goBackDisable = true;
|
||||
|
||||
var url = "/IncrementalBackups/CreateV2BackupButton";
|
||||
var websiteData = $scope.websiteData;
|
||||
var websiteEmails = $scope.websiteEmails;
|
||||
var websiteDatabases = $scope.websiteDatabases;
|
||||
var chk = 0;
|
||||
if (websiteData === true || websiteDatabases === true || websiteEmails === true) {
|
||||
chk = 1;
|
||||
}
|
||||
var data ={};
|
||||
|
||||
var data = {
|
||||
|
||||
data = {
|
||||
Selectedwebsite: $scope.selwebsite,
|
||||
Selectedrepo: $('#reposelectbox').val(),
|
||||
websiteDatabases: websiteDatabases,
|
||||
websiteEmails: websiteEmails,
|
||||
websiteData: websiteData,
|
||||
|
||||
};
|
||||
|
||||
var config = {
|
||||
@@ -1548,7 +1561,16 @@ app.controller('CreateV2Backup', function ($scope, $http, $timeout, $compile) {
|
||||
};
|
||||
|
||||
//alert('Done..........')
|
||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
if (chk === 1) {
|
||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
} else {
|
||||
$scope.backupLoading = true;
|
||||
new PNotify({
|
||||
title: 'Choose Backup Content!',
|
||||
text: 'Please Choose Backup content Data, Database, Email',
|
||||
type: 'error'
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function ListInitialDatas(response) {
|
||||
@@ -1558,9 +1580,8 @@ app.controller('CreateV2Backup', function ($scope, $http, $timeout, $compile) {
|
||||
Domain = $scope.selwebsite;
|
||||
getCreationStatus();
|
||||
|
||||
}
|
||||
else {
|
||||
$scope.backupLoading = true;
|
||||
} else {
|
||||
$scope.backupLoading = true;
|
||||
$scope.installationDetailsForm = true;
|
||||
$scope.installationProgress = false;
|
||||
$scope.errorMessageBox = false;
|
||||
@@ -1621,8 +1642,7 @@ 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;
|
||||
@@ -1667,59 +1687,54 @@ app.controller('CreateV2Backup', function ($scope, $http, $timeout, $compile) {
|
||||
|
||||
});
|
||||
|
||||
app.controller('ConfigureV2Backup', function ($scope, $http, $timeout){
|
||||
app.controller('ConfigureV2Backup', function ($scope, $http, $timeout) {
|
||||
$scope.cyberpanelLoading = true;
|
||||
$scope.selectbackuptype = function () {
|
||||
|
||||
$scope.cyberpanelLoading = false;
|
||||
|
||||
var backuptype = $scope.v2backuptype
|
||||
if (backuptype === 'GDrive')
|
||||
{
|
||||
if (backuptype === 'GDrive') {
|
||||
$scope.cyberpanelLoading = true;
|
||||
$('#GdriveModal').modal('show');
|
||||
}
|
||||
else if(backuptype === 'SFTP')
|
||||
{
|
||||
} else if (backuptype === 'SFTP') {
|
||||
$scope.cyberpanelLoading = true;
|
||||
$('#SFTPModal').modal('show');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
$scope.setupAccount = function(){
|
||||
$scope.setupAccount = function () {
|
||||
window.open("https://platform.cyberpersons.com/gDrive?name=" + $scope.accountName + '&server=' + window.location.href + 'Setup&domain=' + $scope.selwebsite);
|
||||
};
|
||||
|
||||
$scope.ConfigerSFTP = function (){
|
||||
$scope.cyberpanelLoading = false;
|
||||
var url = "/IncrementalBackups/ConfigureSftpV2Backup";
|
||||
$scope.ConfigerSFTP = function () {
|
||||
$scope.cyberpanelLoading = false;
|
||||
var url = "/IncrementalBackups/ConfigureSftpV2Backup";
|
||||
|
||||
var data = {
|
||||
Selectedwebsite: $scope.selwebsite,
|
||||
sfptpasswd: $scope.sfptpasswd,
|
||||
hostName: $scope.hostName,
|
||||
UserName: $scope.UserName,
|
||||
};
|
||||
var data = {
|
||||
Selectedwebsite: $scope.selwebsite,
|
||||
sfptpasswd: $scope.sfptpasswd,
|
||||
hostName: $scope.hostName,
|
||||
UserName: $scope.UserName,
|
||||
};
|
||||
|
||||
var config = {
|
||||
headers: {
|
||||
'X-CSRFToken': getCookie('csrftoken')
|
||||
}
|
||||
};
|
||||
var config = {
|
||||
headers: {
|
||||
'X-CSRFToken': getCookie('csrftoken')
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||
|
||||
|
||||
function ListInitialDatas(response) {
|
||||
function ListInitialDatas(response) {
|
||||
$scope.backupLoading = true;
|
||||
if (response.data.status === 1) {
|
||||
location.reload()
|
||||
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$scope.goBackDisable = false;
|
||||
new PNotify({
|
||||
title: 'Operation Failed!',
|
||||
@@ -1730,7 +1745,7 @@ app.controller('ConfigureV2Backup', function ($scope, $http, $timeout){
|
||||
|
||||
}
|
||||
|
||||
function cantLoadInitialDatas(response) {
|
||||
function cantLoadInitialDatas(response) {
|
||||
$scope.backupLoading = true;
|
||||
new PNotify({
|
||||
title: 'Operation Failed!',
|
||||
@@ -1740,6 +1755,7 @@ app.controller('ConfigureV2Backup', function ($scope, $http, $timeout){
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
function listpaths(pathid, button) {
|
||||
|
||||
console.log("LIST PAYH FUNCTIOB CALLED WITH ID " + pathid);
|
||||
|
||||
@@ -44,6 +44,45 @@
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Backup Content" %}</label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="websiteData" type="checkbox" value="">
|
||||
Data
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="websiteDatabases" type="checkbox" value="">
|
||||
Databases
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="websiteEmails" type="checkbox" value="">
|
||||
Emails
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<!---
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-9">
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input ng-model="websiteSSLs" type="checkbox" value="">
|
||||
SSL Certificates
|
||||
</label>
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans " " %} </label>
|
||||
<div class="col-sm-6">
|
||||
|
||||
@@ -782,6 +782,7 @@ def CreateV2BackupButton(request):
|
||||
Selectedwebsite = data['Selectedwebsite']
|
||||
Selectedrepo = data['Selectedrepo']
|
||||
|
||||
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
admin = Administrator.objects.get(pk=userID)
|
||||
|
||||
@@ -790,9 +791,22 @@ def CreateV2BackupButton(request):
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
|
||||
background = CPBackupsV2({'domain': Selectedwebsite, 'BasePath': '/home/backup', 'BackupDatabase': 1, 'BackupData': 1,
|
||||
'BackupEmails': 1, 'BackendName': Selectedrepo, 'function': 'InitiateBackup', })
|
||||
|
||||
extra_args = {}
|
||||
extra_args['function'] = 'InitiateBackup'
|
||||
extra_args['website'] = Selectedwebsite
|
||||
extra_args['BasePath'] = '/home/backup'
|
||||
extra_args['BackendName'] = Selectedrepo
|
||||
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.start()
|
||||
# background = CPBackupsV2({'domain': Selectedwebsite, 'BasePath': '/home/backup', 'BackupDatabase': 1, 'BackupData': 1,
|
||||
# 'BackupEmails': 1, 'BackendName': Selectedrepo, 'function': 'InitiateBackup', })
|
||||
# background.start()
|
||||
|
||||
time.sleep(2)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user