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 ...".
master
Jose M. Guisado 2023-06-26 17:39:55 +02:00
parent d029df8e84
commit 9c91fb16b4
1 changed files with 8 additions and 0 deletions

View File

@ -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,