mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-06 17:15:38 -08:00
Plugins 1 - Screenshot + fixes
This commit is contained in:
@@ -3929,8 +3929,8 @@ def process_plugin_events(plugin):
|
||||
index = 0
|
||||
for plugObj in pluginObjects:
|
||||
# find corresponding object for the event and merge
|
||||
if plugObj.idsHash == eveObj.idsHash:
|
||||
pluginObjects[index] = combine_plugin_objects(plugObj, eveObj)
|
||||
if plugObj.idsHash == eveObj.idsHash:
|
||||
pluginObjects[index] = combine_plugin_objects(plugObj, eveObj)
|
||||
|
||||
index += 1
|
||||
|
||||
@@ -3948,9 +3948,7 @@ def process_plugin_events(plugin):
|
||||
|
||||
sql.execute ("INSERT INTO Plugins_Objects (Plugin, Object_PrimaryID, Object_SecondaryID, DateTimeCreated, DateTimeChanged, Watched_Value1, Watched_Value2, Watched_Value3, Watched_Value4, Status, Extra, UserData, ForeignKey) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)", (plugObj.pluginPref, plugObj.primaryId , plugObj.secondaryId , createdTime, plugObj.changed , plugObj.watched1 , plugObj.watched2 , plugObj.watched3 , plugObj.watched4 , plugObj.status , plugObj.extra, plugObj.userData, plugObj.foreignKey ))
|
||||
else:
|
||||
q = f"UPDATE Plugins_Objects set Plugin = '{plugObj.pluginPref}', DateTimeChanged = '{plugObj.changed}', Watched_Value1 = '{plugObj.watched1}', Watched_Value2 = '{plugObj.watched2}', Watched_Value3 = '{plugObj.watched3}', Watched_Value4 = '{plugObj.watched4}', Status = '{plugObj.status}', Extra = '{plugObj.extra}', ForeignKey = '{plugObj.foreignKey}' WHERE 'Index' = {plugObj.index}"
|
||||
|
||||
sql.execute (q)
|
||||
sql.execute (f"UPDATE Plugins_Objects set Plugin = '{plugObj.pluginPref}', DateTimeChanged = '{plugObj.changed}', Watched_Value1 = '{plugObj.watched1}', Watched_Value2 = '{plugObj.watched2}', Watched_Value3 = '{plugObj.watched3}', Watched_Value4 = '{plugObj.watched4}', Status = '{plugObj.status}', Extra = '{plugObj.extra}', ForeignKey = '{plugObj.foreignKey}' WHERE \"Index\" = {plugObj.index}")
|
||||
|
||||
# Update the Plugins_Events with the new statuses
|
||||
sql.execute ("DELETE FROM Plugins_Events")
|
||||
@@ -3964,7 +3962,7 @@ def process_plugin_events(plugin):
|
||||
|
||||
sql.execute ("INSERT INTO Plugins_Events (Plugin, Object_PrimaryID, Object_SecondaryID, DateTimeCreated, DateTimeChanged, Watched_Value1, Watched_Value2, Watched_Value3, Watched_Value4, Status, Extra, UserData, ForeignKey) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)", (plugObj.pluginPref, plugObj.primaryId , plugObj.secondaryId , createdTime, plugObj.changed , plugObj.watched1 , plugObj.watched2 , plugObj.watched3 , plugObj.watched4 , plugObj.status , plugObj.extra, plugObj.userData, plugObj.foreignKey ))
|
||||
|
||||
commitDB()
|
||||
commitDB()
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
class plugin_object_class:
|
||||
|
||||
BIN
docs/img/plugins.png
Executable file
BIN
docs/img/plugins.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 218 KiB |
BIN
docs/img/plugins_settings.png
Executable file
BIN
docs/img/plugins_settings.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 158 KiB |
@@ -64,7 +64,7 @@ function getFormControl(dbColumnDef, value, index) {
|
||||
result = `<span><a href="${value}" target="_blank">${value}</a><span>`;
|
||||
break;
|
||||
case 'devicemac':
|
||||
result = `<span><a href="/deviceDetails.php?mac=${value}" target="_blank">${value}</a><span>`;
|
||||
result = `<span class="anonymizeMac"><a href="/deviceDetails.php?mac=${value}" target="_blank">${value}</a><span>`;
|
||||
break;
|
||||
case 'threshold':
|
||||
$.each(dbColumnDef.options, function(index, obj) {
|
||||
@@ -111,11 +111,6 @@ function saveData (id) {
|
||||
{
|
||||
showMessage('<?= lang('Gen_LockedDB');?>')
|
||||
}
|
||||
|
||||
// if (result) {
|
||||
// period = result;
|
||||
// $('#period').val(period);
|
||||
// }
|
||||
|
||||
});
|
||||
}
|
||||
@@ -208,10 +203,7 @@ function generateTabs()
|
||||
|
||||
$.each(pluginDefinitions, function(index, obj) {
|
||||
|
||||
|
||||
|
||||
headersHtml = ""
|
||||
// headers = []
|
||||
headersHtml = ""
|
||||
colDefinitions = []
|
||||
evRows = ""
|
||||
obRows = ""
|
||||
@@ -222,7 +214,7 @@ function generateTabs()
|
||||
if(colDef.show == true) // select only the ones to show
|
||||
{
|
||||
colDefinitions.push(colDef)
|
||||
headersHtml += `<th class="col-sm-2" >${localize(colDef, "name" )}</th>`
|
||||
headersHtml += `<th class="${colDef.css_classes}" >${localize(colDef, "name" )}</th>`
|
||||
}
|
||||
});
|
||||
|
||||
@@ -247,7 +239,7 @@ function generateTabs()
|
||||
var histCount = 0
|
||||
var histCountDisplayed = 0
|
||||
|
||||
for(i=0;i<pluginHistory.length;i++)
|
||||
for(i=pluginHistory.length-1;i >= 0;i--) // from latest to the oldest
|
||||
{
|
||||
if(pluginHistory[i].Plugin == obj.unique_prefix)
|
||||
{
|
||||
@@ -377,8 +369,7 @@ function generateTabs()
|
||||
activetab = '' // only first tab is active
|
||||
});
|
||||
|
||||
initTabs()
|
||||
|
||||
initTabs()
|
||||
}
|
||||
|
||||
// --------------------------------------------------------
|
||||
|
||||
@@ -6,7 +6,7 @@ Highly experimental feature. Follow the below very carefully and check example p
|
||||
|
||||
These issues will be hopefully fixed with time, so please don't report them. Instead, if you know how, feel free to investigate and submit a PR to fix the below. Keep the PRs small as it's easier to approve them:
|
||||
|
||||
* Existing plugin objects sometimes not interpreted correctly and a new object is created instead, resulting in dupliucat entries.
|
||||
* Existing plugin objects sometimes not interpreted correctly and a new object is created instead, resulting in duplicate entries.
|
||||
* Occasional (experienced twice) hanging of processing plugin script file.
|
||||
* UI displaying outdated values until the API endpoints get refreshed.
|
||||
|
||||
@@ -245,7 +245,7 @@ The UI will adjust how columns are displayed in the UI based on the definition o
|
||||
- The `options` property is used in conjunction with these types:
|
||||
- `threshold` - The `options` array contains objects from lowest `maximum` to highest with corresponding `hexColor` used for the value background color if it's less than the specified `maximum`, but more than the previous one in the `options` array
|
||||
- `replace` - The `options` array contains objects with an `equals` property, that is compared to the "value" and if the values are the same, the string in `replacement` is displayed in the UI instead of the actual "value"
|
||||
- `devicemac` - The value is considered to be a mac adress and a link pointing to the device with teh given mac address is generated.
|
||||
- `devicemac` - The value is considered to be a mac adress and a link pointing to the device with the given mac address is generated.
|
||||
- `url` - The value is considered to be a url so a link is generated.
|
||||
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
[
|
||||
{
|
||||
"column": "Index",
|
||||
"css_classes": "col-sm-2",
|
||||
"show": false,
|
||||
"type": "label",
|
||||
"default_value":"",
|
||||
@@ -33,6 +34,7 @@
|
||||
} ,
|
||||
{
|
||||
"column": "Plugin",
|
||||
"css_classes": "col-sm-2",
|
||||
"show": false,
|
||||
"type": "label",
|
||||
"default_value":"",
|
||||
@@ -45,6 +47,7 @@
|
||||
},
|
||||
{
|
||||
"column": "Object_PrimaryID",
|
||||
"css_classes": "col-sm-2",
|
||||
"show": true,
|
||||
"type": "label",
|
||||
"default_value":"",
|
||||
@@ -57,6 +60,7 @@
|
||||
},
|
||||
{
|
||||
"column": "Object_SecondaryID",
|
||||
"css_classes": "col-sm-2",
|
||||
"show": true,
|
||||
"type": "url",
|
||||
"default_value":"",
|
||||
@@ -69,6 +73,7 @@
|
||||
} ,
|
||||
{
|
||||
"column": "DateTimeCreated",
|
||||
"css_classes": "col-sm-2",
|
||||
"show": true,
|
||||
"type": "label",
|
||||
"default_value":"",
|
||||
@@ -81,6 +86,7 @@
|
||||
},
|
||||
{
|
||||
"column": "DateTimeChanged",
|
||||
"css_classes": "col-sm-2",
|
||||
"show": true,
|
||||
"type": "label",
|
||||
"default_value":"",
|
||||
@@ -93,6 +99,7 @@
|
||||
},
|
||||
{
|
||||
"column": "Watched_Value1",
|
||||
"css_classes": "col-sm-1",
|
||||
"show": true,
|
||||
"type": "label",
|
||||
"default_value":"",
|
||||
@@ -104,6 +111,7 @@
|
||||
},
|
||||
{
|
||||
"column": "Watched_Value2",
|
||||
"css_classes": "col-sm-1",
|
||||
"show": true,
|
||||
"type": "label",
|
||||
"default_value":"",
|
||||
@@ -116,6 +124,7 @@
|
||||
},
|
||||
{
|
||||
"column": "Watched_Value3",
|
||||
"css_classes": "col-sm-2",
|
||||
"show": false,
|
||||
"type": "label",
|
||||
"default_value":"",
|
||||
@@ -128,6 +137,7 @@
|
||||
} ,
|
||||
{
|
||||
"column": "Watched_Value4",
|
||||
"css_classes": "col-sm-2",
|
||||
"show": false,
|
||||
"type": "label",
|
||||
"default_value":"",
|
||||
@@ -140,6 +150,7 @@
|
||||
} ,
|
||||
{
|
||||
"column": "Extra",
|
||||
"css_classes": "col-sm-3",
|
||||
"show": true,
|
||||
"type": "label",
|
||||
"default_value":"",
|
||||
@@ -152,6 +163,7 @@
|
||||
},
|
||||
{
|
||||
"column": "ForeignKey",
|
||||
"css_classes": "col-sm-2",
|
||||
"show": true,
|
||||
"type": "devicemac",
|
||||
"default_value":"",
|
||||
@@ -164,6 +176,7 @@
|
||||
},
|
||||
{
|
||||
"column": "Status",
|
||||
"css_classes": "col-sm-1",
|
||||
"show": true,
|
||||
"type": "replace",
|
||||
"default_value":"",
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
}],
|
||||
"description": [{
|
||||
"language_code":"en_us",
|
||||
"string" : "This plugin is to monitor status changes of different services or websites."
|
||||
"string" : "This plugin is to monitor status changes of services or websites."
|
||||
}],
|
||||
"params" : [{
|
||||
"name" : "macs",
|
||||
@@ -35,6 +35,7 @@
|
||||
[
|
||||
{
|
||||
"column": "Index",
|
||||
"css_classes": "col-sm-2",
|
||||
"show": false,
|
||||
"type": "label",
|
||||
"default_value":"",
|
||||
@@ -47,6 +48,7 @@
|
||||
} ,
|
||||
{
|
||||
"column": "Plugin",
|
||||
"css_classes": "col-sm-2",
|
||||
"show": false,
|
||||
"type": "label",
|
||||
"default_value":"",
|
||||
@@ -59,6 +61,7 @@
|
||||
},
|
||||
{
|
||||
"column": "Object_PrimaryID",
|
||||
"css_classes": "col-sm-2",
|
||||
"show": true,
|
||||
"type": "url",
|
||||
"default_value":"",
|
||||
@@ -71,6 +74,7 @@
|
||||
},
|
||||
{
|
||||
"column": "Object_SecondaryD",
|
||||
"css_classes": "col-sm-2",
|
||||
"show": false,
|
||||
"type": "label",
|
||||
"default_value":"",
|
||||
@@ -83,6 +87,7 @@
|
||||
} ,
|
||||
{
|
||||
"column": "DateTimeCreated",
|
||||
"css_classes": "col-sm-2",
|
||||
"show": true,
|
||||
"type": "label",
|
||||
"default_value":"",
|
||||
@@ -95,6 +100,7 @@
|
||||
},
|
||||
{
|
||||
"column": "DateTimeChanged",
|
||||
"css_classes": "col-sm-2",
|
||||
"show": true,
|
||||
"type": "label",
|
||||
"default_value":"",
|
||||
@@ -107,6 +113,7 @@
|
||||
},
|
||||
{
|
||||
"column": "Watched_Value1",
|
||||
"css_classes": "col-sm-2",
|
||||
"show": true,
|
||||
"type": "threshold",
|
||||
"default_value":"",
|
||||
@@ -140,6 +147,7 @@
|
||||
},
|
||||
{
|
||||
"column": "Watched_Value2",
|
||||
"css_classes": "col-sm-2",
|
||||
"show": true,
|
||||
"type": "label",
|
||||
"default_value":"",
|
||||
@@ -152,6 +160,7 @@
|
||||
},
|
||||
{
|
||||
"column": "Watched_Value3",
|
||||
"css_classes": "col-sm-2",
|
||||
"show": false,
|
||||
"type": "label",
|
||||
"default_value":"",
|
||||
@@ -164,6 +173,7 @@
|
||||
} ,
|
||||
{
|
||||
"column": "Watched_Value4",
|
||||
"css_classes": "col-sm-2",
|
||||
"show": false,
|
||||
"type": "label",
|
||||
"default_value":"",
|
||||
@@ -176,6 +186,7 @@
|
||||
} ,
|
||||
{
|
||||
"column": "UserData",
|
||||
"css_classes": "col-sm-2",
|
||||
"show": true,
|
||||
"type": "textboxsave",
|
||||
"default_value":"",
|
||||
@@ -188,6 +199,7 @@
|
||||
},
|
||||
{
|
||||
"column": "Status",
|
||||
"css_classes": "col-sm-1",
|
||||
"show": true,
|
||||
"type": "replace",
|
||||
"default_value":"",
|
||||
@@ -213,6 +225,7 @@
|
||||
},
|
||||
{
|
||||
"column": "Extra",
|
||||
"css_classes": "col-sm-3",
|
||||
"show": false,
|
||||
"type": "label",
|
||||
"default_value":"",
|
||||
|
||||
Reference in New Issue
Block a user