From 09fd3455281732be70f8c6d03ccb5ae5206ead54 Mon Sep 17 00:00:00 2001 From: jokob-sk Date: Wed, 16 Jul 2025 08:32:51 +1000 Subject: [PATCH] color alignemnt network tab, pop-up box devDetails --- front/js/ui_components.js | 37 +++++++++++++++++++++---- front/network.php | 33 +++++++++++++--------- front/php/templates/language/fr_fr.json | 0 front/php/templates/language/it_it.json | 0 front/php/templates/language/uk_ua.json | 0 5 files changed, 51 insertions(+), 19 deletions(-) mode change 100644 => 100755 front/php/templates/language/fr_fr.json mode change 100644 => 100755 front/php/templates/language/it_it.json mode change 100644 => 100755 front/php/templates/language/uk_ua.json diff --git a/front/js/ui_components.js b/front/js/ui_components.js index 1c324dd3..df94323e 100755 --- a/front/js/ui_components.js +++ b/front/js/ui_components.js @@ -630,17 +630,21 @@ function getStatusBadgeParts(tmp_devPresentLastScan, tmp_devAlertDown, macAddres let css = 'bg-gray text-white statusUnknown'; let icon = ''; let status = 'unknown'; + let cssText = ''; if (tmp_devPresentLastScan == 1) { css = 'bg-green text-white statusOnline'; + cssText = 'text-green'; icon = ''; status = 'online'; } else if (tmp_devAlertDown == 1) { css = 'bg-red text-white statusDown'; + cssText = 'text-red'; icon = ''; status = 'down'; } else if (tmp_devPresentLastScan != 1) { css = 'bg-gray text-white statusOffline'; + cssText = 'text-gray50'; icon = ''; status = 'offline'; } @@ -650,6 +654,7 @@ function getStatusBadgeParts(tmp_devPresentLastScan, tmp_devAlertDown, macAddres return { cssClass: css, + cssText: cssText, iconHtml: icon, mac: macAddress, text: cleanedText, @@ -729,10 +734,12 @@ function initSelect2() { templateSelection: function (data, container) { if (!data.id) return data.text; // default for placeholder etc. + const device = getDevDataByMac(data.id); + const badge = getStatusBadgeParts( - getDevDataByMac(data.id, "devPresentLastScan"), - getDevDataByMac(data.id, "devAlertDown"), - data.id + device.devPresentLastScan, + device.devAlertDown, + device.devMac ) $(container).addClass(badge.cssClass); @@ -740,8 +747,19 @@ function initSelect2() { // Custom HTML const html = $(` - - ${atob(getDevDataByMac(data.id, "devIcon"))} + + ${atob(device.devIcon)} ${data.text} (${badge.iconHtml}) @@ -840,10 +858,17 @@ function initHoverNodeInfo() { let hoverTimeout = null; let lastTarget = null; + // remove title as it's replaced by the hover-box + $(document).on('mouseover', '.hover-node-info', function () { + this.removeAttribute('title'); + + $(this).attr("title", ""); // remove title as it's replaced by the hover-box + }); + $(document).on('mouseenter', '.hover-node-info', function (e) { const $el = $(this); lastTarget = this; - + // use timeout to prevent a quick hover and exit toi flash a card when navigating to a target node with your mouse clearTimeout(hoverTimeout); diff --git a/front/network.php b/front/network.php index b2796f6c..f915d6bf 100755 --- a/front/network.php +++ b/front/network.php @@ -28,7 +28,7 @@
' // _id is added so it doesn't conflict with AdminLTE tab behavior - .'
'.$decoded_icon.'
'.$node_name.'' .$str_port. + .'
'.$decoded_icon.'
'.$node_name.'' .$str_port. '
'; @@ -269,7 +273,7 @@ $networkDeviceTypes = str_replace("]", "",(str_replace("[", "", getSettingValue("NETWORK_DEVICE_TYPES")))); - $sql = "SELECT node_name, node_mac, online, node_type, node_ports_count, parent_mac, node_icon + $sql = "SELECT node_name, node_mac, online, node_type, node_ports_count, parent_mac, node_icon, node_alert FROM ( SELECT a.devName as node_name, @@ -277,7 +281,8 @@ a.devPresentLastScan as online, a.devType as node_type, a.devParentMAC as parent_mac, - a.devIcon as node_icon + a.devIcon as node_icon, + a.devAlertDown as node_alert FROM Devices a WHERE a.devType in (".$networkDeviceTypes.") AND devIsArchived = 0 @@ -304,7 +309,9 @@ 'node_type' => $row['node_type'], 'parent_mac' => $row['parent_mac'], 'node_icon' => $row['node_icon'], - 'node_ports_count' => $row['node_ports_count']); + 'node_ports_count' => $row['node_ports_count'], + 'node_alert' => $row['node_alert'] + ); } // Control no rows @@ -323,6 +330,7 @@ $row['node_type'], $row['node_ports_count'], $row['node_icon'], + $row['node_alert'], $activetab); $activetab = ""; // reset active tab indicator, only the first tab is active @@ -755,11 +763,10 @@ function initTree(myHierarchy) highlightedCss = nodeData.data.mac == selectedNodeMac ? " highlightedNode" : ""; - // css indicating online/offline status - statusCss = ` netStatus-${nodeData.data.status}`; + const badgeConf = getStatusBadgeParts(nodeData.data.presentLastScan, nodeData.data.alertDown, nodeData.data.mac, statusText = '') return result = `
- ${devicePort} ${deviceIcon} + ${devicePort} ${deviceIcon} ${nodeData.data.name}
diff --git a/front/php/templates/language/fr_fr.json b/front/php/templates/language/fr_fr.json old mode 100644 new mode 100755 diff --git a/front/php/templates/language/it_it.json b/front/php/templates/language/it_it.json old mode 100644 new mode 100755 diff --git a/front/php/templates/language/uk_ua.json b/front/php/templates/language/uk_ua.json old mode 100644 new mode 100755