mirror of https://git.48k.eu/ogcp
views: remove MAC data in /action/client/search
Remove MAC from clients in client search view. The generation of the MAC data requires individual /client/info requests for each client causing huge server load for big deployments.master
parent
159f4c56a5
commit
89cc9d3f9f
|
@ -19,9 +19,6 @@
|
|||
<label for="ip-filter">{{ _('IP Address') }}</label>
|
||||
<input type="text" id="ip-filter" class="form-control mb-2">
|
||||
|
||||
<label for="mac-filter">{{ _('MAC') }}</label>
|
||||
<input type="text" id="mac-filter" class="form-control mb-2">
|
||||
|
||||
<button id="search-button" class="btn btn-primary">{{ _('Search') }}</button>
|
||||
</div>
|
||||
|
||||
|
@ -50,7 +47,7 @@
|
|||
}
|
||||
|
||||
const li = document.createElement('li');
|
||||
li.textContent = `${client.name} (IP: ${client.ip.join(', ')} | MAC: ${client.mac})`;
|
||||
li.textContent = `${client.name} (IP: ${client.ip.join(', ')})`;
|
||||
ul.appendChild(li);
|
||||
});
|
||||
}
|
||||
|
@ -58,13 +55,11 @@
|
|||
function filterClients() {
|
||||
const nameFilter = document.getElementById('name-filter').value.toLowerCase();
|
||||
const ipFilter = document.getElementById('ip-filter').value;
|
||||
const macFilter = document.getElementById('mac-filter').value;
|
||||
|
||||
const filtered = clients.filter(client => {
|
||||
const matchesName = nameFilter ? client.name.toLowerCase().includes(nameFilter) : true;
|
||||
const matchesIP = ipFilter ? client.ip.some(ip => ip.includes(ipFilter)) : true;
|
||||
const matchesMAC = macFilter ? client.mac.includes(macFilter) : true;
|
||||
return matchesName && matchesIP && matchesMAC;
|
||||
return matchesName && matchesIP;
|
||||
});
|
||||
|
||||
renderClients(filtered);
|
||||
|
@ -74,7 +69,7 @@
|
|||
document.getElementById('search-button').addEventListener('click', filterClients);
|
||||
|
||||
// Search on Enter key press
|
||||
document.querySelectorAll('#name-filter, #ip-filter, #mac-filter').forEach(input => {
|
||||
document.querySelectorAll('#name-filter, #ip-filter').forEach(input => {
|
||||
input.addEventListener('keydown', event => {
|
||||
if (event.key === 'Enter') {
|
||||
event.preventDefault();
|
||||
|
|
|
@ -2007,12 +2007,6 @@ def action_client_delete():
|
|||
def action_client_search():
|
||||
scopes, clients = get_scopes()
|
||||
clients = parse_scopes_from_tree(scopes, 'computer')
|
||||
for client in clients:
|
||||
payload = {'client': [client['ip'][0]]}
|
||||
info_response = multi_request('get', '/client/info', payload)
|
||||
for res in info_response:
|
||||
mac = res['json']['mac'].lower()
|
||||
client['mac'] = mac
|
||||
|
||||
return render_template('actions/client_search.html',
|
||||
scopes=scopes,
|
||||
|
|
Loading…
Reference in New Issue