From 17f91229d6792aa182d1a67adf323488bf2d784d Mon Sep 17 00:00:00 2001 From: Javier Sánchez Parra Date: Thu, 25 Aug 2022 17:22:54 +0200 Subject: 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. --- ogcp/static/js/ogcp.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'ogcp/static/js') diff --git a/ogcp/static/js/ogcp.js b/ogcp/static/js/ogcp.js index bdd7581..d5615b8 100644 --- a/ogcp/static/js/ogcp.js +++ b/ogcp/static/js/ogcp.js @@ -248,3 +248,20 @@ function RemovePartition(evt) { }); } +function checkImageServer() { + const images = $('input:checkbox[form|="imagesForm"]:not(:hidden)') + + images.on('change', function() { + const selectedServer = $('#' + $.escapeSelector(this.dataset.server)); + const serversSelector = 'input:checkbox[name|="image-server"]'; + const nonSelectedServers = $(serversSelector).not(selectedServer); + + selectedServer.prop('checked', true); + + nonSelectedServers.each(function() { + $(this).prop('checked', false); + const checkboxes = $('input:checkbox[data-server|="' + this.id + '"]'); + checkboxes.prop('checked', false); + }); + }); +} -- cgit v1.2.3-18-g5258