Michael Pimmer c770a7adfb
Backups: Restore directly from archive
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2018-11-17 08:59:29 -05:00

157 lines
4.7 KiB
HTML

{% extends "base.html" %}
{% comment %}
#
# This file is part of FreedomBox.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
{% endcomment %}
{% load i18n %}
{% block page_head %}
<style type="text/css">
.share-operations form {
display: inline-block;
}
.share-operations {
text-align: right;
}
</style>
{% endblock %}
{% block content %}
<h2>{{ title }}</h2>
{% for paragraph in description %}
<p>{{ paragraph|safe }}</p>
{% endfor %}
<h3>{% trans 'Backup archives' %}</h3>
{% if available_apps %}
<p>
<a title="{% trans 'New backup' %}"
role="button" class="btn btn-primary"
href="{% url 'backups:create' %}">
{% trans 'New backup' %}
</a>
</p>
{% else %}
<p>
<a title="{% trans 'New backup' %}"
role="button" class="btn btn-primary disabled"
href="{% url 'backups:create' %}">
{% trans 'New backup' %}
</a>
</p>
<p>
{% blocktrans trimmed %}
No apps that support backup are currently installed. Backup can be
created after an app supporting backups is installed.
{% endblocktrans %}
</p>
{% endif %}
{% if not archives %}
<p>{% trans 'No archives currently exist.' %}</p>
{% else %}
<table class="table table-bordered table-condensed table-striped"
id="archives-list">
<thead>
<tr>
<th>{% trans "Name" %}</th>
<th></th>
</tr>
</thead>
<tbody>
{% for archive in archives %}
<tr id="archive-{{ archive.name }}" class="archive">
<td class="archive-name">{{ archive.name }}</td>
<td class="archive-operations">
<!-- TODO: use or remove
<a class="archive-export btn btn-sm btn-default"
href="{% url 'backups:export' archive.name %}">
{% trans "Export" %}
</a>
-->
<a class="archive-export btn btn-sm btn-default" target="_blank"
href="{% url 'backups:export-and-download' archive.name %}">
{% trans "Download" %}
</a>
<a class="archive-export btn btn-sm btn-default"
href="{% url 'backups:restore-archive' archive.name %}">
{% trans "Restore" %}
</a>
<a class="archive-delete btn btn-sm btn-default"
href="{% url 'backups:delete' archive.name %}">
<span class="glyphicon glyphicon-trash" aria-hidden="true">
</span>
</a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
<h3>{% trans 'Existing backup files' %}</h3>
{% if not exports %}
<p>{% trans 'No existing backup files were found.' %}</p>
{% else %}
<table class="table table-bordered table-condensed table-striped"
id="exports-list">
<thead>
<tr>
<th>{% trans "Location" %}</th>
<th>{% trans "Name" %}</th>
<th></th>
</tr>
</thead>
<tbody>
{% for export in exports %}
{% for name in export.files %}
<tr id="export-{{ label }}-{{ name }}" class="export">
<td class="export-label">{{ export.label }}</td>
<td class="export-name">{{ name }}</td>
<td class="export-operations">
<a class="download btn btn-sm btn-default" target="_blank"
href="{% url 'backups:download' export.device|urlencode:'' name|urlencode:'' %}">
{% trans "Download" %}
</a>
<a class="restore btn btn-sm btn-default"
href="{% url 'backups:restore' export.device|urlencode:'' name|urlencode:'' %}">
{% trans "Restore" %}
</a>
</td>
</tr>
{% endfor %}
{% endfor %}
</tbody>
</table>
{% endif %}
<p>
<a title="{% trans 'Upload a backup file' %}"
role="button" class="btn btn-primary"
href="{% url 'backups:upload' %}">
{% trans 'Upload backup file' %}
</a>
</p>
{% endblock %}