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/static/js/ogcp.js | |
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/static/js/ogcp.js')
-rw-r--r-- | ogcp/static/js/ogcp.js | 17 |
1 files changed, 17 insertions, 0 deletions
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); + }); + }); +} |