mirror of https://git.48k.eu/ogcp
js: show only clients in the scope pills
Exclude folders, centers servers and rooms from the scope pills so only clients are shown.master
parent
e7bafd7be9
commit
3f16293fea
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue