From 9ada27cf7edf27e43ea47beb54e8640abb02a7f2 Mon Sep 17 00:00:00 2001 From: jokob-sk Date: Mon, 21 Jul 2025 17:56:49 +1000 Subject: [PATCH] sync plugin, plugins UI css fixes --- front/css/app.css | 33 +++++++++++++++- front/plugins/_publisher_mqtt/config.json | 6 +-- front/plugins/icmp_scan/config.json | 2 +- front/plugins/sync/sync.py | 45 +++++++++++----------- front/pluginsCore.php | 47 +++++++++++++++-------- 5 files changed, 88 insertions(+), 45 deletions(-) diff --git a/front/css/app.css b/front/css/app.css index 6fd5a099..d8bef07f 100755 --- a/front/css/app.css +++ b/front/css/app.css @@ -885,6 +885,10 @@ height: 50px; margin: 10px; padding: 10px; } +#notifications .notification-box{ + min-height: 90vh; +} + #notificationData textarea{ width: 100%; @@ -1669,6 +1673,10 @@ input[readonly] { } /* AdminLTE overrides */ +.content-wrapper { + min-height: calc(100vh - 31px) !important; +} + #networkTree .box { border-width:1px; @@ -1905,7 +1913,10 @@ input[readonly] { /* PLUGINS page */ /* ----------------------------------------------------------------- */ - +#tabs-location +{ + padding-right: 0px; +} .plugin-filters { @@ -1920,9 +1931,25 @@ input[readonly] { padding-bottom: 0px; } -.plugin-content .left-nav{ +.plugin-content .nav-tabs li a +{ + border-right-width: 0px; +} + +#tabs-content-location-wrap +{ + min-height: 90vh; +} + +#tabs-content-location textarea { width: 100%; +} + +.plugin-content .left-nav{ + width: calc(100%); padding-right: 0px; + z-index: 2; + background-color: inherit !important; } .plugin-content #tabs-content-location @@ -1996,6 +2023,8 @@ input[readonly] { .pluginBadge { float: right; + margin-right: 3px; + opacity: 0.6; } .pluginBadgeWrap diff --git a/front/plugins/_publisher_mqtt/config.json b/front/plugins/_publisher_mqtt/config.json index 77443db6..2f8e2f2b 100755 --- a/front/plugins/_publisher_mqtt/config.json +++ b/front/plugins/_publisher_mqtt/config.json @@ -147,7 +147,7 @@ { "column": "Watched_Value1", "css_classes": "col-sm-3", - "show": true, + "show": false, "type": "label", "default_value": "", "options": [], @@ -177,7 +177,7 @@ { "column": "Watched_Value3", "css_classes": "col-sm-2", - "show": true, + "show": false, "type": "label", "default_value": "", "options": [], @@ -193,7 +193,7 @@ "column": "Watched_Value4", "css_classes": "col-sm-2", "show": true, - "type": "device_mac", + "type": "device_name_mac", "default_value": "", "options": [], "localized": ["name"], diff --git a/front/plugins/icmp_scan/config.json b/front/plugins/icmp_scan/config.json index ef5466c9..02895cf2 100755 --- a/front/plugins/icmp_scan/config.json +++ b/front/plugins/icmp_scan/config.json @@ -311,7 +311,7 @@ "column": "Watched_Value2", "css_classes": "col-sm-2", "show": true, - "type": "label", + "type": "textarea_readonly", "default_value": "", "options": [], "localized": [ diff --git a/front/plugins/sync/sync.py b/front/plugins/sync/sync.py index 61a1459e..00197b37 100755 --- a/front/plugins/sync/sync.py +++ b/front/plugins/sync/sync.py @@ -176,32 +176,31 @@ def main(): # only process received .log files, skipping the one logging the progress of this plugin if file_name != 'last_result.log': mylog('verbose', [f'[{pluginName}] Processing: "{file_name}"']) - - # Store e.g. Node_1 from last_result.encoded.Node_1.1.log - tmp_SyncHubNodeName = '' - if len(file_name.split('.')) > 2: - tmp_SyncHubNodeName = file_name.split('.')[1] - - - file_path = f"{LOG_PATH}/{file_name}" - with open(file_path, 'r') as f: - data = json.load(f) - for device in data['data']: - if device['devMac'] not in unique_mac_addresses: - device['devSyncHubNode'] = tmp_SyncHubNodeName - unique_mac_addresses.add(device['devMac']) - device_data.append(device) - - # Rename the file to "processed_" + current name - new_file_name = f"processed_{file_name}" - new_file_path = os.path.join(LOG_PATH, new_file_name) + # make sure the file has teh correct name (e.g last_result.encoded.Node_1.1.log) to skip any otehr plugin files + if len(file_name.split('.')) > 2: + # Store e.g. Node_1 from last_result.encoded.Node_1.1.log + syncHubNodeName = file_name.split('.')[1] - # Overwrite if the new file already exists - if os.path.exists(new_file_path): - os.remove(new_file_path) + file_path = f"{LOG_PATH}/{file_name}" + + with open(file_path, 'r') as f: + data = json.load(f) + for device in data['data']: + if device['devMac'] not in unique_mac_addresses: + device['devSyncHubNode'] = syncHubNodeName + unique_mac_addresses.add(device['devMac']) + device_data.append(device) + + # Rename the file to "processed_" + current name + new_file_name = f"processed_{file_name}" + new_file_path = os.path.join(LOG_PATH, new_file_name) - os.rename(file_path, new_file_path) + # Overwrite if the new file already exists + if os.path.exists(new_file_path): + os.remove(new_file_path) + + os.rename(file_path, new_file_path) if len(device_data) > 0: # Retrieve existing devMac values from the Devices table diff --git a/front/pluginsCore.php b/front/pluginsCore.php index 5a53eb63..8945ddbe 100755 --- a/front/pluginsCore.php +++ b/front/pluginsCore.php @@ -17,8 +17,10 @@ -
- +
+
+ +
@@ -35,7 +37,14 @@ function initMacFilter() { const mac = urlParams.get('mac'); // Set the MAC in the input field - $("#txtMacFilter").val(mac); + if(mac) + { + $("#txtMacFilter").val(mac); + } + else + { + $("#txtMacFilter").val("--"); + } return mac; } @@ -52,7 +61,6 @@ function initFields() { // - different from what's already displayed if (currentVal != "--" && currentVal !== lastMac) { - // Update the lastMac so we don't reload unnecessarily lastMac = currentVal; @@ -315,16 +323,19 @@ function createTabHeader(pluginObj, stats) { // Determine the active class for the first tab const activeClass = pluginDefinitions.indexOf(pluginObj) === 0 ? 'active' : ''; - // Append the tab header to the tabs location - $('#tabs-location').append(` -
  • - - ${getString(`${prefix}_icon`)} ${getString(`${prefix}_display_name`)} - - - ${stats.objectDataCount > 0 ? `
    ${stats.objectDataCount}
    ` : ""} -
  • - `); + if(stats.objectDataCount > 0) + { + // Append the tab header to the tabs location + $('#tabs-location').append(` +
  • + + ${getString(`${prefix}_icon`)} ${getString(`${prefix}_display_name`)} + + + ${stats.objectDataCount > 0 ? `
    ${stats.objectDataCount}
    ` : ""} +
  • + `); + } } function createTabContent(pluginObj) { @@ -477,9 +488,13 @@ function shouldBeShown(entry, pluginObj) compare_operator = dataFilters[i].compare_operator; compare_js_template = dataFilters[i].compare_js_template; compare_use_quotes = dataFilters[i].compare_use_quotes; - compare_field_id_value = $(`#${compare_field_id}`).val(); + compare_field_id_value = $(`#${compare_field_id}`).val(); + + // console.log(compare_field_id_value); + // console.log(compare_field_id); + - // apply filter i sthe filter field has a valid value + // apply filter if the filter field has a valid value if(compare_field_id_value != undefined && compare_field_id_value != '--') { // valid value