summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlejandro Sirgo Rica <asirgo@soleta.eu>2024-07-08 11:11:33 +0200
committerAlejandro Sirgo Rica <asirgo@soleta.eu>2024-07-15 14:45:49 +0200
commit5af2b3738be739796ae98ce68a3ea9162c7248bf (patch)
tree40123ba8cc44172b9f44251a83bbfa86f5b698e3
parent0d2f38ac4780deca0ad3a2c9fb248136bb4dfb58 (diff)
ogcp: enable modification of client ip
Add 'id' value to the /client/update payload. Enable modification for the ip input field in the client update form.
-rw-r--r--ogcp/forms/action_forms.py1
-rw-r--r--ogcp/views.py3
2 files changed, 3 insertions, 1 deletions
diff --git a/ogcp/forms/action_forms.py b/ogcp/forms/action_forms.py
index 69149da..e72e37c 100644
--- a/ogcp/forms/action_forms.py
+++ b/ogcp/forms/action_forms.py
@@ -126,6 +126,7 @@ class FolderForm(FlaskForm):
class ClientDetailsForm(FlaskForm):
server = HiddenField()
+ client_id = HiddenField()
name = StringField(label=_l('Name'),
validators=[InputRequired()])
ip = StringField(label=_l('IP'),
diff --git a/ogcp/views.py b/ogcp/views.py
index f22bb62..2a6c244 100644
--- a/ogcp/views.py
+++ b/ogcp/views.py
@@ -1343,6 +1343,7 @@ def action_client_update():
return redirect(url_for("scopes"))
payload = {"ip": form.ip.data,
+ "id": int(form.client_id.data),
"serial_number": form.serial_number.data,
"netdriver": "generic",
"maintenance": form.maintenance.data,
@@ -1380,8 +1381,8 @@ def action_client_update():
db_client = r.json()
form.server.data = "{0}:{1}".format(server.ip, server.port)
+ form.client_id.data = db_client['id']
form.ip.data = db_client['ip']
- form.ip.render_kw = {'readonly': True}
form.name.data = db_client['name']
form.mac.data = prettify_mac(db_client['mac'])
form.serial_number.data = db_client['serial_number']