diff options
author | Javier Hernandez <jhernandez@soleta.eu> | 2024-01-12 12:41:12 +0100 |
---|---|---|
committer | OpenGnSys Support Team <soporte-og@soleta.eu> | 2024-01-12 14:27:22 +0100 |
commit | 04fe9e836746144a597d270db16142046f1b69b3 (patch) | |
tree | 76f8fe565f028e819e98a272154300d8f83803e6 | |
parent | 088316e006638c2f2b7c9de98df40e8f488f9c52 (diff) |
views: Make session form easier to understand
Show a more detailed description of each choice
Display an error and redirect the user if an empty list of os's was
received. Post does not work with an empty list
-rw-r--r-- | ogcp/views.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/ogcp/views.py b/ogcp/views.py index c414af3..c00098f 100644 --- a/ogcp/views.py +++ b/ogcp/views.py @@ -838,9 +838,14 @@ def action_session(): form.ips.data = ' '.join(ips) r = server.get('/session', payload={'client': list(ips)}) sessions = r.json()['sessions'] + if not sessions: + flash(_('ogServer returned an empty session list'), + category='error') + return redirect(url_for('commands')) + for os in sessions: choice = (f"{os['disk']} {os['partition']}", - f"{os['name']} ({os['disk']},{os['partition']})") + f"OS: {os['name']} (Disk:{os['disk']}, Partition:{os['partition']})") form.os.choices.append(choice) scopes, clients = get_scopes(set(ips)) selected_clients = list(get_selected_clients(scopes['scope']).items()) |