ui: Handle and show most page load errors as alerts

- In addition to the OperationalError, also handle all generic exceptions during
page submit and page load. Redirect to the same page or parent using
breadcrumbs.

- Log exceptions handled by common error middleware so that they are also part
of the system logs.

- Update kiwix test as needed.

- Refactor some test code that is setting up the menu items.

Tests:

- When an error occurs during form POST, the same page is show but with an error
message.

- When an error occurs in an app page during GET, the browser is redirected to
the parent section.

- When an error occurs in apps page during GET, the browser is redirected to the
home page.

- When an error occurs in home page during GET, the error is not handled and
default 500 handle is triggered.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
This commit is contained in:
Sunil Mohan Adapa authored and Veiko Aasa committed 2024-12-29 17:16:06 +02:00
1 parent 59a0a3b25f
commit 407fccba2f
7 files changed
+97 -44

No files matched your search

+2 -5
View File
@@ -20,9 +20,7 @@ from django.conf import settings
from django.http import Http404
from django.urls import re_path
from plinth import cfg
from plinth import menu as menu_module
from plinth import module_loader
from plinth import cfg, module_loader
from plinth.modules import help as help_module
from plinth.modules.help import views
@@ -57,9 +55,8 @@ def fixture_developer_configuration():
@pytest.fixture(name='menu', autouse=True)
def fixture_menu():
def fixture_menu(test_menu):
"""Initialized menu module."""
menu_module.init()
help_module.HelpApp() # Create all menu components