js: prevent js exception in pages without pill control

Add check to test if a pill control has been found and don't try
to add mac data to non existent client pill controls.
master
Alejandro Sirgo Rica 2024-05-13 10:07:47 +02:00
parent 17f8b25fe5
commit 2b905ddcaf
2 changed files with 6 additions and 1 deletions

View File

@ -5,6 +5,11 @@ let updateTimeoutId = null;
async function show_client_mac(pill_id) {
const pill = $('#' +pill_id);
if (!pill.length) {
return
}
const ip = pill.html().split('<br>')[1]
if (!macs.get(ip)) {

View File

@ -111,7 +111,7 @@
<!-- ChartJS -->
<script src="{{ url_for('static', filename='AdminLTE/plugins/chart.js/Chart.min.js') }}"></script>
<script src="{{ url_for('static', filename='js/ogcp.js') }}?v=3"></script>
<script src="{{ url_for('static', filename='js/ogcp.js') }}?v=4"></script>
<script>
// error messages