better check for available device #1132

This commit is contained in:
jokob-sk
2025-08-11 19:52:16 +10:00
parent 1c4e6c7e38
commit e73c8e830a
4 changed files with 12 additions and 18 deletions

View File

@@ -782,15 +782,15 @@ function initSelect2() {
// ------------------------------------------
// Render a device link with hover-over functionality
function renderDeviceLink(data, container, useName = false) {
if (!data.id || !isValidMac(data.id)) return data.text; // default placeholder etc.
// If no valid MAC, return placeholder text
if (!data.id || !isValidMac(data.id)) {
return data.text;
}
const device = getDevDataByMac(data.id);
const badge = getStatusBadgeParts(
device.devPresentLastScan,
device.devAlertDown,
device.devMac
);
if (!device) {
return data.text;
}
// badge class and hover-info class to container
$(container)