From 9c91fb16b4999160ad8dec4a10e98f0953668eca Mon Sep 17 00:00:00 2001 From: "Jose M. Guisado" Date: Mon, 26 Jun 2023 17:39:55 +0200 Subject: 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 ...". --- ogcp/views.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'ogcp') 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, -- cgit v1.2.3-18-g5258