mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 09:36:05 -08:00
Filter applied on <> arrows #627
This commit is contained in:
@@ -654,6 +654,26 @@ if ($ENABLED_DARKMODE === True) {
|
|||||||
devicesList = [];
|
devicesList = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// only loop thru the filtered down list
|
||||||
|
visibleDevices = getCache("ntx_visible_macs")
|
||||||
|
|
||||||
|
if(visibleDevices != "") {
|
||||||
|
visibleDevicesMACs = visibleDevices.split(',');
|
||||||
|
|
||||||
|
devicesList_tmp = [];
|
||||||
|
|
||||||
|
// Iterate through the data and filter only visible devices
|
||||||
|
$.each(devicesList, function(index, item) {
|
||||||
|
// Check if the current item's MAC exists in visibleDevicesMACs
|
||||||
|
if (visibleDevicesMACs.includes(item.dev_MAC)) {
|
||||||
|
devicesList_tmp.push(item);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Update devicesList with the filtered items
|
||||||
|
devicesList = devicesList_tmp;
|
||||||
|
}
|
||||||
|
|
||||||
return devicesList;
|
return devicesList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -795,7 +795,7 @@ function multiEditDevices()
|
|||||||
// Initialize an empty array to store selected rows
|
// Initialize an empty array to store selected rows
|
||||||
var selectedRows = [];
|
var selectedRows = [];
|
||||||
|
|
||||||
console.log($('#tableDevices')[0].rows);
|
// console.log($('#tableDevices')[0].rows);
|
||||||
|
|
||||||
// Loop through each row in the HTML collection
|
// Loop through each row in the HTML collection
|
||||||
for (var i = 0; i < rows.length; i++) {
|
for (var i = 0; i < rows.length; i++) {
|
||||||
@@ -819,7 +819,7 @@ function multiEditDevices()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Now, selectedDevices contains all selected devices
|
// Now, selectedDevices contains all selected devices
|
||||||
console.log(selectedDevices);
|
// console.log(selectedDevices);
|
||||||
|
|
||||||
macs = ""
|
macs = ""
|
||||||
|
|
||||||
@@ -831,5 +831,39 @@ function multiEditDevices()
|
|||||||
window.location.href = window.location.origin + '/maintenance.php#tab_multiEdit?macs=' + macs.slice(0, -1);
|
window.location.href = window.location.origin + '/maintenance.php#tab_multiEdit?macs=' + macs.slice(0, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// Function collects shown devices from the DataTable
|
||||||
|
function getMacsOfShownDevices() {
|
||||||
|
|
||||||
|
rows = $('#tableDevices')[0].rows
|
||||||
|
macs = []
|
||||||
|
|
||||||
|
var devicesDataTableData = $('#tableDevices').dataTable().fnGetData();
|
||||||
|
|
||||||
|
var selectedDevices = [];
|
||||||
|
|
||||||
|
for (var i = 0; i < rows.length; i++) {
|
||||||
|
selectedDevices.push(devicesDataTableData[rows[i]._DT_RowIndex]);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var i = 1; i < selectedDevices.length; i++) {
|
||||||
|
macs.push(selectedDevices[i][mapIndx(11)]); // mapIndx(11) == MAC
|
||||||
|
}
|
||||||
|
|
||||||
|
return macs;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
// Update cahce with shown devices before navigating away
|
||||||
|
window.addEventListener('beforeunload', function(event) {
|
||||||
|
// Call your function here
|
||||||
|
macs = getMacsOfShownDevices();
|
||||||
|
|
||||||
|
setCache("ntx_visible_macs", macs)
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user