mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-02-04 08:13:38 +00:00
- Splinter/selenium have implicit and explicit waiting time. Implicit wait time will make every negative lookup wait for about 3 seconds before it actually fails. Because we ensure missing elements in quite a few places, this introduces many 3 seconds wait periods during testing. Remove it instead rely on explicit waiting whenever needed. - Explicit wait time is only used during explicitly requests waiting conditions. In a loop the API waits for a maximum of timeout period until a given condition is satisfied. Each time the condition is checked, it goes into sleep for explicit wait period amount of time. This is typically a second or so. Since we are impatient, make it 0.1 instead. - Also make sure that whenever a page is visit()ed, we automatically wait until the page is fully loaded by overriding the splinter wait condition. Otherwise, we will need to introduce waiting code in a lot of places. - Using document.readyState == complete is a better check to ensure that a page is fully loaded. If we proceed with the page 'loading' or 'interactive' state, we will have to change a lot of code to make it wait. - Handle Apache restarts when waiting for page load. The error page apparently is never reaches document.readyState == 'complete'. So, if an error page is encountered, always reload. - While waiting for installation, ensure that we atomically check that page has loaded fully and the installation progress is not being shown. Otherwise, there would be race condition due to installation page refreshing itself. Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
127 lines
3.9 KiB
HTML
127 lines
3.9 KiB
HTML
{% extends "base.html" %}
|
|
{% comment %}
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
{% endcomment %}
|
|
|
|
{% load bootstrap %}
|
|
{% load i18n %}
|
|
{% load static %}
|
|
|
|
{% block page_head %}
|
|
{% if setup_state == 'up-to-date' %}
|
|
<noscript>
|
|
<meta http-equiv="refresh" content="0" />
|
|
</noscript>
|
|
{% elif setup_current_operation %}
|
|
<noscript>
|
|
<meta http-equiv="refresh" content="3" />
|
|
</noscript>
|
|
{% endif %}
|
|
{% endblock %}
|
|
|
|
{% block content %}
|
|
|
|
{% include "app-header.html" with setup=True %}
|
|
|
|
{% include "toolbar.html" %}
|
|
|
|
{% if setup_state == 'up-to-date' %}
|
|
|
|
{% trans "Application installed." %}
|
|
|
|
{% elif not setup_current_operation %}
|
|
|
|
<p>
|
|
{% if setup_state == 'needs-setup' %}
|
|
{% blocktrans trimmed %}
|
|
Install this application?
|
|
{% endblocktrans %}
|
|
{% elif setup_state == 'needs-update' %}
|
|
{% blocktrans trimmed %}
|
|
This application needs an update. Update now?
|
|
{% endblocktrans %}
|
|
{% endif %}
|
|
</p>
|
|
|
|
<form class="form-install" action="" method="post">
|
|
{% csrf_token %}
|
|
|
|
{% if package_manager_is_busy %}
|
|
<div class="alert alert-warning" role="alert">
|
|
{% blocktrans trimmed %}
|
|
Another installation or upgrade is already running.
|
|
Please wait for a few moments before trying again.
|
|
{% endblocktrans %}
|
|
</div>
|
|
{% elif setup_helper.has_unavailable_packages %}
|
|
<div class="alert alert-warning" role="alert">
|
|
{% blocktrans trimmed %}
|
|
This application is currently not available in your distribution.
|
|
{% endblocktrans %}
|
|
<button type="submit" class="btn btn-default btn-sm" name="refresh-packages">
|
|
<span class="fa fa-refresh"></span> Check again
|
|
</button>
|
|
</div>
|
|
{% endif %}
|
|
|
|
<input type="submit" class="btn btn-md btn-primary" name="install"
|
|
{% if package_manager_is_busy or setup_helper.has_unavailable_packages %}
|
|
disabled="disabled"
|
|
{% endif %}
|
|
{% if setup_state == 'needs-setup' %}
|
|
value="{% trans "Install" %}"
|
|
{% elif setup_state == 'needs-update' %}
|
|
value="{% trans "Update" %}"
|
|
{% endif %} />
|
|
|
|
</form>
|
|
|
|
{% else %}
|
|
|
|
{% if setup_current_operation.step == 'pre' %}
|
|
<div class="installing install-state-pre">
|
|
{% trans "Performing pre-install operation" %}
|
|
</div>
|
|
{% elif setup_current_operation.step == 'post' %}
|
|
<div class="installing install-state-post">
|
|
{% trans "Performing post-install operation" %}
|
|
</div>
|
|
{% elif setup_current_operation.step == 'install' %}
|
|
{% with transaction=setup_current_operation.transaction %}
|
|
<div class="installing install-state-installing">
|
|
{% blocktrans trimmed with package_names=transaction.package_names|join:", " status=transaction.status_string %}
|
|
Installing {{ package_names }}: {{ status }}
|
|
{% endblocktrans %}
|
|
</div>
|
|
<div class="progress">
|
|
<div class="progress-bar progress-bar-striped active"
|
|
role="progressbar" aria-valuemin="0" aria-valuemax="100"
|
|
aria-valuenow="{{ transaction.percentage }}"
|
|
style="width: {{ transaction.percentage }}%">
|
|
<span class="sr-only">
|
|
{% blocktrans trimmed with percentage=transaction.percentage %}
|
|
{{ percentage }}% complete
|
|
{% endblocktrans %}
|
|
</span>
|
|
</div>
|
|
</div>
|
|
{% endwith %}
|
|
{% endif %}
|
|
|
|
{% endif %}
|
|
|
|
{% endblock %}
|
|
|
|
|
|
{% block page_js %}
|
|
|
|
{% if setup_current_operation or setup_state == 'up-to-date' %}
|
|
{% if setup_state == 'up-to-date' %}
|
|
<script type="text/javascript" src="{% static 'theme/js/refresh_immediately.js' %}"></script>
|
|
{% else %}
|
|
<script type="text/javascript" src="{% static 'theme/js/refresh.js' %}"></script>
|
|
{% endif %}
|
|
{% endif %}
|
|
|
|
{% endblock %}
|