summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlejandro Sirgo Rica <asirgo@soleta.eu>2024-06-12 14:16:42 +0200
committerAlejandro Sirgo Rica <asirgo@soleta.eu>2024-06-13 17:38:44 +0200
commit3f16293fea546303775364e2d1f7404815db74f3 (patch)
tree39327f86d19a53c43d597ccf134fd0c57518f0fa
parente7bafd7be9c59f49f92b4f9e0643e2292d0ef9e6 (diff)
js: show only clients in the scope pills
Exclude folders, centers servers and rooms from the scope pills so only clients are shown.
-rw-r--r--ogcp/static/js/ogcp.js18
1 files changed, 8 insertions, 10 deletions
diff --git a/ogcp/static/js/ogcp.js b/ogcp/static/js/ogcp.js
index b23c6e0..a52ff93 100644
--- a/ogcp/static/js/ogcp.js
+++ b/ogcp/static/js/ogcp.js
@@ -25,16 +25,18 @@ async function show_client_mac(pill_id) {
function showSelectedClient(client_checkbox) {
const container = $('#selected-clients');
const pill_id = 'pill-' + client_checkbox.name.replaceAll(/[. ()]/g, '_');
+ const client_name = client_checkbox.name.replaceAll(/_\d+$/g, '');
+ if (client_name === 'scope-room' || client_name === 'scope-center' || client_name === 'folder' || client_name === 'scope-server') {
+ return;
+ }
if (client_checkbox.checked) {
if (!($('#' + pill_id).length)) {
- const client_name = client_checkbox.name.replaceAll(/_\d+$/g, '');
$(container).append('<div class="badge badge-pill og-pill badge-light" ' +
'id="'+ pill_id + '">' + client_name +
'<br>' + client_checkbox.value + '</div>');
- if (client_name !== 'scope-room' && client_name !== 'scope-center' && client_name !== 'folder') {
- show_client_mac(pill_id);
- }
+
+ show_client_mac(pill_id);
}
return;
}
@@ -46,11 +48,7 @@ function showSelectedClientsOnEvents() {
const checkboxes = $('input:checkbox[form|="scopesForm"]');
const container = $('#selected-clients');
- const client_checkboxes = checkboxes.filter(function () {
- return $(this).siblings().length == "1";
- });
-
- client_checkboxes.on('change show-client', function () {
+ checkboxes.on('change show-client', function () {
showSelectedClient(this);
});
}
@@ -401,7 +399,7 @@ function limitCheckboxes() {
checkboxes.on('change', function () {
const checked = this;
checkboxes.filter((i, c) => c !== checked).prop('checked', false);
- checkboxes.not('[name="scope-server"]').each(function() {
+ checkboxes.each(function() {
showSelectedClient(this);
});
checkScopeServer();