@theotherwillembotha/node-red-plugincore 0.0.50 → 0.0.51

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/README.md +60 -21
  2. package/build/GenerateNodes.js +2 -0
  3. package/build/Nodes.html +174 -250
  4. package/build/Nodes.js +2 -0
  5. package/build/core/NodeConstructor.d.ts +4 -2
  6. package/build/core/NodeConstructor.d.ts.map +1 -1
  7. package/build/core/NodeConstructor.js +5 -3
  8. package/build/core/NodeGenerator.js +8 -8
  9. package/build/core/logger/node/ConsoleLoggerConfigNode.html +20 -61
  10. package/build/core/logger/node/LokiLoggerConfigNode.d.ts +1 -1
  11. package/build/core/logger/node/LokiLoggerConfigNode.html +37 -73
  12. package/build/core/logger/node/LokiLoggerConfigNode.js +1 -1
  13. package/build/core/logger/node/RestLoggerConfigNode.html +51 -77
  14. package/build/core/logger/node/RestLoggerConfigNode.js +1 -1
  15. package/build/core/logger/service/LoggerService.d.ts +1 -1
  16. package/build/core/logger/service/LoggerService.d.ts.map +1 -1
  17. package/build/core/logger/service/LoggerService.js +2 -3
  18. package/build/core/logger/template/LoggerTemplate.d.ts.map +1 -1
  19. package/build/core/logger/template/LoggerTemplate.html +15 -12
  20. package/build/core/logger/template/LoggerTemplate.js +1 -2
  21. package/build/core/metrics/MetricsDecorator.js +2 -2
  22. package/build/core/metrics/node/CounterMetricConfigNode.html +2 -2
  23. package/build/core/metrics/node/GaugeMetricConfigNode.html +2 -2
  24. package/build/core/metrics/node/GaugeMetricConfigNode.js +2 -2
  25. package/build/core/metrics/node/MetricsConfigNode.html +1 -1
  26. package/build/core/metrics/node/TimerMetricConfigNode.html +13 -13
  27. package/build/core/metrics/service/MetricsService.d.ts +1 -1
  28. package/build/core/metrics/service/MetricsService.js +6 -6
  29. package/build/core/metrics/template/CounterMetricTemplate.html +1 -1
  30. package/build/core/metrics/template/GaugeMetricTemplate.html +1 -1
  31. package/build/core/metrics/template/TimerMetricTemplate.html +1 -1
  32. package/build/core/other/node/DelegatedConfigReferenceNode.d.ts +57 -0
  33. package/build/core/other/node/DelegatedConfigReferenceNode.d.ts.map +1 -0
  34. package/build/core/other/node/DelegatedConfigReferenceNode.html +1 -0
  35. package/build/core/other/node/DelegatedConfigReferenceNode.js +79 -0
  36. package/build/core/tagging/NodeDescriptionDecorator.js +1 -1
  37. package/build/core/tagging/service/NodeTypeService.js +1 -1
  38. package/build/core/webhook/node/WebhookServerConfigNode.html +5 -5
  39. package/build/core/webhook/template/WebhookTemplate.html +18 -10
  40. package/build/index.d.ts +1 -1
  41. package/build/index.d.ts.map +1 -1
  42. package/build/index.js +1 -1
  43. package/documentation/CounterMetricConfigNode.png +0 -0
  44. package/documentation/GaugeMetricConfigNode.png +0 -0
  45. package/documentation/MetricsConfigNode.png +0 -0
  46. package/documentation/TimerMetricConfigNode.png +0 -0
  47. package/documentation/WebhookNode.png +0 -0
  48. package/package.json +4 -3
  49. package/src/GenerateNodes.ts +3 -1
  50. package/src/core/NodeConstructor.ts +7 -4
  51. package/src/core/NodeGenerator.ts +8 -8
  52. package/src/core/logger/node/ConsoleLoggerConfigNode.html +20 -61
  53. package/src/core/logger/node/LokiLoggerConfigNode.html +37 -73
  54. package/src/core/logger/node/LokiLoggerConfigNode.ts +2 -2
  55. package/src/core/logger/node/RestLoggerConfigNode.html +51 -77
  56. package/src/core/logger/node/RestLoggerConfigNode.ts +1 -1
  57. package/src/core/logger/service/LoggerService.ts +3 -4
  58. package/src/core/logger/template/LoggerTemplate.html +15 -12
  59. package/src/core/logger/template/LoggerTemplate.ts +1 -2
  60. package/src/core/metrics/MetricsDecorator.ts +2 -2
  61. package/src/core/metrics/node/CounterMetricConfigNode.html +2 -2
  62. package/src/core/metrics/node/GaugeMetricConfigNode.html +2 -2
  63. package/src/core/metrics/node/GaugeMetricConfigNode.ts +2 -2
  64. package/src/core/metrics/node/MetricsConfigNode.html +1 -1
  65. package/src/core/metrics/node/MetricsConfigNode.ts +1 -1
  66. package/src/core/metrics/node/TimerMetricConfigNode.html +13 -13
  67. package/src/core/metrics/service/MetricsService.ts +6 -6
  68. package/src/core/metrics/template/CounterMetricTemplate.html +1 -1
  69. package/src/core/metrics/template/GaugeMetricTemplate.html +1 -1
  70. package/src/core/metrics/template/TimerMetricTemplate.html +1 -1
  71. package/src/core/other/node/DelegatedConfigReferenceNode.html +1 -0
  72. package/src/core/other/node/DelegatedConfigReferenceNode.ts +70 -0
  73. package/src/core/tagging/NodeDescriptionDecorator.ts +1 -1
  74. package/src/core/tagging/service/NodeTypeService.ts +1 -1
  75. package/src/core/webhook/node/WebhookServerConfigNode.html +5 -5
  76. package/src/core/webhook/template/WebhookTemplate.html +18 -10
  77. package/src/index.ts +1 -2
  78. package/build/core/logger/node/LoggerConfigNode.d.ts +0 -30
  79. package/build/core/logger/node/LoggerConfigNode.d.ts.map +0 -1
  80. package/build/core/logger/node/LoggerConfigNode.html +0 -307
  81. package/build/core/logger/node/LoggerConfigNode.js +0 -60
  82. package/src/core/logger/node/LoggerConfigNode.html +0 -307
  83. package/src/core/logger/node/LoggerConfigNode.ts +0 -95
