summaryrefslogtreecommitdiffstats
path: root/ogcp/views.py
diff options
context:
space:
mode:
Diffstat (limited to 'ogcp/views.py')
-rw-r--r--ogcp/views.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/ogcp/views.py b/ogcp/views.py
index 9e1a028..d022d04 100644
--- a/ogcp/views.py
+++ b/ogcp/views.py
@@ -2410,6 +2410,38 @@ def action_room_update():
return render_template('actions/room_update.html', form=form,
scopes=scopes)
+@app.route('/action/room/info', methods=['GET'])
+@login_required
+def action_room_info():
+ form = RoomForm(request.form)
+ params = request.args.to_dict()
+ room_id = params.get('scope-room')
+ if not room_id:
+ flash(_('Please, select a room to update'), category='error')
+ return redirect(url_for('scopes'))
+ server = get_server_from_ip_port(params['scope-server'])
+
+ del form.center
+
+ payload = {"id": int(room_id)}
+ r = server.get('/room/info', payload)
+ if not r:
+ return ogserver_down('scopes')
+ if r.status_code != requests.codes.ok:
+ return ogserver_error('scopes')
+ form.name.data = r.json()['name']
+ form.name.render_kw = {'readonly': True}
+ form.gateway.data = r.json()['gateway']
+ form.gateway.render_kw = {'readonly': True}
+ form.netmask.data = r.json()['netmask']
+ form.netmask.render_kw = {'readonly': True}
+
+ form.submit.render_kw = {'readonly': True, 'hidden': True}
+
+ scopes, clients = get_scopes()
+ return render_template('actions/room_details.html', form=form,
+ scopes=scopes)
+
@app.route('/action/room/delete', methods=['GET', 'POST'])
@login_required
def action_room_delete():