From 145b3ecc65803937a0a40672158652e770a7fda7 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Thu, 18 Aug 2022 21:49:25 -0700 Subject: [PATCH] operation: Show operations on app page in addition to setup page - Will be utilized by uninstall. Tests: - Operation progress is shown during uninstall of coturn app. Signed-off-by: Sunil Mohan Adapa Reviewed-by: James Valleroy --- plinth/templates/app.html | 74 +++++++++++++++++++++------------------ plinth/views.py | 4 +++ 2 files changed, 43 insertions(+), 35 deletions(-) diff --git a/plinth/templates/app.html b/plinth/templates/app.html index bc30d849a..8f9beef85 100644 --- a/plinth/templates/app.html +++ b/plinth/templates/app.html @@ -14,49 +14,53 @@ {% include "app-header.html" %} - {% include "toolbar.html" with enabled=is_enabled %} + {% if not operations %} + {% include "toolbar.html" with enabled=is_enabled %} - {% block subsubmenu %} - {% if subsubmenu %} - {% show_subsubmenu subsubmenu %} - {% endif %} - {% endblock %} + {% block subsubmenu %} + {% if subsubmenu %} + {% show_subsubmenu subsubmenu %} + {% endif %} + {% endblock %} - {% block status %} - {% if is_running is not None and not is_running %} - - {% endif %} - {% endblock %} + {% block status %} + {% if is_running is not None and not is_running %} + + {% endif %} + {% endblock %} - {% block internal_zone %} - {% include "internal-zone.html" %} - {% endblock %} + {% block internal_zone %} + {% include "internal-zone.html" %} + {% endblock %} - {% block port_forwarding_info %} - {% include "port-forwarding-info.html" with service_name=app_info.name %} - {% endblock %} + {% block port_forwarding_info %} + {% include "port-forwarding-info.html" with service_name=app_info.name %} + {% endblock %} - {% block configuration %} - {% if form %} -

{% trans "Configuration" %}

+ {% block configuration %} + {% if form %} +

{% trans "Configuration" %}

-
- {% csrf_token %} + + {% csrf_token %} - {{ form|bootstrap }} + {{ form|bootstrap }} - -
- {% endif %} - {% endblock %} + + + {% endif %} + {% endblock %} - {% block extra_content %} - {% endblock %} + {% block extra_content %} + {% endblock %} + {% else %} + {% include "operations.html" %} + {% endif %} {% endblock %} diff --git a/plinth/views.py b/plinth/views.py index 6310005af..e95990401 100644 --- a/plinth/views.py +++ b/plinth/views.py @@ -256,6 +256,10 @@ class AppView(FormView): context['has_diagnostics'] = self.app.has_diagnostics() context['port_forwarding_info'] = get_port_forwarding_info(self.app) context['app_enable_disable_form'] = self.get_enable_disable_form() + context['operations'] = operation.manager.filter(self.app.app_id) + context['refresh_page_sec'] = None + if context['operations']: + context['refresh_page_sec'] = 3 from plinth.modules.firewall.components import Firewall context['firewall'] = self.app.get_components_of_type(Firewall)