@@ -6,7 +6,7 @@
6
6
  .addDefault("level", {value:"info", required:true})
7
7
 
8
8
  .addDefault("loki_host", {})
9
- .addDefault("loki_tenantID", {})
9
+ .addDefault("loki_tenantid", {})
10
10
  .addDefault("loki_userid", {})
11
11
  .addDefault("loki_authtoken", {})
12
12
 
@@ -51,103 +51,67 @@
51
51
  <script type="text/html" template-section="onIncludeEditForm">
52
52
  <div id="LoggerConfig">
53
53
  <div class="form-row">
54
- <label for="node-config-input-name"><i class="fa fa-tag"></i> Name</label>
54
+ <label class="towb_editorlabel" for="node-config-input-name"><i class="fa fa-font"></i> Name</label>
55
55
  <input type="text" id="node-config-input-name" />
56
56
  </div>
57
57
 
58
58
  <div class="form-row">
59
- <label for="node-config-input-level"><i class="fa fa-tag"></i> Level</label>
59
+ <label class="towb_editorlabel" for="node-config-input-level"><i class="fa fa-signal"></i> Level</label>
60
60
  <input type="text" id="node-config-input-level" />
61
61
  </div>
62
62
 
63
63
  <div class="form-row">
64
- <label for="node-config-input-loki_host"><i class="fa fa-tag"></i> Host</label>
64
+ <label class="towb_editorlabel" for="node-config-input-loki_host"><i class="fa fa-server"></i> Host</label>
65
65
  <input class="required" type="text" id="node-config-input-loki_host" />
66
66
  </div>
67
67
  <div class="form-row">
68
- <label for="node-config-input-loki_tenantID"><i class="fa fa-tag"></i> TenantID</label>
69
- <input class="" type="text" id="node-config-input-loki_tenantID" />
68
+ <label class="towb_editorlabel" for="node-config-input-loki_tenantid"><i class="fa fa-building-o"></i> Tenant ID</label>
69
+ <input class="" type="text" id="node-config-input-loki_tenantid" />
70
70
  </div>
71
71
  <div class="form-row">
72
- <label for="node-config-input-loki_userid"><i class="fa fa-tag"></i> Username</label>
72
+ <label class="towb_editorlabel" for="node-config-input-loki_userid"><i class="fa fa-user"></i> Username</label>
73
73
  <input class="" type="text" id="node-config-input-loki_userid" />
74
74
  </div>
75
75
  <div class="form-row">
76
- <label for="node-config-input-loki_authtoken"><i class="fa fa-tag"></i> AuthToken</label>
76
+ <label class="towb_editorlabel" for="node-config-input-loki_authtoken"><i class="fa fa-key"></i> Auth Token</label>
77
77
  <input class="" type="password" id="node-config-input-loki_authtoken" />
78
78
  </div>
79
79
 
80
80
  <div class="form-row">
81
- <label for="node-config-input-templateEditor"><i class="fa fa-tag"></i> Template</label>
81
+ <label class="towb_editorlabel" for="node-config-input-templateEditor"><i class="fa fa-code"></i> Template</label>
82
82
  <div style="height: 250px; min-height:150px;" class="node-text-editor" id="node-config-input-templateEditor"></div>
