From 52b61df025641d3070140ce4fa0bd28aead047e4 Mon Sep 17 00:00:00 2001 From: Alejandro Sirgo Rica Date: Tue, 23 Jul 2024 12:40:12 +0200 Subject: js: use div instead of br in client pills Improve html structure inside client pills so the values can be obtained with jquery by matching the name field of the div. --- ogcp/static/js/ogcp.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'ogcp/static') diff --git a/ogcp/static/js/ogcp.js b/ogcp/static/js/ogcp.js index 548122b..af95dde 100644 --- a/ogcp/static/js/ogcp.js +++ b/ogcp/static/js/ogcp.js @@ -10,7 +10,7 @@ async function show_client_mac(pill_id) { return } - const ip = pill.html().split('
')[1] + const ip = $('[name="ip"]', pill).html() if (!macs.get(ip)) { const resp = await fetch('/client/mac?ip=' + ip); @@ -19,7 +19,7 @@ async function show_client_mac(pill_id) { } const mac = macs.get(ip) - pill.append('
' + mac); + pill.append('
' + mac + '
'); } function showSelectedClient(client_checkbox) { @@ -33,8 +33,10 @@ function showSelectedClient(client_checkbox) { if (client_checkbox.checked) { if (!($('#' + pill_id).length)) { $(container).append('
' + client_name + - '
' + client_checkbox.value + '
'); + 'id="'+ pill_id + '">' + + '
' + client_name + '
' + + '
' + client_checkbox.value + '
'+ + ''); show_client_mac(pill_id); } -- cgit v1.2.3-18-g5258