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-08-31 15:57:52 +0200 |
commit | 17f91229d6792aa182d1a67adf323488bf2d784d (patch) | |
tree | c4ec25c5ecd96f4d137c00c953c7ac2bed153884 /ogcp/templates | |
parent | 0b5dd659f1e5bb3487f58f34b778d90f6c33cebd (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/templates')
-rw-r--r-- | ogcp/templates/images.html | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/ogcp/templates/images.html b/ogcp/templates/images.html index 4231df2..d053913 100644 --- a/ogcp/templates/images.html +++ b/ogcp/templates/images.html @@ -8,17 +8,31 @@ </form> {{ super() }} </form> + +<script> + // Launch the javascript on document ready, so all the global functions exists + // in the scope + document.addEventListener('readystatechange', () => { + if (document.readyState === 'complete') { + checkImageServer(); + } + }); +</script> {% endblock %} {% block sidebar %} <ul id="servers" class="nav flex-column nav-pills"> {% for response in responses %} + {% set server_str = response["server"]["ip"] ~ ":" ~ response["server"]["port"] %} + <input class="form-check-input" type="checkbox" form="imagesForm" + id="{{ server_str }}" value="{{ server_str }}" + onclick="return false;" name="image-server" hidden/> <li class="nav-item"><b>{{ response["server"]["name"] }}</b> <ul id="images" class="nav flex-column nav-pills"> {% for image in response["json"]["images"] %} <li id="{{ image["name"] }}_{{ image["id"] }}" class="nav-item"> <input class="form-check-input" type="checkbox" form="imagesForm" - value="{{ image["id"] }}" + data-server="{{ server_str }}" value="{{ image["id"] }}" {% if image.get("selected", False) %}checked{% endif %} name="{{ image["name"] }}_{{ image["id"] }}" /> {{ image["name"] }} @@ -41,4 +55,3 @@ </button> {% endif %} {% endblock %} - |