js: Simplify auto-refresh page logic

- Implement ability to refresh page at the framework level so that every page
does not need to handle it.

- Refresh after number of seconds specified in context of the view.

Tests performed:

- Trigger the following functions and ensure that page reload after 3 seconds
during the running operation while it does refresh before and after the
operation.
  - Diagnostics tests from the module.
  - Gitweb repository cloning.
  - Monkeysphere publish key to server.
  - OpenVPN setup.
  - Tor configuration update.
  - Manual software update.
  - App installation.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
This commit is contained in:
Sunil Mohan Adapa authored and Veiko Aasa committed 2020-06-29 10:09:04 +03:00
1 parent 1b5a10a628
commit 3efff2fa42
18 files changed
+45 -176

No files matched your search

-14
View File
@@ -7,16 +7,6 @@
{% load i18n %}
{% load static %}
{% block page_head %}
{% if config_running %}
<noscript>
<meta http-equiv="refresh" content="3" />
</noscript>
{% endif %}
{% endblock %}
{% block status %}
{% if config_running %}
<h3>{% trans "Status" %}</h3>
@@ -112,8 +102,4 @@
<script type="text/javascript" src="{% static 'tor/tor.js' %}"></script>
{% if config_running %}
<script type="text/javascript" src="{% static 'theme/js/refresh.js' %}"></script>
{% endif %}
{% endblock %}
+1
View File
@@ -46,6 +46,7 @@ def index(request):
'has_diagnostics': True,
'is_enabled': status['enabled'],
'is_running': status['is_running'],
'refresh_page_sec': 3 if bool(config_process) else None,
})