File: //proc/676643/root/usr/local/CyberCP/backup/templates/backup/googleDrive.html
{% extends "baseTemplate/index.html" %}
{% load i18n %}
{% block title %}{% trans "Google Drive Backups - CyberPanel" %}{% endblock %}
{% block content %}
{% load static %}
{% get_current_language as LANGUAGE_CODE %}
<!-- Current language: {{ LANGUAGE_CODE }} -->
<style>
.modern-container {
max-width: 1400px;
margin: 0 auto;
padding: 2rem;
}
.page-header {
text-align: center;
margin-bottom: 3rem;
padding: 3rem 0;
background: linear-gradient(135deg, var(--bg-secondary, #f8f9ff) 0%, var(--bg-hover, #f0f1ff) 100%);
border-radius: 20px;
animation: fadeInDown 0.5s ease-out;
position: relative;
overflow: hidden;
}
.page-header::before {
content: '';
position: absolute;
top: -50%;
right: -50%;
width: 200%;
height: 200%;
background: url('data:image/svg+xml;utf8,<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><path d="M0 0h100v100H0z" fill="none"/><path d="M0 50h100M50 0v100" stroke="%23e8e9ff" stroke-width="0.5"/></svg>') repeat;
transform: rotate(45deg);
opacity: 0.5;
}
.page-title {
font-size: 3rem;
font-weight: 700;
color: var(--text-primary, #1e293b);
margin-bottom: 1rem;
display: flex;
align-items: center;
justify-content: center;
gap: 1rem;
position: relative;
z-index: 1;
}
.google-drive-icon {
width: 60px;
height: 60px;
background: var(--bg-primary, white);
border-radius: 12px;
display: flex;
align-items: center;
justify-content: center;
box-shadow: var(--shadow-md, 0 4px 12px rgba(0,0,0,0.1));
}
.page-subtitle {
font-size: 1.25rem;
color: var(--text-secondary, #64748b);
margin-bottom: 1.5rem;
position: relative;
z-index: 1;
}
.header-actions {
display: flex;
gap: 1rem;
justify-content: center;
flex-wrap: wrap;
position: relative;
z-index: 1;
}
.btn-primary {
background: #5b5fcf;
color: white;
border: none;
padding: 0.75rem 2rem;
border-radius: 10px;
font-weight: 500;
cursor: pointer;
transition: all 0.3s ease;
display: inline-flex;
align-items: center;
gap: 0.5rem;
text-decoration: none;
font-size: 0.875rem;
}
.btn-primary:hover {
background: #4547a9;
transform: translateY(-2px);
box-shadow: 0 8px 20px rgba(91, 95, 207, 0.4);
color: white;
}
.btn-secondary {
background: var(--bg-primary, #fff);
color: #5b5fcf;
border: 1px solid var(--border-primary, #e8e9ff);
padding: 0.75rem 2rem;
border-radius: 10px;
font-weight: 500;
cursor: pointer;
transition: all 0.3s ease;
display: inline-flex;
align-items: center;
gap: 0.5rem;
text-decoration: none;
font-size: 0.875rem;
}
.btn-secondary:hover {
background: var(--bg-secondary, #f8f9ff);
border-color: #5b5fcf;
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(91, 95, 207, 0.2);
}
.btn-danger {
background: #ef4444;
color: white;
border: none;
padding: 0.5rem 1rem;
border-radius: 8px;
font-weight: 500;
cursor: pointer;
transition: all 0.3s ease;
display: inline-flex;
align-items: center;
gap: 0.5rem;
font-size: 0.825rem;
}
.btn-danger:hover {
background: #dc2626;
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}
.btn-gray {
background: #6b7280;
color: white;
border: none;
padding: 0.5rem 1.5rem;
border-radius: 8px;
font-weight: 500;
cursor: pointer;
transition: all 0.3s ease;
display: inline-flex;
align-items: center;
gap: 0.5rem;
font-size: 0.875rem;
}
.btn-gray:hover {
background: #4b5563;
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(107, 114, 128, 0.4);
}
.main-card {
background: var(--bg-primary, white);
border-radius: 16px;
box-shadow: var(--shadow-sm, 0 1px 3px rgba(0,0,0,0.05)), var(--shadow-lg, 0 10px 40px rgba(0,0,0,0.08));
border: 1px solid var(--border-primary, #e8e9ff);
overflow: hidden;
margin-bottom: 2rem;
animation: fadeInUp 0.5s ease-out;
}
.card-header {
background: linear-gradient(135deg, var(--bg-secondary, #f8f9ff) 0%, var(--bg-hover, #f0f1ff) 100%);
padding: 1.5rem 2rem;
border-bottom: 1px solid var(--border-primary, #e8e9ff);
}
.card-title {
font-size: 1.25rem;
font-weight: 600;
color: var(--text-primary, #1e293b);
margin: 0;
display: flex;
align-items: center;
gap: 0.75rem;
}
.card-body {
padding: 2rem;
}
.account-selector {
background: var(--bg-secondary, #f8f9ff);
border: 1px solid var(--border-primary, #e8e9ff);
border-radius: 12px;
padding: 1.5rem;
margin-bottom: 2rem;
}
.form-section {
margin-bottom: 2rem;
}
.form-group {
margin-bottom: 1.5rem;
}
.form-label {
display: block;
margin-bottom: 0.5rem;
font-weight: 500;
color: var(--text-primary, #1e293b);
font-size: 0.875rem;
}
.form-control {
width: 100%;
padding: 0.875rem 1rem;
border: 1px solid var(--border-primary, #e8e9ff);
border-radius: 10px;
font-size: 0.875rem;
transition: all 0.3s ease;
background: var(--bg-primary, #fff);
}
.form-control:focus {
outline: none;
border-color: #5b5fcf;
box-shadow: 0 0 0 3px rgba(91, 95, 207, 0.1);
}
.gdrive-table {
width: 100%;
background: var(--bg-primary, white);
border-radius: 12px;
overflow: hidden;
border: 1px solid var(--border-primary, #e8e9ff);
}
.gdrive-table thead {
background: linear-gradient(135deg, var(--bg-secondary, #f8f9ff) 0%, var(--bg-hover, #f0f1ff) 100%);
}
.gdrive-table th {
padding: 1rem;
text-align: left;
font-weight: 600;
color: var(--text-primary, #1e293b);
font-size: 0.875rem;
text-transform: uppercase;
letter-spacing: 0.05em;
border-bottom: 1px solid var(--border-primary, #e8e9ff);
}
.gdrive-table td {
padding: 1rem;
color: var(--text-secondary, #64748b);
font-size: 0.875rem;
border-bottom: 1px solid var(--border-light, #f3f4f6);
}
.gdrive-table tbody tr:hover {
background: var(--bg-secondary, #f8f9ff);
}
.gdrive-table tbody tr:last-child td {
border-bottom: none;
}
.frequency-badge {
background: var(--accent-light, #e0e7ff);
color: #5b5fcf;
padding: 0.25rem 0.75rem;
border-radius: 6px;
font-size: 0.875rem;
font-weight: 500;
}
.retention-info {
background: var(--warning-light, #fef3c7);
border: 1px solid var(--warning-border, #fde68a);
border-radius: 12px;
padding: 1rem 1.5rem;
margin-bottom: 2rem;
display: flex;
align-items: center;
gap: 1rem;
}
.retention-info i {
color: #f59e0b;
font-size: 1.25rem;
}
.retention-info p {
margin: 0;
color: var(--warning-text, #92400e);
font-size: 0.875rem;
}
.retention-info a {
color: #5b5fcf;
font-weight: 600;
text-decoration: none;
}
.retention-info a:hover {
text-decoration: underline;
}
.loading-spinner {
width: 20px;
height: 20px;
border: 3px solid var(--border-primary, #e8e9ff);
border-top-color: #5b5fcf;
border-radius: 50%;
animation: spin 1s linear infinite;
display: inline-block;
margin-left: 1rem;
}
.modal-content {
border-radius: 16px;
overflow: hidden;
border: none;
box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}
.modal-header {
background: linear-gradient(135deg, var(--bg-secondary, #f8f9ff) 0%, var(--bg-hover, #f0f1ff) 100%);
border-bottom: 1px solid var(--border-primary, #e8e9ff);
padding: 1.5rem 2rem;
}
.modal-title {
font-size: 1.25rem;
font-weight: 600;
color: var(--text-primary, #1e293b);
margin: 0;
}
.modal-body {
padding: 2rem;
}
.modal-footer {
border-top: 1px solid var(--border-primary, #e8e9ff);
padding: 1.5rem 2rem;
background: var(--bg-secondary, #f8f9ff);
}
.log-table {
width: 100%;
background: var(--bg-secondary, #f8f9ff);
border-radius: 8px;
overflow: hidden;
}
.log-table th {
background: var(--bg-hover, #e8e9ff);
padding: 0.75rem;
text-align: left;
font-weight: 600;
color: var(--text-primary, #1e293b);
font-size: 0.875rem;
}
.log-table td {
padding: 0.75rem;
color: var(--text-secondary, #64748b);
font-size: 0.875rem;
border-bottom: 1px solid var(--border-primary, #e8e9ff);
}
.log-type {
font-weight: 600;
color: #5b5fcf;
}
@keyframes spin {
to { transform: rotate(360deg); }
}
@keyframes fadeInDown {
from {
opacity: 0;
transform: translateY(-20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
@keyframes fadeInUp {
from {
opacity: 0;
transform: translateY(20px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
@media (max-width: 768px) {
.page-title {
font-size: 2rem;
}
.google-drive-icon {
width: 48px;
height: 48px;
}
}
</style>
<div class="modern-container" ng-controller="googleDrive">
<div class="page-header">
<h1 class="page-title">
<div class="google-drive-icon">
<img src="https://upload.wikimedia.org/wikipedia/commons/1/12/Google_Drive_icon_%282020%29.svg"
alt="Google Drive" style="width: 36px; height: 36px;">
</div>
{% trans "Google Drive Backups" %}
</h1>
<p class="page-subtitle">{% trans "Set up and manage automatic backups to Google Drive" %}</p>
<div class="header-actions">
<a href="https://cyberpanel.net/docs/backup-to-google-drive/"
target="_blank"
class="btn-secondary">
<i class="fas fa-book"></i>
{% trans "Documentation" %}
</a>
<button type="button" class="btn-primary" data-toggle="modal" data-target="#setupGdrive">
<i class="fas fa-plus-circle"></i>
{% trans "Setup New Account" %}
</button>
</div>
</div>
<!-- Main Configuration Card -->
<div class="main-card">
<div class="card-header">
<h2 class="card-title">
<i class="fas fa-cog"></i>
{% trans "Google Drive Backup Configuration" %}
<span ng-hide="cyberPanelLoading" class="loading-spinner"></span>
</h2>
</div>
<div class="card-body">
<!-- Account Selector -->
<div class="account-selector">
<div class="form-group">
<label class="form-label">
<i class="fas fa-user-circle" style="margin-right: 0.5rem;"></i>
{% trans "Select Google Drive Account" %}
</label>
<div style="display: flex; gap: 1rem; align-items: center;">
<select ng-change="fetchWebsites()" ng-model="selectedAccount" class="form-control">
<option value="">{% trans "Choose an account..." %}</option>
{% for items in accounts %}
<option>{{ items }}</option>
{% endfor %}
</select>
<button ng-hide="driveHidden" type="button" ng-click="deleteAccount()" class="btn-danger">
<i class="fas fa-trash"></i>
{% trans "Delete" %}
</button>
</div>
</div>
</div>
<!-- Backup Settings -->
<div ng-hide="driveHidden">
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label class="form-label">
<i class="fas fa-sync-alt" style="margin-right: 0.5rem;"></i>
{% trans "Backup Frequency" %}
</label>
<select ng-change="changeFrequency()" ng-model="backupFrequency" class="form-control">
<option>Never</option>
<option>Daily</option>
<option>Weekly</option>
</select>
<small class="form-text text-muted" style="margin-top: 0.5rem;">
{% trans "Currently" %}: <span class="frequency-badge">{$ currently $}</span>
</small>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label class="form-label">
<i class="fas fa-history" style="margin-right: 0.5rem;"></i>
{% trans "Backup File Retention" %}
</label>
<select id="fileretention" ng-model="Retentiontime" ng-change="changeRetention()" class="form-control">
<option value="1d">1 day</option>
<option value="1w">1 week</option>
<option value="1m">1 month</option>
<option value="6m">6 months</option>
</select>
</div>
</div>
</div>
<!-- Retention Info -->
<div class="retention-info">
<i class="fas fa-info-circle"></i>
<p>
{% trans "Backup retention is a" %}
<a href="https://cyberpanel.net/cyberpanel-addons" target="_blank">{% trans "paid feature" %}</a>.
{% trans "Upgrade to manage how long backups are stored." %}
</p>
</div>
<!-- Site Management -->
<div class="form-section">
<div class="form-group">
<label class="form-label">
<i class="fas fa-globe" style="margin-right: 0.5rem;"></i>
{% trans "Add Sites for Backup" %}
</label>
<div style="display: flex; gap: 1rem; align-items: center;">
<select ng-model="selectedWebsite" class="form-control">
<option value="">{% trans "Choose a website..." %}</option>
{% for items in websites %}
<option>{{ items }}</option>
{% endfor %}
</select>
<button type="button" ng-click="addSite()" class="btn-primary">
<i class="fas fa-plus"></i>
{% trans "Add Site" %}
</button>
</div>
</div>
</div>
<!-- Action Buttons -->
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem;">
<button data-toggle="modal" data-target="#backupLogs"
type="button" ng-click="fetchLogs()" class="btn-gray">
<i class="fas fa-file-alt"></i>
{% trans "View Logs" %}
</button>
<select ng-model="recordsToShow" ng-change="fetchWebsites()"
class="form-control" style="width: auto;">
<option>10</option>
<option>50</option>
<option>100</option>
</select>
</div>
<!-- Sites Table -->
<table class="gdrive-table">
<thead>
<tr>
<th>{% trans "Website" %}</th>
<th style="text-align: center;">{% trans "Actions" %}</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="website in websites track by $index">
<td>
<i class="fas fa-globe" style="color: #5b5fcf; margin-right: 0.5rem;"></i>
<strong ng-bind="website.name"></strong>
</td>
<td style="text-align: center;">
<button type="button" ng-click="deleteSite(website.name)" class="btn-danger">
<i class="fas fa-times"></i>
{% trans "Remove" %}
</button>
</td>
</tr>
</tbody>
</table>
<!-- Pagination -->
<div style="display: flex; justify-content: center; margin-top: 2rem;">
<select ng-model="currentPage" class="form-control"
ng-change="fetchWebsites()" style="width: auto;">
<option ng-repeat="page in pagination">{$ $index + 1 $}</option>
</select>
</div>
</div>
</div>
</div>
<!-- Setup Account Modal -->
<div id="setupGdrive" class="modal fade" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">
<i class="fas fa-user-plus" style="margin-right: 0.5rem;"></i>
{% trans "Set up Google Drive Account" %}
</h4>
<button type="button" class="close" data-dismiss="modal" style="font-size: 1.5rem;">×</button>
</div>
<div class="modal-body">
<form name="containerSettingsForm" action="/" method="post">
<div class="form-group">
<label class="form-label">
<i class="fas fa-tag" style="margin-right: 0.5rem;"></i>
{% trans "Account Name" %}
</label>
<input name="accountName" type="text" class="form-control"
ng-model="accountName"
placeholder="{% trans 'e.g., My Google Drive Backup' %}" required>
<small class="form-text text-muted">
{% trans "Choose a descriptive name for this Google Drive account" %}
</small>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn-secondary" data-dismiss="modal">
<i class="fas fa-times"></i>
{% trans "Cancel" %}
</button>
<button type="button" class="btn-primary" ng-click="setupAccount()">
<i class="fas fa-check"></i>
{% trans "Continue Setup" %}
<span ng-hide="cyberPanelLoading" class="loading-spinner" style="width: 16px; height: 16px;"></span>
</button>
</div>
</div>
</div>
</div>
<!-- Logs Modal -->
<div id="backupLogs" class="modal fade" role="dialog">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">
<i class="fas fa-file-alt" style="margin-right: 0.5rem;"></i>
{% trans "Backup Logs" %}
<span ng-hide="cyberPanelLoading" class="loading-spinner" style="width: 16px; height: 16px;"></span>
</h4>
<button type="button" class="close" data-dismiss="modal" style="font-size: 1.5rem;">×</button>
</div>
<div class="modal-body">
<div style="display: flex; justify-content: flex-end; margin-bottom: 1rem;">
<select ng-model="recordsToShowLogs" ng-change="fetchLogs()"
class="form-control" style="width: auto;">
<option>10</option>
<option>50</option>
<option>100</option>
</select>
</div>
<table class="log-table">
<thead>
<tr>
<th style="width: 100px;">{% trans "Type" %}</th>
<th>{% trans "Message" %}</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="log in logs track by $index">
<td class="log-type" ng-bind="log.type"></td>
<td ng-bind="log.message"></td>
</tr>
</tbody>
</table>
<div style="display: flex; justify-content: center; margin-top: 2rem;">
<select ng-model="currentPageLogs" class="form-control"
ng-change="fetchLogs()" style="width: auto;">
<option ng-repeat="page in paginationLogs">{$ $index + 1 $}</option>
</select>
</div>
</div>
</div>
</div>
</div>
</div>
{% endblock %}