summaryrefslogtreecommitdiffstats
path: root/ogcp/static
diff options
context:
space:
mode:
authorDaniel García Moreno <danigm@soleta.eu>2022-09-13 12:01:23 +0200
committerJavier Sánchez Parra <jsanchez@soleta.eu>2022-09-27 09:48:36 +0200
commitefe97317534942c97bfbc132e096655b8191105f (patch)
tree88237db1120a3bf4daeff0233a82505f269a098e /ogcp/static
parent1db12230f94c33c8d701f4af5ea3fd48e76c4dad (diff)
Add different selection mode for the tree view
Diffstat (limited to 'ogcp/static')
-rw-r--r--ogcp/static/js/ogcp.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/ogcp/static/js/ogcp.js b/ogcp/static/js/ogcp.js
index d5615b8..e72bc83 100644
--- a/ogcp/static/js/ogcp.js
+++ b/ogcp/static/js/ogcp.js
@@ -265,3 +265,28 @@ function checkImageServer() {
});
});
}
+
+function limitCheckboxes() {
+ const checkboxes = $('input:checkbox[form|="scopesForm"]');
+
+ checkboxes.on('change', function () {
+ const checked = this;
+ checkboxes.filter((i, c) => c !== checked).prop('checked', false);
+ checkboxes.each(function() {
+ showSelectedClient(this);
+ });
+ checkScopeServer();
+ });
+}
+
+function checkScopeServer() {
+ const servers = $('input:checkbox[form|="scopesForm"][name="scope-server"]');
+ servers.each(function() {
+ const checkbox = this;
+ const checkboxChildren = $('input:checkbox', this.parentNode).not(this);
+ if (checkboxChildren.length == 0) return;
+
+ const checkedChildren = checkboxChildren.filter(":checked");
+ checkbox.checked = checkedChildren.length > 0;
+ });
+}