diff options
author | Javier Hernandez <jhernandez@soleta.eu> | 2024-01-18 13:19:02 +0100 |
---|---|---|
committer | OpenGnSys Support Team <soporte-og@soleta.eu> | 2024-01-18 17:04:59 +0100 |
commit | b6b16f895e72a049eeafc0e07eb9336d0bd9825e (patch) | |
tree | 88ae00e3b64e6199b5bba8271975ea868db1230e | |
parent | cfd98c664b5e2f5d617d7509e52ab95281641aeb (diff) |
views: preselect most used bootmode1.1.3-12
In "set boot-mode" preselect bootmode that is most used by the clients
selected.
-rw-r--r-- | ogcp/views.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/ogcp/views.py b/ogcp/views.py index c0b2c98..f560fa1 100644 --- a/ogcp/views.py +++ b/ogcp/views.py @@ -1347,7 +1347,11 @@ def action_mode(): flash(_('Ogserver replied with status code not ok'), category='error') return redirect(url_for('commands')) - available_modes = [(mode, mode) for mode in r.json()['modes']] + most_used_mode = max(modes_set, key=lambda m: len(modes_set[m])) + available_modes = [] + if most_used_mode in r.json()['modes']: + available_modes.append((most_used_mode, most_used_mode)) + available_modes.extend([(mode, mode) for mode in r.json()['modes'] if mode != most_used_mode]) if not available_modes: flash(_('no boot templates are available in the server'), category='error') |