From e82d959c85b159fe8e73a7e3ad6b5a11d7f35390 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Thu, 11 Sep 2025 08:25:18 -0700 Subject: [PATCH] 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 Reviewed-by: Veiko Aasa --- plinth/templates/app-logs.html | 42 ++++++++++++++++++++++++++++++ plinth/templates/toolbar.html | 9 ++++++- plinth/urls.py | 2 ++ plinth/views.py | 20 ++++++++++++++ static/themes/default/css/main.css | 6 +++++ static/themes/default/js/main.js | 12 +++++++++ 6 files changed, 90 insertions(+), 1 deletion(-) create mode 100644 plinth/templates/app-logs.html diff --git a/plinth/templates/app-logs.html b/plinth/templates/app-logs.html new file mode 100644 index 000000000..c701ac07b --- /dev/null +++ b/plinth/templates/app-logs.html @@ -0,0 +1,42 @@ +{% extends "base.html" %} +{% comment %} +# SPDX-License-Identifier: AGPL-3.0-or-later +{% endcomment %} + +{% load i18n %} + +{% block content %} +

{% trans "Logs" %}: {{ app_info.name }}

+ +

+ {% blocktrans trimmed %} + These are the last lines of the logs for services involved in this app. + If you want to report a bug, please use the bug + tracker and attach this log to the bug report. + {% endblocktrans %} +

+ +
+
+ + {% trans "Caution:" %} +
+
+ {% blocktrans trimmed %} + Please remove any personal information from the log before submitting + the bug report. + {% endblocktrans %} +
+
+ + {% for component in logs %} +
+

{{ component.unit }}: {{ component.description }}

+

+ +

+
+ {% endfor %} + +{% endblock %} diff --git a/plinth/templates/toolbar.html b/plinth/templates/toolbar.html index e5b13a3a1..78b818a83 100644 --- a/plinth/templates/toolbar.html +++ b/plinth/templates/toolbar.html @@ -21,7 +21,7 @@ {% endif %} - {% if has_diagnostics or show_uninstall or has_backup_restore %} + {% if has_diagnostics or has_logs or show_uninstall or has_backup_restore %}