FreedomBox/plinth/templates/package_install.html
Sunil Mohan Adapa 3a22e1717e packages: refresh package list before install and handle errors
- Refresh package list before trying to install packages.  Also lookup
  the ID of the package, including the version, using the newly fetched
  package list.

- Call on_install() callback requested by modules only if the package
  installation was successful.  Handle any exception raised in the
  callback itself.

- Handle exceptions raised during packagekit operations.  Also check the
  returned results for error code.

- Capture error/success status during a transaction.  Don't destroy the
  transaction object until the error/success status has been collected.
  When a view is refreshed after completion of a transaction collect the
  result of the transaction and show it to the user.

- Handle cases where package searches in the package list fails.  Simply
  show the package name without its description.
2015-04-04 12:25:12 -04:00

80 lines
2.1 KiB
HTML

{% extends "base.html" %}
{% comment %}
#
# This file is part of Plinth.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
{% endcomment %}
{% load bootstrap %}
{% block page_head %}
{% if is_installing %}
<meta http-equiv="refresh" content="3" />
{% endif %}
{% endblock %}
{% block content %}
<h2>Installation</h2>
{% if not is_installing %}
<p>This feature requires addtional packages to be installed. Do you
wish to install them?</p>
<table class="table">
<thead>
<tr><th>Package</th><th>Summary</th></tr>
</thead>
<tbody>
{% for package_name, package in packages.items %}
<tr>
<td>{{ package_name }}</td>
<td>{{ package.get_summary }}</td>
</tr>
{% endfor %}
</tbody>
</table>
<form action="" method="post">
{% csrf_token %}
<input type="submit" class="btn btn-md btn-primary" value="Install" />
</form>
{% else %}
{% for key, transaction in transactions.items %}
<div>Installing {{ transaction.package_names|join:", " }}:
{{ transaction.status_string }}
</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">{{ transaction.percentage }}% complete</span>
</div>
</div>
{% endfor %}
{% endif %}
{% endblock %}