summaryrefslogtreecommitdiffstats
path: root/modules-available/locations/templates/mismatch-cleanup.html
diff options
context:
space:
mode:
authorSimon Rettberg2023-05-12 14:21:28 +0200
committerSimon Rettberg2023-05-12 14:21:28 +0200
commitdf5fd48da3a0163375e4567485b882f14baf6ead (patch)
tree35e423b91fd8a6524e06416d5092d1f716b6a364 /modules-available/locations/templates/mismatch-cleanup.html
parent[eventlog] Remove stray line (c&p error) (diff)
downloadslx-admin-df5fd48da3a0163375e4567485b882f14baf6ead.tar.gz
slx-admin-df5fd48da3a0163375e4567485b882f14baf6ead.tar.xz
slx-admin-df5fd48da3a0163375e4567485b882f14baf6ead.zip
[locations] cleanup: Hide/disable move button if action not available
Hide the button entirely if there are no movable machines in the displayed list. Disable the button as long as the user selected at least one unmovable machine.
Diffstat (limited to 'modules-available/locations/templates/mismatch-cleanup.html')
-rw-r--r--modules-available/locations/templates/mismatch-cleanup.html24
1 files changed, 21 insertions, 3 deletions
diff --git a/modules-available/locations/templates/mismatch-cleanup.html b/modules-available/locations/templates/mismatch-cleanup.html
index a6f45d27..53a956df 100644
--- a/modules-available/locations/templates/mismatch-cleanup.html
+++ b/modules-available/locations/templates/mismatch-cleanup.html
@@ -32,7 +32,7 @@
<tr>
<td>
<div class="checkbox checkbox-inline">
- <input id="machine-{{machineuuid}}" type="checkbox" name="machines[]" value="{{machineuuid}}" {{disabled}}>
+ <input class="mcb {{#canmove}}cmov{{/canmove}}" id="machine-{{machineuuid}}" type="checkbox" name="machines[]" value="{{machineuuid}}" {{disabled}}>
<label for="machine-{{machineuuid}}">{{hostname}}{{^hostname}}{{clientip}}{{/hostname}}</label>
</div>
</td>
@@ -60,10 +60,28 @@
<span class="glyphicon glyphicon-repeat"></span>
{{lang_resetMachines}}
</button>
- <button type="submit" class="btn btn-success" name="action" value="movemachines">
+ {{#canmove}}
+ <button id="btn-move" type="submit" class="btn btn-success" name="action" value="movemachines">
<span class="glyphicon glyphicon-arrow-right"></span>
{{lang_moveMachines}}
</button>
+ {{/canmove}}
</div>
</form>
-<div class="clearfix"></div> \ No newline at end of file
+<div class="clearfix"></div>
+
+<script>
+ document.addEventListener('DOMContentLoaded', function () {
+ var $btn = $('#btn-move');
+ if ($btn.length === 0)
+ return;
+ var ccheck = function() {
+ var $e = $('input.mcb:checked');
+ var nope = $e.is(':not(.cmov)');
+ var yep = $e.is('.cmov');
+ $btn.prop('disabled', nope || !yep);
+ };
+ ccheck();
+ $('input.mcb').change(ccheck);
+ });
+</script> \ No newline at end of file