83
83
  </div>
84
84
  </div>
85
85
  </script>
86
86
 
87
87
  <script type="text/markdown" template-section="onIncludeDocumentation">
88
- Configuration node for the Logger Integration
89
-
90
- ## Inputs
91
- : *name* (string) : The common name for the logger Configuration
92
- : *level* (level) : The logging level - debug, info, warning, error
93
- : *platform*(string) : The common name for the logger Configuration
94
- : *template*(mustache) : A template for the log messages.
95
-
96
- ## Logger platform
97
- Currently supported logging platforms
98
-
99
- ### Console
100
- The log message will be printed out to stdio
101
-
102
- ### Http / Https
103
- Publish the message to an http endpoint using a http / https POST command.
104
-
105
- : *url* (url) : The endpoint for the url where requests are to be posted to.
106
- : *ignore ssl errors* (boolean) : If enabled, the invalid ssl certificates will be ignored.
107
- : *authentication* (auth method) : what auth method should be used for the http request. (none, basic, api key)
108
-
109
- #### Authentication
110
- ##### Basic
111
- Provides basic authentication using the Authorization header
112
-
113
- : *username* (string) : the username used for basic authentication
114
- : *password* (string) : the password used for basic authentication
115
-
116
- ##### APIKey
117
- Provides authentication using a matrix parameter, header or query parameter and an apikey
118
-
119
- : *mechanism* (mechanism) : the mechanism that will be used for transmitting the key (header, queryparam, matrixparam)
120
- : *apikey name* (string) : the name of the key used for api authentication. (path variable or query param name)
121
- : *apikey value*(string) : the value of the api key that will be transmitted. (beware of special characters)
122
-
123
- ### Loki
124
- Publish the message to a loki endpoint.
125
-
126
- : *host* (string) : the host and port\ of the loki instance that it being logged to
127
- : *tenant* (string) : the tenant id that will be used to log to
128
- : *username* (string) : the username for the loki instance.
129
- : *authtoken* (string) : the authtoken for the loki instance.
130
-
131
- # Mustache Templating
132
- Mustache / Handlebars are used for building up the logged message payloads that are sent to the logging backend.
133
- The resultant message will be interpreted as a string, meaning care should be taken in the event that a string representation of a json object is built.
134
-
135
- ### Provided Properties
136
- A couple of values are provided to the logging context by default.
137
-
138
- : *msg* (object) : an object containing the payload or message that should be parsed through the template.
139
- : *currentTime* (object) : a string containing the current time in ISO8601 format
140
-
141
- ### Mustache Helpers
142
- In addition to the provided properties, some "helpers" have also been provided to assist in serialization.
143
-
144
- : *json* (helper) : converts a json object to a string using the JSON.stringify method.
145
-
146
- ## Examples
147
- - {{{json msg}}} - serializes the the msg object to json format.
148
-
149
- # References
150
- - [Mustache - Wikipedia](https://en.wikipedia.org/wiki/Mustache_(template_system))
151
- - [Mustache - Playground](https://jgonggrijp.gitlab.io/wontache/playground.html)
88
+ Pushes log messages to a Grafana Loki instance using the Loki HTTP API.
89
+
90
+ ### Properties
91
+ : *name* (string) : A descriptive name for this logger configuration.
92
+ : *level* (level) : The minimum log level. Messages below this threshold are suppressed. Options: DEBUG, INFO, WARNING, ERROR.
93
+ : *host* (string) : The base URL of the Loki instance, including port (e.g. `http://localhost:3100`).
94
+ : *tenant ID* (string) : The tenant identifier for multi-tenant Loki deployments (`X-Scope-OrgID` header). Leave blank for single-tenant deployments.
95
+ : *username* (string) : Username for Loki authentication.
96
+ : *auth token* (string) : Authentication token or password for Loki.
97
+ : *template* (mustache) : A Mustache/Handlebars template that formats the log message body.
98
+
99
+ ### Mustache Templating
100
+ Mustache/Handlebars templates build the message string pushed to Loki.
101
+
102
+ #### Provided Properties
103
+ : *msg* (object) : The Node-RED message object passed through the node.
104
+ : *currentTime* (string) : The current time in ISO 8601 format.
105
+
106
+ #### Helpers
107
+ : *json* (helper) : Serialises an object to a JSON string using `JSON.stringify`.
108
+
109
+ #### Examples
110
+ - `{{{json msg}}}` — serialises the full message object as JSON.
111
+
112
+ #### References
113
+ - [Grafana Loki HTTP API](https://grafana.com/docs/loki/latest/reference/loki-http-api/)
114
+ - [Mustache — Wikipedia](https://en.wikipedia.org/wiki/Mustache_(template_system))
115
+ - [Mustache — Playground](https://jgonggrijp.gitlab.io/wontache/playground.html)
152
116
  </script>
153
117
 
@@ -15,7 +15,7 @@ interface LokiLoggerConfigNodeConfig extends ConfigNodeConfig {
15
15
  loki_host:string,
16
16
  loki_userid?:string,
17
17
  loki_authtoken?:string,
18
- loki_tenantID?:string
18
+ loki_tenantid?:string
19
19
  }
20
20
 
21
21
  @NodeDescription({
@@ -46,7 +46,7 @@ export class LokiLoggerConfigNode extends ConfigNode<LokiLoggerConfigNodeConfig>
46
46
  host:config.loki_host,
47
47
  userid:config.loki_userid,
48
48
  authtoken:config.loki_authtoken,
49
- tenantID:config.loki_tenantID,
49
+ tenantID:config.loki_tenantid,
50
50
  }
51
51
 
52
52
  this._logger = LoggerService.get(loggerConfig);
@@ -6,8 +6,8 @@
6
6
  .addDefault("level", {value:"info", required:true})
7
7
 
8
8
  // platform rest:
9
- .addDefault("est_url", {})
10
- .addDefault("est_ignoresslerror", {})
9
+ .addDefault("rest_url", {})
10
+ .addDefault("rest_ignoresslerror", {})
11
11
  .addDefault("rest_auth_type", {})
12
12
  .addDefault("rest_auth_basic_username", {})
13
13
  .addDefault("rest_auth_basic_password", {})
@@ -88,122 +88,96 @@
88
88
  <script type="text/html" template-section="onIncludeEditForm">
89
89
  <div id="LoggerConfig">
90
90
  <div class="form-row">
91
- <label for="node-config-input-name"><i class="fa fa-tag"></i> Name</label>
91
+ <label class="towb_editorlabel" for="node-config-input-name"><i class="fa fa-font"></i> Name</label>
92
92
  <input type="text" id="node-config-input-name" />
93
93
  </div>
94
94
 
95
95
  <div class="form-row">
96
- <label for="node-config-input-level"><i class="fa fa-tag"></i> Level</label>
96
+ <label class="towb_editorlabel" for="node-config-input-level"><i class="fa fa-signal"></i> Level</label>
97
97
  <input type="text" id="node-config-input-level" />
98
98
  </div>
99
99
 
100
100
  <div class="platform platform-rest">
101
101
  <div class="form-row">
102
- <label for="node-config-input-rest_url"><i class="fa fa-tag"></i> URL</label>
102
+ <label class="towb_editorlabel" for="node-config-input-rest_url"><i class="fa fa-link"></i> URL</label>
103
103
  <input class="platform-rest-input required" type="text" id="node-config-input-rest_url" />
104
104
  </div>
105
105
  <div class="form-row">
106
- <label></label>
106
+ <label class="towb_editorlabel"></label>
107
107
  <input type="checkbox" id="node-config-input-rest_ignoresslerror" style="width:20px; margin-right:5px;" />
108
108
  <label style="width:auto" for="node-config-input-rest_ignoresslerror"><span>Ignore Invalid SSL certificates</span></label>
109
109
  </div>
110
110
  <div class="form-row">
111
- <label for="node-config-input-rest_auth_type"><i class="fa fa-tag"></i> Authentication</label>
111
+ <label class="towb_editorlabel" for="node-config-input-rest_auth_type"><i class="fa fa-lock"></i> Authentication</label>
112
112
  <input class="platform-rest-input required" type="text" id="node-config-input-rest_auth_type" />
113
113
  </div>
114
114
  <div class="form-row platform-rest-auth auth-basic">
115
- <label for="node-config-input-rest_auth_basic_username"><i class="fa fa-tag"></i> Username</label>
115
+ <label class="towb_editorlabel" for="node-config-input-rest_auth_basic_username"><i class="fa fa-user"></i> Username</label>
116
116
  <input class="platform-rest-input" type="text" id="node-config-input-rest_auth_basic_username" />
117
117
  </div>
118
118
  <div class="form-row platform-rest-auth auth-basic">
119
- <label for="node-config-input-rest_auth_basic_password"><i class="fa fa-tag"></i> Password</label>
119
+ <label class="towb_editorlabel" for="node-config-input-rest_auth_basic_password"><i class="fa fa-key"></i> Password</label>
120
120
  <input class="platform-rest-input" type="password" id="node-config-input-rest_auth_basic_password" />
121
121
  </div>
122
122
  <div class="form-row platform-rest-auth auth-apikey">
123
- <label for="node-config-input-rest_auth_apikey_mechanism"><i class="fa fa-tag"></i> Mechanism</label>
123
+ <label class="towb_editorlabel" for="node-config-input-rest_auth_apikey_mechanism"><i class="fa fa-exchange"></i> Mechanism</label>
124
124
  <input class="platform-rest-input" type="text" id="node-config-input-rest_auth_apikey_mechanism" />
125
125
  </div>
126
126
  <div class="form-row platform-rest-auth auth-apikey">
127
- <label for="node-config-input-rest_auth_apikey_name"><i class="fa fa-tag"></i> APIKey name</label>
127
+ <label class="towb_editorlabel" for="node-config-input-rest_auth_apikey_name"><i class="fa fa-id-badge"></i> APIKey name</label>
128
128
  <input class="platform-rest-input" type="text" id="node-config-input-rest_auth_apikey_name" />
129
129
  </div>
130
130
  <div class="form-row platform-rest-auth auth-apikey">
131
- <label for="node-config-input-rest_auth_apikey_value"><i class="fa fa-tag"></i> APIKey value</label>
131
+ <label class="towb_editorlabel" for="node-config-input-rest_auth_apikey_value"><i class="fa fa-lock"></i> APIKey value</label>
132
132
  <input class="platform-rest-input" type="text" id="node-config-input-rest_auth_apikey_value" />
133
133
  </div>
134
134
  </div>
135
135
 
136
136
  <div class="form-row">
137
- <label for="node-config-input-templateEditor"><i class="fa fa-tag"></i> Template</label>
137
+ <label class="towb_editorlabel" for="node-config-input-templateEditor"><i class="fa fa-code"></i> Template</label>
138
138
  <div style="height: 250px; min-height:150px;" class="node-text-editor" id="node-config-input-templateEditor"></div>
139
139
  </div>
140
140
  </div>
141
141
  </script>
142
142
 
143
143
  <script type="text/markdown" template-section="onIncludeDocumentation">
144
- Configuration node for the Logger Integration
145
-
146
- ## Inputs
147
- : *name* (string) : The common name for the logger Configuration
148
- : *level* (level) : The logging level - debug, info, warning, error
149
- : *platform*(string) : The common name for the logger Configuration
150
- : *template*(mustache) : A template for the log messages.
151
-
152
- ## Logger platform
153
- Currently supported logging platforms
154
-
155
- ### Console
156
- The log message will be printed out to stdio
157
-
158
- ### Http / Https
159
- Publish the message to an http endpoint using a http / https POST command.
160
-
161
- : *url* (url) : The endpoint for the url where requests are to be posted to.
162
- : *ignore ssl errors* (boolean) : If enabled, the invalid ssl certificates will be ignored.
163
- : *authentication* (auth method) : what auth method should be used for the http request. (none, basic, api key)
164
-
165
- #### Authentication
166
- ##### Basic
167
- Provides basic authentication using the Authorization header
168
-
169
- : *username* (string) : the username used for basic authentication
170
- : *password* (string) : the password used for basic authentication
171
-
172
- ##### APIKey
173
- Provides authentication using a matrix parameter, header or query parameter and an apikey
174
-
175
- : *mechanism* (mechanism) : the mechanism that will be used for transmitting the key (header, queryparam, matrixparam)
176
- : *apikey name* (string) : the name of the key used for api authentication. (path variable or query param name)
177
- : *apikey value*(string) : the value of the api key that will be transmitted. (beware of special characters)
178
-
179
- ### Loki
180
- Publish the message to a loki endpoint.
181
-
182
- : *host* (string) : the host and port\ of the loki instance that it being logged to
183
- : *tenant* (string) : the tenant id that will be used to log to
184
- : *username* (string) : the username for the loki instance.
185
- : *authtoken* (string) : the authtoken for the loki instance.
186
-
187
- # Mustache Templating
188
- Mustache / Handlebars are used for building up the logged message payloads that are sent to the logging backend.
189
- The resultant message will be interpreted as a string, meaning care should be taken in the event that a string representation of a json object is built.
190
-
191
- ### Provided Properties
192
- A couple of values are provided to the logging context by default.
193
-
194
- : *msg* (object) : an object containing the payload or message that should be parsed through the template.
195
- : *currentTime* (object) : a string containing the current time in ISO8601 format
196
-
197
- ### Mustache Helpers
198
- In addition to the provided properties, some "helpers" have also been provided to assist in serialization.
199
-
200
- : *json* (helper) : converts a json object to a string using the JSON.stringify method.
201
-
202
- ## Examples
203
- - {{{json msg}}} - serializes the the msg object to json format.
204
-
205
- # References
206
- - [Mustache - Wikipedia](https://en.wikipedia.org/wiki/Mustache_(template_system))
207
- - [Mustache - Playground](https://jgonggrijp.gitlab.io/wontache/playground.html)
144
+ Posts log messages to an HTTP or HTTPS endpoint as a JSON payload.
145
+
146
+ ### Properties
147
+ : *name* (string) : A descriptive name for this logger configuration.
148
+ : *level* (level) : The minimum log level. Messages below this threshold are suppressed. Options: DEBUG, INFO, WARNING, ERROR.
149
+ : *url* (url) : The endpoint that log messages will be POSTed to.
150
+ : *ignore SSL errors* (boolean) : When enabled, invalid SSL certificates are accepted.
151
+ : *authentication* (select) : The authentication strategy applied to each request. Options: None, Basic, ApiKey.
152
+ : *template* (mustache) : A Mustache/Handlebars template that formats the log message body.
153
+
154
+ ### Authentication
155
+ #### Basic
156
+ Authenticates using the HTTP `Authorization` header (RFC 7617).
157
+ : *username* (string) : The username credential.
158
+ : *password* (string) : The password credential.
159
+
160
+ #### ApiKey
161
+ Authenticates by injecting a key/value pair into the request.
162
+ : *mechanism* (select) : Where the key is injected Header, Query Param, or Matrix Param.
163
+ : *APIKey name* (string) : The name of the key (e.g. `x-api-key`).
164
+ : *APIKey value* (string) : The value of the key.
165
+
166
+ ### Mustache Templating
167
+ Mustache/Handlebars templates build the message string POSTed to the endpoint.
168
+
169
+ #### Provided Properties
170
+ : *msg* (object) : The Node-RED message object passed through the node.
171
+ : *currentTime* (string) : The current time in ISO 8601 format.
172
+
173
+ #### Helpers
174
+ : *json* (helper) : Serialises an object to a JSON string using `JSON.stringify`.
175
+
176
+ #### Examples
177
+ - `{{{json msg}}}` serialises the full message object as JSON.
178
+
179
+ #### References
180
+ - [Mustache Wikipedia](https://en.wikipedia.org/wiki/Mustache_(template_system))
181
+ - [Mustache — Playground](https://jgonggrijp.gitlab.io/wontache/playground.html)
208
182
  </script>
209
183
 
@@ -24,7 +24,7 @@ interface RestLoggerConfigNodeConfig extends ConfigNodeConfig {
24
24
 
25
25
  @NodeDescription({
26
26
  id:"RestLoggerConfigNode",
27
- name:"Console Logger",
27
+ name:"Rest Endpoint Logger",
28
28
  group:"config",
29
29
  sourceFile:SourceUtility.getSourcePath("/build/", "/src/") + "RestLoggerConfigNode.html",
30
30
  package: "@theotherwillembotha/node-red-plugincore",
@@ -5,7 +5,6 @@ import Handlebars from "handlebars";
5
5
  import { createLogger, format, transports } from "winston";
6
6
  import LokiTransport from "winston-loki";
7
7
  import { URLRecord, parseURL } from 'whatwg-url';
8
- import { LoggerConfigNode } from "../node/LoggerConfigNode";
9
8
  import { LoggerTemplate } from "../template/LoggerTemplate";
10
9
  var network = require('network');
11
10
  import deepEqual from "deep-equal";
@@ -137,7 +136,7 @@ export interface LokiLoggerConfig extends BaseLoggerConfig{
137
136
  host:string;
138
137
  userid?:string;
139
138
  authtoken?:string;
140
- tenantID?:string;
139
+ tenantid?:string;
141
140
  }
142
141
 
143
142
  class LokiLogger extends NewLogger<LokiLoggerConfig>{
@@ -151,7 +150,7 @@ class LokiLogger extends NewLogger<LokiLoggerConfig>{
151
150
  json: true,
152
151
  format: format.json(),
153
152
  headers: {
154
- "X-Scope-OrgID": (config.tenantID) ? config.tenantID : undefined
153
+ "X-Scope-OrgID": (config.tenantid) ? config.tenantid : undefined
155
154
  },
156
155
  replaceTimestamp: true,
157
156
  onConnectionError: (err:unknown) => console.error(err),
@@ -301,7 +300,7 @@ export class LoggerService extends BaseService {
301
300
  "services-plugin",
302
301
  "@theotherwillembotha/node-red-plugincore",
303
302
  LoggerService,
304
- [LoggerConfigNode, LoggerTemplate]
303
+ [LoggerTemplate]
305
304
  );
306
305
  }
307
306
  }
@@ -102,7 +102,7 @@
102
102
  <script type="text/javascript" template-section="onCompose">
103
103
  node
104
104
  .addDefault("logEnabled", { value:false, required:true})
105
- .addDefault("logger", { required:false})
105
+ .addDefault("logger", { required:false, value:'', type:"DelegatedConfigReferenceNode"})
106
106
  .addDefault("logTemplateOverrideEnabled", {value:false})
107
107
  .addDefault("logTemplateOverride", {value:"message:{{msg}}"})
108
108
  </script>
@@ -186,7 +186,7 @@
186
186
  value: node.logTemplateOverride
187
187
  });
188
188
 
189
- let loggerSelector = $("#{{defaults.logger}}");
189
+ let loggerSelector = $("#logger-selector");
190
190
  let loggerEditButton = $("#logger-edit-btn");
191
191
  let loggerAddButton = $("#logger-add-btn");
192
192
 
@@ -199,7 +199,7 @@
199
199
 
200
200
  // figure out what type of logger this is.
201
201
  let selectedLogger = (await getLoggers()).find(logger => logger.id === loggerSelector.val());
202
- RED.editor.editConfig("#{{defaults.logger}}", selectedLogger.type, selectedLogger.id);
202
+ RED.editor.editConfig("#logger-selector", selectedLogger.type, selectedLogger.id);
203
203
  });
204
204
 
205
205
  loggerAddButton.on('click', function(event) {
@@ -223,14 +223,14 @@
223
223
  .appendTo($dropdown);
224
224
  });
225
225
 
226
- // Position it near the button
226
+ // Append first so outerWidth() is measurable, then position so the
227
+ // right edge of the dropdown aligns with the right edge of the button.
228
+ $('body').append($dropdown);
227
229
  $dropdown.css({
228
- top: $btn.offset().top + $btn.height(),
229
- left: $btn.offset().left
230
+ top: $btn.offset().top + $btn.outerHeight(),
231
+ left: $btn.offset().left + $btn.outerWidth() - $dropdown.outerWidth()
230
232
  });
231
233
 
232
- $('body').append($dropdown);
233
-
234
234
  $(document).on('mousedown.dropdown', function(e) {
235
235
  if (!$(e.target).closest('.loggertype-dropdown').length) {
236
236
  $dropdown.remove();
@@ -247,7 +247,7 @@
247
247
  // Do whatever you need with the selection
248
248
  console.log('Selected:', selectedValue, selectedText);
249
249
  $dropdown.remove();
250
- RED.editor.editConfig("#{{defaults.logger}}", selectedValue, "_ADD_");
250
+ RED.editor.editConfig("#logger-selector", selectedValue, "_ADD_");
251
251
  });
252
252
  })
253
253
  });
@@ -265,12 +265,15 @@
265
265
  // lastly, make sure that we set the correct value on the logger selector.
266
266
  updateLoggerSelectorList().then(() => {
267
267
  loggerSelector.val(node.logger);
268
+ loggerSelector.trigger('change');
268
269
  });
269
270
 
270
271
  </script>
271
272
 
272
273
  <script type="text/javascript" template-section="onIncludeEditSave">
273
274
  node = this;
275
+ var selectedLogger = $("#logger-selector").val();
276
+ node.logger = (selectedLogger && selectedLogger !== "_ADD_") ? selectedLogger : '';
274
277
  node.logTemplateOverride = node.logTemplateOverrideEditor.getValue();
275
278
  node.logTemplateOverrideEditor.destroy();
276
279
  delete node.logTemplateOverrideEditor;
@@ -289,9 +292,9 @@
289
292
 
290
293
  <div id="section_logEnabled">
291
294
  <div class="form-row nomargin">
292
- <label for="{{defaults.logger}}">Logger</label>
295
+ <label for="logger-selector">Logger</label>
293
296
  <div style="width: 70%; display: inline-flex;">
294
- <select id="{{defaults.logger}}" style="flex-grow: 1;" class="">
297
+ <select id="logger-selector" style="flex-grow: 1;" class="">
295
298
  <option value="_ADD_">none</option>
296
299
  </select>
297
300
  <a id="logger-edit-btn" class="red-ui-button disabled" style="margin-left: 10px;">
@@ -310,7 +313,7 @@
310
313
 
311
314
  <div id="section_logTemplateOverrideEnabled">
312
315
  <div class="form-row">
313
- <label for="node-input-logTemplateOverrideEditor"><i class="fa fa-tag"></i> Template</label>
316
+ <label class="towb_editorlabel" for="node-input-logTemplateOverrideEditor"><i class="fa fa-code"></i> Template</label>
314
317
  <div style="height: 250px; min-height:150px;" class="node-text-editor" id="node-input-logTemplateOverrideEditor"></div>
315
318
  </div>
316
319
  </div>
@@ -1,6 +1,5 @@
1
1
  import { SourceUtility } from "../../NodeGenerator";
2
2
  import { BaseNodeConfig, Template, TemplateDescriptor } from "../../NodeConstructor"
3
- import { LoggerConfigNode } from "../node/LoggerConfigNode";
4
3
 
5
4
  export interface LoggerTemplateConfig extends BaseNodeConfig{
6
5
  logEnabled:boolean,
@@ -17,7 +16,7 @@ export class LoggerTemplate extends Template {
17
16
  "logger",
18
17
  LoggerTemplate,
19
18
  SourceUtility.getSourcePath("/build/", "/src/") + "LoggerTemplate.html",
20
- [LoggerConfigNode],
19
+ [],
21
20
  )
22
21
  }
23
22
  }
@@ -100,7 +100,7 @@ export function Metrics(metricsConfig: MetricsConfig):Function {
100
100
  metricdescription:metricsConfig.description,
101
101
  node:nde
102
102
  };
103
- this[valueSymbol] = _metrics.guage(gaugeConfig);
103
+ this[valueSymbol] = _metrics.gauge(gaugeConfig);
104
104
  return this[valueSymbol];
105
105
  }
106
106
 
@@ -183,7 +183,7 @@ export function Metrics(metricsConfig: MetricsConfig):Function {
183
183
  metricdescription:metricsConfig.description,
184
184
  node:nde
185
185
  };
186
- this[valueSymbol] = _metrics.guage(gaugeConfig);
186
+ this[valueSymbol] = _metrics.gauge(gaugeConfig);
187
187
  return this[valueSymbol];
188
188
  }
189
189
 
@@ -20,12 +20,12 @@
20
20
  <script type="text/html" template-section="onIncludeEditForm">
21
21
  <div id="MetricsConfig">
22
22
  <div class="form-row">
23
- <label for="node-config-input-name"><i class="fa fa-tag"></i> Name</label>
23
+ <label class="towb_editorlabel" for="node-config-input-name"><i class="fa fa-font"></i> Name</label>
24
24
  <input type="text" id="node-config-input-name" />
25
25
  </div>
26
26
 
27
27
  <div class="form-row">
28
- <label for="node-config-input-description"><i class="fa fa-tag"></i> Description</label>
28
+ <label class="towb_editorlabel" for="node-config-input-description"><i class="fa fa-info-circle"></i> Description</label>
29
29
  <input type="text" id="node-config-input-description" />
30
30
  </div>
31
31
 
@@ -20,12 +20,12 @@
20
20
  <script type="text/html" template-section="onIncludeEditForm">
21
21
  <div id="MetricsConfig">
22
22
  <div class="form-row">
23
- <label for="node-config-input-name"><i class="fa fa-tag"></i> Name</label>
23
+ <label class="towb_editorlabel" for="node-config-input-name"><i class="fa fa-font"></i> Name</label>
24
24
  <input type="text" id="node-config-input-name">
25
25
  </div>
26
26
 
27
27
  <div class="form-row">
28
- <label for="node-config-input-description"><i class="fa fa-tag"></i> Description</label>
28
+ <label class="towb_editorlabel" for="node-config-input-description"><i class="fa fa-info-circle"></i> Description</label>
29
29
  <input type="text" id="node-config-input-description">
30
30
  </div>
31
31
 
@@ -14,7 +14,7 @@ interface GaugeMetricConfigNodeConfig extends ConfigNodeConfig, GaugeMetricConfi
14
14
 
15
15
  @NodeDescription({
16
16
  id:"GaugeMetricConfigNode",
17
- name:"Guage Metric Config Node",
17
+ name:"Gauge Metric Config Node",
18
18
  group:"config",
19
19
  sourceFile:SourceUtility.getSourcePath("/build/", "/src/") + "GaugeMetricConfigNode.html",
20
20
  package: "@theotherwillembotha/node-red-plugincore",
@@ -45,7 +45,7 @@ export class GaugeMetricConfigNode extends ConfigNode<GaugeMetricConfigNodeConfi
45
45
  }
46
46
  };
47
47
 
48
- this._gauge = this._metrics.guage(gaugeConfig);
48
+ this._gauge = this._metrics.gauge(gaugeConfig);
49
49
 
50
50
  if(config.reset){
51
51
  _this._gauge.reset();
@@ -8,7 +8,7 @@
8
8
  <script type="text/html" template-section="onIncludeEditForm">
9
9
  <div id="MetricsConfig">
10
10
  <div class="form-row">
11
- <label for="node-config-input-name"><i class="fa fa-tag"></i> Name</label>
11
+ <label class="towb_editorlabel" for="node-config-input-name"><i class="fa fa-font"></i> Name</label>
12
12
  <input type="text" id="node-config-input-name" />
13
13
  </div>
14
14
  </div>
@@ -16,7 +16,7 @@ The metrics / repositories are menanaged by the plugin and triggered when the fl
16
16
 
17
17
  The reasoning for this is that the Metrics exist outside of the flow, but is configured using the flow.
18
18
  Basically, if the metrics arent changed, we dont have to redeploy the metrics, which means that
19
- stuff like coutners, guages and timers are not reset.
19
+ stuff like coutners, gauges and timers are not reset.
20
20
  */
21
21
  interface MetricsConfigNodeConfig extends ConfigNodeConfig, WebhookTemplateConfig {
22
22
  }