summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJose M. Guisado <jguisado@soleta.eu>2023-06-26 17:39:55 +0200
committerJose M. Guisado <jguisado@soleta.eu>2023-06-27 08:56:49 +0200
commit9c91fb16b4999160ad8dec4a10e98f0953668eca (patch)
tree71972e4bb8f01ab041bb4983ff4062bd213aee09
parentd029df8e842f8dce9d48f8ec9e11e336b0af46e9 (diff)
views: add placeholder text inside dhcp conf textarea
Help user by hinting the current expected format via a placeholder in the textarea box. Current regex has its limitations when parsing dhcpd host declarations. It does not support multi line host declarations or different options outside "hardware ethernet ..." and "fixed-address ...".
-rw-r--r--ogcp/views.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/ogcp/views.py b/ogcp/views.py
index 0a65c17..179a98f 100644
--- a/ogcp/views.py
+++ b/ogcp/views.py
@@ -905,6 +905,13 @@ def action_client_add():
return render_template('actions/client_details.html', form=form,
parent="scopes.html", scopes=scopes)
+PLACEHOLDER_TEXT = '''host example1 { hardware ethernet 94:c6:91:a6:25:1a; fixed-address 10.141.10.100; }
+host example2 { hardware ethernet 94:c6:91:a6:25:1b; fixed-address 10.141.10.101; }
+host example3 { hardware ethernet 94:c6:91:a6:25:1c; fixed-address 10.141.10.102; }
+host example4 { hardware ethernet 94:c6:91:a6:25:1d; fixed-address 10.141.10.103; }
+host example5 { hardware ethernet 94:c6:91:a6:25:1e; fixed-address 10.141.10.104; }
+host example6 { hardware ethernet 94:c6:91:a6:25:1f; fixed-address 10.141.10.105; }
+...'''
@app.route('/action/clients/import', methods=['GET'])
@login_required
def action_clients_import_get():
@@ -923,6 +930,7 @@ def action_clients_import_get():
for room in rooms if room['id'] == int(selected_room_id)]
form.room.choices = selected_room
form.room.render_kw = {'readonly': True}
+ form.dhcpd_conf.render_kw = {'placeholder': PLACEHOLDER_TEXT}
scopes, _clients = get_scopes()
return render_template('actions/import_clients.html', form=form,