diff options
author | Javier Sánchez Parra <jsanchez@soleta.eu> | 2022-08-23 17:41:27 +0200 |
---|---|---|
committer | Javier Sánchez Parra <jsanchez@soleta.eu> | 2022-09-27 09:48:35 +0200 |
commit | 9ca010a981bb7c0a4dcc91fb0bcfdf0eb086fdb4 (patch) | |
tree | 3c794eb60c0ab0ce363b35ae4f6fdc5e58a3f02b /ogcp/views.py | |
parent | 3d42c2c66c5fe4cfb3fcab6847234b6e27ad4eb1 (diff) |
Adapt Add center to work with several ogServers
This commit adds a new select input with all available ogServers to "Add
center" view. The ogCP creates the center in the ogServer selected by
the user.
Diffstat (limited to 'ogcp/views.py')
-rw-r--r-- | ogcp/views.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/ogcp/views.py b/ogcp/views.py index 6b10321..8a0d8ba 100644 --- a/ogcp/views.py +++ b/ogcp/views.py @@ -1255,7 +1255,8 @@ def action_center_add(): if request.method == 'POST': payload = {"name": form.name.data, "comment": form.comment.data} - r = g.server.post('/center/add', payload) + server = get_server_from_ip_port(form.server.data) + r = server.post('/center/add', payload) if r.status_code != requests.codes.ok: flash(_('Server replied with error code when adding the center'), category='error') @@ -1263,6 +1264,9 @@ def action_center_add(): flash(_('Center added successfully'), category='info') return redirect(url_for("scopes")) else: + server_choices = [(server.ip + ':' + str(server.port), server.name) + for server in servers] + form.server.choices = server_choices scopes, clients = get_scopes() return render_template('actions/add_center.html', form=form, scopes=scopes) |