From 61de54bc346bd10d9aa657a646d2b7d89b5cfcaf Mon Sep 17 00:00:00 2001 From: jokob-sk Date: Mon, 14 Jul 2025 11:01:16 +1000 Subject: [PATCH] net refactor --- docker-compose.yml | 10 +- docs/DEBUG_INVALID_JSON.md | 2 +- front/css/app.css | 2 +- front/css/dark-patch.css | 2 +- front/css/system-dark-patch.css | 2 +- front/deviceDetailsTools.php | 18 +-- front/js/settings_utils.js | 52 +++++--- front/js/ui_components.js | 27 ++-- front/multiEditCore.php | 2 +- front/network.php | 135 +++++++------------- front/php/server/dbHelper.php | 2 +- front/php/server/devices.php | 142 +--------------------- front/php/templates/language/ar_ar.json | 6 - front/php/templates/language/ca_ca.json | 6 - front/php/templates/language/cs_cz.json | 6 - front/php/templates/language/de_de.json | 6 - front/php/templates/language/en_us.json | 7 +- front/php/templates/language/es_es.json | 6 - front/php/templates/language/fr_fr.json | 6 - front/php/templates/language/it_it.json | 6 - front/php/templates/language/nb_no.json | 6 - front/php/templates/language/pl_pl.json | 6 - front/php/templates/language/pt_br.json | 6 - front/php/templates/language/ru_ru.json | 6 - front/php/templates/language/tr_tr.json | 6 - front/php/templates/language/uk_ua.json | 6 - front/php/templates/language/zh_cn.json | 6 - front/plugins/newdev_template/config.json | 3 +- 28 files changed, 126 insertions(+), 364 deletions(-) mode change 100644 => 100755 front/php/templates/language/ru_ru.json mode change 100644 => 100755 front/php/templates/language/uk_ua.json diff --git a/docker-compose.yml b/docker-compose.yml index 2d572369..0688911c 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -23,11 +23,11 @@ services: # - ${DEV_LOCATION}/api:/app/api # --------------------------------------------------------------------------- # DELETE START anyone trying to use this file: comment out / delete BELOW lines, they are only for development purposes - - ${APP_DATA_LOCATION}/netalertx/dhcp_samples/dhcp1.leases:/mnt/dhcp1.leases - - ${APP_DATA_LOCATION}/netalertx/dhcp_samples/dhcp2.leases:/mnt/dhcp2.leases - - ${APP_DATA_LOCATION}/netalertx/dhcp_samples/pihole_dhcp_full.leases:/etc/pihole/dhcp.leases - - ${APP_DATA_LOCATION}/netalertx/dhcp_samples/pihole_dhcp_2.leases:/etc/pihole/dhcp2.leases - - ${APP_DATA_LOCATION}/pihole/etc-pihole/pihole-FTL.db:/etc/pihole/pihole-FTL.db + - ${APP_DATA_LOCATION}/netalertx/dhcp_samples/dhcp1.leases:/mnt/dhcp1.leases # test data for DCPLSS plugin + - ${APP_DATA_LOCATION}/netalertx/dhcp_samples/dhcp2.leases:/mnt/dhcp2.leases # test data for DCPLSS plugin + - ${APP_DATA_LOCATION}/netalertx/dhcp_samples/pihole_dhcp_full.leases:/etc/pihole/dhcp.leases # test data for DCPLSS plugin + - ${APP_DATA_LOCATION}/netalertx/dhcp_samples/pihole_dhcp_2.leases:/etc/pihole/dhcp2.leases # test data for DCPLSS plugin + - ${APP_DATA_LOCATION}/pihole/etc-pihole/pihole-FTL.db:/etc/pihole/pihole-FTL.db # test data for PIHOLE plugin - ${DEV_LOCATION}/mkdocs.yml:/app/mkdocs.yml - ${DEV_LOCATION}/docs:/app/docs - ${DEV_LOCATION}/server:/app/server diff --git a/docs/DEBUG_INVALID_JSON.md b/docs/DEBUG_INVALID_JSON.md index 785609ff..bd66abfb 100755 --- a/docs/DEBUG_INVALID_JSON.md +++ b/docs/DEBUG_INVALID_JSON.md @@ -10,7 +10,7 @@ Check the the HTTP response of the failing backend call by following these steps - Copy the URL causing the error and enter it in the address bar of your browser directly and hit enter. The copied URLs could look something like this (notice the query strings at the end): - `http://:20211/api/table_devices.json?nocache=1704141103121` - `http://:20211/php/server/devices.php?action=getDevicesTotals` - - `http://:20211/php/server/devices.php?action=getDevicesList&status=all` + - Post the error response in the existing issue thread on GitHub or create a new issue and include the redacted response of the failing query. diff --git a/front/css/app.css b/front/css/app.css index a33e8d0b..c7201642 100755 --- a/front/css/app.css +++ b/front/css/app.css @@ -1790,7 +1790,7 @@ input[readonly] { .plugin-content #tabs-content-location { margin: 0px; - /* padding-top: 0; */ + padding-top: 0; } .integrations-plugins .content diff --git a/front/css/dark-patch.css b/front/css/dark-patch.css index 27730385..700e56da 100755 --- a/front/css/dark-patch.css +++ b/front/css/dark-patch.css @@ -722,7 +722,7 @@ input[type="password"]::-webkit-caps-lock-indicator { margin-left: 0px; } .small-box:hover .icon { - font-size: 3.74em; + font-size: 3em; } .small-box .icon { top: 0.01em; diff --git a/front/css/system-dark-patch.css b/front/css/system-dark-patch.css index 6b6a9197..5aceec93 100755 --- a/front/css/system-dark-patch.css +++ b/front/css/system-dark-patch.css @@ -724,7 +724,7 @@ margin-left: 0px; } .small-box:hover .icon { - font-size: 3.74em; + font-size: 3em; } .small-box .icon { top: 0.01em; diff --git a/front/deviceDetailsTools.php b/front/deviceDetailsTools.php index 560b03be..cba3d5f7 100755 --- a/front/deviceDetailsTools.php +++ b/front/deviceDetailsTools.php @@ -14,7 +14,7 @@
-
+

