mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 09:36:05 -08:00
Plugins filter
This commit is contained in:
@@ -193,6 +193,29 @@ Required `CMD` setting example with above query (you can set `"type": "label"` i
|
||||
|
||||
Used to initialize internal settings. Check the `newdev_template` plugin for details.
|
||||
|
||||
## Filters
|
||||
|
||||
Plugin entries can be filtered based on values entered into filter fields. The `txtMacFilter` textbox/field contains the Mac address of the currently viewed device or simply a mac address that's available in the `mac` query string.
|
||||
|
||||
| Property | Required | Description |
|
||||
|----------------------|----------------------|----------------------|
|
||||
| `compare_column` | yes | Plugin column name that's value is used for comparison (**Left** side of the equation) |
|
||||
| `compare_operator` | yes | JavaScript comparison operator |
|
||||
| `compare_field_id` | yes | The `id` of a input text field containing a value is used for comparison (**Right** side of the equation)|
|
||||
| `compare_js_wrapper` | yes | JavaScript code used to convert left and right side of the equation. `{value}` is replaced with input values. |
|
||||
|
||||
|
||||
```json
|
||||
"data_filters": [
|
||||
{
|
||||
"compare_column" : "Object_PrimaryID",
|
||||
"compare_operator" : "==",
|
||||
"compare_field_id": "txtMacFilter",
|
||||
"compare_js_wrapper": "'{value}.toString()'"
|
||||
}
|
||||
],
|
||||
```
|
||||
|
||||
### Mapping the plugin results into a database table
|
||||
|
||||
PiAlert will take the results of the plugin execution and insert these results into a database table, if a plugin contains the property `"mapped_to_table"` in the `config.json` root. The mapping of the columns is defined in the `database_column_definitions` array.
|
||||
|
||||
@@ -3,6 +3,14 @@
|
||||
"unique_prefix": "DHCPLSS",
|
||||
"enabled": true,
|
||||
"data_source": "python-script",
|
||||
"data_filters": [
|
||||
{
|
||||
"compare_column" : "Object_PrimaryID",
|
||||
"compare_operator" : "==",
|
||||
"compare_field_id": "txtMacFilter",
|
||||
"compare_js_wrapper": "'{value}.toString()'"
|
||||
}
|
||||
],
|
||||
"localized": ["display_name", "description", "icon"],
|
||||
"mapped_to_table": "DHCP_Leases",
|
||||
"display_name" : [{
|
||||
|
||||
@@ -2,7 +2,15 @@
|
||||
"code_name": "snmp_discovery",
|
||||
"unique_prefix": "SNMPDSC",
|
||||
"enabled": true,
|
||||
"data_source": "python-script",
|
||||
"data_source": "pyton-script",
|
||||
"data_filters": [
|
||||
{
|
||||
"compare_column" : "Object_PrimaryID",
|
||||
"compare_operator" : "==",
|
||||
"compare_field_id": "txtMacFilter",
|
||||
"compare_js_wrapper": "'{value}.toString()'"
|
||||
}
|
||||
],
|
||||
"localized": ["display_name", "description", "icon"],
|
||||
"mapped_to_table": "DHCP_Leases",
|
||||
"display_name" : [{
|
||||
|
||||
@@ -3,6 +3,14 @@
|
||||
"unique_prefix": "UNFIMP",
|
||||
"enabled": true,
|
||||
"data_source": "python-script",
|
||||
"data_filters": [
|
||||
{
|
||||
"compare_column" : "Object_PrimaryID",
|
||||
"compare_operator" : "==",
|
||||
"compare_field_id": "txtMacFilter",
|
||||
"compare_js_wrapper": "'{value}.toString()'"
|
||||
}
|
||||
],
|
||||
"localized": ["display_name", "description", "icon"],
|
||||
"mapped_to_table": "DHCP_Leases",
|
||||
"display_name" : [{
|
||||
|
||||
Reference in New Issue
Block a user