diff options
Diffstat (limited to 'ogcp')
-rw-r--r-- | ogcp/static/js/ogcp.js | 18 |
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(); |