mirror of
https://github.com/unraid/webgui.git
synced 2026-04-19 16:20:55 -05:00
Toggle based on majority checkbox state
This commit is contained in:
@@ -119,6 +119,12 @@ function vm() {
|
||||
buttons(document.vm);
|
||||
});
|
||||
}
|
||||
function thread2containers(n) {
|
||||
const selector = $('form[name=ct]').find(`[name$=":${n}"]`);
|
||||
const checkboxes = selector.length;
|
||||
const checked = selector.filter(':checked').length;
|
||||
selector.prop('checked', (checkboxes - checked > checked ? true : false)).change();
|
||||
}
|
||||
function ct() {
|
||||
// fetch the current container assignments
|
||||
$.post('/webGui/include/CPUset.php',{id:'ct',cpus:'<?=$cpuset?>'},function(d){
|
||||
@@ -126,9 +132,9 @@ function ct() {
|
||||
$('#table-ct').html(data[0]);
|
||||
$('#names-ct').val(data[1]);
|
||||
buttons(document.ct);
|
||||
// inject global cpu pinning links
|
||||
// inject thread to containers toggles
|
||||
$('form[name=ct]').find('thead tr th:gt(1)').each((i, elem) => {
|
||||
elem.innerHTML = elem.innerHTML.replace(/(\d+)/g, `<a href="javascript:void(0)" data-state="false" onclick="$(this).data('state', !$(this).data('state')); $('form[name=ct]').find('[name$=":$1"]').prop('checked', $(this).data('state')).change()">$1</a>`);
|
||||
elem.innerHTML = elem.innerHTML.replace(/(\d+)/g, `<a href="#" onclick="thread2containers(this.innerText);return false;" title="Toggle thread to containers">$1</a>`);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user