mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-08 14:26:16 +01:00
optmize naming convention
This commit is contained in:
@@ -757,7 +757,7 @@ class BackupManager:
|
|||||||
return HttpResponse(final_json)
|
return HttpResponse(final_json)
|
||||||
else:
|
else:
|
||||||
config = {'type': data['type'], 'path': data['path']}
|
config = {'type': data['type'], 'path': data['path']}
|
||||||
nd = NormalBackupDests(name='local', config=json.dumps(config))
|
nd = NormalBackupDests(name=data['name'], config=json.dumps(config))
|
||||||
nd.save()
|
nd.save()
|
||||||
|
|
||||||
final_dic = {'status' : 1, 'destStatus': 1, 'error_message': "None"}
|
final_dic = {'status' : 1, 'destStatus': 1, 'error_message': "None"}
|
||||||
@@ -786,7 +786,8 @@ class BackupManager:
|
|||||||
|
|
||||||
config = json.loads(items.config)
|
config = json.loads(items.config)
|
||||||
|
|
||||||
if config['type'] == data['type'] and data['type'] == 'SFTP':
|
if config['type'] == data['type']:
|
||||||
|
if config['type'] == 'SFTP':
|
||||||
dic = {
|
dic = {
|
||||||
'name': items.name,
|
'name': items.name,
|
||||||
'ip': config['ip'],
|
'ip': config['ip'],
|
||||||
@@ -854,15 +855,7 @@ class BackupManager:
|
|||||||
nameOrPath = data['nameOrPath']
|
nameOrPath = data['nameOrPath']
|
||||||
type = data['type']
|
type = data['type']
|
||||||
|
|
||||||
if type == 'SFTP':
|
|
||||||
NormalBackupDests.objects.get(name=nameOrPath).delete()
|
NormalBackupDests.objects.get(name=nameOrPath).delete()
|
||||||
else:
|
|
||||||
dests = NormalBackupDests.objects.filter(name='local')
|
|
||||||
for items in dests:
|
|
||||||
config = json.loads(items.config)
|
|
||||||
if config['path'] == nameOrPath:
|
|
||||||
items.delete()
|
|
||||||
break
|
|
||||||
|
|
||||||
final_dic = {'status': 1, 'delStatus': 1, 'error_message': "None"}
|
final_dic = {'status': 1, 'delStatus': 1, 'error_message': "None"}
|
||||||
final_json = json.dumps(final_dic)
|
final_json = json.dumps(final_dic)
|
||||||
@@ -880,20 +873,14 @@ class BackupManager:
|
|||||||
if ACLManager.currentContextPermission(currentACL, 'scheDuleBackups') == 0:
|
if ACLManager.currentContextPermission(currentACL, 'scheDuleBackups') == 0:
|
||||||
return ACLManager.loadError()
|
return ACLManager.loadError()
|
||||||
|
|
||||||
if dest.objects.all().count() <= 1:
|
destinations = NormalBackupDests.objects.all()
|
||||||
try:
|
|
||||||
homeDest = dest(destLoc="Home")
|
|
||||||
homeDest.save()
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
backups = dest.objects.all()
|
|
||||||
|
|
||||||
destinations = []
|
dests = []
|
||||||
|
|
||||||
for items in backups:
|
for dest in destinations:
|
||||||
destinations.append(items.destLoc)
|
dests.append(dest.name)
|
||||||
|
|
||||||
return render(request, 'backup/backupSchedule.html', {'destinations': destinations})
|
return render(request, 'backup/backupSchedule.html', {'destinations': dests})
|
||||||
|
|
||||||
except BaseException as msg:
|
except BaseException as msg:
|
||||||
return HttpResponse(str(msg))
|
return HttpResponse(str(msg))
|
||||||
|
|||||||
@@ -415,288 +415,6 @@ app.controller('restoreWebsiteControl', function ($scope, $http, $timeout) {
|
|||||||
|
|
||||||
//*** Restore site ends here ***///
|
//*** Restore site ends here ***///
|
||||||
|
|
||||||
///** Schedule Backup ***//
|
|
||||||
|
|
||||||
app.controller('scheduleBackup', function ($scope, $http, $timeout) {
|
|
||||||
|
|
||||||
$scope.scheduleBackupLoading = true;
|
|
||||||
$scope.canNotAddSchedule = true;
|
|
||||||
$scope.scheduleAdded = true;
|
|
||||||
$scope.couldNotConnect = true;
|
|
||||||
$scope.scheduleFreq = true;
|
|
||||||
$scope.scheduleBtn = true;
|
|
||||||
$scope.localPath = true;
|
|
||||||
|
|
||||||
populateCurrentRecords();
|
|
||||||
|
|
||||||
$scope.scheduleFreqView = function () {
|
|
||||||
$scope.scheduleBackupLoading = true;
|
|
||||||
$scope.canNotAddSchedule = true;
|
|
||||||
$scope.scheduleAdded = true;
|
|
||||||
$scope.couldNotConnect = true;
|
|
||||||
$scope.scheduleFreq = false;
|
|
||||||
$scope.scheduleBtn = true;
|
|
||||||
|
|
||||||
if($scope.backupDest === 'Home'){
|
|
||||||
$scope.localPath = false;
|
|
||||||
}else{
|
|
||||||
$scope.localPath = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.scheduleBtnView = function () {
|
|
||||||
$scope.scheduleBackupLoading = true;
|
|
||||||
$scope.canNotAddSchedule = true;
|
|
||||||
$scope.scheduleAdded = true;
|
|
||||||
$scope.couldNotConnect = true;
|
|
||||||
$scope.scheduleFreq = false;
|
|
||||||
$scope.scheduleBtn = false;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.addSchedule = function () {
|
|
||||||
|
|
||||||
$scope.scheduleBackupLoading = false;
|
|
||||||
$scope.canNotAddSchedule = true;
|
|
||||||
$scope.scheduleAdded = true;
|
|
||||||
$scope.couldNotConnect = true;
|
|
||||||
$scope.scheduleFreq = false;
|
|
||||||
$scope.scheduleBtn = false;
|
|
||||||
|
|
||||||
|
|
||||||
url = "/backup/submitBackupSchedule";
|
|
||||||
|
|
||||||
|
|
||||||
var data = {
|
|
||||||
backupDest: $scope.backupDest,
|
|
||||||
backupFreq: $scope.backupFreq,
|
|
||||||
localPath: $scope.localPathValue
|
|
||||||
};
|
|
||||||
|
|
||||||
var config = {
|
|
||||||
headers: {
|
|
||||||
'X-CSRFToken': getCookie('csrftoken')
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
|
||||||
|
|
||||||
|
|
||||||
function ListInitialDatas(response) {
|
|
||||||
|
|
||||||
|
|
||||||
if (response.data.scheduleStatus == 1) {
|
|
||||||
|
|
||||||
$scope.scheduleBackupLoading = true;
|
|
||||||
$scope.canNotAddSchedule = true;
|
|
||||||
$scope.scheduleAdded = false;
|
|
||||||
$scope.couldNotConnect = true;
|
|
||||||
$scope.scheduleFreq = true;
|
|
||||||
$scope.scheduleBtn = true;
|
|
||||||
|
|
||||||
|
|
||||||
populateCurrentRecords();
|
|
||||||
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
|
|
||||||
$scope.scheduleBackupLoading = true;
|
|
||||||
$scope.canNotAddSchedule = false;
|
|
||||||
$scope.scheduleAdded = true;
|
|
||||||
$scope.couldNotConnect = true;
|
|
||||||
$scope.scheduleFreq = false;
|
|
||||||
$scope.scheduleBtn = false;
|
|
||||||
|
|
||||||
$scope.errorMessage = response.data.error_message;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function cantLoadInitialDatas(response) {
|
|
||||||
|
|
||||||
$scope.scheduleBackupLoading = true;
|
|
||||||
$scope.canNotAddSchedule = true;
|
|
||||||
$scope.scheduleAdded = true;
|
|
||||||
$scope.couldNotConnect = false;
|
|
||||||
$scope.scheduleFreq = false;
|
|
||||||
$scope.scheduleBtn = false;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.checkConn = function (ip) {
|
|
||||||
|
|
||||||
$scope.destinationLoading = false;
|
|
||||||
$scope.connectionFailed = true;
|
|
||||||
$scope.connectionSuccess = true;
|
|
||||||
$scope.canNotAddDestination = true;
|
|
||||||
$scope.destinationAdded = true;
|
|
||||||
$scope.couldNotConnect = true;
|
|
||||||
|
|
||||||
url = "/backup/getConnectionStatus";
|
|
||||||
|
|
||||||
|
|
||||||
var data = {
|
|
||||||
IPAddress: ip,
|
|
||||||
};
|
|
||||||
|
|
||||||
var config = {
|
|
||||||
headers: {
|
|
||||||
'X-CSRFToken': getCookie('csrftoken')
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
|
||||||
|
|
||||||
|
|
||||||
function ListInitialDatas(response) {
|
|
||||||
|
|
||||||
|
|
||||||
if (response.data.connStatus == 1) {
|
|
||||||
|
|
||||||
$scope.destinationLoading = true;
|
|
||||||
$scope.connectionFailed = true;
|
|
||||||
$scope.connectionSuccess = false;
|
|
||||||
$scope.canNotAddDestination = true;
|
|
||||||
$scope.destinationAdded = true;
|
|
||||||
$scope.couldNotConnect = true;
|
|
||||||
|
|
||||||
$scope.IPAddress = ip;
|
|
||||||
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$scope.destinationLoading = true;
|
|
||||||
$scope.connectionFailed = false;
|
|
||||||
$scope.connectionSuccess = true;
|
|
||||||
$scope.canNotAddDestination = true;
|
|
||||||
$scope.destinationAdded = true;
|
|
||||||
$scope.couldNotConnect = true;
|
|
||||||
|
|
||||||
$scope.errorMessage = response.data.error_message;
|
|
||||||
$scope.IPAddress = ip;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function cantLoadInitialDatas(response) {
|
|
||||||
$scope.destinationLoading = true;
|
|
||||||
$scope.connectionFailed = true;
|
|
||||||
$scope.connectionSuccess = true;
|
|
||||||
$scope.canNotAddDestination = true;
|
|
||||||
$scope.destinationAdded = true;
|
|
||||||
$scope.couldNotConnect = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
$scope.delSchedule = function (destLoc, frequency) {
|
|
||||||
|
|
||||||
$scope.scheduleBackupLoading = false;
|
|
||||||
$scope.canNotAddSchedule = true;
|
|
||||||
$scope.scheduleAdded = true;
|
|
||||||
$scope.couldNotConnect = true;
|
|
||||||
$scope.scheduleFreq = true;
|
|
||||||
$scope.scheduleBtn = true;
|
|
||||||
|
|
||||||
|
|
||||||
url = "/backup/scheduleDelete";
|
|
||||||
|
|
||||||
|
|
||||||
var data = {
|
|
||||||
destLoc: destLoc,
|
|
||||||
frequency: frequency,
|
|
||||||
};
|
|
||||||
|
|
||||||
var config = {
|
|
||||||
headers: {
|
|
||||||
'X-CSRFToken': getCookie('csrftoken')
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
|
||||||
|
|
||||||
|
|
||||||
function ListInitialDatas(response) {
|
|
||||||
|
|
||||||
|
|
||||||
if (response.data.delStatus == 1) {
|
|
||||||
|
|
||||||
$scope.scheduleBackupLoading = true;
|
|
||||||
$scope.canNotAddSchedule = true;
|
|
||||||
$scope.scheduleAdded = true;
|
|
||||||
$scope.couldNotConnect = true;
|
|
||||||
$scope.scheduleFreq = true;
|
|
||||||
$scope.scheduleBtn = true;
|
|
||||||
|
|
||||||
|
|
||||||
populateCurrentRecords();
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
|
|
||||||
$scope.scheduleBackupLoading = true;
|
|
||||||
$scope.canNotAddSchedule = true;
|
|
||||||
$scope.scheduleAdded = true;
|
|
||||||
$scope.couldNotConnect = true;
|
|
||||||
$scope.scheduleFreq = true;
|
|
||||||
$scope.scheduleBtn = true;
|
|
||||||
$scope.errorMessage = response.data.error_message;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function cantLoadInitialDatas(response) {
|
|
||||||
|
|
||||||
$scope.scheduleBackupLoading = true;
|
|
||||||
$scope.canNotAddSchedule = true;
|
|
||||||
$scope.scheduleAdded = true;
|
|
||||||
$scope.couldNotConnect = false;
|
|
||||||
$scope.scheduleFreq = true;
|
|
||||||
$scope.scheduleBtn = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
function populateCurrentRecords() {
|
|
||||||
|
|
||||||
url = "/backup/getCurrentBackupSchedules";
|
|
||||||
|
|
||||||
var data = {};
|
|
||||||
|
|
||||||
var config = {
|
|
||||||
headers: {
|
|
||||||
'X-CSRFToken': getCookie('csrftoken')
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
|
||||||
|
|
||||||
|
|
||||||
function ListInitialDatas(response) {
|
|
||||||
|
|
||||||
|
|
||||||
if (response.data.fetchStatus == 1) {
|
|
||||||
|
|
||||||
$scope.records = JSON.parse(response.data.data);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function cantLoadInitialDatas(response) {
|
|
||||||
$scope.couldNotConnect = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
//*** Schedule Backup ***///
|
|
||||||
|
|
||||||
//*** Remote Backup site ****//
|
//*** Remote Backup site ****//
|
||||||
app.controller('remoteBackupControl', function ($scope, $http, $timeout) {
|
app.controller('remoteBackupControl', function ($scope, $http, $timeout) {
|
||||||
|
|
||||||
@@ -1755,6 +1473,7 @@ app.controller('backupDestinations', function ($scope, $http) {
|
|||||||
var data = {
|
var data = {
|
||||||
type: type,
|
type: type,
|
||||||
path: $scope.localPath,
|
path: $scope.localPath,
|
||||||
|
name: $scope.name
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1851,3 +1570,316 @@ app.controller('backupDestinations', function ($scope, $http) {
|
|||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//
|
||||||
|
|
||||||
|
app.controller('scheduleBackup', function ($scope, $http) {
|
||||||
|
|
||||||
|
$scope.cyberPanelLoading = true;
|
||||||
|
$scope.driveHidden = true;
|
||||||
|
|
||||||
|
$scope.currentPage = 1;
|
||||||
|
$scope.recordsToShow = 10;
|
||||||
|
|
||||||
|
$scope.fetchWebsites = function () {
|
||||||
|
|
||||||
|
$scope.cyberPanelLoading = false;
|
||||||
|
|
||||||
|
var config = {
|
||||||
|
headers: {
|
||||||
|
'X-CSRFToken': getCookie('csrftoken')
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var data = {
|
||||||
|
selectedAccount: $scope.selectedAccount,
|
||||||
|
page: $scope.currentPage,
|
||||||
|
recordsToShow: $scope.recordsToShow
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
dataurl = "/backup/fetchgDriveSites";
|
||||||
|
|
||||||
|
$http.post(dataurl, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||||
|
|
||||||
|
function ListInitialDatas(response) {
|
||||||
|
$scope.cyberPanelLoading = true;
|
||||||
|
if (response.data.status === 1) {
|
||||||
|
$scope.driveHidden = false;
|
||||||
|
new PNotify({
|
||||||
|
title: 'Success',
|
||||||
|
text: 'Successfully fetched.',
|
||||||
|
type: 'success'
|
||||||
|
});
|
||||||
|
$scope.websites = JSON.parse(response.data.websites);
|
||||||
|
$scope.pagination = response.data.pagination;
|
||||||
|
$scope.currently = response.data.currently;
|
||||||
|
} else {
|
||||||
|
new PNotify({
|
||||||
|
title: 'Operation Failed!',
|
||||||
|
text: response.data.error_message,
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function cantLoadInitialDatas(response) {
|
||||||
|
$scope.cyberPanelLoading = true;
|
||||||
|
new PNotify({
|
||||||
|
title: 'Operation Failed!',
|
||||||
|
text: 'Could not connect to server, please refresh this page.',
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.addSite = function () {
|
||||||
|
$scope.cyberPanelLoading = false;
|
||||||
|
|
||||||
|
var config = {
|
||||||
|
headers: {
|
||||||
|
'X-CSRFToken': getCookie('csrftoken')
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var data = {
|
||||||
|
selectedWebsite: $scope.selectedWebsite,
|
||||||
|
selectedAccount: $scope.selectedAccount
|
||||||
|
};
|
||||||
|
|
||||||
|
dataurl = "/backup/addSitegDrive";
|
||||||
|
|
||||||
|
$http.post(dataurl, data, config).then(ListInitialData, cantLoadInitialData);
|
||||||
|
|
||||||
|
|
||||||
|
function ListInitialData(response) {
|
||||||
|
$scope.cyberPanelLoading = true;
|
||||||
|
if (response.data.status === 1) {
|
||||||
|
new PNotify({
|
||||||
|
title: 'Success',
|
||||||
|
text: 'Site successfully added.',
|
||||||
|
type: 'success'
|
||||||
|
});
|
||||||
|
$scope.fetchWebsites();
|
||||||
|
} else {
|
||||||
|
new PNotify({
|
||||||
|
title: 'Operation Failed!',
|
||||||
|
text: response.data.error_message,
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function cantLoadInitialData(response) {
|
||||||
|
$scope.cyberPanelLoading = true;
|
||||||
|
new PNotify({
|
||||||
|
title: 'Operation Failed!',
|
||||||
|
text: 'Could not connect to server, please refresh this page',
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.deleteAccount = function () {
|
||||||
|
$scope.cyberPanelLoading = false;
|
||||||
|
|
||||||
|
var config = {
|
||||||
|
headers: {
|
||||||
|
'X-CSRFToken': getCookie('csrftoken')
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var data = {
|
||||||
|
selectedAccount: $scope.selectedAccount
|
||||||
|
};
|
||||||
|
|
||||||
|
dataurl = "/backup/deleteAccountgDrive";
|
||||||
|
|
||||||
|
$http.post(dataurl, data, config).then(ListInitialData, cantLoadInitialData);
|
||||||
|
|
||||||
|
|
||||||
|
function ListInitialData(response) {
|
||||||
|
$scope.cyberPanelLoading = true;
|
||||||
|
if (response.data.status === 1) {
|
||||||
|
new PNotify({
|
||||||
|
title: 'Success',
|
||||||
|
text: 'Account successfully deleted.',
|
||||||
|
type: 'success'
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
new PNotify({
|
||||||
|
title: 'Operation Failed!',
|
||||||
|
text: response.data.error_message,
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function cantLoadInitialData(response) {
|
||||||
|
$scope.cyberPanelLoading = true;
|
||||||
|
new PNotify({
|
||||||
|
title: 'Operation Failed!',
|
||||||
|
text: 'Could not connect to server, please refresh this page',
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.changeFrequency = function () {
|
||||||
|
$scope.cyberPanelLoading = false;
|
||||||
|
|
||||||
|
var config = {
|
||||||
|
headers: {
|
||||||
|
'X-CSRFToken': getCookie('csrftoken')
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var data = {
|
||||||
|
selectedAccount: $scope.selectedAccount,
|
||||||
|
backupFrequency: $scope.backupFrequency
|
||||||
|
};
|
||||||
|
|
||||||
|
dataurl = "/backup/changeAccountFrequencygDrive";
|
||||||
|
|
||||||
|
$http.post(dataurl, data, config).then(ListInitialData, cantLoadInitialData);
|
||||||
|
|
||||||
|
|
||||||
|
function ListInitialData(response) {
|
||||||
|
$scope.cyberPanelLoading = true;
|
||||||
|
if (response.data.status === 1) {
|
||||||
|
new PNotify({
|
||||||
|
title: 'Success',
|
||||||
|
text: 'Changes successfully applied',
|
||||||
|
type: 'success'
|
||||||
|
});
|
||||||
|
$scope.fetchWebsites();
|
||||||
|
} else {
|
||||||
|
new PNotify({
|
||||||
|
title: 'Operation Failed!',
|
||||||
|
text: response.data.error_message,
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function cantLoadInitialData(response) {
|
||||||
|
$scope.cyberPanelLoading = true;
|
||||||
|
new PNotify({
|
||||||
|
title: 'Operation Failed!',
|
||||||
|
text: 'Could not connect to server, please refresh this page',
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.deleteSite = function (website) {
|
||||||
|
$scope.cyberPanelLoading = false;
|
||||||
|
|
||||||
|
var config = {
|
||||||
|
headers: {
|
||||||
|
'X-CSRFToken': getCookie('csrftoken')
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var data = {
|
||||||
|
selectedAccount: $scope.selectedAccount,
|
||||||
|
website: website
|
||||||
|
};
|
||||||
|
|
||||||
|
dataurl = "/backup/deleteSitegDrive";
|
||||||
|
|
||||||
|
$http.post(dataurl, data, config).then(ListInitialData, cantLoadInitialData);
|
||||||
|
|
||||||
|
|
||||||
|
function ListInitialData(response) {
|
||||||
|
$scope.cyberPanelLoading = true;
|
||||||
|
if (response.data.status === 1) {
|
||||||
|
new PNotify({
|
||||||
|
title: 'Success',
|
||||||
|
text: 'Website Deleted.',
|
||||||
|
type: 'success'
|
||||||
|
});
|
||||||
|
$scope.fetchWebsites();
|
||||||
|
} else {
|
||||||
|
new PNotify({
|
||||||
|
title: 'Operation Failed!',
|
||||||
|
text: response.data.error_message,
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function cantLoadInitialData(response) {
|
||||||
|
$scope.cyberPanelLoading = true;
|
||||||
|
new PNotify({
|
||||||
|
title: 'Operation Failed!',
|
||||||
|
text: 'Could not connect to server, please refresh this page',
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.currentPageLogs = 1;
|
||||||
|
$scope.recordsToShowLogs = 10;
|
||||||
|
|
||||||
|
$scope.fetchLogs = function () {
|
||||||
|
|
||||||
|
$scope.cyberPanelLoading = false;
|
||||||
|
|
||||||
|
var config = {
|
||||||
|
headers: {
|
||||||
|
'X-CSRFToken': getCookie('csrftoken')
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var data = {
|
||||||
|
selectedAccount: $scope.selectedAccount,
|
||||||
|
page: $scope.currentPageLogs,
|
||||||
|
recordsToShow: $scope.recordsToShowLogs
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
dataurl = "/backup/fetchDriveLogs";
|
||||||
|
|
||||||
|
$http.post(dataurl, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||||
|
|
||||||
|
function ListInitialDatas(response) {
|
||||||
|
$scope.cyberPanelLoading = true;
|
||||||
|
if (response.data.status === 1) {
|
||||||
|
$scope.driveHidden = false;
|
||||||
|
new PNotify({
|
||||||
|
title: 'Success',
|
||||||
|
text: 'Successfully fetched.',
|
||||||
|
type: 'success'
|
||||||
|
});
|
||||||
|
$scope.logs = JSON.parse(response.data.logs);
|
||||||
|
$scope.paginationLogs = response.data.pagination;
|
||||||
|
} else {
|
||||||
|
new PNotify({
|
||||||
|
title: 'Operation Failed!',
|
||||||
|
text: response.data.error_message,
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function cantLoadInitialDatas(response) {
|
||||||
|
$scope.cyberPanelLoading = true;
|
||||||
|
new PNotify({
|
||||||
|
title: 'Operation Failed!',
|
||||||
|
text: 'Could not connect to server, please refresh this page.',
|
||||||
|
type: 'error'
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
});
|
||||||
|
|||||||
@@ -138,6 +138,13 @@
|
|||||||
|
|
||||||
<!--- AWS Start --->
|
<!--- AWS Start --->
|
||||||
|
|
||||||
|
<div ng-hide="localHide" class="form-group">
|
||||||
|
<label class="col-sm-3 control-label">{% trans "Name" %}</label>
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<input type="text" class="form-control" ng-model="name" required>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div ng-hide="localHide" class="form-group">
|
<div ng-hide="localHide" class="form-group">
|
||||||
<label class="col-sm-3 control-label">{% trans "Local Path" %}</label>
|
<label class="col-sm-3 control-label">{% trans "Local Path" %}</label>
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
@@ -168,14 +175,16 @@
|
|||||||
<table class="table">
|
<table class="table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
<th>{% trans "Name" %}</th>
|
||||||
<th>{% trans "Path" %}</th>
|
<th>{% trans "Path" %}</th>
|
||||||
<th>{% trans "Delete" %}</th>
|
<th>{% trans "Delete" %}</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr ng-repeat="record in records track by $index">
|
<tr ng-repeat="record in records track by $index">
|
||||||
|
<td ng-bind="record.name"></td>
|
||||||
<td ng-bind="record.path"></td>
|
<td ng-bind="record.path"></td>
|
||||||
<td ng-click="removeDestination('local', record.path)"><img src="{% static 'images/delete.png' %}">
|
<td ng-click="removeDestination('local', record.name)"><img src="{% static 'images/delete.png' %}">
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -5,125 +5,200 @@
|
|||||||
|
|
||||||
{% load static %}
|
{% load static %}
|
||||||
|
|
||||||
|
|
||||||
{% get_current_language as LANGUAGE_CODE %}
|
{% get_current_language as LANGUAGE_CODE %}
|
||||||
<!-- Current language: {{ LANGUAGE_CODE }} -->
|
<!-- Current language: {{ LANGUAGE_CODE }} -->
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div id="page-title">
|
<div id="page-title">
|
||||||
<h2>{% trans "Schedule Back up" %} - <a target="_blank" href="http://go.cyberpanel.net/remote-backup"
|
<h2>{% trans "Schedule Back up" %} - <a target="_blank"
|
||||||
|
href="http://go.cyberpanel.net/remote-backup"
|
||||||
style="height: 23px;line-height: 21px; text-decoration: underline"
|
style="height: 23px;line-height: 21px; text-decoration: underline"
|
||||||
class="btn btn-border btn-alt border-red btn-link font-red"
|
class="btn btn-border btn-alt border-red btn-link font-red"
|
||||||
title=""><span>{% trans "Remote Backups" %}</span></a></h2>
|
title=""><span>{% trans "Remote Backups" %}</span></a>
|
||||||
<p>{% trans "On this page you can schedule Back ups to localhost or remote server (If you have added one)." %}</p>
|
</h2>
|
||||||
|
<p>{% trans "On this page you can schedule Back ups to localhost or remote server (If you have added one)" %}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div ng-controller="scheduleBackup" class="panel">
|
<div ng-controller="googleDrive" class="panel">
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<h3 class="title-hero">
|
<h3 class="title-hero">
|
||||||
{% trans "Schedule Back up" %} - <img ng-hide="scheduleBackupLoading"
|
{% trans "Schedule Back up" %} <img ng-hide="cyberPanelLoading"
|
||||||
src="{% static 'images/loading.gif' %}"> <a target="_blank"
|
src="{% static 'images/loading.gif' %}">
|
||||||
href="{% url 'backupLogs' %}"
|
|
||||||
style="height: 23px;line-height: 21px;"
|
|
||||||
title="">{% trans "Backup Logs" %}</a>
|
|
||||||
</h3>
|
</h3>
|
||||||
<div class="example-box-wrapper">
|
<div class="example-box-wrapper">
|
||||||
|
|
||||||
|
|
||||||
<form action="/" class="form-horizontal bordered-row">
|
<form action="/" class="form-horizontal bordered-row">
|
||||||
|
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-sm-3 control-label">{% trans "Select Destination" %}</label>
|
<label class="col-sm-3 control-label">{% trans "Select Destination" %}</label>
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
<select ng-change="scheduleFreqView()" ng-model="backupDest" class="form-control">
|
<select ng-change="fetchWebsites()" ng-model="selectedAccount" class="form-control">
|
||||||
{% for items in destinations %}
|
{% for items in destinations %}
|
||||||
<option>{{ items }}</option>
|
<option>{{ items }}</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
<button ng-hide="driveHidden" type="button" ng-click="deleteAccount()"
|
||||||
|
class="btn btn-danger">{% trans "Delete" %}</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div ng-hide="scheduleFreq" class="form-group">
|
<div ng-hide="driveHidden" class="form-group">
|
||||||
<label class="col-sm-3 control-label">{% trans "Select Frequency" %}</label>
|
<label class="col-sm-3 control-label">{% trans "Select Backup Frequency" %}</label>
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
<select ng-change="scheduleBtnView()" ng-model="backupFreq" class="form-control">
|
<select ng-change="changeFrequency()" ng-model="backupFrequency" class="form-control">
|
||||||
|
<option>Never</option>
|
||||||
<option>Daily</option>
|
<option>Daily</option>
|
||||||
<option>Weekly</option>
|
<option>Weekly</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
Currently: {$ currently $}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div ng-hide="localPath" class="form-group">
|
<div ng-hide="driveHidden" class="form-group">
|
||||||
<label class="col-sm-3 control-label">{% trans "Local Path" %}</label>
|
<label class="col-sm-3 control-label">{% trans "Add Sites for Backup" %}</label>
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
<input name="dom" type="text" class="form-control" ng-model="localPathValue"
|
<select ng-model="selectedWebsite" class="form-control">
|
||||||
placeholder="{% trans "Local directory where backups will be moved after creation." %}"
|
{% for items in websites %}
|
||||||
required>
|
<option>{{ items }}</option>
|
||||||
|
{% endfor %}
|
||||||
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
<button type="button" ng-click="addSite()"
|
||||||
|
class="btn btn-primary">{% trans "Add Site" %}</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div ng-hide="driveHidden" class="form-group">
|
||||||
<div ng-hide="scheduleBtn" class="form-group">
|
<div class="row">
|
||||||
<label class="col-sm-3 control-label"></label>
|
<div style="margin-left: 2%" class="col-sm-3">
|
||||||
<div class="col-sm-4">
|
<button data-toggle="modal" data-target="#backupLogs" ng-hide="driveHidden"
|
||||||
<button type="button" ng-click="addSchedule()"
|
type="button" ng-click="fetchLogs()"
|
||||||
class="btn btn-primary btn-lg btn-block">{% trans "Add Destination" %}</button>
|
class="btn btn-gray">{% trans "View Logs" %}</button>
|
||||||
|
<div id="backupLogs" class="modal fade" role="dialog">
|
||||||
|
<div class="modal-dialog modal-lg">
|
||||||
|
<!-- Modal content-->
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" data-dismiss="modal">×
|
||||||
|
</button>
|
||||||
|
<h4 class="modal-title">{% trans "Git Logs" %} <img
|
||||||
|
ng-hide="cyberPanelLoading"
|
||||||
|
src="{% static 'images/loading.gif' %}">
|
||||||
|
</h4>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-9">
|
||||||
</div>
|
</div>
|
||||||
|
<div class="col-sm-2">
|
||||||
|
|
||||||
<!------ List of Destinations --------------->
|
|
||||||
|
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
<select ng-model="recordsToShowLogs"
|
||||||
<label class="col-sm-3 control-label"></label>
|
ng-change="fetchLogs()"
|
||||||
<div class="col-sm-4">
|
class="form-control" id="example-select">
|
||||||
|
<option>10</option>
|
||||||
<div ng-hide="canNotAddSchedule" class="alert alert-danger">
|
<option>50</option>
|
||||||
<p>{% trans "Cannot add schedule. Error message:" %} {$ errorMessage $} </p>
|
<option>100</option>
|
||||||
</div>
|
</select>
|
||||||
|
|
||||||
<div ng-hide="scheduleAdded" class="alert alert-success">
|
|
||||||
<p>{% trans "Schedule Added" %}</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div ng-hide="couldNotConnect" class="alert alert-danger">
|
|
||||||
<p>{% trans "Could not connect to server. Please refresh this page." %}</p>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<table style="margin: 0px; padding-bottom: 2%" class="table">
|
||||||
|
|
||||||
<div class="col-sm-12">
|
|
||||||
|
|
||||||
<table class="table">
|
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>{% trans "ID" %}</th>
|
<th>Type</th>
|
||||||
<th>{% trans "Destination" %}</th>
|
<th>Message</th>
|
||||||
<th>{% trans "Frequency" %}</th>
|
|
||||||
<th>{% trans "Delete" %}</th>
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr ng-repeat="record in records track by $index">
|
<tr ng-repeat="log in logs track by $index">
|
||||||
<td ng-bind="record.id"></td>
|
<td ng-bind="log.type"></td>
|
||||||
<td ng-bind="record.destLoc"></td>
|
<td ng-bind="log.message"></td>
|
||||||
<td ng-bind="record.frequency"></td>
|
|
||||||
<td ng-click="delSchedule(record.destLoc,record.frequency)"><img
|
|
||||||
src="{% static 'images/delete.png' %}"></td>
|
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
<div style="margin-top: 2%" class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-8">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-3">
|
||||||
|
<div class="form-group">
|
||||||
|
<select ng-model="currentPageLogs"
|
||||||
|
class="form-control"
|
||||||
|
ng-change="fetchLogs()">
|
||||||
|
<option ng-repeat="page in paginationLogs">
|
||||||
|
{$
|
||||||
|
$index + 1
|
||||||
|
$}
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div> <!-- end row -->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!------ List of records --------------->
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-6">
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-2">
|
||||||
|
<div class="form-group">
|
||||||
|
<select ng-model="recordsToShow"
|
||||||
|
ng-change="fetchWebsites()"
|
||||||
|
class="form-control" id="example-select">
|
||||||
|
<option>10</option>
|
||||||
|
<option>50</option>
|
||||||
|
<option>100</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<table style="margin-top: 2%" class="table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>Sites</th>
|
||||||
|
<th>Action</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr ng-repeat="website in websites track by $index">
|
||||||
|
<td ng-bind="website.name"></td>
|
||||||
|
<td>
|
||||||
|
<button type="button" ng-click="deleteSite(website.name)"
|
||||||
|
class="btn btn-danger">{% trans "Delete" %}</button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<div style="margin-top: 2%" class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-8">
|
||||||
|
</div>
|
||||||
|
<div class="col-md-3">
|
||||||
|
<div class="form-group">
|
||||||
|
<select ng-model="currentPage" class="form-control"
|
||||||
|
ng-change="fetchWebsites()">
|
||||||
|
<option ng-repeat="page in pagination">{$ $index + 1
|
||||||
|
$}
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div> <!-- end row -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user