Sunil Mohan Adapa 4cb1477c0d
setup: Drop setup_helper and use the new Operation API
- Task of managing an operation's progress is now performed by the new Operation
class. Drop them from setup helper.

- Task of providing install() method is now moved to package module. Instead of
storing operation specific data in setup_helper like objects, store them in
thread specific storage that can retrieved anywhere during the operation without
holding references.

- Progress of an operation show as a progress bar is currently missing. This
will be regression until fixed later.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-08-15 10:36:32 -04:00

90 lines
2.7 KiB
HTML

{% extends "base.html" %}
{% comment %}
# SPDX-License-Identifier: AGPL-3.0-or-later
{% endcomment %}
{% load bootstrap %}
{% load i18n %}
{% load static %}
{% block content %}
{% include "app-header.html" with setup=True %}
{% include "toolbar.html" %}
{% if setup_state.value == 'up-to-date' %}
{% trans "Application installed." %}
{% elif not operations %}
<p>
{% if setup_state.value == 'needs-setup' %}
{% blocktrans trimmed %}
Install this application?
{% endblocktrans %}
{% elif setup_state.value == '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 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> {% trans "Check again" %}
</button>
</div>
{% elif package_conflicts and package_conflicts_action.value != 'ignore' %}
<div class="alert alert-warning" role="alert">
{% blocktrans trimmed %}
<strong>Conflicting Packages:</strong> Some packages installed on
the system conflict with the installation of this app. The following
packages will be removed if you proceed:
{% endblocktrans %}
{% for package in package_conflicts %}
{{ package }}
{% endfor %}
</div>
{% endif %}
<input type="submit" class="btn btn-md btn-primary" name="install"
{% if package_manager_is_busy or has_unavailable_packages %}
disabled="disabled"
{% endif %}
{% if setup_state.value == 'needs-setup' %}
value="{% trans "Install" %}"
{% elif setup_state.value == 'needs-update' %}
value="{% trans "Update" %}"
{% endif %} />
</form>
{% else %}
{% for operation in operations %}
<div class="app-operation">
<span class="fa fa-refresh fa-spin processing"></span>
{{ operation.translated_message }}
</div>
{% endfor %}
{% endif %}
{% endblock %}