Skip to content

Commit

Permalink
Merge pull request #1135 from master3395/v2.3.5-dev
Browse files Browse the repository at this point in the history
V2.3.5 dev
  • Loading branch information
usmannasir authored Oct 17, 2023
2 parents dd8ef05 + 30bfdda commit 960d320
Show file tree
Hide file tree
Showing 45 changed files with 1,210 additions and 344 deletions.
175 changes: 167 additions & 8 deletions IncBackups/static/IncBackups/IncBackups.js
Original file line number Diff line number Diff line change
Expand Up @@ -1918,10 +1918,10 @@ app.controller('ScheduleV2Backup', function ($scope, $http, $timeout, $compile)
if (response.data.status === 1) {
$scope.selectwebsite();
new PNotify({
title: 'Success!',
text: 'Successfully deleted.',
type: 'success'
});
title: 'Success!',
text: 'Successfully deleted.',
type: 'success'
});

} else {
new PNotify({
Expand Down Expand Up @@ -2054,10 +2054,10 @@ app.controller('ScheduleV2Backup', function ($scope, $http, $timeout, $compile)
if (response.data.status === 1) {
$scope.selectwebsite();
new PNotify({
title: 'Success!',
text: 'Successfully created.',
type: 'success'
});
title: 'Success!',
text: 'Successfully created.',
type: 'success'
});

} else {
new PNotify({
Expand Down Expand Up @@ -2242,3 +2242,162 @@ app.controller('ScheduleV2Backup', function ($scope, $http, $timeout, $compile)

});


app.controller('DeleteBackuprepo', function ($scope, $http, $timeout, $compile) {

$scope.backupLoading = true;
$scope.installationProgress = true;
$scope.errorMessageBox = true;
$scope.success = true;
$scope.couldNotConnect = true;
$scope.goBackDisable = true;

$scope.selectwebsite = function () {
document.getElementById('reposelectbox').innerHTML = "";
$scope.backupLoading = false;
// document.getElementById('CreateV2BackupButton').style.display = "block";
var url = "/IncrementalBackups/selectwebsiteCreatev2";

var data = {
Selectedwebsite: $scope.selwebsite,
Selectedrepo: $('#reposelectbox').val(),
};
//alert( $scope.selwebsite);

var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};


$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);


function ListInitialDatas(response) {
$scope.backupLoading = true;
if (response.data.status === 1) {

const selectBox = document.getElementById('reposelectbox');


const options = response.data.data;
const option = document.createElement('option');


option.value = 1;
option.text = 'Choose Repo';

selectBox.appendChild(option);

if (options.length >= 1) {
for (let i = 0; i < options.length; i++) {

const option = document.createElement('option');


option.value = options[i];
option.text = options[i];

selectBox.appendChild(option);
}

} else {
new PNotify({
title: 'Error!',
text: 'file empty',
type: 'error'
});
}


} else {
new PNotify({
title: 'Error!',
text: response.data.error_message,
type: 'error'
});
}

}

function cantLoadInitialDatas(response) {
$scope.backupLoading = true;
new PNotify({
title: 'Operation Failed!',
text: 'Could not connect to server, please refresh this page',
type: 'error'
});
}
}

$scope.DeleteV2BackupButton = function () {
$scope.backupLoading = false;
$scope.installationDetailsForm = true;
$scope.installationProgress = false;
$scope.errorMessageBox = true;
$scope.success = true;
$scope.couldNotConnect = true;
$scope.goBackDisable = true;

var url = "/IncrementalBackups/DeleteV2BackupButton";


data = {
Selectedwebsite: $scope.selwebsite,
Selectedrepo: $('#reposelectbox').val(),
};

var config = {
headers: {
'X-CSRFToken': getCookie('csrftoken')
}
};

//alert('Done..........')
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);

function ListInitialDatas(response) {
if (response.data.status === 1) {
$scope.backupLoading = true;
$scope.installationDetailsForm = true;
$scope.installationProgress = true;
$scope.errorMessageBox = true;
$scope.success = false;
$scope.couldNotConnect = true;
$scope.goBackDisable = true;
new PNotify({
title: 'Operation Done!',
text: 'Delete Successfully',
type: 'sucess'
});
} else {
$scope.backupLoading = true;
$scope.installationDetailsForm = true;
$scope.installationProgress = false;
$scope.errorMessageBox = false;
$scope.success = true;
$scope.couldNotConnect = true;
$scope.goBackDisable = false;

$scope.errorMessage = response.data.error_message;
new PNotify({
title: 'Operation Failed!',
text: response.data.error_message,
type: 'error'
});
}

}

function cantLoadInitialDatas(response) {
$scope.backupLoading = true;
new PNotify({
title: 'Operation Failed!',
text: 'Could not connect to server, please refresh this page',
type: 'error'
});
}
}
});

3 changes: 1 addition & 2 deletions IncBackups/templates/IncBackups/CreateV2Backup.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ <h3 class="title-hero">
- <a href="{% url 'RestoreV2backupSite' %}">Restore Backups</a>
</h3>
<div class="example-box-wrapper">

<p align="center" style="margin-top: 2%; margin-bottom: 2%">
<iframe width="788.54" height="443" src="https://www.youtube.com/embed/7dI1013xvUc"
title="YouTube video player" frameborder="0"
Expand Down Expand Up @@ -58,7 +57,7 @@ <h3 class="title-hero">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">{% trans "Backup Content" %}</label>
<label class="col-sm-3 control-label">{% trans "Backup Contents" %}</label>
<div class="col-sm-9">
<div class="checkbox">
<label>
Expand Down
121 changes: 121 additions & 0 deletions IncBackups/templates/IncBackups/DeleteV2repo.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
{% extends "baseTemplate/index.html" %}
{% load i18n %}
{% block title %}{% trans "Delete v2 Backup" %}{% endblock %}
{% block content %}

{% load static %}

{% get_current_language as LANGUAGE_CODE %}
<!-- Current language: {{ LANGUAGE_CODE }} -->
<style>

</style>

<div class="container">

<div id="page-title">
<h2>{% trans "Delete V2 Repo" %} - <a target="_blank" href="http://go.cyberpanel.net/backup"
style="height: 23px;line-height: 21px;"
class="btn btn-border btn-alt border-red btn-link font-red"
title=""><span>{% trans "Backup Docs" %}</span></a></h2>
<p>{% trans "This page can be used to delete your backup repo" %}</p>
</div>

<div ng-controller="DeleteBackuprepo" class="panel">
<div class="panel-body">
<h3 class="title-hero">
{% trans "Create v2 Backup" %} <img ng-hide="backupLoading" src="{% static 'images/loading.gif' %}">

</h3>
<div class="example-box-wrapper">



<form class="form-horizontal bordered-row">


<div class="form-group">
<label class="col-sm-3 control-label">{% trans "Select Website" %} </label>
<div class="col-sm-6">
<select id="create-backup-select" ng-change="selectwebsite()" ng-model="selwebsite"
class="form-control">
{% for items in websiteList %}
<option value="{{ items }}">{{ items }}</option>
{% endfor %}
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">{% trans "Select Repo" %} </label>
<div class="col-sm-6">
<select id="reposelectbox" ng-change="selectrepo()" ng-model="testhabbi"
class="form-control">
</select>
</div>
</div>

<div class="form-group">
<label class="col-sm-3 control-label">{% trans " " %} </label>
<div class="col-sm-6">
<button class="btn" id="DeleteV2BackupButton" ng-click="DeleteV2BackupButton()"
style="border-radius: 6px;background-color: #3447b7;color: white !important;">
Delete Backup repo
</button>
</div>
</div>


<div ng-hide="installationProgress" class="form-group">
<label class="col-sm-2 control-label"></label>
<div class="col-sm-7">

<div class="alert alert-success text-center">
<h2>{$ currentStatus $}</h2>
</div>

<div class="progress">
<div id="installProgress" class="progress-bar" role="progressbar" aria-valuenow="70"
aria-valuemin="0" aria-valuemax="100" style="width:0%">
<span class="sr-only">70% Complete</span>
</div>
</div>

<div ng-hide="errorMessageBox" class="alert alert-danger">
<p>{% trans "Error message:" %} {$ errorMessage $}</p>
</div>

<div ng-hide="success" class="alert alert-success">
<p>{% trans "Backup succesfully." %}</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 ng-hide="installationProgress" class="form-group">
<label class="col-sm-3 control-label"></label>
<div class="col-sm-4">
<button type="button" ng-disabled="goBackDisable" ng-click="goBack()"
class="btn btn-primary btn-lg">{% trans "Go Back" %}</button>
</div>
</div>

</form>


</div>

</div>

</div>


</div>


{% endblock %}
2 changes: 2 additions & 0 deletions IncBackups/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,7 @@
url(r'^schedulev2Backups$', views.schedulev2Backups, name='schedulev2Backups'),
url(r'^DeleteScheduleV2$', views.DeleteScheduleV2, name='DeleteScheduleV2'),
url(r'^CreateScheduleV2$', views.CreateScheduleV2, name='CreateScheduleV2'),
url(r'^DeleteRepoV2$', views.DeleteRepoV2, name='DeleteRepoV2'),
url(r'^DeleteV2BackupButton$', views.DeleteV2BackupButton, name='DeleteV2BackupButton'),

]
Loading

0 comments on commit 960d320

Please sign in to comment.