sync plugin, plugins UI css fixes

This commit is contained in:
jokob-sk
2025-07-21 17:56:49 +10:00
parent 752322bbad
commit 9ada27cf7e
5 changed files with 88 additions and 45 deletions

View File

@@ -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

View File

@@ -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"],

View File

@@ -311,7 +311,7 @@
"column": "Watched_Value2",
"css_classes": "col-sm-2",
"show": true,
"type": "label",
"type": "textarea_readonly",
"default_value": "",
"options": [],
"localized": [

View File

@@ -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

View File

@@ -17,8 +17,10 @@
<ul id="tabs-location" class="nav nav-tabs col-sm-2 ">
<!-- PLACEHOLDER -->
</ul>
<div id="tabs-content-location" class="tab-content col-sm-10">
<!-- PLACEHOLDER -->
<div id="tabs-content-location-wrap" class="tab-content col-sm-10">
<div id="tabs-content-location" class="tab-content col-sm-12">
<!-- PLACEHOLDER -->
</div>
</div>
</section>
@@ -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(`
<li class="left-nav ${activeClass} ">
<a class="col-sm-12 textOverflow" href="#${prefix}" data-plugin-prefix="${prefix}" id="${prefix}_id" data-toggle="tab">
${getString(`${prefix}_icon`)} ${getString(`${prefix}_display_name`)}
</a>
${stats.objectDataCount > 0 ? `<div class="pluginBadgeWrap"><span title="" class="badge pluginBadge" >${stats.objectDataCount}</span></div>` : ""}
</li>
`);
if(stats.objectDataCount > 0)
{
// Append the tab header to the tabs location
$('#tabs-location').append(`
<li class="left-nav ${activeClass} ">
<a class="col-sm-12 textOverflow" href="#${prefix}" data-plugin-prefix="${prefix}" id="${prefix}_id" data-toggle="tab">
${getString(`${prefix}_icon`)} ${getString(`${prefix}_display_name`)}
</a>
${stats.objectDataCount > 0 ? `<div class="pluginBadgeWrap"><span title="" class="badge pluginBadge" >${stats.objectDataCount}</span></div>` : ""}
</li>
`);
}
}
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