mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 09:36:05 -08:00
sync plugin, plugins UI css fixes
This commit is contained in:
@@ -885,6 +885,10 @@ height: 50px;
|
|||||||
margin: 10px;
|
margin: 10px;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
}
|
}
|
||||||
|
#notifications .notification-box{
|
||||||
|
min-height: 90vh;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#notificationData textarea{
|
#notificationData textarea{
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@@ -1669,6 +1673,10 @@ input[readonly] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* AdminLTE overrides */
|
/* AdminLTE overrides */
|
||||||
|
.content-wrapper {
|
||||||
|
min-height: calc(100vh - 31px) !important;
|
||||||
|
}
|
||||||
|
|
||||||
#networkTree .box
|
#networkTree .box
|
||||||
{
|
{
|
||||||
border-width:1px;
|
border-width:1px;
|
||||||
@@ -1905,7 +1913,10 @@ input[readonly] {
|
|||||||
/* PLUGINS page */
|
/* PLUGINS page */
|
||||||
/* ----------------------------------------------------------------- */
|
/* ----------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#tabs-location
|
||||||
|
{
|
||||||
|
padding-right: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
.plugin-filters
|
.plugin-filters
|
||||||
{
|
{
|
||||||
@@ -1920,9 +1931,25 @@ input[readonly] {
|
|||||||
padding-bottom: 0px;
|
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%;
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.plugin-content .left-nav{
|
||||||
|
width: calc(100%);
|
||||||
padding-right: 0px;
|
padding-right: 0px;
|
||||||
|
z-index: 2;
|
||||||
|
background-color: inherit !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.plugin-content #tabs-content-location
|
.plugin-content #tabs-content-location
|
||||||
@@ -1996,6 +2023,8 @@ input[readonly] {
|
|||||||
.pluginBadge
|
.pluginBadge
|
||||||
{
|
{
|
||||||
float: right;
|
float: right;
|
||||||
|
margin-right: 3px;
|
||||||
|
opacity: 0.6;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pluginBadgeWrap
|
.pluginBadgeWrap
|
||||||
|
|||||||
@@ -147,7 +147,7 @@
|
|||||||
{
|
{
|
||||||
"column": "Watched_Value1",
|
"column": "Watched_Value1",
|
||||||
"css_classes": "col-sm-3",
|
"css_classes": "col-sm-3",
|
||||||
"show": true,
|
"show": false,
|
||||||
"type": "label",
|
"type": "label",
|
||||||
"default_value": "",
|
"default_value": "",
|
||||||
"options": [],
|
"options": [],
|
||||||
@@ -177,7 +177,7 @@
|
|||||||
{
|
{
|
||||||
"column": "Watched_Value3",
|
"column": "Watched_Value3",
|
||||||
"css_classes": "col-sm-2",
|
"css_classes": "col-sm-2",
|
||||||
"show": true,
|
"show": false,
|
||||||
"type": "label",
|
"type": "label",
|
||||||
"default_value": "",
|
"default_value": "",
|
||||||
"options": [],
|
"options": [],
|
||||||
@@ -193,7 +193,7 @@
|
|||||||
"column": "Watched_Value4",
|
"column": "Watched_Value4",
|
||||||
"css_classes": "col-sm-2",
|
"css_classes": "col-sm-2",
|
||||||
"show": true,
|
"show": true,
|
||||||
"type": "device_mac",
|
"type": "device_name_mac",
|
||||||
"default_value": "",
|
"default_value": "",
|
||||||
"options": [],
|
"options": [],
|
||||||
"localized": ["name"],
|
"localized": ["name"],
|
||||||
|
|||||||
@@ -311,7 +311,7 @@
|
|||||||
"column": "Watched_Value2",
|
"column": "Watched_Value2",
|
||||||
"css_classes": "col-sm-2",
|
"css_classes": "col-sm-2",
|
||||||
"show": true,
|
"show": true,
|
||||||
"type": "label",
|
"type": "textarea_readonly",
|
||||||
"default_value": "",
|
"default_value": "",
|
||||||
"options": [],
|
"options": [],
|
||||||
"localized": [
|
"localized": [
|
||||||
|
|||||||
@@ -176,32 +176,31 @@ def main():
|
|||||||
# only process received .log files, skipping the one logging the progress of this plugin
|
# only process received .log files, skipping the one logging the progress of this plugin
|
||||||
if file_name != 'last_result.log':
|
if file_name != 'last_result.log':
|
||||||
mylog('verbose', [f'[{pluginName}] Processing: "{file_name}"'])
|
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:
|
# make sure the file has teh correct name (e.g last_result.encoded.Node_1.1.log) to skip any otehr plugin files
|
||||||
data = json.load(f)
|
if len(file_name.split('.')) > 2:
|
||||||
for device in data['data']:
|
# Store e.g. Node_1 from last_result.encoded.Node_1.1.log
|
||||||
if device['devMac'] not in unique_mac_addresses:
|
syncHubNodeName = file_name.split('.')[1]
|
||||||
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)
|
|
||||||
|
|
||||||
# Overwrite if the new file already exists
|
file_path = f"{LOG_PATH}/{file_name}"
|
||||||
if os.path.exists(new_file_path):
|
|
||||||
os.remove(new_file_path)
|
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:
|
if len(device_data) > 0:
|
||||||
# Retrieve existing devMac values from the Devices table
|
# Retrieve existing devMac values from the Devices table
|
||||||
|
|||||||
@@ -17,8 +17,10 @@
|
|||||||
<ul id="tabs-location" class="nav nav-tabs col-sm-2 ">
|
<ul id="tabs-location" class="nav nav-tabs col-sm-2 ">
|
||||||
<!-- PLACEHOLDER -->
|
<!-- PLACEHOLDER -->
|
||||||
</ul>
|
</ul>
|
||||||
<div id="tabs-content-location" class="tab-content col-sm-10">
|
<div id="tabs-content-location-wrap" class="tab-content col-sm-10">
|
||||||
<!-- PLACEHOLDER -->
|
<div id="tabs-content-location" class="tab-content col-sm-12">
|
||||||
|
<!-- PLACEHOLDER -->
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
@@ -35,7 +37,14 @@ function initMacFilter() {
|
|||||||
const mac = urlParams.get('mac');
|
const mac = urlParams.get('mac');
|
||||||
|
|
||||||
// Set the MAC in the input field
|
// Set the MAC in the input field
|
||||||
$("#txtMacFilter").val(mac);
|
if(mac)
|
||||||
|
{
|
||||||
|
$("#txtMacFilter").val(mac);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$("#txtMacFilter").val("--");
|
||||||
|
}
|
||||||
|
|
||||||
return mac;
|
return mac;
|
||||||
}
|
}
|
||||||
@@ -52,7 +61,6 @@ function initFields() {
|
|||||||
// - different from what's already displayed
|
// - different from what's already displayed
|
||||||
if (currentVal != "--" && currentVal !== lastMac) {
|
if (currentVal != "--" && currentVal !== lastMac) {
|
||||||
|
|
||||||
|
|
||||||
// Update the lastMac so we don't reload unnecessarily
|
// Update the lastMac so we don't reload unnecessarily
|
||||||
lastMac = currentVal;
|
lastMac = currentVal;
|
||||||
|
|
||||||
@@ -315,16 +323,19 @@ function createTabHeader(pluginObj, stats) {
|
|||||||
// Determine the active class for the first tab
|
// Determine the active class for the first tab
|
||||||
const activeClass = pluginDefinitions.indexOf(pluginObj) === 0 ? 'active' : '';
|
const activeClass = pluginDefinitions.indexOf(pluginObj) === 0 ? 'active' : '';
|
||||||
|
|
||||||
// Append the tab header to the tabs location
|
if(stats.objectDataCount > 0)
|
||||||
$('#tabs-location').append(`
|
{
|
||||||
<li class="left-nav ${activeClass} ">
|
// Append the tab header to the tabs location
|
||||||
<a class="col-sm-12 textOverflow" href="#${prefix}" data-plugin-prefix="${prefix}" id="${prefix}_id" data-toggle="tab">
|
$('#tabs-location').append(`
|
||||||
${getString(`${prefix}_icon`)} ${getString(`${prefix}_display_name`)}
|
<li class="left-nav ${activeClass} ">
|
||||||
|
<a class="col-sm-12 textOverflow" href="#${prefix}" data-plugin-prefix="${prefix}" id="${prefix}_id" data-toggle="tab">
|
||||||
</a>
|
${getString(`${prefix}_icon`)} ${getString(`${prefix}_display_name`)}
|
||||||
${stats.objectDataCount > 0 ? `<div class="pluginBadgeWrap"><span title="" class="badge pluginBadge" >${stats.objectDataCount}</span></div>` : ""}
|
|
||||||
</li>
|
</a>
|
||||||
`);
|
${stats.objectDataCount > 0 ? `<div class="pluginBadgeWrap"><span title="" class="badge pluginBadge" >${stats.objectDataCount}</span></div>` : ""}
|
||||||
|
</li>
|
||||||
|
`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function createTabContent(pluginObj) {
|
function createTabContent(pluginObj) {
|
||||||
@@ -477,9 +488,13 @@ function shouldBeShown(entry, pluginObj)
|
|||||||
compare_operator = dataFilters[i].compare_operator;
|
compare_operator = dataFilters[i].compare_operator;
|
||||||
compare_js_template = dataFilters[i].compare_js_template;
|
compare_js_template = dataFilters[i].compare_js_template;
|
||||||
compare_use_quotes = dataFilters[i].compare_use_quotes;
|
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 != '--')
|
if(compare_field_id_value != undefined && compare_field_id_value != '--')
|
||||||
{
|
{
|
||||||
// valid value
|
// valid value
|
||||||
|
|||||||
Reference in New Issue
Block a user