mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 09:36:05 -08:00
Network fixes #475
This commit is contained in:
@@ -903,8 +903,7 @@ input[readonly] {
|
|||||||
{
|
{
|
||||||
display: block;
|
display: block;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
margin-left: 170px;
|
margin-left: 170px;
|
||||||
top: 5px;
|
|
||||||
font-size: large;
|
font-size: large;
|
||||||
left: -15px;
|
left: -15px;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -597,18 +597,19 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
// Handle network node click - select correct tab in teh bottom table
|
||||||
function handleNodeClick(event)
|
function handleNodeClick(event)
|
||||||
{
|
{
|
||||||
|
console.log(event.target.offsetParent.offsetParent)
|
||||||
console.log(event.target.offsetParent)
|
|
||||||
|
const targetTabMAC = $(event.target.offsetParent.offsetParent).attr("data-mytreemacmain");
|
||||||
const targetTabMAC = $(event.target.offsetParent).attr("data-mytreemacmain");
|
|
||||||
|
|
||||||
var targetTab = $(`a[data-mytabmac="${targetTabMAC}"]`);
|
var targetTab = $(`a[data-mytabmac="${targetTabMAC}"]`);
|
||||||
|
|
||||||
// Simulate a click event on the target tab
|
// Simulate a click event on the target tab
|
||||||
targetTab.click();
|
targetTab.click();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
var myTree;
|
var myTree;
|
||||||
var treeAreaHeight = 800;
|
var treeAreaHeight = 800;
|
||||||
@@ -637,16 +638,37 @@
|
|||||||
|
|
||||||
(port == "" || port == 0 ) ? portBckgIcon = `<i class="fa fa-wifi"></i>` : portBckgIcon = `<i class="fa fa-ethernet"></i>`;
|
(port == "" || port == 0 ) ? portBckgIcon = `<i class="fa fa-wifi"></i>` : portBckgIcon = `<i class="fa fa-ethernet"></i>`;
|
||||||
|
|
||||||
// Build HTML for individual nodes in the network diagram
|
// Build HTML for individual nodes in the network diagram
|
||||||
deviceIcon = (!emptyArr.includes(nodeData.data.icon )) ? `<div class="netIcon"><i class="fa fa-${nodeData.data.icon}"></i></div>` : "";
|
deviceIcon = (!emptyArr.includes(nodeData.data.icon )) ?
|
||||||
devicePort = `<div class="netPort" style="width:${emSize*sizeCoefficient}em;height:${emSize*sizeCoefficient}em">${port}</div> <div class="portBckgIcon" style="margin-left:-${emSize*sizeCoefficient}em;">${portBckgIcon}</div>`;
|
`<div class="netIcon">
|
||||||
collapseExpandIcon = nodeData.data.hiddenChildren ? "square-plus" : "square-minus";
|
<i class="fa fa-${nodeData.data.icon}"></i>
|
||||||
collapseExpandHtml = nodeData.data.hasChildren ? `<div class="netCollapse" style="font-size:${emSize*sizeCoefficient}em;" data-mytreepath='${nodeData.data.path}" data-mytreemac="${nodeData.data.mac}"><i class='fa fa-${collapseExpandIcon} pointer"></i></div>` : "";
|
</div>` : "";
|
||||||
statusCss = ` netStatus-${nodeData.data.status}`;
|
devicePort = `<div class="netPort"
|
||||||
|
style="width:${emSize*sizeCoefficient}em;height:${emSize*sizeCoefficient}em">
|
||||||
|
${port}</div>
|
||||||
|
<div class="portBckgIcon"
|
||||||
|
style="margin-left:-${emSize*sizeCoefficient}em;">
|
||||||
|
${portBckgIcon}
|
||||||
|
</div>`;
|
||||||
|
collapseExpandIcon = nodeData.data.hiddenChildren ?
|
||||||
|
"square-plus" : "square-minus";
|
||||||
|
|
||||||
|
// generate +/- icon if node has children nodes
|
||||||
|
collapseExpandHtml = nodeData.data.hasChildren ?
|
||||||
|
`<div class="netCollapse"
|
||||||
|
style="font-size:${emSize*sizeCoefficient}em;top:${1/2*emSize*sizeCoefficient}em"
|
||||||
|
data-mytreepath="${nodeData.data.path}"
|
||||||
|
data-mytreemac="${nodeData.data.mac}">
|
||||||
|
<i class="fa fa-${collapseExpandIcon} pointer"></i>
|
||||||
|
</div>` : "";
|
||||||
|
|
||||||
selectedNodeMac = $(".nav-tabs-custom .active a").attr('data-mytabmac')
|
selectedNodeMac = $(".nav-tabs-custom .active a").attr('data-mytabmac')
|
||||||
|
|
||||||
highlightedCss = nodeData.data.mac == selectedNodeMac ? " highlightedNode" : "";
|
highlightedCss = nodeData.data.mac == selectedNodeMac ?
|
||||||
|
" highlightedNode" : "";
|
||||||
|
|
||||||
|
// css indicating online/offline status
|
||||||
|
statusCss = ` netStatus-${nodeData.data.status}`;
|
||||||
|
|
||||||
return result = `<div class="box ${nodeData.data.hasChildren ? "pointer":""} ${statusCss} ${highlightedCss}"
|
return result = `<div class="box ${nodeData.data.hasChildren ? "pointer":""} ${statusCss} ${highlightedCss}"
|
||||||
data-mytreemacmain="${nodeData.data.mac}"
|
data-mytreemacmain="${nodeData.data.mac}"
|
||||||
|
|||||||
@@ -452,7 +452,7 @@
|
|||||||
"run_event_tooltip" : "Enable the setting and save your changes at first before you run it.",
|
"run_event_tooltip" : "Enable the setting and save your changes at first before you run it.",
|
||||||
"run_event_icon" : "fa-play",
|
"run_event_icon" : "fa-play",
|
||||||
"general_event_title" : "Executing an ad-hoc event",
|
"general_event_title" : "Executing an ad-hoc event",
|
||||||
"general_event_description" : " The event you nove triggered might take a while until background processes finish. The execution ended once the below execution queue empties (Check the <a href='/maintenance.php#tab_Logging'>error log</a> if you envounter issues). <br/> <br/> Execution queue:",
|
"general_event_description" : " The event you nove triggered might take a while until background processes finish. The execution ended once the below execution queue empties (Check the <a href='/maintenance.php#tab_Logging'>error log</a> if you encounter issues). <br/> <br/> Execution queue:",
|
||||||
"Plugins_Unprocessed_Events" : "Unprocessed Events",
|
"Plugins_Unprocessed_Events" : "Unprocessed Events",
|
||||||
"Plugins_Objects" : "Plugin Objects",
|
"Plugins_Objects" : "Plugin Objects",
|
||||||
"Plugins_DeleteAll" : "Delete all (filters are ignored)",
|
"Plugins_DeleteAll" : "Delete all (filters are ignored)",
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ sys.path.append('/home/pi/pialert/pialert')
|
|||||||
|
|
||||||
from plugin_helper import Plugin_Object, Plugin_Objects, decodeBase64
|
from plugin_helper import Plugin_Object, Plugin_Objects, decodeBase64
|
||||||
from logger import mylog, append_line_to_file
|
from logger import mylog, append_line_to_file
|
||||||
from helper import timeNowTZ
|
from helper import timeNowTZ, get_setting_value
|
||||||
from const import logPath, pialertPath
|
from const import logPath, pialertPath
|
||||||
|
|
||||||
|
|
||||||
@@ -92,8 +92,12 @@ def cleanup_database (dbPath, DAYS_TO_KEEP_EVENTS, PHOLUS_DAYS_DATA, HRS_TO_KEEP
|
|||||||
|
|
||||||
cursor.execute(delete_query)
|
cursor.execute(delete_query)
|
||||||
|
|
||||||
|
|
||||||
# Trim Notifications entries to less than DBCLNP_NOTIFI_HIST setting
|
# Trim Notifications entries to less than DBCLNP_NOTIFI_HIST setting
|
||||||
mylog('verbose', [f'[DBCLNP] Plugins_History: Trim Notifications entries to less than {str(get_setting_value('DBCLNP_NOTIFI_HIST'))} )'])
|
|
||||||
|
histCount = get_setting_value('DBCLNP_NOTIFI_HIST')
|
||||||
|
|
||||||
|
mylog('verbose', [f'[DBCLNP] Plugins_History: Trim Notifications entries to less than {histCount}'])
|
||||||
|
|
||||||
# Build the SQL query to delete entries
|
# Build the SQL query to delete entries
|
||||||
delete_query = f"""DELETE FROM Notifications
|
delete_query = f"""DELETE FROM Notifications
|
||||||
@@ -104,7 +108,7 @@ def cleanup_database (dbPath, DAYS_TO_KEEP_EVENTS, PHOLUS_DAYS_DATA, HRS_TO_KEEP
|
|||||||
ROW_NUMBER() OVER(PARTITION BY "Notifications" ORDER BY DateTimeCreated DESC) AS row_num
|
ROW_NUMBER() OVER(PARTITION BY "Notifications" ORDER BY DateTimeCreated DESC) AS row_num
|
||||||
FROM Notifications
|
FROM Notifications
|
||||||
) AS ranked_objects
|
) AS ranked_objects
|
||||||
WHERE row_num <= {str(get_setting_value('DBCLNP_NOTIFI_HIST'))}
|
WHERE row_num <= {histCount}
|
||||||
);"""
|
);"""
|
||||||
|
|
||||||
cursor.execute(delete_query)
|
cursor.execute(delete_query)
|
||||||
|
|||||||
Reference in New Issue
Block a user