Custom Watchers - Templating
Custom watchers support templating which can be used to create new types of watchers with predefined characteristics for specific use-cases. A HTML template can be set for the watcher’s configuration
panel, which includes the watcher’s basic settings. This template defaults to the standard configuration panel. A template can also be provided for an additional parameters
panel, which can prompt the user creating the watcher to input additional parameters.
A template uses basic HTML, with injection and processing logic provided by AngularJS syntax. Styling can also be applied using the provided [Bootstrap 3](https://getbootstrap.com/docs/3.3/css/) classes.
Templating for the configuration panel
titlePanelWatcherWizard
represents a root object, which contains the watcher data and methods to process input data. The following properties and methods are provided:
Property | Type | Description |
---|---|---|
|
|
Returns the title of the watcher in the format |
|
|
Access to the whole watcher object with the defined properties on it. An example of the watcher object can be found here |
|
|
Changes |
|
|
Reads and returns |
|
|
Sets the privacy control properties for the watcher and produced alarms/reports. |
|
|
Returns |
|
|
Returns and sets the selected schedule mode |
|
|
Returns and sets the available schedule options |
|
|
Sets the new schedule for the watcher |
|
|
AngularJS-object for the state of the form if it is used in the template |
|
|
Sets |
|
|
Returns the status of the message for the selected form’s input |
|
|
Returns |
|
|
Returns the available fields of selected saved search |
|
|
Returns the available geo-fields of selected saved search |
An example of a configuration
template can be found here.
Templating for the parameters panel
The parameters
panel has an access to two objects on scope of AngularJS controller: params
and data
.
The linked watcher custom parameters can be accessed through the params
object. The newly created watcher requires all parameters to be defined. The template for the parameters
panel should have default values for the hidden parameters on the template.
The data
object represents the available fields of selected saved search. The data
object has the following properties:
Property |
Type |
Description |
|
|
Returns the available fields of selected saved search |
|
|
Returns the available geo-fields of selected saved search |
The parameters
template allows you to customize one section in the watcher creation page (below the configuration
panel). If more flexibility is required, the parameters, as well as the basic settings of a watcher create page, can be rendered using the configuration
template. This template is given full access to the watcher object, the parameters specific to the custom watcher (as titlePanelWatcherWizard.watcher.custom.params
), and the data
object (as titlePanelWatcherWizard.data
).
An example of a parameters
template can be found here.
Defined components
For any of the templates, the following HTML components provide built-in forms for configuring watcher settings.
Component | Attributes | Description |
---|---|---|
|
|
Renders the form to set schedule through a single text value for the selected watcher and invokes calback on changes |
|
|
Renders the form to set schedule through configurable interval and unit value for the selected watcher and invokes calback on changes |
|
|
Renders the form to set the privacy settings for the selected watcher and invokes callback on changes |
|
Renders the form to set priority for the available watcher on the scope |
Sanitizing
Templates do not support usage of insecure HTML tags, attributes, scripts or custom stylesheets using the <style>
tag. Custom HTML tags, attributes, stylesheets can, however, be permitted by setting the following flags in the $INVESTIGATE_HOME/config/investigate.yml
.
Flag |
Type |
Description |
|
|
Allows the use of custom stylesheets |
|
|
Allows the use of specified custom attributes |
|
|
Allows the use of specified custom tags |