FreedomBox/plinth/templates/toolbar.html
Sunil Mohan Adapa e82d959c85
views: Add a menu entry and view for showing logs of an app
Tests:

- View logs menu entry is shown only for apps with daemons. It is now shown for
others such as Backups. It does not add menu for apps such as power.

- View logs entry for Date & Time shows show logs for multiple units. View logs
entry for Nextcloud shows many units.

- The textarea occupies full width. It is not editable. It is always scrolled to
the bottom. Control-A and Control-C selects all the text in it. It is re-sizable
vertically.

- The header shows unit name and unit description correctly.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
2025-09-18 16:35:23 +03:00

81 lines
3.0 KiB
HTML

{% comment %}
# SPDX-License-Identifier: AGPL-3.0-or-later
{% endcomment %}
{% load i18n %}
{% block toolbar %}
<section class="toolbar">
<div class="btn-toolbar" role="toolbar">
{% include "clients-button.html" with clients=app_info.clients enabled=is_enabled %}
{% if app_info.donation_url %}
<a target="_blank" rel="noopener noreferrer"
class="btn btn-default button-secondary button-donate" role="button"
href="{{ app_info.donation_url }}">
<span class="fa fa-heart"></span>
{% trans "Donate" %}
<span class="fa fa-external-link"></span>
</a>
{% endif %}
{% if has_diagnostics or has_logs or show_uninstall or has_backup_restore %}
<!-- Single button -->
<div class="btn-group button-secondary dropdown">
<button type="button" class="btn btn-default dropdown-toggle"
data-bs-toggle="dropdown" aria-haspopup="true"
aria-expanded="false" id="id_extra_actions_button">
<span class="fa fa-cog" aria-hidden="true"></span>
</button>
<div class="dropdown-menu" aria-labelledby="id_extra_actions_button">
{% if has_diagnostics %}
{% include "diagnostics_button.html" with app_id=app_id enabled=is_enabled %}
{% endif %}
{% if has_logs %}
<a class="dropdown-item view-logs-item"
href="{% url 'logs' app_id=app_id %}"
title="{% trans "View Logs" %}">
{% trans "View Logs" %}
</a>
{% endif %}
{% if has_backup_restore %}
<a class="dropdown-item backup-item"
href="{% url 'backups:create' app_id=app_id %}"
title="{% trans "Backup" %}">
{% trans "Backup" %}
</a>
<a class="dropdown-item restore-item"
href="{% url 'backups:index' %}"
title="{% trans "Restore" %}">
{% trans "Restore" %}
</a>
{% endif %}
{% if show_rerun_setup %}
<form class="form form-rerun-setup-button" method="post"
action="{% url 'rerun-setup' app_id=app_id %}">
{% csrf_token %}
<input type="submit" class="dropdown-item no-running-status"
name="rerun-setup" value="{% trans "Re-run setup" %}"/>
</form>
{% endif %}
{% if show_uninstall %}
<a class="dropdown-item uninstall-item"
href="{% url 'uninstall' app_id=app_id %}"
title="{% trans "Uninstall" %}">
{% trans "Uninstall" %}
</a>
{% endif %}
</div>
</div>
{% endif %}
</div>
<div class="toolbar-collapsed-content">
{% include "clients.html" with clients=app_info.clients enabled=is_enabled %}
</div>
</section>
{% endblock toolbar %}