summaryrefslogtreecommitdiffstats
path: root/ogcp/views.py
diff options
context:
space:
mode:
authorAlejandro Sirgo Rica <asirgo@soleta.eu>2024-07-30 13:10:29 +0200
committerAlejandro Sirgo Rica <asirgo@soleta.eu>2024-08-05 10:03:12 +0200
commit3e35997131f51e892b93157c6d18a3a0ba759318 (patch)
treec722d8601b7b4f36af12db95a905ca6212abdda0 /ogcp/views.py
parent695b83d4730e624a7cffa7e6ee14a64ece226eb8 (diff)
ogcp: add connected clients list view
Add view to show the connected clients with access to the client details of each one. The view is accessible through the main dashboard.
Diffstat (limited to 'ogcp/views.py')
-rw-r--r--ogcp/views.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/ogcp/views.py b/ogcp/views.py
index 1beaa5b..2a89d01 100644
--- a/ogcp/views.py
+++ b/ogcp/views.py
@@ -551,6 +551,28 @@ def get_client_mac():
return jsonify(pretty_mac)
+@app.route('/client/list', methods=['GET'])
+@login_required
+def client_list():
+ clients_response = multi_request('get', '/clients')
+ servers_data = {}
+ for i in clients_response:
+ server_id = i['server'].id
+ if server_id not in servers_data:
+ servers_data[server_id] = {}
+ servers_data[server_id]['clients'] = i['json']['clients']
+ for server in servers:
+ if server.id == server_id:
+ servers_data[server_id]['name'] = server.name
+
+ scopes, clients = get_scopes()
+ selected_clients = list(get_selected_clients(scopes['scope']).items())
+
+ return render_template('client_list.html', servers_data=servers_data,
+ selected_clients=selected_clients,
+ scopes=scopes)
+
+
@app.route('/scopes/')
@login_required
def scopes():