summaryrefslogtreecommitdiffstats
path: root/ogcp/views.py
diff options
context:
space:
mode:
Diffstat (limited to 'ogcp/views.py')
-rw-r--r--ogcp/views.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/ogcp/views.py b/ogcp/views.py
index 9a88bbc..ba9f1a3 100644
--- a/ogcp/views.py
+++ b/ogcp/views.py
@@ -1172,6 +1172,19 @@ def action_client_delete():
else:
return redirect(url_for('scopes'))
+def get_clients_modes(ips, server):
+ modes = {}
+ for ip in ips:
+ r = server.get('/client/info', payload={"client": [ip]})
+ resp = r.json()
+ current_boot = resp['boot']
+ client_name = resp['name']
+ if current_boot not in modes:
+ modes[current_boot] = [client_name]
+ else:
+ modes[current_boot].append(client_name)
+ return modes
+
@app.route('/action/mode', methods=['GET', 'POST'])
@login_required
def action_mode():
@@ -1195,6 +1208,7 @@ def action_mode():
return redirect(url_for('commands'))
server = get_server_from_clients(ips)
+ modes_set = get_clients_modes(ips, server)
r = server.get('/mode')
available_modes = [(mode, mode) for mode in r.json()['modes']]
form.boot.choices = list(available_modes)
@@ -1204,7 +1218,7 @@ def action_mode():
selected_clients = list(get_selected_clients(scopes['scope']).items())
return render_template('actions/mode.html', form=form, scopes=scopes,
selected_clients=selected_clients,
- clients=clients)
+ clients=clients, modes_set=modes_set)
@app.route('/action/oglive', methods=['GET', 'POST'])