From 915b8013d94a8aee72aa1dafa80b3ed880652ad7 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Mon, 14 Jan 2019 12:44:56 -0800 Subject: [PATCH] setup: Reduce refresh time when application is already installed In the event setup page is being shown after the application installation is already completed. Immediately reload instead of waiting for 3 seconds are usual. Signed-off-by: Sunil Mohan Adapa Reviewed-by: James Valleroy --- plinth/modules/diagnostics/templates/diagnostics.html | 1 + .../modules/monkeysphere/templates/monkeysphere.html | 1 + plinth/modules/openvpn/templates/openvpn.html | 1 + plinth/modules/tor/templates/tor.html | 1 + plinth/modules/upgrades/templates/upgrades.html | 1 + plinth/templates/setup.html | 11 ++++++++++- static/themes/default/js/refresh.js | 6 +++--- 7 files changed, 18 insertions(+), 4 deletions(-) diff --git a/plinth/modules/diagnostics/templates/diagnostics.html b/plinth/modules/diagnostics/templates/diagnostics.html index 797d1356f..f8f45f94a 100644 --- a/plinth/modules/diagnostics/templates/diagnostics.html +++ b/plinth/modules/diagnostics/templates/diagnostics.html @@ -81,6 +81,7 @@ {% block page_js %} {% if is_running %} + {% endif %} {% endblock %} diff --git a/plinth/modules/monkeysphere/templates/monkeysphere.html b/plinth/modules/monkeysphere/templates/monkeysphere.html index f33442fdd..2a9aa2378 100644 --- a/plinth/modules/monkeysphere/templates/monkeysphere.html +++ b/plinth/modules/monkeysphere/templates/monkeysphere.html @@ -173,6 +173,7 @@ {% block page_js %} {% if running %} + {% endif %} {% endblock %} diff --git a/plinth/modules/openvpn/templates/openvpn.html b/plinth/modules/openvpn/templates/openvpn.html index 6d37f07e7..6ac6d0c90 100644 --- a/plinth/modules/openvpn/templates/openvpn.html +++ b/plinth/modules/openvpn/templates/openvpn.html @@ -133,5 +133,6 @@ {% block page_js %} {% if status.setup_running %} + {% endif %} {% endblock %} diff --git a/plinth/modules/tor/templates/tor.html b/plinth/modules/tor/templates/tor.html index 2a168a64d..74ca11668 100644 --- a/plinth/modules/tor/templates/tor.html +++ b/plinth/modules/tor/templates/tor.html @@ -173,6 +173,7 @@ {% if config_running %} + {% endif %} {% endblock %} diff --git a/plinth/modules/upgrades/templates/upgrades.html b/plinth/modules/upgrades/templates/upgrades.html index 067176c06..1c6e035a5 100644 --- a/plinth/modules/upgrades/templates/upgrades.html +++ b/plinth/modules/upgrades/templates/upgrades.html @@ -88,5 +88,6 @@ {% if is_busy %} + {% endif %} {% endblock %} diff --git a/plinth/templates/setup.html b/plinth/templates/setup.html index d7a96b060..94bfb2f01 100644 --- a/plinth/templates/setup.html +++ b/plinth/templates/setup.html @@ -23,7 +23,11 @@ {% load static %} {% block page_head %} - {% if setup_current_operation or setup_state == 'up-to-date' %} + {% if setup_state == 'up-to-date' %} + + {% elif setup_current_operation %} @@ -140,6 +144,11 @@ {% if setup_current_operation or setup_state == 'up-to-date' %} + {% if setup_state == 'up-to-date' %} + + {% else %} + + {% endif %} {% endif %} {% endblock %} diff --git a/static/themes/default/js/refresh.js b/static/themes/default/js/refresh.js index 891d9abdb..12ab9fdac 100644 --- a/static/themes/default/js/refresh.js +++ b/static/themes/default/js/refresh.js @@ -21,9 +21,9 @@ function sleep(ms) { // Refresh the page once in n seconds async function refresh(ms) { + if (typeof ms === 'undefined') + ms = 3000; + await sleep(ms); window.location.reload(); } - -refresh(3000); -