From 167a4f5f8a4e0fcc2d979468975c3ecd87d30b9d Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Wed, 27 Nov 2019 00:14:44 -0800 Subject: [PATCH] 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 Reviewed-by: James Valleroy --- plinth/modules/openvpn/templates/openvpn.html | 113 ++++++++---------- plinth/modules/openvpn/views.py | 7 +- 2 files changed, 55 insertions(+), 65 deletions(-) diff --git a/plinth/modules/openvpn/templates/openvpn.html b/plinth/modules/openvpn/templates/openvpn.html index 71609f4af..13f9d8777 100644 --- a/plinth/modules/openvpn/templates/openvpn.html +++ b/plinth/modules/openvpn/templates/openvpn.html @@ -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 %} +

{% trans "Status" %}

+ +

+ {% 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 %} +

+ +
+ {% csrf_token %} + + +
+ {% endif %} + + {% if not status.is_setup and status.setup_running %} +

{% trans "Status" %}

+ +

+ + {% trans "OpenVPN setup is running" %} +

+ +

+ {% 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 %} +

+ {% endif %} + + {% if status.is_setup %} + {{ block.super }} + {% endif %} + +{% endblock %} + +{% block configuration %} {% if status.is_setup %} @@ -68,68 +113,8 @@ {% endif %} -

{% trans "Status" %}

- - {% if not status.is_setup and not status.setup_running %} -

- {% 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 %} -

- -
- {% csrf_token %} - - -
- {% endif %} - - {% if not status.is_setup and status.setup_running %} -

- - {% trans "OpenVPN setup is running" %} -

- -

- {% 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 %} -

- {% endif %} - {% if status.is_setup %} -

- {% if status.is_running %} - - {% trans "OpenVPN server is running" %} - {% else %} - - {% trans "OpenVPN server is not running" %} - {% endif %} -

- - {% include "diagnostics_button.html" with module="openvpn" enabled=status.enabled %} - - {% include "port-forwarding-info.html" with service_name=title %} - -

{% trans "Configuration" %}

- -
- {% csrf_token %} - - {{ form|bootstrap }} - - -
+ {{ block.super }} {% endif %} {% endblock %} diff --git a/plinth/modules/openvpn/views.py b/plinth/modules/openvpn/views.py index 668449e06..42e0f25a4 100644 --- a/plinth/modules/openvpn/views.py +++ b/plinth/modules/openvpn/views.py @@ -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'], })