@theotherwillembotha/node-red-plugincore 0.0.50 → 0.0.52
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.
- package/README.md +155 -23
- package/build/GenerateNodes.js +3 -0
- package/build/Nodes.html +174 -250
- package/build/Nodes.js +2 -0
- package/build/core/NodeConstructor.d.ts +4 -2
- package/build/core/NodeConstructor.d.ts.map +1 -1
- package/build/core/NodeConstructor.js +5 -3
- package/build/core/NodeGenerator.js +8 -8
- package/build/core/logger/node/ConsoleLoggerConfigNode.html +20 -61
- package/build/core/logger/node/LokiLoggerConfigNode.d.ts +1 -1
- package/build/core/logger/node/LokiLoggerConfigNode.html +37 -73
- package/build/core/logger/node/LokiLoggerConfigNode.js +1 -1
- package/build/core/logger/node/RestLoggerConfigNode.html +51 -77
- package/build/core/logger/node/RestLoggerConfigNode.js +1 -1
- package/build/core/logger/service/LoggerService.d.ts +1 -1
- package/build/core/logger/service/LoggerService.d.ts.map +1 -1
- package/build/core/logger/service/LoggerService.js +2 -3
- package/build/core/logger/template/LoggerTemplate.d.ts.map +1 -1
- package/build/core/logger/template/LoggerTemplate.html +15 -12
- package/build/core/logger/template/LoggerTemplate.js +1 -2
- package/build/core/metrics/MetricsDecorator.js +2 -2
- package/build/core/metrics/node/CounterMetricConfigNode.html +2 -2
- package/build/core/metrics/node/GaugeMetricConfigNode.html +2 -2
- package/build/core/metrics/node/GaugeMetricConfigNode.js +2 -2
- package/build/core/metrics/node/MetricsConfigNode.html +1 -1
- package/build/core/metrics/node/TimerMetricConfigNode.html +13 -13
- package/build/core/metrics/service/MetricsService.d.ts +1 -1
- package/build/core/metrics/service/MetricsService.js +6 -6
- package/build/core/metrics/template/CounterMetricTemplate.html +1 -1
- package/build/core/metrics/template/GaugeMetricTemplate.html +1 -1
- package/build/core/metrics/template/TimerMetricTemplate.html +1 -1
- package/build/core/other/node/DelegatedConfigReferenceNode.d.ts +57 -0
- package/build/core/other/node/DelegatedConfigReferenceNode.d.ts.map +1 -0
- package/build/core/other/node/DelegatedConfigReferenceNode.html +1 -0
- package/build/core/other/node/DelegatedConfigReferenceNode.js +79 -0
- package/build/core/tagging/NodeDescriptionDecorator.js +1 -1
- package/build/core/tagging/service/NodeTypeService.js +1 -1
- package/build/core/ui/template/UIHelperTemplate.d.ts +5 -0
- package/build/core/ui/template/UIHelperTemplate.d.ts.map +1 -0
- package/build/core/ui/template/UIHelperTemplate.html +229 -0
- package/build/core/ui/template/UIHelperTemplate.js +11 -0
- package/build/core/webhook/node/WebhookServerConfigNode.html +5 -5
- package/build/core/webhook/template/WebhookTemplate.html +18 -10
- package/build/index.d.ts +2 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +3 -1
- package/documentation/ConsoleLoggerConfigNode.png +0 -0
- package/documentation/CounterMetricConfigNode.png +0 -0
- package/documentation/GaugeMetricConfigNode.png +0 -0
- package/documentation/LokiLoggerConfigNode.png +0 -0
- package/documentation/MetricsConfigNode.png +0 -0
- package/documentation/RestLoggerConfigNode.png +0 -0
- package/documentation/TimerMetricConfigNode.png +0 -0
- package/documentation/WebhookNode.png +0 -0
- package/package.json +20 -8
- package/src/GenerateNodes.ts +5 -2
- package/src/core/NodeConstructor.ts +7 -4
- package/src/core/NodeGenerator.ts +8 -8
- package/src/core/logger/node/ConsoleLoggerConfigNode.html +20 -61
- package/src/core/logger/node/LokiLoggerConfigNode.html +37 -73
- package/src/core/logger/node/LokiLoggerConfigNode.ts +2 -2
- package/src/core/logger/node/RestLoggerConfigNode.html +51 -77
- package/src/core/logger/node/RestLoggerConfigNode.ts +1 -1
- package/src/core/logger/service/LoggerService.ts +3 -4
- package/src/core/logger/template/LoggerTemplate.html +15 -12
- package/src/core/logger/template/LoggerTemplate.ts +1 -2
- package/src/core/metrics/MetricsDecorator.ts +2 -2
- package/src/core/metrics/node/CounterMetricConfigNode.html +2 -2
- package/src/core/metrics/node/GaugeMetricConfigNode.html +2 -2
- package/src/core/metrics/node/GaugeMetricConfigNode.ts +2 -2
- package/src/core/metrics/node/MetricsConfigNode.html +1 -1
- package/src/core/metrics/node/MetricsConfigNode.ts +1 -1
- package/src/core/metrics/node/TimerMetricConfigNode.html +13 -13
- package/src/core/metrics/service/MetricsService.ts +6 -6
- package/src/core/metrics/template/CounterMetricTemplate.html +1 -1
- package/src/core/metrics/template/GaugeMetricTemplate.html +1 -1
- package/src/core/metrics/template/TimerMetricTemplate.html +1 -1
- package/src/core/other/node/DelegatedConfigReferenceNode.html +1 -0
- package/src/core/other/node/DelegatedConfigReferenceNode.ts +70 -0
- package/src/core/tagging/NodeDescriptionDecorator.ts +1 -1
- package/src/core/tagging/service/NodeTypeService.ts +1 -1
- package/src/core/ui/template/UIHelperTemplate.html +229 -0
- package/src/core/ui/template/UIHelperTemplate.ts +14 -0
- package/src/core/webhook/node/WebhookServerConfigNode.html +5 -5
- package/src/core/webhook/template/WebhookTemplate.html +18 -10
- package/src/index.ts +3 -1
- package/build/core/logger/node/LoggerConfigNode.d.ts +0 -30
- package/build/core/logger/node/LoggerConfigNode.d.ts.map +0 -1
- package/build/core/logger/node/LoggerConfigNode.html +0 -307
- package/build/core/logger/node/LoggerConfigNode.js +0 -60
- package/src/core/logger/node/LoggerConfigNode.html +0 -307
- package/src/core/logger/node/LoggerConfigNode.ts +0 -95
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
.addDefault("level", {value:"info", required:true})
|
|
7
7
|
|
|
8
8
|
// platform rest:
|
|
9
|
-
.addDefault("
|
|
10
|
-
.addDefault("
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
: *name*
|
|
148
|
-
: *level*
|
|
149
|
-
: *
|
|
150
|
-
: *
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
: *
|
|
163
|
-
: *
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
: *
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
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:"
|
|
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
|
-
|
|
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.
|
|
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
|
-
[
|
|
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 = $("#
|
|
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("#
|
|
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
|
-
//
|
|
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.
|
|
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("#
|
|
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="
|
|
295
|
+
<label for="logger-selector">Logger</label>
|
|
293
296
|
<div style="width: 70%; display: inline-flex;">
|
|
294
|
-
<select id="
|
|
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-
|
|
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
|
-
[
|
|
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.
|
|
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.
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
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:"
|
|
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.
|
|
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-
|
|
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,
|
|
19
|
+
stuff like coutners, gauges and timers are not reset.
|
|
20
20
|
*/
|
|
21
21
|
interface MetricsConfigNodeConfig extends ConfigNodeConfig, WebhookTemplateConfig {
|
|
22
22
|
}
|
|
@@ -88,23 +88,23 @@
|
|
|
88
88
|
<script type="text/html" template-section="onIncludeEditForm">
|
|
89
89
|
<div id="TimerMetricConfig">
|
|
90
90
|
<div class="form-row">
|
|
91
|
-
<label class="towb_editorlabel" for="node-config-input-name"><i class="fa fa-
|
|
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 class="towb_editorlabel" for="node-config-input-description"><i class="fa fa-
|
|
96
|
+
<label class="towb_editorlabel" for="node-config-input-description"><i class="fa fa-info-circle"></i> Description</label>
|
|
97
97
|
<input type="text" id="node-config-input-description" />
|
|
98
98
|
</div>
|
|
99
99
|
|
|
100
100
|
<div class="form-row">
|
|
101
|
-
<label class="towb_editorlabel" for="node-config-input-metricType"><i class="fa fa-
|
|
101
|
+
<label class="towb_editorlabel" for="node-config-input-metricType"><i class="fa fa-bar-chart"></i> Type</label>
|
|
102
102
|
<input class="towb_editorfield" type="text" id="node-config-input-metricType" />
|
|
103
103
|
</div>
|
|
104
104
|
|
|
105
105
|
<div class="metrictype metrictype_histogram">
|
|
106
106
|
<div class="form-row">
|
|
107
|
-
<label class="towb_editorlabel" for="node-config-input-buckettype"><i class="fa fa-
|
|
107
|
+
<label class="towb_editorlabel" for="node-config-input-buckettype"><i class="fa fa-sliders"></i> Bucket Type</label>
|
|
108
108
|
<input class="towb_editorfield" type="text" id="node-config-input-buckettype" />
|
|
109
109
|
</div>
|
|
110
110
|
|
|
@@ -114,37 +114,37 @@
|
|
|
114
114
|
|
|
115
115
|
<div class="metricsconfig_buckets metricsconfig_buckets_manual">
|
|
116
116
|
<div class="form-row">
|
|
117
|
-
<label class="towb_editorlabel" for="node-config-input-buckettype_manual_intervals"><i class="fa fa-
|
|
117
|
+
<label class="towb_editorlabel" for="node-config-input-buckettype_manual_intervals"><i class="fa fa-sliders"></i> Buckets</label>
|
|
118
118
|
<input type="text" id="node-config-input-buckettype_manual_intervals" placeholder="0.001, 0.01, 0.1, 1, 2, 5", value="0.001, 0.01, 0.1, 1, 2, 5"/>
|
|
119
119
|
</div>
|
|
120
120
|
</div>
|
|
121
121
|
|
|
122
122
|
<div class="metricsconfig_buckets metricsconfig_buckets_linear">
|
|
123
123
|
<div class="form-row">
|
|
124
|
-
<label class="towb_editorlabel" for="node-config-input-buckettype_linear_start"><i class="fa fa-
|
|
124
|
+
<label class="towb_editorlabel" for="node-config-input-buckettype_linear_start"><i class="fa fa-sliders"></i> Start</label>
|
|
125
125
|
<input class="towb_editorfield_short" type="text" id="node-config-input-buckettype_linear_start" placeholder="0.000", value="0.000"/>
|
|
126
126
|
</div>
|
|
127
127
|
<div class="form-row">
|
|
128
|
-
<label class="towb_editorlabel" for="node-config-input-
|
|
128
|
+
<label class="towb_editorlabel" for="node-config-input-buckettype_linear_interval"><i class="fa fa-sliders"></i> Interval</label>
|
|
129
129
|
<input class="towb_editorfield_short" type="text" id="node-config-input-buckettype_linear_interval" placeholder="10", value="10"/>
|
|
130
130
|
</div>
|
|
131
131
|
<div class="form-row">
|
|
132
|
-
<label class="towb_editorlabel" for="node-config-input-buckettype_linear_count"><i class="fa fa-
|
|
132
|
+
<label class="towb_editorlabel" for="node-config-input-buckettype_linear_count"><i class="fa fa-sliders"></i> Count</label>
|
|
133
133
|
<input class="towb_editorfield_short" type="text" id="node-config-input-buckettype_linear_count" placeholder="10", value="10"/>
|
|
134
134
|
</div>
|
|
135
135
|
</div>
|
|
136
136
|
|
|
137
137
|
<div class="metricsconfig_buckets metricsconfig_buckets_exponential">
|
|
138
138
|
<div class="form-row">
|
|
139
|
-
<label class="towb_editorlabel" for="node-config-input-buckettype_exponential_start"><i class="fa fa-
|
|
139
|
+
<label class="towb_editorlabel" for="node-config-input-buckettype_exponential_start"><i class="fa fa-sliders"></i> Start</label>
|
|
140
140
|
<input class="towb_editorfield_short" type="text" id="node-config-input-buckettype_exponential_start" placeholder="1", value="1"/>
|
|
141
141
|
</div>
|
|
142
142
|
<div class="form-row">
|
|
143
|
-
<label class="towb_editorlabel" for="node-config-input-buckettype_exponential_factor"><i class="fa fa-
|
|
143
|
+
<label class="towb_editorlabel" for="node-config-input-buckettype_exponential_factor"><i class="fa fa-sliders"></i> Factor</label>
|
|
144
144
|
<input class="towb_editorfield_short" type="text" id="node-config-input-buckettype_exponential_factor" placeholder="2", value="2"/>
|
|
145
145
|
</div>
|
|
146
146
|
<div class="form-row">
|
|
147
|
-
<label class="towb_editorlabel" for="node-config-input-buckettype_exponential_count"><i class="fa fa-
|
|
147
|
+
<label class="towb_editorlabel" for="node-config-input-buckettype_exponential_count"><i class="fa fa-sliders"></i> Count</label>
|
|
148
148
|
<input class="towb_editorfield_short" type="text" id="node-config-input-buckettype_exponential_count" placeholder="10", value="10"/>
|
|
149
149
|
</div>
|
|
150
150
|
</div>
|
|
@@ -152,7 +152,7 @@
|
|
|
152
152
|
|
|
153
153
|
<div class="metrictype metrictype_summary">
|
|
154
154
|
<div class="form-row">
|
|
155
|
-
<label class="towb_editorlabel" for="node-config-input-percentiletype"><i class="fa fa-
|
|
155
|
+
<label class="towb_editorlabel" for="node-config-input-percentiletype"><i class="fa fa-sliders"></i> Percentile Type</label>
|
|
156
156
|
<input type="text" id="node-config-input-percentiletype" />
|
|
157
157
|
</div>
|
|
158
158
|
|
|
@@ -162,7 +162,7 @@
|
|
|
162
162
|
|
|
163
163
|
<div class="metricsconfig_percentiles metricsconfig_percentiles_manual">
|
|
164
164
|
<div class="form-row">
|
|
165
|
-
<label class="towb_editorlabel" for="node-config-input-percentiletype_manual_intervals"><i class="fa fa-
|
|
165
|
+
<label class="towb_editorlabel" for="node-config-input-percentiletype_manual_intervals"><i class="fa fa-sliders"></i> Percentiles</label>
|
|
166
166
|
<input class="towb_editorfield" type="text" id="node-config-input-percentiletype_manual_intervals" placeholder="0.01, 0.1, 0.9, 0.99", value="0.01, 0.1, 0.9, 0.99"/>
|
|
167
167
|
</div>
|
|
168
168
|
</div>
|
|
@@ -415,18 +415,18 @@ export class MetricsContainer {
|
|
|
415
415
|
return counter;
|
|
416
416
|
}
|
|
417
417
|
|
|
418
|
-
public
|
|
419
|
-
var
|
|
420
|
-
var gauge:GaugeMetric = this.gauges[
|
|
418
|
+
public gauge(config: GaugeMetricConfig): GaugeMetric {
|
|
419
|
+
var gaugeId = `gauge_${config.node.id}`;
|
|
420
|
+
var gauge:GaugeMetric = this.gauges[gaugeId];
|
|
421
421
|
if(gauge){
|
|
422
422
|
// check if the config has changed much.
|
|
423
423
|
if(!deepEqual(gauge.config(), config)){
|
|
424
|
-
this._registry.removeSingleMetric(
|
|
425
|
-
this.gauges[
|
|
424
|
+
this._registry.removeSingleMetric(gaugeId);
|
|
425
|
+
this.gauges[gaugeId] = (gauge = new GaugeMetric(gaugeId, config, this._registry));
|
|
426
426
|
}
|
|
427
427
|
}
|
|
428
428
|
else{
|
|
429
|
-
this.gauges[
|
|
429
|
+
this.gauges[gaugeId] = (gauge = new GaugeMetric(gaugeId, config, this._registry));
|
|
430
430
|
}
|
|
431
431
|
return gauge;
|
|
432
432
|
}
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
<!-- CounterMetric -->
|
|
29
29
|
<div id="section_countermetricconfig">
|
|
30
30
|
<div class="form-row">
|
|
31
|
-
<label for="node-input-counterConfig"><i class="fa fa-
|
|
31
|
+
<label class="towb_editorlabel" for="node-input-counterConfig"><i class="fa fa-bar-chart"></i> Counter</label>
|
|
32
32
|
<input type="text" id="node-input-counterConfig" />
|
|
33
33
|
</div>
|
|
34
34
|
</div>
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
<!-- GaugeMetric -->
|
|
28
28
|
<div id="section_gaugemetricconfig">
|
|
29
29
|
<div class="form-row">
|
|
30
|
-
<label for="node-input-gaugeConfig"><i class="fa fa-
|
|
30
|
+
<label class="towb_editorlabel" for="node-input-gaugeConfig"><i class="fa fa-bar-chart"></i> Gauge</label>
|
|
31
31
|
<input type="text" id="node-input-gaugeConfig" />
|
|
32
32
|
</div>
|
|
33
33
|
</div>
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
|
|
28
28
|
<div id="section_timermetricconfig">
|
|
29
29
|
<div class="form-row">
|
|
30
|
-
<label for="node-input-timerConfig"><i class="fa fa-
|
|
30
|
+
<label class="towb_editorlabel" for="node-input-timerConfig"><i class="fa fa-clock-o"></i> Timer</label>
|
|
31
31
|
<input type="text" id="node-input-timerConfig" />
|
|
32
32
|
</div>
|
|
33
33
|
</div>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<!-- This section is intentionally left blank -->
|