mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-09-19 04:59:01 +00:00
backups: Make UI more consistent with other apps
- Replace subsubmenu with buttons - Left align icons in table header (restore and delete) - Replace the technical term "repository" with "location" - Confirmation dialogs shouldn't have app name, description, manual etc. - Confirmation dialogs don't need Cancel buttons Signed-off-by: Joseph Nuthalapati <njoseph@thoughtworks.com> [sunil@medhas.org: Remove 'primary' for all but one button] Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
parent
22c00d5cd4
commit
c2cb187d91
@ -44,7 +44,21 @@
|
|||||||
|
|
||||||
{% block configuration %}
|
{% block configuration %}
|
||||||
|
|
||||||
<h3>{% trans 'Existing backup locations' %}</h3>
|
<a title="{% trans 'Create a new backup' %}"
|
||||||
|
role="button" class="btn btn-primary"
|
||||||
|
href="{% url 'backups:create' %}">
|
||||||
|
<span class="fa fa-plus" aria-hidden="true"></span>
|
||||||
|
{% trans 'Create Backup' %}
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<a title="{% trans 'Upload and restore a backup archive' %}"
|
||||||
|
role="button" class="btn btn-default"
|
||||||
|
href="{% url 'backups:upload' %}">
|
||||||
|
<span class="fa fa-upload" aria-hidden="true"></span>
|
||||||
|
{% trans 'Upload and Restore' %}
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<h3>{% trans 'Existing Backups' %}</h3>
|
||||||
|
|
||||||
{% include "backups_repository.inc" with repository=root_repository uuid='root' editable=False %}
|
{% include "backups_repository.inc" with repository=root_repository uuid='root' editable=False %}
|
||||||
|
|
||||||
@ -52,13 +66,13 @@
|
|||||||
{% include "backups_repository.inc" with editable=True %}
|
{% include "backups_repository.inc" with editable=True %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
<br />
|
<br/>
|
||||||
|
|
||||||
<a title="{% trans 'Create new repository' %}"
|
<a title="{% trans 'Add a remote backup location' %}"
|
||||||
role="button" class="btn btn-primary"
|
role="button" class="btn btn-default"
|
||||||
href="{% url 'backups:repository-add' %}">
|
href="{% url 'backups:repository-add' %}">
|
||||||
<span class="fa fa-plus" aria-hidden="true"></span>
|
<span class="fa fa-plus" aria-hidden="true"></span>
|
||||||
{% trans 'Add Remote Repository' %}
|
{% trans 'Add Remote Location' %}
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@ -24,15 +24,16 @@
|
|||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th colspan="2">
|
<th colspan="2">
|
||||||
|
<span style="vertical-align: text-top">
|
||||||
{% if repository.error %}
|
{% if repository.error %}
|
||||||
<span class="fa fa-exclamation-triangle mount-error"
|
<span class="fa fa-exclamation-triangle mount-error"
|
||||||
aria-hidden="true" title="{{ repository.error }}">
|
aria-hidden="true" title="{{ repository.error }}">
|
||||||
</span>
|
</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{{ repository.name }}
|
{{ repository.name }}
|
||||||
|
|
||||||
|
<span class="pull-right">
|
||||||
{% if editable %}
|
{% if editable %}
|
||||||
|
|
||||||
{% if repository.mounted %}
|
{% if repository.mounted %}
|
||||||
@ -65,11 +66,13 @@
|
|||||||
<a title="{% trans 'Remove Location. This will not delete the remote backup.' %}"
|
<a title="{% trans 'Remove Location. This will not delete the remote backup.' %}"
|
||||||
role="button" class="repository-remove btn btn-sm btn-default"
|
role="button" class="repository-remove btn btn-sm btn-default"
|
||||||
href="{% url 'backups:repository-remove' uuid %}">
|
href="{% url 'backups:repository-remove' uuid %}">
|
||||||
<span class="fa fa-trash-o" aria-hidden="true">
|
<span class="fa fa-trash-o" aria-hidden="true">
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
</span>
|
||||||
|
|
||||||
|
</span>
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|||||||
@ -40,10 +40,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<input type="submit" class="btn btn-primary"
|
<input type="submit" class="btn btn-primary"
|
||||||
value="{% trans "Create Repository" %}"/>
|
value="{% trans "Create Location" %}"/>
|
||||||
<a class="btn btn-default" role="button" href="{% url 'backups:index' %}">
|
|
||||||
{% trans "Cancel" %}
|
|
||||||
</a>
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@ -43,11 +43,7 @@
|
|||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
|
|
||||||
<input type="submit" class="btn btn-danger"
|
<input type="submit" class="btn btn-danger"
|
||||||
value="{% trans "Remove Repository" %}"/>
|
value="{% trans "Remove Location" %}"/>
|
||||||
<a class="btn btn-default" role="button"
|
|
||||||
href="{% url 'backups:index' %}">
|
|
||||||
{% trans "Cancel" %}
|
|
||||||
</a>
|
|
||||||
</form>
|
</form>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|||||||
@ -47,10 +47,6 @@
|
|||||||
{% trans "Restoring" %}
|
{% trans "Restoring" %}
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<a class="btn btn-default" role="button"
|
|
||||||
href="{% url 'backups:index' %}">
|
|
||||||
{% trans "Cancel" %}
|
|
||||||
</a>
|
|
||||||
</form>
|
</form>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|||||||
@ -57,9 +57,6 @@
|
|||||||
{{ form|bootstrap }}
|
{{ form|bootstrap }}
|
||||||
|
|
||||||
<input type="submit" class="btn btn-primary" value="{% trans 'Verify Host' %}"/>
|
<input type="submit" class="btn btn-primary" value="{% trans 'Verify Host' %}"/>
|
||||||
<a class="btn btn-default" role="button" href="{% url 'backups:index' %}">
|
|
||||||
{% trans "Cancel" %}
|
|
||||||
</a>
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@ -49,17 +49,6 @@ from .repository import (BorgRepository, SshBorgRepository, get_repository,
|
|||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
subsubmenu = [{
|
|
||||||
'url': reverse_lazy('backups:index'),
|
|
||||||
'text': ugettext_lazy('Backups')
|
|
||||||
}, {
|
|
||||||
'url': reverse_lazy('backups:upload'),
|
|
||||||
'text': ugettext_lazy('Upload')
|
|
||||||
}, {
|
|
||||||
'url': reverse_lazy('backups:create'),
|
|
||||||
'text': ugettext_lazy('Create')
|
|
||||||
}]
|
|
||||||
|
|
||||||
|
|
||||||
@method_decorator(delete_tmp_backup_file, name='dispatch')
|
@method_decorator(delete_tmp_backup_file, name='dispatch')
|
||||||
class IndexView(TemplateView):
|
class IndexView(TemplateView):
|
||||||
@ -71,7 +60,6 @@ class IndexView(TemplateView):
|
|||||||
context = super().get_context_data(**kwargs)
|
context = super().get_context_data(**kwargs)
|
||||||
context['title'] = backups.name
|
context['title'] = backups.name
|
||||||
context['description'] = backups.description
|
context['description'] = backups.description
|
||||||
context['subsubmenu'] = subsubmenu
|
|
||||||
context['manual_page'] = backups.manual_page
|
context['manual_page'] = backups.manual_page
|
||||||
root_repository = BorgRepository(ROOT_REPOSITORY)
|
root_repository = BorgRepository(ROOT_REPOSITORY)
|
||||||
context['root_repository'] = root_repository.get_view_content()
|
context['root_repository'] = root_repository.get_view_content()
|
||||||
@ -90,10 +78,7 @@ class CreateArchiveView(SuccessMessageMixin, FormView):
|
|||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
"""Return additional context for rendering the template."""
|
"""Return additional context for rendering the template."""
|
||||||
context = super().get_context_data(**kwargs)
|
context = super().get_context_data(**kwargs)
|
||||||
context['title'] = backups.name
|
context['title'] = _('Create a new backup')
|
||||||
context['description'] = backups.description
|
|
||||||
context['subsubmenu'] = subsubmenu
|
|
||||||
context['manual_page'] = backups.manual_page
|
|
||||||
return context
|
return context
|
||||||
|
|
||||||
def form_valid(self, form):
|
def form_valid(self, form):
|
||||||
@ -140,10 +125,7 @@ class UploadArchiveView(SuccessMessageMixin, FormView):
|
|||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
"""Return additional context for rendering the template."""
|
"""Return additional context for rendering the template."""
|
||||||
context = super().get_context_data(**kwargs)
|
context = super().get_context_data(**kwargs)
|
||||||
context['title'] = backups.name
|
context['title'] = _('Upload and restore a backup')
|
||||||
context['description'] = backups.description
|
|
||||||
context['subsubmenu'] = subsubmenu
|
|
||||||
context['manual_page'] = backups.manual_page
|
|
||||||
try:
|
try:
|
||||||
disk_info = storage.get_disk_info('/')
|
disk_info = storage.get_disk_info('/')
|
||||||
except PlinthError as exception:
|
except PlinthError as exception:
|
||||||
@ -272,7 +254,6 @@ class AddRepositoryView(SuccessMessageMixin, FormView):
|
|||||||
"""Return additional context for rendering the template."""
|
"""Return additional context for rendering the template."""
|
||||||
context = super().get_context_data(**kwargs)
|
context = super().get_context_data(**kwargs)
|
||||||
context['title'] = _('Create remote backup repository')
|
context['title'] = _('Create remote backup repository')
|
||||||
context['subsubmenu'] = subsubmenu
|
|
||||||
return context
|
return context
|
||||||
|
|
||||||
def form_valid(self, form):
|
def form_valid(self, form):
|
||||||
@ -315,7 +296,6 @@ class VerifySshHostkeyView(SuccessMessageMixin, FormView):
|
|||||||
"""Return additional context for rendering the template."""
|
"""Return additional context for rendering the template."""
|
||||||
context = super().get_context_data(**kwargs)
|
context = super().get_context_data(**kwargs)
|
||||||
context['title'] = _('Verify SSH hostkey')
|
context['title'] = _('Verify SSH hostkey')
|
||||||
context['subsubmenu'] = subsubmenu
|
|
||||||
context['hostname'] = self._get_hostname()
|
context['hostname'] = self._get_hostname()
|
||||||
return context
|
return context
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user