mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-08 06:16:08 +01:00
optmize naming convention
This commit is contained in:
@@ -757,7 +757,7 @@ class BackupManager:
|
||||
return HttpResponse(final_json)
|
||||
else:
|
||||
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()
|
||||
|
||||
final_dic = {'status' : 1, 'destStatus': 1, 'error_message': "None"}
|
||||
@@ -786,25 +786,26 @@ class BackupManager:
|
||||
|
||||
config = json.loads(items.config)
|
||||
|
||||
if config['type'] == data['type'] and data['type'] == 'SFTP':
|
||||
dic = {
|
||||
'name': items.name,
|
||||
'ip': config['ip'],
|
||||
'username': config['username'],
|
||||
'path': config['path'],
|
||||
'port': config['port'],
|
||||
}
|
||||
else:
|
||||
dic = {
|
||||
'name': items.name,
|
||||
'path': config['path'],
|
||||
}
|
||||
if config['type'] == data['type']:
|
||||
if config['type'] == 'SFTP':
|
||||
dic = {
|
||||
'name': items.name,
|
||||
'ip': config['ip'],
|
||||
'username': config['username'],
|
||||
'path': config['path'],
|
||||
'port': config['port'],
|
||||
}
|
||||
else:
|
||||
dic = {
|
||||
'name': items.name,
|
||||
'path': config['path'],
|
||||
}
|
||||
|
||||
if checker == 0:
|
||||
json_data = json_data + json.dumps(dic)
|
||||
checker = 1
|
||||
else:
|
||||
json_data = json_data + ',' + json.dumps(dic)
|
||||
if checker == 0:
|
||||
json_data = json_data + json.dumps(dic)
|
||||
checker = 1
|
||||
else:
|
||||
json_data = json_data + ',' + json.dumps(dic)
|
||||
|
||||
json_data = json_data + ']'
|
||||
final_json = json.dumps({'status': 1, 'error_message': "None", "data": json_data})
|
||||
@@ -854,15 +855,7 @@ class BackupManager:
|
||||
nameOrPath = data['nameOrPath']
|
||||
type = data['type']
|
||||
|
||||
if type == 'SFTP':
|
||||
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
|
||||
NormalBackupDests.objects.get(name=nameOrPath).delete()
|
||||
|
||||
final_dic = {'status': 1, 'delStatus': 1, 'error_message': "None"}
|
||||
final_json = json.dumps(final_dic)
|
||||
@@ -880,20 +873,14 @@ class BackupManager:
|
||||
if ACLManager.currentContextPermission(currentACL, 'scheDuleBackups') == 0:
|
||||
return ACLManager.loadError()
|
||||
|
||||
if dest.objects.all().count() <= 1:
|
||||
try:
|
||||
homeDest = dest(destLoc="Home")
|
||||
homeDest.save()
|
||||
except:
|
||||
pass
|
||||
backups = dest.objects.all()
|
||||
destinations = NormalBackupDests.objects.all()
|
||||
|
||||
destinations = []
|
||||
dests = []
|
||||
|
||||
for items in backups:
|
||||
destinations.append(items.destLoc)
|
||||
for dest in destinations:
|
||||
dests.append(dest.name)
|
||||
|
||||
return render(request, 'backup/backupSchedule.html', {'destinations': destinations})
|
||||
return render(request, 'backup/backupSchedule.html', {'destinations': dests})
|
||||
|
||||
except BaseException as msg:
|
||||
return HttpResponse(str(msg))
|
||||
|
||||
@@ -415,288 +415,6 @@ app.controller('restoreWebsiteControl', function ($scope, $http, $timeout) {
|
||||
|
||||
//*** 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 ****//
|
||||
app.controller('remoteBackupControl', function ($scope, $http, $timeout) {
|
||||
|
||||
@@ -1755,6 +1473,7 @@ app.controller('backupDestinations', function ($scope, $http) {
|
||||
var data = {
|
||||
type: type,
|
||||
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 --->
|
||||
|
||||
<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">
|
||||
<label class="col-sm-3 control-label">{% trans "Local Path" %}</label>
|
||||
<div class="col-sm-6">
|
||||
@@ -168,14 +175,16 @@
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{% trans "Name" %}</th>
|
||||
<th>{% trans "Path" %}</th>
|
||||
<th>{% trans "Delete" %}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="record in records track by $index">
|
||||
<td ng-bind="record.name"></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>
|
||||
|
||||
</tr>
|
||||
|
||||
@@ -1,130 +1,205 @@
|
||||
{% extends "baseTemplate/index.html" %}
|
||||
{% load i18n %}
|
||||
{% block title %}{% trans "Schedule Back up - CyberPanel" %} {% endblock %}
|
||||
{% block title %}{% trans "Schedule Back up - CyberPanel" %}{% endblock %}
|
||||
{% block content %}
|
||||
|
||||
{% load static %}
|
||||
|
||||
|
||||
{% get_current_language as LANGUAGE_CODE %}
|
||||
<!-- Current language: {{ LANGUAGE_CODE }} -->
|
||||
|
||||
<div class="container">
|
||||
<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"
|
||||
class="btn btn-border btn-alt border-red btn-link font-red"
|
||||
title=""><span>{% trans "Remote Backups" %}</span></a></h2>
|
||||
<p>{% trans "On this page you can schedule Back ups to localhost or remote server (If you have added one)." %}</p>
|
||||
title=""><span>{% trans "Remote Backups" %}</span></a>
|
||||
</h2>
|
||||
<p>{% trans "On this page you can schedule Back ups to localhost or remote server (If you have added one)" %}</p>
|
||||
</div>
|
||||
|
||||
<div ng-controller="scheduleBackup" class="panel">
|
||||
<div ng-controller="googleDrive" class="panel">
|
||||
<div class="panel-body">
|
||||
<h3 class="title-hero">
|
||||
{% trans "Schedule Back up" %} - <img ng-hide="scheduleBackupLoading"
|
||||
src="{% static 'images/loading.gif' %}"> <a target="_blank"
|
||||
href="{% url 'backupLogs' %}"
|
||||
style="height: 23px;line-height: 21px;"
|
||||
title="">{% trans "Backup Logs" %}</a>
|
||||
{% trans "Schedule Back up" %} <img ng-hide="cyberPanelLoading"
|
||||
src="{% static 'images/loading.gif' %}">
|
||||
</h3>
|
||||
<div class="example-box-wrapper">
|
||||
|
||||
|
||||
<form action="/" class="form-horizontal bordered-row">
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Select Destination" %}</label>
|
||||
<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 %}
|
||||
<option>{{ items }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<button ng-hide="driveHidden" type="button" ng-click="deleteAccount()"
|
||||
class="btn btn-danger">{% trans "Delete" %}</button>
|
||||
</div>
|
||||
|
||||
<div ng-hide="scheduleFreq" class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Select Frequency" %}</label>
|
||||
<div ng-hide="driveHidden" class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Select Backup Frequency" %}</label>
|
||||
<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>Weekly</option>
|
||||
</select>
|
||||
</div>
|
||||
Currently: {$ currently $}
|
||||
</div>
|
||||
|
||||
<div ng-hide="localPath" class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Local Path" %}</label>
|
||||
<div ng-hide="driveHidden" class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "Add Sites for Backup" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<input name="dom" type="text" class="form-control" ng-model="localPathValue"
|
||||
placeholder="{% trans "Local directory where backups will be moved after creation." %}"
|
||||
required>
|
||||
<select ng-model="selectedWebsite" class="form-control">
|
||||
{% for items in websites %}
|
||||
<option>{{ items }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<button type="button" ng-click="addSite()"
|
||||
class="btn btn-primary">{% trans "Add Site" %}</button>
|
||||
</div>
|
||||
|
||||
<div ng-hide="driveHidden" class="form-group">
|
||||
<div class="row">
|
||||
<div style="margin-left: 2%" class="col-sm-3">
|
||||
<button data-toggle="modal" data-target="#backupLogs" ng-hide="driveHidden"
|
||||
type="button" ng-click="fetchLogs()"
|
||||
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 class="modal-body">
|
||||
|
||||
<div ng-hide="scheduleBtn" class="form-group">
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-4">
|
||||
<button type="button" ng-click="addSchedule()"
|
||||
class="btn btn-primary btn-lg btn-block">{% trans "Add Destination" %}</button>
|
||||
<div class="row">
|
||||
<div class="col-sm-9">
|
||||
</div>
|
||||
<div class="col-sm-2">
|
||||
<div class="form-group">
|
||||
<select ng-model="recordsToShowLogs"
|
||||
ng-change="fetchLogs()"
|
||||
class="form-control" id="example-select">
|
||||
<option>10</option>
|
||||
<option>50</option>
|
||||
<option>100</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<table style="margin: 0px; padding-bottom: 2%" class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Type</th>
|
||||
<th>Message</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="log in logs track by $index">
|
||||
<td ng-bind="log.type"></td>
|
||||
<td ng-bind="log.message"></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="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>
|
||||
</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>
|
||||
</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>
|
||||
|
||||
<!------ List of Destinations --------------->
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-4">
|
||||
|
||||
<div ng-hide="canNotAddSchedule" class="alert alert-danger">
|
||||
<p>{% trans "Cannot add schedule. Error message:" %} {$ errorMessage $} </p>
|
||||
</div>
|
||||
|
||||
<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 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>
|
||||
|
||||
<div class="form-group">
|
||||
|
||||
<div class="col-sm-12">
|
||||
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{% trans "ID" %}</th>
|
||||
<th>{% trans "Destination" %}</th>
|
||||
<th>{% trans "Frequency" %}</th>
|
||||
<th>{% trans "Delete" %}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="record in records track by $index">
|
||||
<td ng-bind="record.id"></td>
|
||||
<td ng-bind="record.destLoc"></td>
|
||||
<td ng-bind="record.frequency"></td>
|
||||
<td ng-click="delSchedule(record.destLoc,record.frequency)"><img
|
||||
src="{% static 'images/delete.png' %}"></td>
|
||||
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!------ List of records --------------->
|
||||
|
||||
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user