openvpn: Use app.html instead of simple_app.html

- Place status section above download profile section for coding convenience.

- Reuse diagnostics button and port forwarding information from app.html

- Reuse status section instead of custom one.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa 2019-11-27 00:14:44 -08:00 committed by James Valleroy
parent ece2dd5e57
commit 167a4f5f8a
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808
2 changed files with 55 additions and 65 deletions

View File

@ -1,4 +1,4 @@
{% extends "simple_app.html" %}
{% extends "app.html" %}
{% comment %}
#
# This file is part of FreedomBox.
@ -33,9 +33,54 @@
{% endblock %}
{% block configuration %}
{% block status %}
{% include "clients.html" with clients=clients enabled=is_enabled %}
{% if not status.is_setup and not status.setup_running %}
<h3>{% trans "Status" %}</h3>
<p>
{% blocktrans trimmed %}
OpenVPN has not yet been setup. Performing a secure setup
takes a very long time. Depending on how fast your
{{ box_name }} is, it may even take hours. If the setup
is interrupted, you may start it again.
{% endblocktrans %}
</p>
<form class="form form-setup" method="post"
action="{% url 'openvpn:setup' %}">
{% csrf_token %}
<input type="submit" class="btn btn-primary"
value="{% trans "Start setup" %}"/>
</form>
{% endif %}
{% if not status.is_setup and status.setup_running %}
<h3>{% trans "Status" %}</h3>
<p class="running-status-parent">
<span class='running-status loading'></span>
{% trans "OpenVPN setup is running" %}
</p>
<p>
{% blocktrans trimmed %}
To perform a secure setup, this process takes a very long
time. Depending on how fast your {{ box_name }} is, it may
even take hours. If the setup is interrupted, you may start
it again.
{% endblocktrans %}
</p>
{% endif %}
{% if status.is_setup %}
{{ block.super }}
{% endif %}
{% endblock %}
{% block configuration %}
{% if status.is_setup %}
@ -68,68 +113,8 @@
{% endif %}
<h3>{% trans "Status" %}</h3>
{% if not status.is_setup and not status.setup_running %}
<p>
{% blocktrans trimmed %}
OpenVPN has not yet been setup. Performing a secure setup
takes a very long time. Depending on how fast your
{{ box_name }} is, it may even take hours. If the setup
is interrupted, you may start it again.
{% endblocktrans %}
</p>
<form class="form form-setup" method="post"
action="{% url 'openvpn:setup' %}">
{% csrf_token %}
<input type="submit" class="btn btn-primary"
value="{% trans "Start setup" %}"/>
</form>
{% endif %}
{% if not status.is_setup and status.setup_running %}
<p class="running-status-parent">
<span class='running-status loading'></span>
{% trans "OpenVPN setup is running" %}
</p>
<p>
{% blocktrans trimmed %}
To perform a secure setup, this process takes a very long
time. Depending on how fast your {{ box_name }} is, it may
even take hours. If the setup is interrupted, you may start
it again.
{% endblocktrans %}
</p>
{% endif %}
{% if status.is_setup %}
<p class="running-status-parent">
{% if status.is_running %}
<span class='running-status active'></span>
{% trans "OpenVPN server is running" %}
{% else %}
<span class='running-status inactive'></span>
{% trans "OpenVPN server is not running" %}
{% endif %}
</p>
{% include "diagnostics_button.html" with module="openvpn" enabled=status.enabled %}
{% include "port-forwarding-info.html" with service_name=title %}
<h3>{% trans "Configuration" %}</h3>
<form class="form form-configuration" method="post">
{% csrf_token %}
{{ form|bootstrap }}
<input type="submit" class="btn btn-primary"
value="{% trans "Update setup" %}"/>
</form>
{{ block.super }}
{% endif %}
{% endblock %}

View File

@ -59,12 +59,17 @@ def index(request):
return TemplateResponse(
request, 'openvpn.html', {
'title': openvpn.name,
'name': openvpn.name,
'clients': openvpn.clients,
'description': openvpn.description,
'manual_page': openvpn.manual_page,
'port_forwarding_info': openvpn.port_forwarding_info,
'status': status,
'form': form
'form': form,
'show_status_block': True,
'is_running': status['is_running'],
'diagnostics_module_name': 'openvpn',
'is_enabled': status['enabled'],
})