From 249403a6dd64e76750b6719a9a964bed6b231638 Mon Sep 17 00:00:00 2001 From: Johannes Keyser Date: Wed, 31 May 2017 23:53:44 +0200 Subject: [PATCH] diagnostics: Disable button if app/service is not running Reviewed-by: Sunil Mohan Adapa --- .../diagnostics/templates/diagnostics_button.html | 9 +++++++-- plinth/modules/letsencrypt/templates/letsencrypt.html | 2 +- plinth/modules/networks/templates/connections_list.html | 2 +- plinth/modules/openvpn/templates/openvpn.html | 2 +- plinth/modules/tor/templates/tor.html | 2 +- plinth/modules/users/templates/users_list.html | 2 +- plinth/templates/service.html | 2 +- 7 files changed, 13 insertions(+), 8 deletions(-) diff --git a/plinth/modules/diagnostics/templates/diagnostics_button.html b/plinth/modules/diagnostics/templates/diagnostics_button.html index 6126a8743..4f463c51c 100644 --- a/plinth/modules/diagnostics/templates/diagnostics_button.html +++ b/plinth/modules/diagnostics/templates/diagnostics_button.html @@ -23,6 +23,11 @@ action="{% url 'diagnostics:module' module %}"> {% csrf_token %} - + {% if enabled %} + + {% else %} + + {% endif %} diff --git a/plinth/modules/letsencrypt/templates/letsencrypt.html b/plinth/modules/letsencrypt/templates/letsencrypt.html index 5bc9c225e..e258ca2c3 100644 --- a/plinth/modules/letsencrypt/templates/letsencrypt.html +++ b/plinth/modules/letsencrypt/templates/letsencrypt.html @@ -100,7 +100,7 @@ - {% include "diagnostics_button.html" with module="letsencrypt" %} + {% include "diagnostics_button.html" with module="letsencrypt" enabled=True %} {% else %} {% blocktrans trimmed %} No domains have been configured. Configure domains to be able to diff --git a/plinth/modules/networks/templates/connections_list.html b/plinth/modules/networks/templates/connections_list.html index 506c354ac..862db5b29 100644 --- a/plinth/modules/networks/templates/connections_list.html +++ b/plinth/modules/networks/templates/connections_list.html @@ -108,7 +108,7 @@ {% include "connections_diagram.html" %} - {% include "diagnostics_button.html" with module="networks" %} + {% include "diagnostics_button.html" with module="networks" enabled=True %} diff --git a/plinth/modules/openvpn/templates/openvpn.html b/plinth/modules/openvpn/templates/openvpn.html index 3bbdf74ef..ac65c4ad9 100644 --- a/plinth/modules/openvpn/templates/openvpn.html +++ b/plinth/modules/openvpn/templates/openvpn.html @@ -111,7 +111,7 @@ {% endif %}

- {% include "diagnostics_button.html" with module="openvpn" %} + {% include "diagnostics_button.html" with module="openvpn" enabled=status.is_running %}

{% trans "Configuration" %}

diff --git a/plinth/modules/tor/templates/tor.html b/plinth/modules/tor/templates/tor.html index 2bd0be414..736ec84ad 100644 --- a/plinth/modules/tor/templates/tor.html +++ b/plinth/modules/tor/templates/tor.html @@ -53,7 +53,7 @@ {% endif %}

- {% include "diagnostics_button.html" with module="tor" %} + {% include "diagnostics_button.html" with module="tor" enabled=status.is_running %} {% if status.hs_enabled %}
diff --git a/plinth/modules/users/templates/users_list.html b/plinth/modules/users/templates/users_list.html index 35ab68f8c..71978225d 100644 --- a/plinth/modules/users/templates/users_list.html +++ b/plinth/modules/users/templates/users_list.html @@ -64,7 +64,7 @@ {% endfor %}
- {% include "diagnostics_button.html" with module="users" %} + {% include "diagnostics_button.html" with module="users" enabled=True %} diff --git a/plinth/templates/service.html b/plinth/templates/service.html index 45a146689..549a8e63d 100644 --- a/plinth/templates/service.html +++ b/plinth/templates/service.html @@ -57,7 +57,7 @@ {% block diagnostics %} {% if diagnostics_module_name %} - {% include "diagnostics_button.html" with module=diagnostics_module_name %} + {% include "diagnostics_button.html" with module=diagnostics_module_name enabled=service.is_running %} {% endif %} {% endblock %}