mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-07 05:45:59 +01:00
Cyberpanel_Haabi
This commit is contained in:
@@ -1201,7 +1201,7 @@ app.controller('restoreRemoteBackupsInc', function ($scope, $http, $timeout) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
app.controller('restorev2backupoage', function ($scope, $http, $timeout) {
|
app.controller('restorev2backupoage', function ($scope, $http, $timeout, $compile) {
|
||||||
|
|
||||||
|
|
||||||
$scope.backupLoading = true;
|
$scope.backupLoading = true;
|
||||||
@@ -1214,6 +1214,249 @@ app.controller('restorev2backupoage', function ($scope, $http, $timeout) {
|
|||||||
|
|
||||||
var data = {
|
var data = {
|
||||||
Selectedwebsite: $scope.selwebsite,
|
Selectedwebsite: $scope.selwebsite,
|
||||||
|
|
||||||
|
};
|
||||||
|
//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 Repooo';
|
||||||
|
|
||||||
|
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.RestorePathV2 = function (SnapshotId, Path){
|
||||||
|
|
||||||
|
console.log("SnapshotId: " + SnapshotId)
|
||||||
|
console.log("Path: "+Path)
|
||||||
|
var url = "/IncrementalBackups/RestorePathV2";
|
||||||
|
var data ={
|
||||||
|
snapshotid: SnapshotId,
|
||||||
|
path: Path
|
||||||
|
}
|
||||||
|
|
||||||
|
var config = {
|
||||||
|
headers: {
|
||||||
|
'X-CSRFToken': getCookie('csrftoken')
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||||
|
|
||||||
|
|
||||||
|
function ListInitialDatas(response) {
|
||||||
|
|
||||||
|
if (response.data.status === 1) {
|
||||||
|
$scope.SnapShotId = response.data.SnapShotId;
|
||||||
|
$scope.tempPath = response.data.Path;
|
||||||
|
|
||||||
|
console.log("Returned ID on ListInitialDatas: " + $scope.SnapShotId)
|
||||||
|
console.log("Returned PATH on ListInitialDatas: " + $scope.tempPath)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function cantLoadInitialDatas(response) {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$scope.selectrepo = function () {
|
||||||
|
$scope.backupLoading = false;
|
||||||
|
|
||||||
|
var url = "/IncrementalBackups/selectreporestorev2";
|
||||||
|
|
||||||
|
var data = {
|
||||||
|
Selectedrepo: $('#reposelectbox').val(),
|
||||||
|
Selectedwebsite: $scope.selwebsite,
|
||||||
|
}
|
||||||
|
//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) {
|
||||||
|
|
||||||
|
var data = response.data.data
|
||||||
|
|
||||||
|
console.log(response.data.data)
|
||||||
|
console.log(response.data.data[0][1])
|
||||||
|
var snaphots = response.data.data[0][1]
|
||||||
|
|
||||||
|
for (var i = 0; i < snaphots.length; i++) {
|
||||||
|
var tml = ' <tr style="">\n' +
|
||||||
|
' <td>' + snaphots[i].id + '</td>' +
|
||||||
|
' <td><button type="button" \n' +
|
||||||
|
' class="btn btn-danger">Delete</button></td>\n' +
|
||||||
|
' \n' +
|
||||||
|
' </tr>' +
|
||||||
|
'<tr style="border: none!important;"> <td colspan="2" style="display: inherit;max-height: 10px;background-color: transparent; border: none">\n' +
|
||||||
|
' <button id="' + snaphots[i].id + '" class="my-4 mx-4 btn " style="margin-bottom: 15px;margin-top: -8px;background-color: #161a69; color: white;border-radius: 6px" onclick=listpaths("' + i + '","' + snaphots[i].id + '")>+</button>\n' +
|
||||||
|
' </td></tr>' +
|
||||||
|
'<tr style="border: none!important;">' +
|
||||||
|
' <td colspan="2" style="display: none;border: none" id="' + i + '">' +
|
||||||
|
' <table id="inside" style="margin: 0 auto;">\n';
|
||||||
|
|
||||||
|
for (var j = 0; j < snaphots[i].paths.length; j++) {
|
||||||
|
tml += '<tr style="border-top: 1px #cccccc solid;display: flex;padding: 15px; justify-content: space-between;">\n' +
|
||||||
|
'<td style="">' + snaphots[i].paths[j] + '</td>\n' +
|
||||||
|
'<td style="">' +
|
||||||
|
'<button id="' + snaphots[i].paths[j] + '" style="margin-inline: 30px; color: white!important; background-color: #3051be; border-radius: 6px;" class="btn" ng-click=\'RestorePathV2("' + snaphots[i].id + '","' + snaphots[i].paths[j] + '")\'>Restore</button></td>\n' +
|
||||||
|
'</tr>\n';
|
||||||
|
}
|
||||||
|
|
||||||
|
tml += '</table>\n' +
|
||||||
|
'</td>\n' +
|
||||||
|
'</tr>\n' +
|
||||||
|
'</tr>\n';
|
||||||
|
var mp = $compile(tml)($scope);
|
||||||
|
|
||||||
|
$('#listsnapshots').append(mp);
|
||||||
|
}
|
||||||
|
|
||||||
|
// $scope.Snaphot_ID
|
||||||
|
|
||||||
|
// var table = document.getElementById("snapshotstable");
|
||||||
|
//
|
||||||
|
// // Loop through the data and create a new row for each item
|
||||||
|
// for (var i = 0; i < data.length; i++) {
|
||||||
|
// // Create a new row element
|
||||||
|
// var row = table.insertRow();
|
||||||
|
//
|
||||||
|
// // Create the first cell and set its value to the current item in the data array
|
||||||
|
// var idCell = row.insertCell(0);
|
||||||
|
// idCell.innerHTML = data[i];
|
||||||
|
//
|
||||||
|
// // Create the second cell and add a delete button to it
|
||||||
|
// var deleteCell = row.insertCell(1);
|
||||||
|
// var deleteButton = document.createElement("button");
|
||||||
|
// deleteButton.innerHTML = "Delete";
|
||||||
|
// deleteButton.addEventListener("click", function() {
|
||||||
|
// // Call your delete function here
|
||||||
|
// console.log("Deleting item:", data[i]);
|
||||||
|
// });
|
||||||
|
// deleteCell.appendChild(deleteButton);
|
||||||
|
// }
|
||||||
|
} 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'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
app.controller('CreateV2Backup', function ($scope, $http, $timeout, $compile) {
|
||||||
|
|
||||||
|
|
||||||
|
$scope.backupLoading = true;
|
||||||
|
|
||||||
|
$scope.selectwebsite = function () {
|
||||||
|
document.getElementById('reposelectbox').innerHTML = "";
|
||||||
|
$scope.backupLoading = false;
|
||||||
|
// document.getElementById('CreateV2BackupButton').style.display = "block";
|
||||||
|
var url = "/IncrementalBackups/selectwebsiteRetorev2";
|
||||||
|
|
||||||
|
var data = {
|
||||||
|
Selectedwebsite: $scope.selwebsite,
|
||||||
|
Selectedrepo: $('#reposelectbox').val(),
|
||||||
};
|
};
|
||||||
//alert( $scope.selwebsite);
|
//alert( $scope.selwebsite);
|
||||||
|
|
||||||
@@ -1290,16 +1533,16 @@ app.controller('restorev2backupoage', function ($scope, $http, $timeout) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$scope.selectrepo = function () {
|
$scope.CreateV2BackupButton = function(){
|
||||||
$scope.backupLoading = false;
|
$scope.backupLoading = false;
|
||||||
|
|
||||||
var url = "/IncrementalBackups/selectreporestorev2";
|
var url = "/IncrementalBackups/CreateV2BackupButton";
|
||||||
|
|
||||||
var data = {
|
var data = {
|
||||||
Selectedrepo: $('#reposelectbox').val(),
|
|
||||||
Selectedwebsite: $scope.selwebsite,
|
Selectedwebsite: $scope.selwebsite,
|
||||||
}
|
Selectedrepo: $('#reposelectbox').val(),
|
||||||
//alert( $scope.selwebsite);
|
};
|
||||||
|
alert($scope.selwebsite + "...... repo...." + $('#reposelectbox').val(),);
|
||||||
|
|
||||||
var config = {
|
var config = {
|
||||||
headers: {
|
headers: {
|
||||||
@@ -1311,85 +1554,19 @@ app.controller('restorev2backupoage', function ($scope, $http, $timeout) {
|
|||||||
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
$http.post(url, data, config).then(ListInitialDatas, cantLoadInitialDatas);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function ListInitialDatas(response) {
|
function ListInitialDatas(response) {
|
||||||
$scope.backupLoading = true;
|
$scope.backupLoading = true;
|
||||||
if (response.data.status === 1) {
|
if (response.data.status === 1) {
|
||||||
|
|
||||||
var data = response.data.data
|
console.log("Returned Selectedwebsite: " + response.data.Selectedwebsite)
|
||||||
|
console.log("Returned Selectedrepo: " + response.data.Selectedrepo)
|
||||||
|
|
||||||
console.log(response.data.data)
|
|
||||||
console.log(response.data.data[0][1])
|
|
||||||
var snaphots = response.data.data[0][1]
|
|
||||||
|
|
||||||
for (var i = 0; i < snaphots.length; i++) {
|
|
||||||
var tml = ' <tr style="">\n' +
|
|
||||||
' <td>' + snaphots[i].id + '</td>' +
|
|
||||||
' <td><button type="button" \n' +
|
|
||||||
' class="btn btn-danger">Delete</button></td>\n' +
|
|
||||||
' \n' +
|
|
||||||
' </tr>' +
|
|
||||||
'<tr style="border: none!important;"> <td colspan="2" style="display: inherit;max-height: 10px;background-color: transparent; border: none">\n' +
|
|
||||||
' <button id="' + snaphots[i].id + '" class="my-4 mx-4 btn " style="margin-bottom: 15px;margin-top: -8px;background-color: #161a69; color: white;border-radius: 6px" onclick=listpaths("' + i + '","' + snaphots[i].id + '")>+</button>\n' +
|
|
||||||
' </td></tr>' +
|
|
||||||
'<tr style="border: none!important;">' +
|
|
||||||
' <td colspan="2" style="display: none;border: none" id="' + i + '">' +
|
|
||||||
' <table id="inside" style="margin: 0 auto;">\n';
|
|
||||||
|
|
||||||
for (var j = 0; j < snaphots[i].paths.length; j++) {
|
|
||||||
tml += '<tr>\n' +
|
|
||||||
'<td>' + snaphots[i].paths[j] + '</td>\n' +
|
|
||||||
'</tr>\n';
|
|
||||||
}
|
|
||||||
|
|
||||||
tml += '</table>\n' +
|
|
||||||
'</td>\n' +
|
|
||||||
'</tr>\n' +
|
|
||||||
'</tr>\n';
|
|
||||||
|
|
||||||
$('#listsnapshots').append(tml);
|
|
||||||
}
|
|
||||||
|
|
||||||
// $scope.Snaphot_ID
|
|
||||||
|
|
||||||
// var table = document.getElementById("snapshotstable");
|
|
||||||
//
|
|
||||||
// // Loop through the data and create a new row for each item
|
|
||||||
// for (var i = 0; i < data.length; i++) {
|
|
||||||
// // Create a new row element
|
|
||||||
// var row = table.insertRow();
|
|
||||||
//
|
|
||||||
// // Create the first cell and set its value to the current item in the data array
|
|
||||||
// var idCell = row.insertCell(0);
|
|
||||||
// idCell.innerHTML = data[i];
|
|
||||||
//
|
|
||||||
// // Create the second cell and add a delete button to it
|
|
||||||
// var deleteCell = row.insertCell(1);
|
|
||||||
// var deleteButton = document.createElement("button");
|
|
||||||
// deleteButton.innerHTML = "Delete";
|
|
||||||
// deleteButton.addEventListener("click", function() {
|
|
||||||
// // Call your delete function here
|
|
||||||
// console.log("Deleting item:", data[i]);
|
|
||||||
// });
|
|
||||||
// deleteCell.appendChild(deleteButton);
|
|
||||||
// }
|
|
||||||
} else {
|
|
||||||
new PNotify({
|
|
||||||
title: 'Error!',
|
|
||||||
text: response.data.error_message,
|
|
||||||
type: 'error'
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function cantLoadInitialDatas(response) {
|
function cantLoadInitialDatas(response) {
|
||||||
$scope.backupLoading = true;
|
|
||||||
new PNotify({
|
|
||||||
title: 'Operation Failed!',
|
|
||||||
text: 'Could not connect to server, please refresh this page',
|
|
||||||
type: 'error'
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1399,7 +1576,7 @@ app.controller('restorev2backupoage', function ($scope, $http, $timeout) {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
app.controller('createV2Backups', function ($scope, $http, $timeout){
|
app.controller('ConfigureV2Backup', function ($scope, $http, $timeout){
|
||||||
$scope.cyberpanelLoading = true;
|
$scope.cyberpanelLoading = true;
|
||||||
$scope.selectbackuptype = function () {
|
$scope.selectbackuptype = function () {
|
||||||
|
|
||||||
@@ -1435,3 +1612,4 @@ function listpaths(pathid,button){
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{% extends "baseTemplate/index.html" %}
|
{% extends "baseTemplate/index.html" %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
{% block title %}{% trans "Create V2 Backup" %}{% endblock %}
|
{% block title %}{% trans "Configure V2 Backup" %}{% endblock %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
{% load static %}
|
{% load static %}
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
|
||||||
<div ng-controller="createV2Backups" class="panel">
|
<div ng-controller="ConfigureV2Backup" class="panel">
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<h3 class="title-hero">
|
<h3 class="title-hero">
|
||||||
{% trans "Backup V2" %} <img ng-hide="cyberpanelLoading"
|
{% trans "Backup V2" %} <img ng-hide="cyberpanelLoading"
|
||||||
87
IncBackups/templates/IncBackups/CreateV2Backup.html
Normal file
87
IncBackups/templates/IncBackups/CreateV2Backup.html
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
{% extends "baseTemplate/index.html" %}
|
||||||
|
{% load i18n %}
|
||||||
|
{% block title %}{% trans "Create 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 "Create V2 Backup Site" %} - <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 create your backup sites" %}</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div ng-controller="CreateV2Backup" class="panel">
|
||||||
|
<div class="panel-body">
|
||||||
|
<h3 class="title-hero">
|
||||||
|
{% trans "Create V2 Backup Site" %} <img ng-hide="backupLoading" src="{% static 'images/loading.gif' %}">
|
||||||
|
</h3>
|
||||||
|
<div class="example-box-wrapper">
|
||||||
|
|
||||||
|
<form action="/IncBackups/static" 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="CreateV2BackupButton" ng-click="CreateV2BackupButton()" style="border-radius: 6px;background-color: #3447b7;color: white !important;"> Create Backup</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{# <div ng-hide="runningSnapshot" class="form-group">#}
|
||||||
|
{##}
|
||||||
|
{# <div class="col-sm-12">#}
|
||||||
|
{##}
|
||||||
|
{# <table id="snapshotstable" class="table">#}
|
||||||
|
{# <thead>#}
|
||||||
|
{# <tr style="border-bottom: #cccccc solid 1px!important;" >#}
|
||||||
|
{# <th style="border: none">{% trans "Snapshot ID" %}</th>#}
|
||||||
|
{# <th style="border: none">{% trans "Action" %} ></th>#}
|
||||||
|
{# </tr>#}
|
||||||
|
{# </thead>#}
|
||||||
|
{# <tbody id="listsnapshots">#}
|
||||||
|
{##}
|
||||||
|
{##}
|
||||||
|
{# </tbody>#}
|
||||||
|
{##}
|
||||||
|
{# </table>#}
|
||||||
|
{# </div>#}
|
||||||
|
{# </div>#}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
@@ -23,10 +23,14 @@ urlpatterns = [
|
|||||||
url(r'^removeSite$', views.remove_site, name='removeSite'),
|
url(r'^removeSite$', views.remove_site, name='removeSite'),
|
||||||
url(r'^addWebsite$', views.add_website, name='addWebsite'),
|
url(r'^addWebsite$', views.add_website, name='addWebsite'),
|
||||||
### V2 Backups URls
|
### V2 Backups URls
|
||||||
url(r'^createV2Backup$', views.createV2Backup, name='createV2Backup'),
|
|
||||||
|
url(r'^CreateV2Backup$', views.CreateV2Backup, name='CreateV2Backup'),
|
||||||
|
url(r'^ConfigureV2Backup$', views.ConfigureV2Backup, name='ConfigureV2Backup'),
|
||||||
url(r'^createV2BackupSetup$', views.createV2BackupSetup, name='createV2BackupSetup'),
|
url(r'^createV2BackupSetup$', views.createV2BackupSetup, name='createV2BackupSetup'),
|
||||||
url(r'^RestoreV2backupSite$', views.RestoreV2backupSite, name='RestoreV2backupSite'),
|
url(r'^RestoreV2backupSite$', views.RestoreV2backupSite, name='RestoreV2backupSite'),
|
||||||
url(r'^selectwebsiteRetorev2$', views.selectwebsiteRetorev2, name='selectwebsiteRetorev2'),
|
url(r'^selectwebsiteRetorev2$', views.selectwebsiteRetorev2, name='selectwebsiteRetorev2'),
|
||||||
url(r'^selectreporestorev2$', views.selectreporestorev2, name='selectreporestorev2'),
|
url(r'^selectreporestorev2$', views.selectreporestorev2, name='selectreporestorev2'),
|
||||||
|
url(r'^RestorePathV2$', views.RestorePathV2, name='RestorePathV2'),
|
||||||
|
url(r'^CreateV2BackupButton$', views.CreateV2BackupButton, name='CreateV2BackupButton'),
|
||||||
|
|
||||||
]
|
]
|
||||||
@@ -712,7 +712,7 @@ def add_website(request):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
def createV2Backup(request):
|
def ConfigureV2Backup(request):
|
||||||
try:
|
try:
|
||||||
user_id, current_acl = _get_user_acl(request)
|
user_id, current_acl = _get_user_acl(request)
|
||||||
if ACLManager.currentContextPermission(current_acl, 'createBackup') == 0:
|
if ACLManager.currentContextPermission(current_acl, 'createBackup') == 0:
|
||||||
@@ -721,14 +721,20 @@ def createV2Backup(request):
|
|||||||
# websites = ACLManager.findAllSites(current_acl, user_id)
|
# websites = ACLManager.findAllSites(current_acl, user_id)
|
||||||
#
|
#
|
||||||
# destinations = _get_destinations(local=True)
|
# destinations = _get_destinations(local=True)
|
||||||
proc = httpProc(request, 'IncBackups/createV2Backup.html')
|
proc = httpProc(request, 'IncBackups/ConfigureV2Backup.html')
|
||||||
return proc.render()
|
return proc.render()
|
||||||
|
|
||||||
|
|
||||||
except BaseException as msg:
|
except BaseException as msg:
|
||||||
logging.writeToFile(str(msg))
|
logging.writeToFile(str(msg))
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
def CreateV2Backup(request):
|
||||||
|
try:
|
||||||
|
userID = request.session['userID']
|
||||||
|
bm = BackupManager()
|
||||||
|
return bm.CreateV2backupSite(request, userID)
|
||||||
|
except KeyError:
|
||||||
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
def createV2BackupSetup(request):
|
def createV2BackupSetup(request):
|
||||||
try:
|
try:
|
||||||
@@ -760,7 +766,22 @@ def createV2BackupSetup(request):
|
|||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
|
||||||
|
def CreateV2BackupButton(request):
|
||||||
|
import re
|
||||||
|
try:
|
||||||
|
userID = request.session['userID']
|
||||||
|
data = json.loads(request.body)
|
||||||
|
Selectedwebsite = data['Selectedwebsite']
|
||||||
|
Selectedrepo = data['Selectedrepo']
|
||||||
|
|
||||||
|
final_dic = {'status': 1, 'Selectedwebsite': Selectedwebsite, 'Selectedrepo': Selectedrepo}
|
||||||
|
final_json = json.dumps(final_dic)
|
||||||
|
return HttpResponse(final_json)
|
||||||
|
|
||||||
|
except BaseException as msg:
|
||||||
|
final_dic = {'status': 0, 'fetchStatus': 0, 'error_message': str(msg)}
|
||||||
|
final_json = json.dumps(final_dic)
|
||||||
|
return HttpResponse(final_json)
|
||||||
|
|
||||||
def RestoreV2backupSite(request):
|
def RestoreV2backupSite(request):
|
||||||
try:
|
try:
|
||||||
@@ -770,6 +791,22 @@ def RestoreV2backupSite(request):
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
return redirect(loadLoginPage)
|
return redirect(loadLoginPage)
|
||||||
|
|
||||||
|
def RestorePathV2(request):
|
||||||
|
import re
|
||||||
|
try:
|
||||||
|
userID = request.session['userID']
|
||||||
|
data = json.loads(request.body)
|
||||||
|
SnapShotId = data['snapshotid']
|
||||||
|
Path = data['path']
|
||||||
|
|
||||||
|
final_dic = {'status': 1, 'SnapShotId': SnapShotId, 'Path': Path}
|
||||||
|
final_json = json.dumps(final_dic)
|
||||||
|
return HttpResponse(final_json)
|
||||||
|
|
||||||
|
except BaseException as msg:
|
||||||
|
final_dic = {'status': 0, 'fetchStatus': 0, 'error_message': str(msg)}
|
||||||
|
final_json = json.dumps(final_dic)
|
||||||
|
return HttpResponse(final_json)
|
||||||
|
|
||||||
def selectwebsiteRetorev2(request):
|
def selectwebsiteRetorev2(request):
|
||||||
import re
|
import re
|
||||||
|
|||||||
@@ -57,6 +57,11 @@ class BackupManager:
|
|||||||
websitesName = ACLManager.findAllSites(currentACL, userID)
|
websitesName = ACLManager.findAllSites(currentACL, userID)
|
||||||
proc = httpProc(request, 'IncBackups/RestoreV2Backup.html', {'websiteList': websitesName}, 'createBackup')
|
proc = httpProc(request, 'IncBackups/RestoreV2Backup.html', {'websiteList': websitesName}, 'createBackup')
|
||||||
return proc.render()
|
return proc.render()
|
||||||
|
def CreateV2backupSite(self, request=None, userID=None, data=None):
|
||||||
|
currentACL = ACLManager.loadedACL(userID)
|
||||||
|
websitesName = ACLManager.findAllSites(currentACL, userID)
|
||||||
|
proc = httpProc(request, 'IncBackups/CreateV2Backup.html', {'websiteList': websitesName}, 'createBackup')
|
||||||
|
return proc.render()
|
||||||
|
|
||||||
def gDrive(self, request=None, userID=None, data=None):
|
def gDrive(self, request=None, userID=None, data=None):
|
||||||
currentACL = ACLManager.loadedACL(userID)
|
currentACL = ACLManager.loadedACL(userID)
|
||||||
|
|||||||
@@ -723,10 +723,12 @@
|
|||||||
<div class="sidebar-submenu">
|
<div class="sidebar-submenu">
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
|
<li><a href="{% url 'CreateV2Backup' %}"
|
||||||
<li><a href="{% url 'createV2Backup' %}"
|
|
||||||
title="{% trans "Create V2 Backup" %}"><span>{% trans "Create V2 Backup" %}</span></a>
|
title="{% trans "Create V2 Backup" %}"><span>{% trans "Create V2 Backup" %}</span></a>
|
||||||
</li>
|
</li>
|
||||||
|
<li><a href="{% url 'ConfigureV2Backup' %}"
|
||||||
|
title="{% trans "Configure V2 Backup" %}"><span>{% trans "Configure V2 Backup" %}</span></a>
|
||||||
|
</li>
|
||||||
<li><a href="{% url 'RestoreV2backupSite' %}"
|
<li><a href="{% url 'RestoreV2backupSite' %}"
|
||||||
title="{% trans "Restore V2 Backup" %}"><span>{% trans "Restore V2 Backup" %}</span></a>
|
title="{% trans "Restore V2 Backup" %}"><span>{% trans "Restore V2 Backup" %}</span></a>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
Reference in New Issue
Block a user