diff options
author | Javier Sánchez Parra <jsanchez@soleta.eu> | 2022-08-25 17:22:54 +0200 |
---|---|---|
committer | Javier Sánchez Parra <jsanchez@soleta.eu> | 2022-09-27 09:48:36 +0200 |
commit | 70eb7389bb5d9015196938d9a589c7d406f29364 (patch) | |
tree | d4a9c650d969e48e6b738abbb0c41aef9e18ecf4 /ogcp/views.py | |
parent | c543ba25a642ebecd1955ad8c1d2c03ad3b3a7f1 (diff) |
Add ogServer parameter to imagesForm
When users select an image, its ogServer is sent too. Then, the back-end
(flask) processes the form to obtain this ogServer and send it the
pertinent requests.
It also makes "Image details" view use this new parameter, and adds
javascript code to ensure that users can only work with several images
at the same time if they belong to the same ogServer.
Diffstat (limited to 'ogcp/views.py')
-rw-r--r-- | ogcp/views.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/ogcp/views.py b/ogcp/views.py index 3b0d134..c2a40b8 100644 --- a/ogcp/views.py +++ b/ogcp/views.py @@ -97,7 +97,7 @@ def validate_elements(elements, min_len=1, max_len=float('inf')): def parse_elements(checkboxes_dict): unwanted_elements = ['csrf_token', 'scope-server', 'scope-center', - 'scope-room'] + 'scope-room', 'image-server'] elements = set() for key, elements_list in checkboxes_dict.items(): if key not in unwanted_elements: @@ -1626,12 +1626,14 @@ def user_delete_post(): @login_required def action_image_info(): form = ImageDetailsForm() - ids = parse_elements(request.args.to_dict()) + params = request.args.to_dict() + ids = parse_elements(params) if not validate_elements(ids, max_len=1): return redirect(url_for('images')) id = ids.pop() - r = g.server.get('/images') + server = get_server_from_ip_port(params['image-server']) + r = server.get('/images') images = r.json()['images'] image = next(img for img in images if img['id'] == int(id)) |