Plugins 0.3 - UI custom form controls

This commit is contained in:
Jokob-sk
2023-02-25 09:31:29 +11:00
parent 43d5c51e7c
commit 16d04fe485
5 changed files with 154 additions and 21 deletions

View File

@@ -166,18 +166,68 @@ Example:
##### database_column_definitions
- Only columns with `"show": true` and also with at least an english translation will be shown in the UI.
- 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 les sthan 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"
```json
{
"column": "Index",
"show": false,
"type": "label",
"column": "Watched_Value1",
"show": true,
"type": "threshold",
"default_value":"",
"options": [],
"options": [
{
"maximum": 199,
"hexColor": "#792D86"
},
{
"maximum": 299,
"hexColor": "#5B862D"
},
{
"maximum": 399,
"hexColor": "#7D862D"
},
{
"maximum": 499,
"hexColor": "#BF6440"
},
{
"maximum": 599,
"hexColor": "#D33115"
}
],
"localized": ["name"],
"name":[{
"language_code":"en_us",
"string" : "N/A"
"string" : "Status code"
}]
},
{
"column": "Status",
"show": true,
"type": "replace",
"default_value":"",
"options": [
{
"equals": "watched-not-changed",
"replacement": "<i class='fa-solid fa-square-check'></i>"
},
{
"equals": "watched-changed",
"replacement": "<i class='fa-solid fa-triangle-exclamation'></i>"
},
{
"equals": "new",
"replacement": "<i class='fa-solid fa-circle-plus'></i>"
}
],
"localized": ["name"],
"name":[{
"language_code":"en_us",
"string" : "Status"
}]
}
```
@@ -353,7 +403,7 @@ Example:
{
"column": "Status",
"show": true,
"type": "label",
"type": "equals",
"default_value":"",
"options": [],
"localized": ["name"],

View File

@@ -1,6 +1,6 @@
## Overview
A simple sample plugin allowing for monitoring web services or urls.
A simple sample plugin allowing for monitoring web services or urls. The status code corresponds to the commonly used [HTTP response status codes](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status).
### Usage
@@ -9,4 +9,4 @@ A simple sample plugin allowing for monitoring web services or urls.
### Notes
- Setting `(WEBMON_)SQL_internet_ip` is not used and specified for demonstration purposes only.
- Parameters `macs` and `internet_ip` are not used and specified for demonstration purposes only.
- Parameters `macs` and `internet_ip` in the `config.json` file are not used and specified for demonstration purposes only.

View File

@@ -58,7 +58,7 @@
{
"column": "Object_PrimaryID",
"show": true,
"type": "text",
"type": "url",
"default_value":"",
"options": [],
"localized": ["name"],
@@ -82,7 +82,7 @@
{
"column": "DateTimeCreated",
"show": true,
"type": "text",
"type": "label",
"default_value":"",
"options": [],
"localized": ["name"],
@@ -94,7 +94,7 @@
{
"column": "DateTimeChanged",
"show": true,
"type": "text",
"type": "label",
"default_value":"",
"options": [],
"localized": ["name"],
@@ -106,9 +106,30 @@
{
"column": "Watched_Value1",
"show": true,
"type": "text",
"type": "threshold",
"default_value":"",
"options": [],
"options": [
{
"maximum": 199,
"hexColor": "#792D86"
},
{
"maximum": 299,
"hexColor": "#5B862D"
},
{
"maximum": 399,
"hexColor": "#7D862D"
},
{
"maximum": 499,
"hexColor": "#BF6440"
},
{
"maximum": 599,
"hexColor": "#D33115"
}
],
"localized": ["name"],
"name":[{
"language_code":"en_us",
@@ -118,7 +139,7 @@
{
"column": "Watched_Value2",
"show": true,
"type": "text",
"type": "label",
"default_value":"",
"options": [],
"localized": ["name"],
@@ -166,9 +187,22 @@
{
"column": "Status",
"show": true,
"type": "label",
"type": "replace",
"default_value":"",
"options": [],
"options": [
{
"equals": "watched-not-changed",
"replacement": "<i class='fa-solid fa-square-check'></i>"
},
{
"equals": "watched-changed",
"replacement": "<i class='fa-solid fa-triangle-exclamation'></i>"
},
{
"equals": "new",
"replacement": "<i class='fa-solid fa-circle-plus'></i>"
}
],
"localized": ["name"],
"name":[{
"language_code":"en_us",