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
master
Javier Hernandez 2024-01-12 12:41:12 +01:00 committed by OpenGnSys Support Team
parent 088316e006
commit 04fe9e8367
1 changed files with 6 additions and 1 deletions

View File

@ -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())