From f6f5b7a478977e22e4c111bf4c252c3b02aed4b9 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Thu, 14 Nov 2024 08:34:53 -0800 Subject: [PATCH] power: Refactor display of package manager busy alerts Tests: - Trigger the message using code change and observe the messages displayed. Signed-off-by: Sunil Mohan Adapa Reviewed-by: Veiko Aasa --- plinth/modules/power/templates/power.html | 15 +------------- .../power/templates/power_busy_warning.html | 20 +++++++++++++++++++ .../power/templates/power_restart.html | 15 +------------- .../power/templates/power_shutdown.html | 15 +------------- 4 files changed, 23 insertions(+), 42 deletions(-) create mode 100644 plinth/modules/power/templates/power_busy_warning.html diff --git a/plinth/modules/power/templates/power.html b/plinth/modules/power/templates/power.html index 667101aab..1ac694bcd 100644 --- a/plinth/modules/power/templates/power.html +++ b/plinth/modules/power/templates/power.html @@ -8,20 +8,7 @@ {% block configuration %} - {% if pkg_manager_is_busy %} -
-
- - {% trans "Caution:" %} -
-
- {% blocktrans trimmed %} - Currently an installation or upgrade is running. - Consider waiting until it's finished before shutting down or restarting. - {% endblocktrans %} -
-
- {% endif %} + {% include "power_busy_warning.html" %}
diff --git a/plinth/modules/power/templates/power_busy_warning.html b/plinth/modules/power/templates/power_busy_warning.html new file mode 100644 index 000000000..29fa14524 --- /dev/null +++ b/plinth/modules/power/templates/power_busy_warning.html @@ -0,0 +1,20 @@ +{% comment %} +# SPDX-License-Identifier: AGPL-3.0-or-later +{% endcomment %} + +{% load i18n %} + +{% if pkg_manager_is_busy %} +
+
+ + {% trans "Caution:" %} +
+
+ {% blocktrans trimmed %} + Currently an installation or upgrade is running. Consider waiting + until it's finished before shutting down or restarting. + {% endblocktrans %} +
+
+{% endif %} diff --git a/plinth/modules/power/templates/power_restart.html b/plinth/modules/power/templates/power_restart.html index ff739cd13..c16436c03 100644 --- a/plinth/modules/power/templates/power_restart.html +++ b/plinth/modules/power/templates/power_restart.html @@ -29,20 +29,7 @@

{% endif %} - {% if pkg_manager_is_busy %} -
-
- - {% trans "Caution:" %} -
-
- {% blocktrans trimmed %} - Currently an installation or upgrade is running. - Consider waiting until it's finished before shutting down or restarting. - {% endblocktrans %} -
-
- {% endif %} + {% include "power_busy_warning.html" %}
{% csrf_token %} diff --git a/plinth/modules/power/templates/power_shutdown.html b/plinth/modules/power/templates/power_shutdown.html index 3aea69f1e..014f7676a 100644 --- a/plinth/modules/power/templates/power_shutdown.html +++ b/plinth/modules/power/templates/power_shutdown.html @@ -28,20 +28,7 @@

{% endif %} - {% if pkg_manager_is_busy %} -
-
- - {% trans "Caution:" %} -
-
- {% blocktrans trimmed %} - Currently an installation or upgrade is running. - Consider waiting until it's finished before shutting down or restarting. - {% endblocktrans %} -
-
- {% endif %} + {% include "power_busy_warning.html" %} {% csrf_token %}