From 609ff0e19ece42b68ff80a3eb14086690bd35c25 Mon Sep 17 00:00:00 2001 From: Javier Hernandez Date: Wed, 13 Dec 2023 11:05:24 +0100 Subject: views: add select repo in import clients Add, in import clients menu, a selector to select the repo to be associated with the clients about to import modify OG_CLIENT_DEFAULT_BOOT variable to be 'oglive'; 'pxe' is not a valid boot mode, and ogserver would return an error --- ogcp/forms/action_forms.py | 1 + ogcp/views.py | 3 +++ 2 files changed, 4 insertions(+) (limited to 'ogcp') diff --git a/ogcp/forms/action_forms.py b/ogcp/forms/action_forms.py index d98a00a..3d02f8a 100644 --- a/ogcp/forms/action_forms.py +++ b/ogcp/forms/action_forms.py @@ -127,6 +127,7 @@ class ClientDetailsForm(FlaskForm): class ImportClientsForm(FlaskForm): server = HiddenField() room = SelectField(label=_l('Room')) + repo = SelectField(label=_l('Repository')) dhcpd_conf = TextAreaField(label=_l('dhcpd configuration')) import_btn = SubmitField(label=_l('Import')) diff --git a/ogcp/views.py b/ogcp/views.py index f64d33c..0d80cc7 100644 --- a/ogcp/views.py +++ b/ogcp/views.py @@ -1015,6 +1015,8 @@ 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} + repositories = get_repositories(server) + form.repo.choices = [(repo["id"], repo["name"]) for repo in repositories] form.dhcpd_conf.render_kw = {'placeholder': PLACEHOLDER_TEXT} scopes, _clients = get_scopes() @@ -1056,6 +1058,7 @@ def action_clients_import_post(): 'netiface': OG_CLIENT_DEFAULT_NETIFACE, 'netmask': "0", 'remote': OG_CLIENT_DEFAULT_REMOTE, + "repo_id": int(form.repo.data), 'room': int(form.room.data)} for client in clients: payload['name'] = client[0] -- cgit v1.2.3-18-g5258