mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2026-05-07 04:16:16 +02:00
593 lines
19 KiB
HTML
593 lines
19 KiB
HTML
{% extends "baseTemplate/index.html" %}
|
|
{% load i18n %}
|
|
{% block title %}{% trans "Create Incremental Backup" %}{% endblock %}
|
|
|
|
{% block header_scripts %}
|
|
<style>
|
|
/* Page Specific Styles */
|
|
.backup-wrapper {
|
|
background: transparent;
|
|
padding: 20px;
|
|
}
|
|
|
|
.backup-container {
|
|
max-width: 1200px;
|
|
margin: 0 auto;
|
|
}
|
|
|
|
/* Page Header */
|
|
.page-header {
|
|
background: var(--bg-secondary, white);
|
|
border-radius: 12px;
|
|
padding: 25px;
|
|
margin-bottom: 25px;
|
|
box-shadow: 0 2px 8px rgba(0,0,0,0.08);
|
|
border: 1px solid var(--border-color, #e8e9ff);
|
|
}
|
|
|
|
.page-header h1 {
|
|
font-size: 24px;
|
|
font-weight: 700;
|
|
color: var(--text-primary, #2f3640);
|
|
margin: 0 0 10px 0;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 15px;
|
|
}
|
|
|
|
.page-header .icon {
|
|
width: 48px;
|
|
height: 48px;
|
|
background: var(--accent-color, #5b5fcf);
|
|
border-radius: 12px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
color: var(--bg-secondary, white);
|
|
font-size: 24px;
|
|
box-shadow: 0 4px 12px rgba(91,95,207,0.3);
|
|
}
|
|
|
|
.page-header p {
|
|
font-size: 14px;
|
|
color: var(--text-secondary, #64748b);
|
|
margin: 0;
|
|
line-height: 1.6;
|
|
}
|
|
|
|
.docs-link {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 6px;
|
|
color: var(--accent-color, #5b5fcf);
|
|
text-decoration: none;
|
|
font-size: 13px;
|
|
font-weight: 600;
|
|
transition: all 0.3s ease;
|
|
margin-top: 10px;
|
|
}
|
|
|
|
.docs-link:hover {
|
|
color: var(--accent-hover, #4b4fbf);
|
|
transform: translateX(2px);
|
|
}
|
|
|
|
/* Content Section */
|
|
.content-section {
|
|
background: var(--bg-secondary, white);
|
|
border-radius: 12px;
|
|
padding: 30px;
|
|
margin-bottom: 25px;
|
|
box-shadow: 0 2px 8px rgba(0,0,0,0.08);
|
|
border: 1px solid var(--border-color, #e8e9ff);
|
|
}
|
|
|
|
.section-title {
|
|
font-size: 18px;
|
|
font-weight: 700;
|
|
color: var(--text-primary, #2f3640);
|
|
margin-bottom: 25px;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 10px;
|
|
}
|
|
|
|
.section-title::before {
|
|
content: '';
|
|
width: 4px;
|
|
height: 24px;
|
|
background: var(--accent-color, #5b5fcf);
|
|
border-radius: 2px;
|
|
}
|
|
|
|
/* Form Styles */
|
|
.form-group {
|
|
margin-bottom: 25px;
|
|
}
|
|
|
|
.form-label {
|
|
display: block;
|
|
font-size: 13px;
|
|
font-weight: 600;
|
|
color: var(--text-primary, #2f3640);
|
|
margin-bottom: 10px;
|
|
text-transform: uppercase;
|
|
letter-spacing: 0.5px;
|
|
}
|
|
|
|
.form-control {
|
|
width: 100%;
|
|
padding: 12px 16px;
|
|
font-size: 14px;
|
|
border: 1px solid var(--border-color, #e8e9ff);
|
|
border-radius: 8px;
|
|
background: var(--bg-hover, #f8f9ff);
|
|
color: var(--text-primary, #2f3640);
|
|
transition: all 0.3s ease;
|
|
}
|
|
|
|
.form-control:focus {
|
|
outline: none;
|
|
border-color: var(--accent-color, #5b5fcf);
|
|
background: var(--bg-secondary, white);
|
|
box-shadow: 0 0 0 3px rgba(91,95,207,0.1);
|
|
}
|
|
|
|
.form-select {
|
|
width: 100%;
|
|
padding: 12px 16px;
|
|
font-size: 14px;
|
|
border: 1px solid var(--border-color, #e8e9ff);
|
|
border-radius: 8px;
|
|
background: var(--bg-hover, #f8f9ff);
|
|
color: var(--text-primary, #2f3640);
|
|
transition: all 0.3s ease;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.form-select:focus {
|
|
outline: none;
|
|
border-color: var(--accent-color, #5b5fcf);
|
|
background: var(--bg-secondary, white);
|
|
box-shadow: 0 0 0 3px rgba(91,95,207,0.1);
|
|
}
|
|
|
|
/* Checkbox Styles */
|
|
.checkbox-group {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 15px;
|
|
}
|
|
|
|
.checkbox-wrapper {
|
|
display: flex;
|
|
align-items: center;
|
|
padding: 15px;
|
|
background: var(--bg-hover, #f8f9ff);
|
|
border: 1px solid var(--border-color, #e8e9ff);
|
|
border-radius: 8px;
|
|
cursor: pointer;
|
|
transition: all 0.3s ease;
|
|
}
|
|
|
|
.checkbox-wrapper:hover {
|
|
background: var(--hover-light, #f0f0ff);
|
|
border-color: var(--accent-color, #5b5fcf);
|
|
}
|
|
|
|
.checkbox-wrapper input[type="checkbox"] {
|
|
width: 18px;
|
|
height: 18px;
|
|
margin-right: 12px;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.checkbox-label {
|
|
font-size: 14px;
|
|
color: var(--text-primary, #2f3640);
|
|
font-weight: 500;
|
|
cursor: pointer;
|
|
user-select: none;
|
|
}
|
|
|
|
/* Button Styles */
|
|
.btn-primary {
|
|
background: var(--accent-color, #5b5fcf);
|
|
color: var(--bg-secondary, white);
|
|
border: none;
|
|
padding: 12px 30px;
|
|
border-radius: 8px;
|
|
font-size: 14px;
|
|
font-weight: 600;
|
|
cursor: pointer;
|
|
transition: all 0.3s ease;
|
|
text-transform: uppercase;
|
|
letter-spacing: 0.5px;
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 8px;
|
|
}
|
|
|
|
.btn-primary:hover {
|
|
background: var(--accent-hover, #4b4fbf);
|
|
transform: translateY(-2px);
|
|
box-shadow: 0 5px 15px rgba(91,95,207,0.3);
|
|
}
|
|
|
|
.btn-primary:disabled {
|
|
background: var(--text-muted, #94a3b8);
|
|
cursor: not-allowed;
|
|
transform: none;
|
|
box-shadow: none;
|
|
}
|
|
|
|
/* Status Textarea */
|
|
.status-textarea {
|
|
width: 100%;
|
|
padding: 15px;
|
|
font-size: 13px;
|
|
font-family: 'Monaco', 'Consolas', monospace;
|
|
line-height: 1.5;
|
|
border: 1px solid var(--border-color, #e8e9ff);
|
|
border-radius: 8px;
|
|
background: var(--bg-hover, #f8f9ff);
|
|
color: var(--text-primary, #2f3640);
|
|
resize: vertical;
|
|
min-height: 200px;
|
|
}
|
|
|
|
/* Table Styles */
|
|
.backups-table {
|
|
width: 100%;
|
|
background: var(--bg-secondary, white);
|
|
border-radius: 8px;
|
|
overflow: hidden;
|
|
border: 1px solid var(--border-color, #e8e9ff);
|
|
}
|
|
|
|
.backups-table th {
|
|
background: var(--bg-hover, #f8f9ff);
|
|
padding: 15px;
|
|
text-align: left;
|
|
font-size: 12px;
|
|
font-weight: 700;
|
|
color: var(--text-secondary, #64748b);
|
|
text-transform: uppercase;
|
|
letter-spacing: 0.5px;
|
|
border-bottom: 1px solid var(--border-color, #e8e9ff);
|
|
}
|
|
|
|
.backups-table td {
|
|
padding: 15px;
|
|
font-size: 14px;
|
|
color: var(--text-primary, #2f3640);
|
|
border-bottom: 1px solid var(--border-light, #f0f0ff);
|
|
}
|
|
|
|
.backups-table tr:last-child td {
|
|
border-bottom: none;
|
|
}
|
|
|
|
.backups-table tr:hover {
|
|
background: var(--bg-hover, #f8f9ff);
|
|
}
|
|
|
|
.action-btn {
|
|
background: var(--accent-color, #5b5fcf);
|
|
color: var(--bg-secondary, white);
|
|
border: none;
|
|
padding: 6px 16px;
|
|
border-radius: 6px;
|
|
font-size: 12px;
|
|
font-weight: 600;
|
|
cursor: pointer;
|
|
transition: all 0.3s ease;
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 6px;
|
|
text-decoration: none;
|
|
}
|
|
|
|
.action-btn:hover {
|
|
background: var(--accent-hover, #4b4fbf);
|
|
transform: translateY(-1px);
|
|
box-shadow: 0 2px 8px rgba(91,95,207,0.3);
|
|
color: var(--bg-secondary, white);
|
|
text-decoration: none;
|
|
}
|
|
|
|
.delete-btn {
|
|
background: var(--danger-color, #ef4444);
|
|
color: var(--bg-secondary, white);
|
|
border: none;
|
|
padding: 6px 16px;
|
|
border-radius: 6px;
|
|
font-size: 12px;
|
|
font-weight: 600;
|
|
cursor: pointer;
|
|
transition: all 0.3s ease;
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 6px;
|
|
}
|
|
|
|
.delete-btn:hover {
|
|
background: var(--danger-hover, #dc2626);
|
|
transform: translateY(-1px);
|
|
box-shadow: 0 2px 8px rgba(239,68,68,0.3);
|
|
}
|
|
|
|
/* Modal Styles */
|
|
.modal-content {
|
|
border: none;
|
|
border-radius: 12px;
|
|
box-shadow: 0 10px 40px rgba(0,0,0,0.15);
|
|
}
|
|
|
|
.modal-header {
|
|
background: var(--bg-hover, #f8f9ff);
|
|
border-bottom: 1px solid var(--border-color, #e8e9ff);
|
|
border-radius: 12px 12px 0 0;
|
|
padding: 20px;
|
|
}
|
|
|
|
.modal-title {
|
|
font-size: 18px;
|
|
font-weight: 700;
|
|
color: var(--text-primary, #2f3640);
|
|
}
|
|
|
|
.modal-body {
|
|
padding: 25px;
|
|
}
|
|
|
|
.modal-footer {
|
|
background: var(--bg-hover, #f8f9ff);
|
|
border-top: 1px solid var(--border-color, #e8e9ff);
|
|
border-radius: 0 0 12px 12px;
|
|
padding: 15px 20px;
|
|
}
|
|
|
|
/* Loading Spinner */
|
|
.loading-spinner {
|
|
display: inline-block;
|
|
width: 16px;
|
|
height: 16px;
|
|
border: 2px solid var(--accent-color, #5b5fcf);
|
|
border-radius: 50%;
|
|
border-top-color: transparent;
|
|
animation: spin 0.8s linear infinite;
|
|
margin-left: 8px;
|
|
}
|
|
|
|
/* Angular cloak */
|
|
[ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak, .x-ng-cloak {
|
|
display: none !important;
|
|
}
|
|
|
|
|
|
@keyframes spin {
|
|
to { transform: rotate(360deg); }
|
|
}
|
|
|
|
/* Empty State */
|
|
.empty-state {
|
|
text-align: center;
|
|
padding: 40px;
|
|
color: var(--text-muted, #8893a7);
|
|
}
|
|
|
|
.empty-state i {
|
|
font-size: 48px;
|
|
color: var(--border-color, #e8e9ff);
|
|
margin-bottom: 15px;
|
|
}
|
|
|
|
.empty-state p {
|
|
font-size: 14px;
|
|
margin: 0;
|
|
}
|
|
|
|
/* Responsive */
|
|
@media (max-width: 768px) {
|
|
.backup-wrapper {
|
|
padding: 15px;
|
|
}
|
|
|
|
.content-section {
|
|
padding: 20px;
|
|
}
|
|
|
|
.backups-table {
|
|
font-size: 12px;
|
|
}
|
|
|
|
.backups-table th,
|
|
.backups-table td {
|
|
padding: 10px;
|
|
}
|
|
}
|
|
</style>
|
|
{% endblock %}
|
|
|
|
{% block content %}
|
|
{% load static %}
|
|
{% get_current_language as LANGUAGE_CODE %}
|
|
|
|
<div class="backup-wrapper">
|
|
<div class="backup-container" ng-controller="createIncrementalBackups" ng-init="cyberpanelLoading=false" ng-cloak>
|
|
<!-- Page Header -->
|
|
<div class="page-header">
|
|
<h1>
|
|
<div class="icon">
|
|
<i class="fas fa-shield-alt"></i>
|
|
</div>
|
|
{% trans "Create Incremental Backup" %}
|
|
</h1>
|
|
<p>{% trans "Create incremental backups for your websites with efficient storage usage and quick restore capabilities." %}</p>
|
|
<a href="https://cyberpanel.net/docs/2-create-restore-incremental-backups/" target="_blank" class="docs-link">
|
|
<i class="fas fa-book"></i>
|
|
{% trans "View Documentation" %}
|
|
<i class="fas fa-external-link-alt" style="font-size: 11px;"></i>
|
|
</a>
|
|
</div>
|
|
|
|
<!-- Configuration Section -->
|
|
<div class="content-section">
|
|
<h2 class="section-title">{% trans "Backup Configuration" %}</h2>
|
|
|
|
|
|
<form>
|
|
<div class="form-group">
|
|
<label class="form-label">{% trans "Select Website" %}</label>
|
|
<select ng-change="fetchDetails()" ng-model="websiteToBeBacked" class="form-select">
|
|
<option value="">{% trans "Choose a website to backup" %}</option>
|
|
{% for items in websiteList %}
|
|
<option>{{ items }}</option>
|
|
{% endfor %}
|
|
</select>
|
|
</div>
|
|
|
|
<div ng-hide="destination" class="form-group">
|
|
<label class="form-label">{% trans "Backup Destination" %}</label>
|
|
<select ng-change="destinationSelection()" ng-model="backupDestinations" class="form-select">
|
|
<option value="">{% trans "Select backup destination" %}</option>
|
|
{% for items in destinations %}
|
|
<option>{{ items }}</option>
|
|
{% endfor %}
|
|
</select>
|
|
</div>
|
|
|
|
<div ng-hide="destination" class="form-group">
|
|
<label class="form-label">{% trans "Backup Content" %}</label>
|
|
<div class="checkbox-group">
|
|
<div class="checkbox-wrapper">
|
|
<input ng-model="websiteData" type="checkbox" id="backup-data" checked>
|
|
<label for="backup-data" class="checkbox-label">{% trans "Website Data" %}</label>
|
|
</div>
|
|
<div class="checkbox-wrapper">
|
|
<input ng-model="websiteDatabases" type="checkbox" id="backup-databases">
|
|
<label for="backup-databases" class="checkbox-label">{% trans "Databases" %}</label>
|
|
</div>
|
|
<div class="checkbox-wrapper">
|
|
<input ng-model="websiteEmails" type="checkbox" id="backup-emails">
|
|
<label for="backup-emails" class="checkbox-label">{% trans "Email Accounts" %}</label>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<!-- Backup Status -->
|
|
<div ng-hide="runningBackup" class="form-group">
|
|
<label class="form-label">{% trans "Backup Progress" %}</label>
|
|
<textarea ng-model="status" class="status-textarea" readonly></textarea>
|
|
</div>
|
|
|
|
<!-- Create Backup Button -->
|
|
<div ng-hide="backupButton" class="form-group" style="text-align: center; margin-top: 30px;">
|
|
<button type="button" ng-click="createBackup()" class="btn-primary" ng-disabled="cyberpanelLoading">
|
|
<i class="fas fa-shield-alt" ng-if="!cyberpanelLoading"></i>
|
|
<i class="fas fa-spinner fa-spin" ng-if="cyberpanelLoading"></i>
|
|
<span ng-if="!cyberpanelLoading">{% trans "Create Backup" %}</span>
|
|
<span ng-if="cyberpanelLoading">{% trans "Creating Backup..." %}</span>
|
|
</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
|
|
|
|
<!-- Existing Backups -->
|
|
<div class="content-section">
|
|
<h2 class="section-title">{% trans "Existing Backups" %}</h2>
|
|
|
|
<div ng-if="!records || records.length === 0" class="empty-state">
|
|
<i class="fas fa-folder-open"></i>
|
|
<p>{% trans "No backups created yet" %}</p>
|
|
</div>
|
|
|
|
<table class="backups-table" ng-if="records && records.length > 0">
|
|
<thead>
|
|
<tr>
|
|
<th>{% trans "Backup ID" %}</th>
|
|
<th>{% trans "Date Created" %}</th>
|
|
<th style="text-align: center;">{% trans "Actions" %}</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr ng-repeat="record in records track by $index">
|
|
<td>
|
|
<i class="fas fa-archive" style="color: var(--accent-color, #5b5fcf); margin-right: 8px;"></i>
|
|
<span ng-bind="record.id"></span>
|
|
</td>
|
|
<td ng-bind="record.date"></td>
|
|
<td style="text-align: center;">
|
|
<a ng-click="restore(record.id)" data-toggle="modal" data-target="#settings"
|
|
class="action-btn" title="Restore">
|
|
<i class="fas fa-undo"></i>
|
|
{% trans "Restore Points" %}
|
|
</a>
|
|
<button type="button" class="delete-btn" ng-click="deleteBackup(record.id)" style="margin-left: 10px;">
|
|
<i class="fas fa-trash-alt"></i>
|
|
{% trans "Delete" %}
|
|
</button>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<!-- Restore Points Modal -->
|
|
<div id="settings" class="modal fade" role="dialog">
|
|
<div class="modal-dialog modal-lg">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h4 class="modal-title">
|
|
{% trans "Restore Points" %}
|
|
<span class="loading-spinner" ng-show="cyberpanelLoading"></span>
|
|
</h4>
|
|
<button type="button" class="close" data-dismiss="modal">×</button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<table class="backups-table">
|
|
<thead>
|
|
<tr>
|
|
<th>{% trans "Job ID" %}</th>
|
|
<th>{% trans "Snapshot ID" %}</th>
|
|
<th>{% trans "Type" %}</th>
|
|
<th>{% trans "Destination" %}</th>
|
|
<th style="text-align: center;">{% trans "Action" %}</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<tr ng-repeat="job in jobs track by $index">
|
|
<td ng-bind="job.id"></td>
|
|
<td ng-bind="job.snapshotid"></td>
|
|
<td ng-bind="job.type"></td>
|
|
<td ng-bind="job.destination"></td>
|
|
<td style="text-align: center;">
|
|
<button ng-click="restorePoint(job.id, 0)" class="action-btn">
|
|
<i class="fas fa-undo"></i>
|
|
{% trans "Restore" %}
|
|
</button>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
|
|
<div ng-hide="restoreSt" style="margin-top: 20px;">
|
|
<label class="form-label">{% trans "Restore Progress" %}</label>
|
|
<textarea ng-model="status" class="status-textarea" rows="7" readonly></textarea>
|
|
</div>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-secondary" data-dismiss="modal">
|
|
{% trans "Close" %}
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script src="{% static 'IncBackups/IncBackups.js' %}"></script>
|
|
{% endblock %} |