mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-07 22:06:05 +01:00
feature: edit/manage inc backups
This commit is contained in:
@@ -767,6 +767,181 @@ app.controller('scheduleBackupInc', function ($scope, $http) {
|
|||||||
$scope.cyberpanelLoading = true;
|
$scope.cyberpanelLoading = true;
|
||||||
if (response.data.status === 1) {
|
if (response.data.status === 1) {
|
||||||
$scope.websites = JSON.parse(response.data.data);
|
$scope.websites = JSON.parse(response.data.data);
|
||||||
|
|
||||||
|
if(response.data.websiteData === 1){
|
||||||
|
$scope.websiteData = true;
|
||||||
|
}
|
||||||
|
if(response.data.websiteDatabases === 1){
|
||||||
|
$scope.websiteDatabases = true;
|
||||||
|
}
|
||||||
|
if(response.data.websiteEmails === 1){
|
||||||
|
$scope.websiteEmails = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
} 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.saveChanges = function () {
|
||||||
|
|
||||||
|
$scope.cyberpanelLoading = false;
|
||||||
|
|
||||||
|
url = "/IncrementalBackups/saveChanges";
|
||||||
|
|
||||||
|
|
||||||
|
var data = {
|
||||||
|
id: $scope.jobID,
|
||||||
|
websiteData: $scope.websiteData,
|
||||||
|
websiteDatabases: $scope.websiteDatabases,
|
||||||
|
websiteEmails: $scope.websiteEmails
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
var config = {
|
||||||
|
headers: {
|
||||||
|
'X-CSRFToken': getCookie('csrftoken')
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||||
|
|
||||||
|
|
||||||
|
function ListInitialDatas(response) {
|
||||||
|
$scope.cyberpanelLoading = true;
|
||||||
|
|
||||||
|
if (response.data.status === 1) {
|
||||||
|
$scope.editInitial($scope.jobID);
|
||||||
|
new PNotify({
|
||||||
|
title: 'Success!',
|
||||||
|
text: 'Operation successful.',
|
||||||
|
type: 'success'
|
||||||
|
});
|
||||||
|
} 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.removeSite = function (website) {
|
||||||
|
|
||||||
|
$scope.cyberpanelLoading = false;
|
||||||
|
|
||||||
|
url = "/IncrementalBackups/removeSite";
|
||||||
|
|
||||||
|
|
||||||
|
var data = {
|
||||||
|
id: $scope.jobID,
|
||||||
|
website: website
|
||||||
|
};
|
||||||
|
|
||||||
|
var config = {
|
||||||
|
headers: {
|
||||||
|
'X-CSRFToken': getCookie('csrftoken')
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||||
|
|
||||||
|
|
||||||
|
function ListInitialDatas(response) {
|
||||||
|
$scope.cyberpanelLoading = true;
|
||||||
|
|
||||||
|
if (response.data.status === 1) {
|
||||||
|
$scope.editInitial($scope.jobID);
|
||||||
|
new PNotify({
|
||||||
|
title: 'Success!',
|
||||||
|
text: 'Operation successful.',
|
||||||
|
type: 'success'
|
||||||
|
});
|
||||||
|
} 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.cyberpanelLoading = true;
|
||||||
|
|
||||||
|
$scope.addWebsite = function () {
|
||||||
|
|
||||||
|
$scope.cyberpanelLoading = false;
|
||||||
|
|
||||||
|
url = "/IncrementalBackups/addWebsite";
|
||||||
|
|
||||||
|
|
||||||
|
var data = {
|
||||||
|
id: $scope.jobID,
|
||||||
|
website: $scope.websiteToBeAdded
|
||||||
|
};
|
||||||
|
|
||||||
|
var config = {
|
||||||
|
headers: {
|
||||||
|
'X-CSRFToken': getCookie('csrftoken')
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||||
|
|
||||||
|
|
||||||
|
function ListInitialDatas(response) {
|
||||||
|
$scope.cyberpanelLoading = true;
|
||||||
|
|
||||||
|
if (response.data.status === 1) {
|
||||||
|
$scope.editInitial($scope.jobID);
|
||||||
|
new PNotify({
|
||||||
|
title: 'Success!',
|
||||||
|
text: 'Operation successful.',
|
||||||
|
type: 'success'
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
new PNotify({
|
new PNotify({
|
||||||
title: 'Operation Failed!',
|
title: 'Operation Failed!',
|
||||||
|
|||||||
@@ -200,7 +200,7 @@
|
|||||||
<button type="button" class="close" data-dismiss="modal">
|
<button type="button" class="close" data-dismiss="modal">
|
||||||
×
|
×
|
||||||
</button>
|
</button>
|
||||||
<h4 class="modal-title">Edit User
|
<h4 class="modal-title">Edit Job
|
||||||
<img ng-hide="cyberpanelLoading"
|
<img ng-hide="cyberpanelLoading"
|
||||||
src="{% static 'images/loading.gif' %}">
|
src="{% static 'images/loading.gif' %}">
|
||||||
</h4>
|
</h4>
|
||||||
@@ -225,7 +225,7 @@
|
|||||||
<label class="col-sm-3 control-label">{% trans "Data" %}</label>
|
<label class="col-sm-3 control-label">{% trans "Data" %}</label>
|
||||||
<div class="checkbox">
|
<div class="checkbox">
|
||||||
<label>
|
<label>
|
||||||
<input ng-model="websiteData"
|
<input ng-model="$parent.websiteData"
|
||||||
type="checkbox" value="">
|
type="checkbox" value="">
|
||||||
Data
|
Data
|
||||||
</label>
|
</label>
|
||||||
@@ -237,7 +237,7 @@
|
|||||||
<label class="col-sm-3 control-label">{% trans "Databases" %}</label>
|
<label class="col-sm-3 control-label">{% trans "Databases" %}</label>
|
||||||
<div class="checkbox">
|
<div class="checkbox">
|
||||||
<label>
|
<label>
|
||||||
<input ng-model="websiteDatabases"
|
<input ng-model="$parent.websiteDatabases"
|
||||||
type="checkbox" value="">
|
type="checkbox" value="">
|
||||||
Databases
|
Databases
|
||||||
</label>
|
</label>
|
||||||
@@ -249,36 +249,104 @@
|
|||||||
<label class="col-sm-3 control-label">{% trans "Emails" %}</label>
|
<label class="col-sm-3 control-label">{% trans "Emails" %}</label>
|
||||||
<div class="checkbox">
|
<div class="checkbox">
|
||||||
<label>
|
<label>
|
||||||
<input ng-model="websiteEmails"
|
<input ng-model="$parent.websiteEmails"
|
||||||
type="checkbox" value="">
|
type="checkbox" value="">
|
||||||
Emails
|
Emails
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<hr>
|
<div ng-hide="installationDetailsForm"
|
||||||
<table class="table">
|
class="form-group">
|
||||||
<thead>
|
<label class="col-sm-3 control-label">{% trans "" %}</label>
|
||||||
<tr>
|
<button type="button" ng-click="saveChanges()"
|
||||||
<th>{% trans "ID" %}</th>
|
class="btn btn-primary btn-lg">{% trans "Save Changes" %}</button>
|
||||||
<th>{% trans "Website" %}</th>
|
</div>
|
||||||
<th>{% trans "Actions" %}</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<tr ng-repeat="record in websites track by $index">
|
|
||||||
<td ng-bind="record.id"></td>
|
|
||||||
<td ng-bind="record.website"></td>
|
|
||||||
<td>
|
|
||||||
<a ng-click="delSchedule(record.id)"
|
|
||||||
class="btn btn-border btn-alt border-red btn-link font-red"
|
|
||||||
href="#"
|
|
||||||
title=""><span>{% trans 'Delete' %}</span></a>
|
|
||||||
</td>
|
|
||||||
|
|
||||||
</tr>
|
<hr>
|
||||||
</tbody>
|
<ul class="nav nav-tabs">
|
||||||
</table>
|
|
||||||
|
<li class="col-md-3 nav-item tab-mod active">
|
||||||
|
<a href="#tab-example-1" data-toggle="tab"
|
||||||
|
class="h4 nav-link">
|
||||||
|
<span>{% trans "Sites" %}</span>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
<li class="col-md-4 tab-mod nav-item">
|
||||||
|
<a href="#tab-example-3" data-toggle="tab"
|
||||||
|
class="h4 nav-link">
|
||||||
|
<span>{% trans "Add Sites" %}</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<div class="tab-content">
|
||||||
|
<div class="tab-pane fade active in"
|
||||||
|
id="tab-example-1">
|
||||||
|
<div class="example-box-wrapper">
|
||||||
|
<table class="table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>{% trans "ID" %}</th>
|
||||||
|
<th>{% trans "Website" %}</th>
|
||||||
|
<th>{% trans "Actions" %}</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr ng-repeat="record in websites track by $index">
|
||||||
|
<td ng-bind="record.id"></td>
|
||||||
|
<td ng-bind="record.website"></td>
|
||||||
|
<td>
|
||||||
|
<a ng-click="removeSite(record.website)"
|
||||||
|
class="btn btn-border btn-alt border-red btn-link font-red"
|
||||||
|
href="#"
|
||||||
|
title=""><span>{% trans 'Delete' %}</span></a>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="tab-pane fade" id="tab-example-3">
|
||||||
|
|
||||||
|
<form action="/"
|
||||||
|
class="form-horizontal bordered-row">
|
||||||
|
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<label class="col-sm-3 control-label">{% trans "Select Site" %}</label>
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<select ng-model="$parent.websiteToBeAdded"
|
||||||
|
class="form-control">
|
||||||
|
{% for items in websiteList %}
|
||||||
|
<option>{{ items }}</option>
|
||||||
|
{% endfor %}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<img ng-hide="cyberpanelLoading"
|
||||||
|
src="{% static 'images/loading.gif' %}">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div ng-hide="savebtn"
|
||||||
|
class="form-group">
|
||||||
|
<label class="col-sm-3 control-label"></label>
|
||||||
|
<div class="col-sm-4">
|
||||||
|
<button type="button"
|
||||||
|
ng-click="addWebsite()"
|
||||||
|
class="btn btn-primary btn-lg btn-block">{% trans "Add" %}</button>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -19,4 +19,7 @@ urlpatterns = [
|
|||||||
url(r'^scheduleDelete$', views.scheduleDelete, name='scheduleDeleteInc'),
|
url(r'^scheduleDelete$', views.scheduleDelete, name='scheduleDeleteInc'),
|
||||||
url(r'^getCurrentBackupSchedules$', views.getCurrentBackupSchedules, name='getCurrentBackupSchedulesInc'),
|
url(r'^getCurrentBackupSchedules$', views.getCurrentBackupSchedules, name='getCurrentBackupSchedulesInc'),
|
||||||
url(r'^fetchSites$', views.fetchSites, name='fetchSites'),
|
url(r'^fetchSites$', views.fetchSites, name='fetchSites'),
|
||||||
|
url(r'^saveChanges$', views.saveChanges, name='saveChanges'),
|
||||||
|
url(r'^removeSite$', views.removeSite, name='removeSite'),
|
||||||
|
url(r'^addWebsite$', views.addWebsite, name='addWebsite'),
|
||||||
]
|
]
|
||||||
@@ -606,6 +606,8 @@ def scheduleBackups(request):
|
|||||||
for items in os.listdir(path):
|
for items in os.listdir(path):
|
||||||
destinations.append('s3:s3.amazonaws.com/%s' % (items))
|
destinations.append('s3:s3.amazonaws.com/%s' % (items))
|
||||||
|
|
||||||
|
websitesName = ACLManager.findAllSites(currentACL, userID)
|
||||||
|
|
||||||
return defRenderer(request, 'IncBackups/backupSchedule.html', {'websiteList': websitesName, 'destinations': destinations})
|
return defRenderer(request, 'IncBackups/backupSchedule.html', {'websiteList': websitesName, 'destinations': destinations})
|
||||||
except BaseException as msg:
|
except BaseException as msg:
|
||||||
logging.writeToFile(str(msg))
|
logging.writeToFile(str(msg))
|
||||||
@@ -723,7 +725,9 @@ def fetchSites(request):
|
|||||||
json_data = json_data + ',' + json.dumps(dic)
|
json_data = json_data + ',' + json.dumps(dic)
|
||||||
|
|
||||||
json_data = json_data + ']'
|
json_data = json_data + ']'
|
||||||
final_json = json.dumps({'status': 1, 'error_message': "None", "data": json_data})
|
final_json = json.dumps({'status': 1, 'error_message': "None", "data": json_data,
|
||||||
|
'websiteData': job.websiteData, 'websiteDatabases': job.websiteDatabases,
|
||||||
|
'websiteEmails': job.websiteDataEmails})
|
||||||
return HttpResponse(final_json)
|
return HttpResponse(final_json)
|
||||||
|
|
||||||
except BaseException as msg:
|
except BaseException as msg:
|
||||||
@@ -779,4 +783,91 @@ def restoreRemoteBackups(request):
|
|||||||
return defRenderer(request, 'IncBackups/restoreRemoteBackups.html', {'websiteList': websitesName, 'destinations': destinations})
|
return defRenderer(request, 'IncBackups/restoreRemoteBackups.html', {'websiteList': websitesName, 'destinations': destinations})
|
||||||
except BaseException as msg:
|
except BaseException as msg:
|
||||||
logging.writeToFile(str(msg))
|
logging.writeToFile(str(msg))
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
def saveChanges(request):
|
||||||
|
try:
|
||||||
|
userID = request.session['userID']
|
||||||
|
currentACL = ACLManager.loadedACL(userID)
|
||||||
|
|
||||||
|
if ACLManager.currentContextPermission(currentACL, 'scheDuleBackups') == 0:
|
||||||
|
return ACLManager.loadErrorJson('scheduleStatus', 0)
|
||||||
|
|
||||||
|
data = json.loads(request.body)
|
||||||
|
|
||||||
|
id = data['id']
|
||||||
|
websiteData = data['websiteData']
|
||||||
|
websiteDatabases = data['websiteDatabases']
|
||||||
|
websiteEmails = data['websiteEmails']
|
||||||
|
|
||||||
|
job = BackupJob.objects.get(pk=id)
|
||||||
|
|
||||||
|
job.websiteData = int(websiteData)
|
||||||
|
job.websiteDatabases = int(websiteDatabases)
|
||||||
|
job.websiteEmails = int(websiteEmails)
|
||||||
|
job.save()
|
||||||
|
|
||||||
|
final_json = json.dumps({'status': 1, 'error_message': "None"})
|
||||||
|
return HttpResponse(final_json)
|
||||||
|
|
||||||
|
|
||||||
|
except BaseException as msg:
|
||||||
|
final_json = json.dumps({'status': 0, 'error_message': str(msg)})
|
||||||
|
return HttpResponse(final_json)
|
||||||
|
|
||||||
|
def removeSite(request):
|
||||||
|
try:
|
||||||
|
userID = request.session['userID']
|
||||||
|
currentACL = ACLManager.loadedACL(userID)
|
||||||
|
|
||||||
|
if ACLManager.currentContextPermission(currentACL, 'scheDuleBackups') == 0:
|
||||||
|
return ACLManager.loadErrorJson('scheduleStatus', 0)
|
||||||
|
|
||||||
|
data = json.loads(request.body)
|
||||||
|
|
||||||
|
id = data['id']
|
||||||
|
website = data['website']
|
||||||
|
|
||||||
|
|
||||||
|
job = BackupJob.objects.get(pk=id)
|
||||||
|
|
||||||
|
site = JobSites.objects.get(job=job, website=website)
|
||||||
|
site.delete()
|
||||||
|
|
||||||
|
final_json = json.dumps({'status': 1, 'error_message': "None"})
|
||||||
|
return HttpResponse(final_json)
|
||||||
|
|
||||||
|
|
||||||
|
except BaseException as msg:
|
||||||
|
final_json = json.dumps({'status': 0, 'error_message': str(msg)})
|
||||||
|
return HttpResponse(final_json)
|
||||||
|
|
||||||
|
def addWebsite(request):
|
||||||
|
try:
|
||||||
|
userID = request.session['userID']
|
||||||
|
currentACL = ACLManager.loadedACL(userID)
|
||||||
|
|
||||||
|
if ACLManager.currentContextPermission(currentACL, 'scheDuleBackups') == 0:
|
||||||
|
return ACLManager.loadErrorJson('scheduleStatus', 0)
|
||||||
|
|
||||||
|
data = json.loads(request.body)
|
||||||
|
|
||||||
|
id = data['id']
|
||||||
|
website = data['website']
|
||||||
|
|
||||||
|
|
||||||
|
job = BackupJob.objects.get(pk=id)
|
||||||
|
|
||||||
|
try:
|
||||||
|
JobSites.objects.get(job=job, website=website)
|
||||||
|
except:
|
||||||
|
site = JobSites(job=job, website=website)
|
||||||
|
site.save()
|
||||||
|
|
||||||
|
final_json = json.dumps({'status': 1, 'error_message': "None"})
|
||||||
|
return HttpResponse(final_json)
|
||||||
|
|
||||||
|
|
||||||
|
except BaseException as msg:
|
||||||
|
final_json = json.dumps({'status': 0, 'error_message': str(msg)})
|
||||||
|
return HttpResponse(final_json)
|
||||||
@@ -767,6 +767,181 @@ app.controller('scheduleBackupInc', function ($scope, $http) {
|
|||||||
$scope.cyberpanelLoading = true;
|
$scope.cyberpanelLoading = true;
|
||||||
if (response.data.status === 1) {
|
if (response.data.status === 1) {
|
||||||
$scope.websites = JSON.parse(response.data.data);
|
$scope.websites = JSON.parse(response.data.data);
|
||||||
|
|
||||||
|
if(response.data.websiteData === 1){
|
||||||
|
$scope.websiteData = true;
|
||||||
|
}
|
||||||
|
if(response.data.websiteDatabases === 1){
|
||||||
|
$scope.websiteDatabases = true;
|
||||||
|
}
|
||||||
|
if(response.data.websiteEmails === 1){
|
||||||
|
$scope.websiteEmails = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
} 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.saveChanges = function () {
|
||||||
|
|
||||||
|
$scope.cyberpanelLoading = false;
|
||||||
|
|
||||||
|
url = "/IncrementalBackups/saveChanges";
|
||||||
|
|
||||||
|
|
||||||
|
var data = {
|
||||||
|
id: $scope.jobID,
|
||||||
|
websiteData: $scope.websiteData,
|
||||||
|
websiteDatabases: $scope.websiteDatabases,
|
||||||
|
websiteEmails: $scope.websiteEmails
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
var config = {
|
||||||
|
headers: {
|
||||||
|
'X-CSRFToken': getCookie('csrftoken')
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||||
|
|
||||||
|
|
||||||
|
function ListInitialDatas(response) {
|
||||||
|
$scope.cyberpanelLoading = true;
|
||||||
|
|
||||||
|
if (response.data.status === 1) {
|
||||||
|
$scope.editInitial($scope.jobID);
|
||||||
|
new PNotify({
|
||||||
|
title: 'Success!',
|
||||||
|
text: 'Operation successful.',
|
||||||
|
type: 'success'
|
||||||
|
});
|
||||||
|
} 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.removeSite = function (website) {
|
||||||
|
|
||||||
|
$scope.cyberpanelLoading = false;
|
||||||
|
|
||||||
|
url = "/IncrementalBackups/removeSite";
|
||||||
|
|
||||||
|
|
||||||
|
var data = {
|
||||||
|
id: $scope.jobID,
|
||||||
|
website: website
|
||||||
|
};
|
||||||
|
|
||||||
|
var config = {
|
||||||
|
headers: {
|
||||||
|
'X-CSRFToken': getCookie('csrftoken')
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||||
|
|
||||||
|
|
||||||
|
function ListInitialDatas(response) {
|
||||||
|
$scope.cyberpanelLoading = true;
|
||||||
|
|
||||||
|
if (response.data.status === 1) {
|
||||||
|
$scope.editInitial($scope.jobID);
|
||||||
|
new PNotify({
|
||||||
|
title: 'Success!',
|
||||||
|
text: 'Operation successful.',
|
||||||
|
type: 'success'
|
||||||
|
});
|
||||||
|
} 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.cyberpanelLoading = true;
|
||||||
|
|
||||||
|
$scope.addWebsite = function () {
|
||||||
|
|
||||||
|
$scope.cyberpanelLoading = false;
|
||||||
|
|
||||||
|
url = "/IncrementalBackups/addWebsite";
|
||||||
|
|
||||||
|
|
||||||
|
var data = {
|
||||||
|
id: $scope.jobID,
|
||||||
|
website: $scope.websiteToBeAdded
|
||||||
|
};
|
||||||
|
|
||||||
|
var config = {
|
||||||
|
headers: {
|
||||||
|
'X-CSRFToken': getCookie('csrftoken')
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||||
|
|
||||||
|
|
||||||
|
function ListInitialDatas(response) {
|
||||||
|
$scope.cyberpanelLoading = true;
|
||||||
|
|
||||||
|
if (response.data.status === 1) {
|
||||||
|
$scope.editInitial($scope.jobID);
|
||||||
|
new PNotify({
|
||||||
|
title: 'Success!',
|
||||||
|
text: 'Operation successful.',
|
||||||
|
type: 'success'
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
new PNotify({
|
new PNotify({
|
||||||
title: 'Operation Failed!',
|
title: 'Operation Failed!',
|
||||||
|
|||||||
Reference in New Issue
Block a user