summaryrefslogtreecommitdiffstats
path: root/ogcp
diff options
context:
space:
mode:
authorJavier Hernandez <jhernandez@soleta.eu>2023-12-21 13:21:46 +0100
committerOpenGnSys Support Team <soporte-og@soleta.eu>2023-12-21 17:00:14 +0100
commit3587806937f7fd1bf2af38f6a894be13f09666a3 (patch)
tree3badfc56c918753f4c59734505a0d2cf0d0b40d6 /ogcp
parent555460f982e733136360a770698e2eb01099f311 (diff)
views: Allow to change boot mode in edit client
Allow user to change boot mode when editing a client. First item selected is the client's current boot mode. This is so that if the user edits the client's data, but doesnt touch bootmode, it stays the same.
Diffstat (limited to 'ogcp')
-rw-r--r--ogcp/views.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/ogcp/views.py b/ogcp/views.py
index e745d7d..7336142 100644
--- a/ogcp/views.py
+++ b/ogcp/views.py
@@ -916,6 +916,7 @@ def action_client_update():
"remote": form.remote.data,
"room": int(form.room.data),
"name": form.name.data,
+ "boot": form.boot.data,
"mac": form.mac.data }
server = get_server_from_ip_port(form.server.data)
r = server.post('/client/update', payload)
@@ -938,7 +939,7 @@ def action_client_update():
r = server.get('/client/info', payload)
db_client = r.json()
- form.mac.render_kw = {'placeholder': 'aabbccddeeaa'}
+ form.mac.render_kw = {'readonly': True}
form.server.data = "{0}:{1}".format(server.ip, server.port)
form.ip.data = db_client['ip']
form.ip.render_kw = {'readonly': True}
@@ -949,7 +950,13 @@ def action_client_update():
form.remote.data = db_client['remote']
form.maintenance.data = db_client['maintenance']
form.netiface.data = db_client['netiface']
- form.boot.render_kw = {'readonly': True}
+
+ current_mode = db_client['boot']
+ r = server.get('/mode')
+ available_modes = [(current_mode, current_mode)]
+ available_modes.extend([(mode, mode) for mode in r.json()['modes']
+ if mode != current_mode])
+ form.boot.choices = list(available_modes)
r = server.get('/scopes')
room_id = db_client['room']