@@ -33,13 +33,13 @@
-
+
-
@@ -56,7 +56,7 @@
-
+

@@ -74,7 +74,7 @@
-
+

@@ -133,7 +133,7 @@
-
+
@@ -151,7 +151,7 @@
-
+
diff --git a/front/js/settings_utils.js b/front/js/settings_utils.js index 2e365071..06eb89d2 100755 --- a/front/js/settings_utils.js +++ b/front/js/settings_utils.js @@ -1192,22 +1192,46 @@ function generateFormHtml(settingsData, set, overrideValue, overrideOptions, ori const eventsList = createArray(set['setEvents']); // inline buttons events - +if (eventsList.length > 0) { + eventsList.forEach(event => { + let eventIcon = "fa-play"; - if (eventsList.length > 0) { - eventsList.forEach(event => { + switch (event) { + case "add_icon": + case "add_option": + eventIcon = "fa-square-plus"; + break; + case "copy_icons": + eventIcon = "fa-copy"; + break; + case "go_to_device": + eventIcon = "fa-square-up-right"; + break; + case "go_to_node": + eventIcon = "fa-network-wired"; + break; + case "run": + eventIcon = "fa-play"; + break; + case "test": + eventIcon = "fa-vial-circle-check"; + break; + default: + eventIcon = "fa-play"; + break; + } - eventsHtml += ` - - `; - }); - } + eventsHtml += ` + + `; + }); +} // Combine and return the final HTML return inputHtml + eventsHtml; diff --git a/front/js/ui_components.js b/front/js/ui_components.js index d541fadc..d86535d2 100755 --- a/front/js/ui_components.js +++ b/front/js/ui_components.js @@ -339,6 +339,7 @@ function execute_settingEvent(element) { feSetKey = $(element).attr('data-myparam-setkey'); feParam = $(element).attr('data-myparam'); feSourceId = $(element).attr('id'); + feValue = $("#"+feSetKey).val(); if (["test", "run"].includes(feEvent)) { // Calls a backend function to add a front-end event (specified by the attributes 'data-myevent' and 'data-myparam-plugin' on the passed element) to an execution queue @@ -391,9 +392,12 @@ function execute_settingEvent(element) { getString('Gen_Okay'), 'overwriteIconType' ); - } else if (["go_to_node"].includes(feEvent)) { + } else if (["go_to_device"].includes(feEvent)) { - goToNetworkNode('NEWDEV_devParentMAC'); + goToDevice(feValue); + } else if (["go_to_node"].includes(feEvent)) { + + goToNetworkNode(feValue); } else { console.warn(`🔺Not implemented: ${feEvent}`) @@ -405,12 +409,19 @@ function execute_settingEvent(element) { // ----------------------------------------------------------------------------- // Go to the correct network node in the Network section -function goToNetworkNode(dropdownId) -{ - setCache('activeNetworkTab', $('#'+dropdownId).val().replaceAll(":","_")+'_id'); +function goToNetworkNode(mac) +{ + setCache('activeNetworkTab', mac.replaceAll(":","_")+'_id'); window.location.href = './network.php'; } + +// ----------------------------------------------------------------------------- +// Go to the device +function goToDevice(mac) +{ + window.location.href = './deviceDetails.php?mac=' + mac; +} // -------------------------------------------------------- @@ -677,9 +688,6 @@ function initSelect2() { ) $(container).addClass(badge.cssClass); - - - // Custom HTML const html = $(` @@ -693,7 +701,6 @@ function initSelect2() { `); - return html; }, @@ -732,7 +739,7 @@ function initSelect2() { { setTimeout(() => { initSelect2() - }, 500); + }, 700); } } diff --git a/front/multiEditCore.php b/front/multiEditCore.php index 111fc1fd..a35a75eb 100755 --- a/front/multiEditCore.php +++ b/front/multiEditCore.php @@ -77,7 +77,7 @@ settingsData = res["data"]; - excludedColumns = ["NEWDEV_devMac", "NEWDEV_devFirstConnection", "NEWDEV_devLastConnection", "NEWDEV_devLastNotification", "NEWDEV_devScan", "NEWDEV_devPresentLastScan", "NEWDEV_devCustomProps" ] + excludedColumns = ["NEWDEV_devMac", "NEWDEV_devFirstConnection", "NEWDEV_devLastConnection", "NEWDEV_devLastNotification", "NEWDEV_devScan", "NEWDEV_devPresentLastScan", "NEWDEV_devCustomProps", "NEWDEV_devChildrenNicsDynamic", "NEWDEV_devChildrenDynamic" ] const relevantColumns = settingsData.filter(set => set.setGroup === "NEWDEV" && diff --git a/front/network.php b/front/network.php index eb27d95f..3a165c35 100755 --- a/front/network.php +++ b/front/network.php @@ -463,12 +463,19 @@ -