views: Use dedicated view when showing an app with operations

Closes: #2309.

- This prevents processing of AppView when the app is being uninstalled. For at
least two apps, this has failed because the AppView assumes that app and its
dependencies are installed.

- Use a dedicated template as well is simplify app template.

Tests:

- Installing and uninstalling an app works.

- Refreshing the app page during uninstall does not lead to an error for samba
and email apps.

- Unit tests pass.

- Functional tests for samba and email work.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa authored and James Valleroy committed 2023-01-30 20:08:11 -05:00
1 parent a94ebc567d
commit d4b21ef1e4
5 files changed
+94 -49

No files matched your search

+5 -5
View File
@@ -91,11 +91,11 @@ def make_request(request, view, **kwargs):
def test_samba_shares_view(rf):
"""Test that a share list has correct view data."""
with patch('plinth.views.AppView.get_context_data', return_value={
'is_enabled': True
}), patch('plinth.modules.samba.get_users',
return_value=USERS), patch('plinth.modules.storage.get_mounts',
return_value=DISKS):
with (patch('plinth.views.AppView.get_context_data',
return_value={'is_enabled': True}),
patch('plinth.modules.samba.get_users', return_value=USERS),
patch('plinth.modules.storage.get_mounts', return_value=DISKS),
patch('plinth.views.AppView.app', return_value=None)):
view = views.SambaAppView.as_view()
response, _ = make_request(rf.get(''), view)