Sunil Mohan Adapa 3efff2fa42
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>
2020-06-29 10:09:04 +03:00

53 lines
1.5 KiB
HTML

{% extends 'app.html' %}
{% comment %}
# SPDX-License-Identifier: AGPL-3.0-or-later
{% endcomment %}
{% load i18n %}
{% load static %}
{% block configuration %}
{% if not is_running %}
<form class="form form-run-diagnostics" method="post"
action="{% url 'diagnostics:index' %}">
{% csrf_token %}
<input type="submit" class="btn btn-primary"
value="{% trans "Run Diagnostics" %}"/>
</form>
{% else %}
<p>{% trans "Diagnostics test is currently running" %}</p>
<div class="progress">
<div class="progress-bar progress-bar-striped active"
role="progressbar" aria-valuemin="0" aria-valuemax="100"
aria-valuenow="{{ results.progress_percentage }}"
style="width: {{ results.progress_percentage }}%">
{{ results.progress_percentage }}%
</div>
</div>
{% endif %}
{% if results %}
<h3>{% trans "Results" %}</h3>
{% if results.error %}
<div class="alert alert-danger alert-dismissable">
<a class="close" data-dismiss="alert">&times;</a>
{{ results.error }}
</div>
{% else %}
{% for app_id, app_results in results.results.items %}
<h4>{% blocktrans %}App: {{ app_id }}{% endblocktrans %}</h4>
{% if app_results %}
{% include "diagnostics_results.html" with results=app_results %}
{% else %}
<p><span class="fa fa-hourglass-o"></span></p>
{% endif %}
{% endfor %}
{% endif %}
{% endif %}
{% endblock %}