@theotherwillembotha/node-red-plugincore 0.1.0 → 0.3.0
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 +616 -220
- package/build/GenerateNodes.js +9 -33
- package/build/Nodes.html +2 -1505
- package/build/Nodes.js +5 -19
- package/build/Plugins.html +11 -0
- package/build/Plugins.js +17 -12
- package/build/core/NodeConstructor.d.ts +12 -16
- package/build/core/NodeConstructor.d.ts.map +1 -1
- package/build/core/NodeConstructor.js +125 -185
- package/build/core/NodeGenerator.d.ts +3 -1
- package/build/core/NodeGenerator.d.ts.map +1 -1
- package/build/core/NodeGenerator.js +139 -43
- package/build/core/NodeManagerRuntime.d.ts +44 -0
- package/build/core/NodeManagerRuntime.d.ts.map +1 -0
- package/build/core/NodeManagerRuntime.js +140 -0
- package/build/core/Utils.d.ts.map +1 -1
- package/build/core/logger/service/LoggerService.d.ts +8 -6
- package/build/core/logger/service/LoggerService.d.ts.map +1 -1
- package/build/core/logger/service/LoggerService.js +101 -23
- package/build/core/logger/template/LoggerTemplate.d.ts +1 -2
- package/build/core/logger/template/LoggerTemplate.d.ts.map +1 -1
- package/build/core/logger/template/LoggerTemplate.js +18 -5
- package/build/core/metrics/MetricsDecorator.d.ts +1 -2
- package/build/core/metrics/MetricsDecorator.d.ts.map +1 -1
- package/build/core/metrics/MetricsDecorator.js +89 -116
- package/build/core/metrics/node/CounterMetricConfigNode.d.ts.map +1 -1
- package/build/core/metrics/node/CounterMetricConfigNode.js +4 -5
- package/build/core/metrics/node/GaugeMetricConfigNode.d.ts.map +1 -1
- package/build/core/metrics/node/GaugeMetricConfigNode.js +5 -6
- package/build/core/metrics/node/MetricsConfigNode.d.ts +19 -9
- package/build/core/metrics/node/MetricsConfigNode.d.ts.map +1 -1
- package/build/core/metrics/node/MetricsConfigNode.js +14 -45
- package/build/core/metrics/node/TimerMetricConfigNode.d.ts.map +1 -1
- package/build/core/metrics/node/TimerMetricConfigNode.js +11 -17
- package/build/core/metrics/service/MetricsService.d.ts +110 -114
- package/build/core/metrics/service/MetricsService.d.ts.map +1 -1
- package/build/core/metrics/service/MetricsService.js +122 -339
- package/build/core/metrics/template/CounterMetricTemplate.d.ts +1 -2
- package/build/core/metrics/template/CounterMetricTemplate.d.ts.map +1 -1
- package/build/core/metrics/template/CounterMetricTemplate.js +16 -5
- package/build/core/metrics/template/GaugeMetricTemplate.d.ts +1 -2
- package/build/core/metrics/template/GaugeMetricTemplate.d.ts.map +1 -1
- package/build/core/metrics/template/GaugeMetricTemplate.js +16 -5
- package/build/core/metrics/template/MetricsTemplate.d.ts +1 -2
- package/build/core/metrics/template/MetricsTemplate.d.ts.map +1 -1
- package/build/core/metrics/template/MetricsTemplate.js +18 -6
- package/build/core/metrics/template/TimerMetricTemplate.d.ts +1 -2
- package/build/core/metrics/template/TimerMetricTemplate.d.ts.map +1 -1
- package/build/core/metrics/template/TimerMetricTemplate.js +16 -5
- package/build/core/other/node/DelegatedConfigReferenceNode.d.ts +1 -1
- package/build/core/other/node/DelegatedConfigReferenceNode.d.ts.map +1 -1
- package/build/core/other/node/DelegatedConfigReferenceNode.js +1 -1
- package/build/core/other/service/InputService.d.ts.map +1 -1
- package/build/core/other/service/SettingsService.d.ts +1 -2
- package/build/core/other/service/SettingsService.d.ts.map +1 -1
- package/build/core/other/service/SettingsService.js +19 -5
- package/build/core/other/template/BasicTemplate.d.ts +1 -2
- package/build/core/other/template/BasicTemplate.d.ts.map +1 -1
- package/build/core/other/template/BasicTemplate.js +15 -5
- package/build/core/other/template/SettingsTemplate.d.ts +1 -2
- package/build/core/other/template/SettingsTemplate.d.ts.map +1 -1
- package/build/core/other/template/SettingsTemplate.js +17 -5
- package/build/core/state/node/InternalStateConfigNode.d.ts +16 -0
- package/build/core/state/node/InternalStateConfigNode.d.ts.map +1 -0
- package/build/core/state/node/InternalStateConfigNode.js +89 -0
- package/build/core/state/node/StateConfigNode.d.ts +24 -0
- package/build/core/state/node/StateConfigNode.d.ts.map +1 -0
- package/build/core/state/node/StateConfigNode.js +22 -0
- package/build/core/state/service/StateService.d.ts +34 -0
- package/build/core/state/service/StateService.d.ts.map +1 -0
- package/build/core/state/service/StateService.js +201 -0
- package/build/core/state/template/StateTemplate.d.ts +7 -0
- package/build/core/state/template/StateTemplate.d.ts.map +1 -0
- package/build/core/state/template/StateTemplate.js +25 -0
- package/build/core/tagging/ServiceDescriptionDecorator.d.ts +10 -0
- package/build/core/tagging/ServiceDescriptionDecorator.d.ts.map +1 -0
- package/build/core/tagging/ServiceDescriptionDecorator.js +10 -0
- package/build/core/tagging/TemplateDescriptionDecorator.d.ts +8 -0
- package/build/core/tagging/TemplateDescriptionDecorator.d.ts.map +1 -0
- package/build/core/tagging/TemplateDescriptionDecorator.js +10 -0
- package/build/core/tagging/service/NodeTypeService.d.ts +1 -2
- package/build/core/tagging/service/NodeTypeService.d.ts.map +1 -1
- package/build/core/tagging/service/NodeTypeService.js +19 -5
- package/build/core/ui/template/ScriptEditorTemplate.d.ts +1 -2
- package/build/core/ui/template/ScriptEditorTemplate.d.ts.map +1 -1
- package/build/core/ui/template/ScriptEditorTemplate.js +15 -5
- package/build/core/ui/template/UIHelperTemplate.d.ts +1 -2
- package/build/core/ui/template/UIHelperTemplate.d.ts.map +1 -1
- package/build/core/ui/template/UIHelperTemplate.js +15 -5
- package/build/core/webhook/node/WebhookServerConfigNode.d.ts.map +1 -1
- package/build/core/webhook/service/ReverseProxyTypeService.d.ts.map +1 -1
- package/build/core/webhook/service/WebhookServerService.d.ts +3 -4
- package/build/core/webhook/service/WebhookServerService.d.ts.map +1 -1
- package/build/core/webhook/service/WebhookServerService.js +48 -18
- package/build/core/webhook/template/WebhookTemplate.d.ts +1 -2
- package/build/core/webhook/template/WebhookTemplate.d.ts.map +1 -1
- package/build/core/webhook/template/WebhookTemplate.js +19 -6
- package/build/index.d.ts +6 -2
- package/build/index.d.ts.map +1 -1
- package/build/index.js +7 -2
- package/build/runtime/NodeManagerRuntime.js +140 -0
- package/documentation/CounterMetricConfigNode.png +0 -0
- package/documentation/GaugeMetricConfigNode.png +0 -0
- package/documentation/LoggerTemplate.png +0 -0
- package/documentation/MetricsTemplate.png +0 -0
- package/documentation/StateTemplate.png +0 -0
- package/documentation/TimerMetricConfigNode_histogram.png +0 -0
- package/documentation/TimerMetricConfigNode_summary.png +0 -0
- package/documentation/WebhookServerConfigNode.png +0 -0
- package/documentation/WebhookTemplate.png +0 -0
- package/package.json +4 -11
- package/src/GenerateNodes.ts +10 -40
- package/src/core/NodeConstructor.ts +150 -228
- package/src/core/NodeGenerator.ts +156 -47
- package/src/core/NodeManagerRuntime.ts +179 -0
- package/src/core/logger/service/LoggerService.ts +60 -32
- package/src/core/logger/template/LoggerTemplate.html +11 -6
- package/src/core/logger/template/LoggerTemplate.ts +9 -11
- package/src/core/metrics/MetricsDecorator.ts +140 -168
- package/src/core/metrics/node/CounterMetricConfigNode.ts +20 -20
- package/src/core/metrics/node/GaugeMetricConfigNode.ts +24 -25
- package/src/core/metrics/node/MetricsConfigNode.ts +29 -48
- package/src/core/metrics/node/TimerMetricConfigNode.ts +50 -59
- package/src/core/metrics/service/MetricsService.ts +214 -489
- package/src/core/metrics/template/CounterMetricTemplate.html +0 -1
- package/src/core/metrics/template/CounterMetricTemplate.ts +8 -11
- package/src/core/metrics/template/GaugeMetricTemplate.html +1 -1
- package/src/core/metrics/template/GaugeMetricTemplate.ts +8 -11
- package/src/core/metrics/template/MetricsTemplate.html +132 -13
- package/src/core/metrics/template/MetricsTemplate.ts +9 -10
- package/src/core/metrics/template/TimerMetricTemplate.ts +8 -10
- package/src/core/other/node/DelegatedConfigReferenceNode.ts +1 -1
- package/src/core/other/service/SettingsService.ts +6 -10
- package/src/core/other/template/BasicTemplate.html +1 -1
- package/src/core/other/template/BasicTemplate.ts +6 -11
- package/src/core/other/template/SettingsTemplate.ts +8 -13
- package/src/core/state/node/InternalStateConfigNode.html +77 -0
- package/src/core/state/node/InternalStateConfigNode.ts +102 -0
- package/src/core/state/node/StateConfigNode.ts +29 -0
- package/src/core/state/service/StateService.ts +180 -0
- package/src/core/state/template/StateTemplate.html +244 -0
- package/src/core/state/template/StateTemplate.ts +18 -0
- package/src/core/tagging/ServiceDescriptionDecorator.ts +23 -0
- package/src/core/tagging/TemplateDescriptionDecorator.ts +19 -0
- package/src/core/tagging/service/NodeTypeService.ts +6 -11
- package/src/core/ui/template/ScriptEditorTemplate.ts +6 -10
- package/src/core/ui/template/UIHelperTemplate.html +41 -26
- package/src/core/ui/template/UIHelperTemplate.ts +6 -10
- package/src/core/webhook/service/WebhookServerService.ts +39 -23
- package/src/core/webhook/template/WebhookTemplate.html +28 -35
- package/src/core/webhook/template/WebhookTemplate.ts +10 -12
- package/src/index.ts +8 -2
- package/build/core/logger/node/ConsoleLoggerConfigNode.d.ts +0 -20
- package/build/core/logger/node/ConsoleLoggerConfigNode.d.ts.map +0 -1
- package/build/core/logger/node/ConsoleLoggerConfigNode.js +0 -62
- package/build/core/logger/node/RestLoggerConfigNode.d.ts +0 -40
- package/build/core/logger/node/RestLoggerConfigNode.d.ts.map +0 -1
- package/build/core/logger/node/RestLoggerConfigNode.js +0 -128
- package/documentation/ConsoleLoggerConfigNode.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/src/core/logger/node/ConsoleLoggerConfigNode.html +0 -90
- package/src/core/logger/node/ConsoleLoggerConfigNode.ts +0 -71
- package/src/core/logger/node/RestLoggerConfigNode.html +0 -183
- package/src/core/logger/node/RestLoggerConfigNode.ts +0 -170
package/build/Nodes.html
CHANGED
|
@@ -6,1509 +6,6 @@
|
|
|
6
6
|
|
|
7
7
|
You have been warned.
|
|
8
8
|
|
|
9
|
+
No owned nodes in this package. Shared nodes are registered via Plugins.html.
|
|
9
10
|
-->
|
|
10
|
-
|
|
11
|
-
<script type="text/javascript">
|
|
12
|
-
RED.nodes.registerType('DelegatedConfigReferenceNode', {
|
|
13
|
-
category: 'config',
|
|
14
|
-
defaults: {},
|
|
15
|
-
oneditprepare: function() {},
|
|
16
|
-
oneditsave: function() {},
|
|
17
|
-
oneditcancel: function() {},
|
|
18
|
-
oneditdelete: function() {},
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
</script>
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
<script type="text/html" data-template-name='DelegatedConfigReferenceNode'>
|
|
25
|
-
|
|
26
|
-
</script>
|
|
27
|
-
|
|
28
|
-
<script type="text/markdown" data-help-name='DelegatedConfigReferenceNode'>
|
|
29
|
-
|
|
30
|
-
</script>
|
|
31
|
-
<script type="text/javascript">
|
|
32
|
-
RED.nodes.registerType('ConsoleLoggerConfigNode', {
|
|
33
|
-
category: 'config',
|
|
34
|
-
label: function() {
|
|
35
|
-
return this.name
|
|
36
|
-
},
|
|
37
|
-
paletteLabel: 'Console Logger Config Node',
|
|
38
|
-
defaults: {
|
|
39
|
-
name: {
|
|
40
|
-
value: 'Logger Example',
|
|
41
|
-
required: true
|
|
42
|
-
},
|
|
43
|
-
platform: {
|
|
44
|
-
value: 'rest',
|
|
45
|
-
required: true
|
|
46
|
-
},
|
|
47
|
-
template: {
|
|
48
|
-
value: 'message:{{msg}}',
|
|
49
|
-
required: true
|
|
50
|
-
},
|
|
51
|
-
level: {
|
|
52
|
-
value: 'info',
|
|
53
|
-
required: true
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
oneditprepare: function() {
|
|
57
|
-
// **** ConsoleLoggerConfigNode **** //
|
|
58
|
-
{
|
|
59
|
-
let node = this;
|
|
60
|
-
let levelSelection = $("#node-config-input-level");
|
|
61
|
-
levelSelection.typedInput({
|
|
62
|
-
type: "level",
|
|
63
|
-
types: [{
|
|
64
|
-
value: "level",
|
|
65
|
-
options: [{
|
|
66
|
-
value: "DEBUG",
|
|
67
|
-
label: "debug"
|
|
68
|
-
}, {
|
|
69
|
-
value: "INFO",
|
|
70
|
-
label: "info"
|
|
71
|
-
}, {
|
|
72
|
-
value: "WARNING",
|
|
73
|
-
label: "warning"
|
|
74
|
-
}, {
|
|
75
|
-
value: "ERROR",
|
|
76
|
-
label: "error"
|
|
77
|
-
}, ]
|
|
78
|
-
}]
|
|
79
|
-
});
|
|
80
|
-
this.editor = RED.editor.createEditor({
|
|
81
|
-
id: 'node-config-input-templateEditor',
|
|
82
|
-
mode: 'ace/mode/handlebars',
|
|
83
|
-
value: this.template
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
},
|
|
87
|
-
oneditsave: function() {
|
|
88
|
-
// **** ConsoleLoggerConfigNode **** //
|
|
89
|
-
{
|
|
90
|
-
let node = this;
|
|
91
|
-
this.template = this.editor.getValue();
|
|
92
|
-
this.editor.destroy();
|
|
93
|
-
delete this.editor;
|
|
94
|
-
}
|
|
95
|
-
},
|
|
96
|
-
oneditcancel: function() {},
|
|
97
|
-
oneditdelete: function() {},
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
</script>
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
<script type="text/html" data-template-name='ConsoleLoggerConfigNode'>
|
|
104
|
-
<div id='section_ConsoleLoggerConfigNode'>
|
|
105
|
-
<div id="LoggerConfig">
|
|
106
|
-
<div class="form-row">
|
|
107
|
-
<label class="towb_editorlabel" for="node-config-input-name"><i class="fa fa-font"></i> Name</label>
|
|
108
|
-
<input type="text" id="node-config-input-name" />
|
|
109
|
-
</div>
|
|
110
|
-
|
|
111
|
-
<div class="form-row">
|
|
112
|
-
<label class="towb_editorlabel" for="node-config-input-level"><i class="fa fa-signal"></i> Level</label>
|
|
113
|
-
<input type="text" id="node-config-input-level" />
|
|
114
|
-
</div>
|
|
115
|
-
|
|
116
|
-
<div class="form-row">
|
|
117
|
-
<label class="towb_editorlabel" for="node-config-input-templateEditor"><i class="fa fa-code"></i> Template</label>
|
|
118
|
-
<div style="height: 250px; min-height:150px;" class="node-text-editor" id="node-config-input-templateEditor"></div>
|
|
119
|
-
</div>
|
|
120
|
-
</div>
|
|
121
|
-
|
|
122
|
-
</div>
|
|
123
|
-
</script>
|
|
124
|
-
|
|
125
|
-
<script type="text/markdown" data-help-name='ConsoleLoggerConfigNode'>
|
|
126
|
-
Writes log output to the Node-RED runtime console (stdout). Suitable for local development and containerised environments where stdout is captured.
|
|
127
|
-
|
|
128
|
-
### Properties
|
|
129
|
-
: *name* (string) : A descriptive name for this logger configuration.
|
|
130
|
-
: *level* (level) : The minimum log level. Messages below this threshold are suppressed. Options: DEBUG, INFO, WARNING, ERROR.
|
|
131
|
-
: *template* (mustache) : A Mustache/Handlebars template that formats the log message body.
|
|
132
|
-
|
|
133
|
-
### Mustache Templating
|
|
134
|
-
Mustache/Handlebars templates build the message string written to the console.
|
|
135
|
-
|
|
136
|
-
#### Provided Properties
|
|
137
|
-
: *msg* (object) : The Node-RED message object passed through the node.
|
|
138
|
-
: *currentTime* (string) : The current time in ISO 8601 format.
|
|
139
|
-
|
|
140
|
-
#### Helpers
|
|
141
|
-
: *json* (helper) : Serialises an object to a JSON string using `JSON.stringify`.
|
|
142
|
-
|
|
143
|
-
#### Examples
|
|
144
|
-
- `{{{json msg}}}` — serialises the full message object as JSON.
|
|
145
|
-
|
|
146
|
-
#### References
|
|
147
|
-
- [Mustache — Wikipedia](https://en.wikipedia.org/wiki/Mustache_(template_system))
|
|
148
|
-
- [Mustache — Playground](https://jgonggrijp.gitlab.io/wontache/playground.html)
|
|
149
|
-
</script>
|
|
150
|
-
<script type="text/javascript">
|
|
151
|
-
RED.nodes.registerType('RestLoggerConfigNode', {
|
|
152
|
-
category: 'config',
|
|
153
|
-
label: function() {
|
|
154
|
-
return this.name
|
|
155
|
-
},
|
|
156
|
-
paletteLabel: 'Rest Logger Config Node',
|
|
157
|
-
defaults: {
|
|
158
|
-
name: {
|
|
159
|
-
value: 'Logger Example',
|
|
160
|
-
required: true
|
|
161
|
-
},
|
|
162
|
-
template: {
|
|
163
|
-
value: 'message:{{msg}}',
|
|
164
|
-
required: true
|
|
165
|
-
},
|
|
166
|
-
level: {
|
|
167
|
-
value: 'info',
|
|
168
|
-
required: true
|
|
169
|
-
},
|
|
170
|
-
rest_url: {},
|
|
171
|
-
rest_ignoresslerror: {},
|
|
172
|
-
rest_auth_type: {},
|
|
173
|
-
rest_auth_basic_username: {},
|
|
174
|
-
rest_auth_basic_password: {},
|
|
175
|
-
rest_auth_apikey_mechanism: {},
|
|
176
|
-
rest_auth_apikey_name: {},
|
|
177
|
-
rest_auth_apikey_value: {},
|
|
178
|
-
},
|
|
179
|
-
oneditprepare: function() {
|
|
180
|
-
// **** RestLoggerConfigNode **** //
|
|
181
|
-
{
|
|
182
|
-
let node = this;
|
|
183
|
-
let showSelectedRestAuthMethod = (value) => {
|
|
184
|
-
$("#LoggerConfig").find(".platform.platform-rest").first().find(".platform-rest-auth").each((i, t) => {
|
|
185
|
-
t = $(t);
|
|
186
|
-
if (t.hasClass(`auth-${value}`)) {
|
|
187
|
-
t.show();
|
|
188
|
-
} else {
|
|
189
|
-
t.hide();
|
|
190
|
-
}
|
|
191
|
-
});
|
|
192
|
-
}
|
|
193
|
-
let levelSelection = $("#node-config-input-level");
|
|
194
|
-
levelSelection.typedInput({
|
|
195
|
-
type: "level",
|
|
196
|
-
types: [{
|
|
197
|
-
value: "level",
|
|
198
|
-
options: [{
|
|
199
|
-
value: "DEBUG",
|
|
200
|
-
label: "debug"
|
|
201
|
-
}, {
|
|
202
|
-
value: "INFO",
|
|
203
|
-
label: "info"
|
|
204
|
-
}, {
|
|
205
|
-
value: "WARNING",
|
|
206
|
-
label: "warning"
|
|
207
|
-
}, {
|
|
208
|
-
value: "ERROR",
|
|
209
|
-
label: "error"
|
|
210
|
-
}, ]
|
|
211
|
-
}]
|
|
212
|
-
});
|
|
213
|
-
let platformRestAuthType = $("#node-config-input-rest_auth_type");
|
|
214
|
-
platformRestAuthType.typedInput({
|
|
215
|
-
type: "authtype",
|
|
216
|
-
types: [{
|
|
217
|
-
value: "authtype",
|
|
218
|
-
options: [{
|
|
219
|
-
value: "none",
|
|
220
|
-
label: "None"
|
|
221
|
-
}, {
|
|
222
|
-
value: "basic",
|
|
223
|
-
label: "Basic"
|
|
224
|
-
}, {
|
|
225
|
-
value: "apikey",
|
|
226
|
-
label: "ApiKey"
|
|
227
|
-
}]
|
|
228
|
-
}]
|
|
229
|
-
});
|
|
230
|
-
platformRestAuthType.on("change", () => showSelectedRestAuthMethod(platformRestAuthType.val()));
|
|
231
|
-
let apiKeyMechanism = $("#node-config-input-rest_auth_apikey_mechanism");
|
|
232
|
-
apiKeyMechanism.typedInput({
|
|
233
|
-
type: "apikeymechansim",
|
|
234
|
-
types: [{
|
|
235
|
-
value: "apikeymechansim",
|
|
236
|
-
options: [{
|
|
237
|
-
value: "header",
|
|
238
|
-
label: "Header"
|
|
239
|
-
}, {
|
|
240
|
-
value: "queryparam",
|
|
241
|
-
label: "Query Param"
|
|
242
|
-
}, {
|
|
243
|
-
value: "matrixparam",
|
|
244
|
-
label: "Matrix Param"
|
|
245
|
-
}]
|
|
246
|
-
}]
|
|
247
|
-
});
|
|
248
|
-
this.editor = RED.editor.createEditor({
|
|
249
|
-
id: 'node-config-input-templateEditor',
|
|
250
|
-
mode: 'ace/mode/handlebars',
|
|
251
|
-
value: this.template
|
|
252
|
-
});
|
|
253
|
-
}
|
|
254
|
-
},
|
|
255
|
-
oneditsave: function() {
|
|
256
|
-
// **** RestLoggerConfigNode **** //
|
|
257
|
-
{
|
|
258
|
-
let node = this;
|
|
259
|
-
this.template = this.editor.getValue();
|
|
260
|
-
this.editor.destroy();
|
|
261
|
-
delete this.editor;
|
|
262
|
-
}
|
|
263
|
-
},
|
|
264
|
-
oneditcancel: function() {},
|
|
265
|
-
oneditdelete: function() {},
|
|
266
|
-
});
|
|
267
|
-
|
|
268
|
-
</script>
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
<script type="text/html" data-template-name='RestLoggerConfigNode'>
|
|
272
|
-
<div id='section_RestLoggerConfigNode'>
|
|
273
|
-
<div id="LoggerConfig">
|
|
274
|
-
<div class="form-row">
|
|
275
|
-
<label class="towb_editorlabel" for="node-config-input-name"><i class="fa fa-font"></i> Name</label>
|
|
276
|
-
<input type="text" id="node-config-input-name" />
|
|
277
|
-
</div>
|
|
278
|
-
|
|
279
|
-
<div class="form-row">
|
|
280
|
-
<label class="towb_editorlabel" for="node-config-input-level"><i class="fa fa-signal"></i> Level</label>
|
|
281
|
-
<input type="text" id="node-config-input-level" />
|
|
282
|
-
</div>
|
|
283
|
-
|
|
284
|
-
<div class="platform platform-rest">
|
|
285
|
-
<div class="form-row">
|
|
286
|
-
<label class="towb_editorlabel" for="node-config-input-rest_url"><i class="fa fa-link"></i> URL</label>
|
|
287
|
-
<input class="platform-rest-input required" type="text" id="node-config-input-rest_url" />
|
|
288
|
-
</div>
|
|
289
|
-
<div class="form-row">
|
|
290
|
-
<label class="towb_editorlabel"></label>
|
|
291
|
-
<input type="checkbox" id="node-config-input-rest_ignoresslerror" style="width:20px; margin-right:5px;" />
|
|
292
|
-
<label style="width:auto" for="node-config-input-rest_ignoresslerror"><span>Ignore Invalid SSL certificates</span></label>
|
|
293
|
-
</div>
|
|
294
|
-
<div class="form-row">
|
|
295
|
-
<label class="towb_editorlabel" for="node-config-input-rest_auth_type"><i class="fa fa-lock"></i> Authentication</label>
|
|
296
|
-
<input class="platform-rest-input required" type="text" id="node-config-input-rest_auth_type" />
|
|
297
|
-
</div>
|
|
298
|
-
<div class="form-row platform-rest-auth auth-basic">
|
|
299
|
-
<label class="towb_editorlabel" for="node-config-input-rest_auth_basic_username"><i class="fa fa-user"></i> Username</label>
|
|
300
|
-
<input class="platform-rest-input" type="text" id="node-config-input-rest_auth_basic_username" />
|
|
301
|
-
</div>
|
|
302
|
-
<div class="form-row platform-rest-auth auth-basic">
|
|
303
|
-
<label class="towb_editorlabel" for="node-config-input-rest_auth_basic_password"><i class="fa fa-key"></i> Password</label>
|
|
304
|
-
<input class="platform-rest-input" type="password" id="node-config-input-rest_auth_basic_password" />
|
|
305
|
-
</div>
|
|
306
|
-
<div class="form-row platform-rest-auth auth-apikey">
|
|
307
|
-
<label class="towb_editorlabel" for="node-config-input-rest_auth_apikey_mechanism"><i class="fa fa-exchange"></i> Mechanism</label>
|
|
308
|
-
<input class="platform-rest-input" type="text" id="node-config-input-rest_auth_apikey_mechanism" />
|
|
309
|
-
</div>
|
|
310
|
-
<div class="form-row platform-rest-auth auth-apikey">
|
|
311
|
-
<label class="towb_editorlabel" for="node-config-input-rest_auth_apikey_name"><i class="fa fa-id-badge"></i> APIKey name</label>
|
|
312
|
-
<input class="platform-rest-input" type="text" id="node-config-input-rest_auth_apikey_name" />
|
|
313
|
-
</div>
|
|
314
|
-
<div class="form-row platform-rest-auth auth-apikey">
|
|
315
|
-
<label class="towb_editorlabel" for="node-config-input-rest_auth_apikey_value"><i class="fa fa-lock"></i> APIKey value</label>
|
|
316
|
-
<input class="platform-rest-input" type="text" id="node-config-input-rest_auth_apikey_value" />
|
|
317
|
-
</div>
|
|
318
|
-
</div>
|
|
319
|
-
|
|
320
|
-
<div class="form-row">
|
|
321
|
-
<label class="towb_editorlabel" for="node-config-input-templateEditor"><i class="fa fa-code"></i> Template</label>
|
|
322
|
-
<div style="height: 250px; min-height:150px;" class="node-text-editor" id="node-config-input-templateEditor"></div>
|
|
323
|
-
</div>
|
|
324
|
-
</div>
|
|
325
|
-
|
|
326
|
-
</div>
|
|
327
|
-
</script>
|
|
328
|
-
|
|
329
|
-
<script type="text/markdown" data-help-name='RestLoggerConfigNode'>
|
|
330
|
-
Posts log messages to an HTTP or HTTPS endpoint as a JSON payload.
|
|
331
|
-
|
|
332
|
-
### Properties
|
|
333
|
-
: *name* (string) : A descriptive name for this logger configuration.
|
|
334
|
-
: *level* (level) : The minimum log level. Messages below this threshold are suppressed. Options: DEBUG, INFO, WARNING, ERROR.
|
|
335
|
-
: *url* (url) : The endpoint that log messages will be POSTed to.
|
|
336
|
-
: *ignore SSL errors* (boolean) : When enabled, invalid SSL certificates are accepted.
|
|
337
|
-
: *authentication* (select) : The authentication strategy applied to each request. Options: None, Basic, ApiKey.
|
|
338
|
-
: *template* (mustache) : A Mustache/Handlebars template that formats the log message body.
|
|
339
|
-
|
|
340
|
-
### Authentication
|
|
341
|
-
#### Basic
|
|
342
|
-
Authenticates using the HTTP `Authorization` header (RFC 7617).
|
|
343
|
-
: *username* (string) : The username credential.
|
|
344
|
-
: *password* (string) : The password credential.
|
|
345
|
-
|
|
346
|
-
#### ApiKey
|
|
347
|
-
Authenticates by injecting a key/value pair into the request.
|
|
348
|
-
: *mechanism* (select) : Where the key is injected — Header, Query Param, or Matrix Param.
|
|
349
|
-
: *APIKey name* (string) : The name of the key (e.g. `x-api-key`).
|
|
350
|
-
: *APIKey value* (string) : The value of the key.
|
|
351
|
-
|
|
352
|
-
### Mustache Templating
|
|
353
|
-
Mustache/Handlebars templates build the message string POSTed to the endpoint.
|
|
354
|
-
|
|
355
|
-
#### Provided Properties
|
|
356
|
-
: *msg* (object) : The Node-RED message object passed through the node.
|
|
357
|
-
: *currentTime* (string) : The current time in ISO 8601 format.
|
|
358
|
-
|
|
359
|
-
#### Helpers
|
|
360
|
-
: *json* (helper) : Serialises an object to a JSON string using `JSON.stringify`.
|
|
361
|
-
|
|
362
|
-
#### Examples
|
|
363
|
-
- `{{{json msg}}}` — serialises the full message object as JSON.
|
|
364
|
-
|
|
365
|
-
#### References
|
|
366
|
-
- [Mustache — Wikipedia](https://en.wikipedia.org/wiki/Mustache_(template_system))
|
|
367
|
-
- [Mustache — Playground](https://jgonggrijp.gitlab.io/wontache/playground.html)
|
|
368
|
-
</script>
|
|
369
|
-
<!-- webhook -->
|
|
370
|
-
<script type="text/javascript">
|
|
371
|
-
// CSS
|
|
372
|
-
dropdownStyles = `
|
|
373
|
-
.proxy-dropdown {
|
|
374
|
-
position: absolute;
|
|
375
|
-
background: white;
|
|
376
|
-
border: 1px solid #ccc;
|
|
377
|
-
border-radius: 4px;
|
|
378
|
-
box-shadow: 0 2px 8px rgba(0,0,0,0.15);
|
|
379
|
-
max-height: 150px;
|
|
380
|
-
overflow-y: auto;
|
|
381
|
-
z-index: 1000;
|
|
382
|
-
min-width: 150px;
|
|
383
|
-
}
|
|
384
|
-
.proxy-dropdown .dropdown-item {
|
|
385
|
-
padding: 6px 12px;
|
|
386
|
-
cursor: pointer;
|
|
387
|
-
}
|
|
388
|
-
.proxy-dropdown .dropdown-item:hover {
|
|
389
|
-
background: #f0f0f0;
|
|
390
|
-
}
|
|
391
|
-
`;
|
|
392
|
-
$('<style>').text(dropdownStyles).appendTo('head');
|
|
393
|
-
|
|
394
|
-
</script>
|
|
395
|
-
<script type="text/javascript">
|
|
396
|
-
RED.nodes.registerType('MetricsConfigNode', {
|
|
397
|
-
category: 'config',
|
|
398
|
-
label: function() {
|
|
399
|
-
return this.name
|
|
400
|
-
},
|
|
401
|
-
paletteLabel: 'Metrics Config',
|
|
402
|
-
defaults: {
|
|
403
|
-
name: {
|
|
404
|
-
value: 'Metrics Example',
|
|
405
|
-
required: true
|
|
406
|
-
},
|
|
407
|
-
webhook: {
|
|
408
|
-
type: 'WebhookServerConfigNode',
|
|
409
|
-
required: true
|
|
410
|
-
},
|
|
411
|
-
webhookPath: {
|
|
412
|
-
value: '/example',
|
|
413
|
-
required: true
|
|
414
|
-
},
|
|
415
|
-
webhookAuth: {
|
|
416
|
-
value: 'none',
|
|
417
|
-
required: true
|
|
418
|
-
},
|
|
419
|
-
webhookAuth_basic_username: {
|
|
420
|
-
value: 'user',
|
|
421
|
-
required: false
|
|
422
|
-
},
|
|
423
|
-
webhookAuth_basic_password: {
|
|
424
|
-
value: 'pass',
|
|
425
|
-
required: false
|
|
426
|
-
},
|
|
427
|
-
webhookAuth_apikey_mechanism: {
|
|
428
|
-
value: 'header',
|
|
429
|
-
required: false
|
|
430
|
-
},
|
|
431
|
-
webhookAuth_apikey_key: {
|
|
432
|
-
value: 'x-api-key',
|
|
433
|
-
required: false
|
|
434
|
-
},
|
|
435
|
-
webhookAuth_apikey_value: {
|
|
436
|
-
value: 'testkey',
|
|
437
|
-
required: false
|
|
438
|
-
},
|
|
439
|
-
reverseProxies_enabled: {
|
|
440
|
-
required: false
|
|
441
|
-
},
|
|
442
|
-
reverseProxies_connections: {
|
|
443
|
-
value: '',
|
|
444
|
-
required: false,
|
|
445
|
-
maxInstances: 10
|
|
446
|
-
},
|
|
447
|
-
_reverseProxies_connections_0: {
|
|
448
|
-
value: '',
|
|
449
|
-
required: false,
|
|
450
|
-
type: 'DelegatedConfigReferenceNode'
|
|
451
|
-
},
|
|
452
|
-
_reverseProxies_connections_1: {
|
|
453
|
-
value: '',
|
|
454
|
-
required: false,
|
|
455
|
-
type: 'DelegatedConfigReferenceNode'
|
|
456
|
-
},
|
|
457
|
-
_reverseProxies_connections_2: {
|
|
458
|
-
value: '',
|
|
459
|
-
required: false,
|
|
460
|
-
type: 'DelegatedConfigReferenceNode'
|
|
461
|
-
},
|
|
462
|
-
_reverseProxies_connections_3: {
|
|
463
|
-
value: '',
|
|
464
|
-
required: false,
|
|
465
|
-
type: 'DelegatedConfigReferenceNode'
|
|
466
|
-
},
|
|
467
|
-
_reverseProxies_connections_4: {
|
|
468
|
-
value: '',
|
|
469
|
-
required: false,
|
|
470
|
-
type: 'DelegatedConfigReferenceNode'
|
|
471
|
-
},
|
|
472
|
-
_reverseProxies_connections_5: {
|
|
473
|
-
value: '',
|
|
474
|
-
required: false,
|
|
475
|
-
type: 'DelegatedConfigReferenceNode'
|
|
476
|
-
},
|
|
477
|
-
_reverseProxies_connections_6: {
|
|
478
|
-
value: '',
|
|
479
|
-
required: false,
|
|
480
|
-
type: 'DelegatedConfigReferenceNode'
|
|
481
|
-
},
|
|
482
|
-
_reverseProxies_connections_7: {
|
|
483
|
-
value: '',
|
|
484
|
-
required: false,
|
|
485
|
-
type: 'DelegatedConfigReferenceNode'
|
|
486
|
-
},
|
|
487
|
-
_reverseProxies_connections_8: {
|
|
488
|
-
value: '',
|
|
489
|
-
required: false,
|
|
490
|
-
type: 'DelegatedConfigReferenceNode'
|
|
491
|
-
},
|
|
492
|
-
_reverseProxies_connections_9: {
|
|
493
|
-
value: '',
|
|
494
|
-
required: false,
|
|
495
|
-
type: 'DelegatedConfigReferenceNode'
|
|
496
|
-
},
|
|
497
|
-
},
|
|
498
|
-
oneditprepare: function() {
|
|
499
|
-
// **** webhook **** //
|
|
500
|
-
{
|
|
501
|
-
let node = this;
|
|
502
|
-
let showSelectedAutnetication = function(value) {
|
|
503
|
-
let webhookConfig = $("#section_webhookconfig");
|
|
504
|
-
webhookConfig.find(".webhookauth").each((i, t) => {
|
|
505
|
-
t = $(t);
|
|
506
|
-
if (t.hasClass(`webhookauth-${value}`)) {
|
|
507
|
-
t.show();
|
|
508
|
-
} else {
|
|
509
|
-
t.hide();
|
|
510
|
-
}
|
|
511
|
-
});
|
|
512
|
-
webhookConfig.find(`.webhookauth-${value}`).find(`.webhookauth-${value}-input.required`).each((i, entry) => {
|
|
513
|
-
let id = entry.id.replace("node-input-", "");
|
|
514
|
-
if (node._def.defaults[id]) {
|
|
515
|
-
node._def.defaults[id].required = true;
|
|
516
|
-
} else {
|
|
517
|
-
console.log(`you forgot to define ${id} in the defaults for WebhookTemplate`);
|
|
518
|
-
}
|
|
519
|
-
});
|
|
520
|
-
Object.entries(node._def.defaults).filter(([k, v]) => k.startsWith(`webhookAuth_`)).filter(([k, v]) => !k.startsWith(`webhookAuth_${value}_`)).forEach(([k, v]) => v.required = false);
|
|
521
|
-
node.webhookAuth = value;
|
|
522
|
-
}
|
|
523
|
-
let webhookAuthSelection = $("#node-config-input-webhookAuth");
|
|
524
|
-
webhookAuthSelection.typedInput({
|
|
525
|
-
type: "authentication",
|
|
526
|
-
types: [{
|
|
527
|
-
value: "authentication",
|
|
528
|
-
options: [{
|
|
529
|
-
value: "none",
|
|
530
|
-
label: "None"
|
|
531
|
-
}, {
|
|
532
|
-
value: "basic",
|
|
533
|
-
label: "BasicAuth"
|
|
534
|
-
}, {
|
|
535
|
-
value: "apikey",
|
|
536
|
-
label: "APIKey"
|
|
537
|
-
}]
|
|
538
|
-
}]
|
|
539
|
-
});
|
|
540
|
-
webhookAuthSelection.on("change", () => showSelectedAutnetication(webhookAuthSelection.val()));
|
|
541
|
-
showSelectedAutnetication(webhookAuthSelection.val());
|
|
542
|
-
let webhookAPIKeyMechanism = $("#node-config-input-webhookAuth_apikey_mechanism");
|
|
543
|
-
webhookAPIKeyMechanism.typedInput({
|
|
544
|
-
type: "apikeymechanism",
|
|
545
|
-
types: [{
|
|
546
|
-
value: "apikeymechansim",
|
|
547
|
-
options: [{
|
|
548
|
-
value: "header",
|
|
549
|
-
label: "Header"
|
|
550
|
-
}, {
|
|
551
|
-
value: "queryparam",
|
|
552
|
-
label: "Query Param"
|
|
553
|
-
}, {
|
|
554
|
-
value: "matrixparam",
|
|
555
|
-
label: "Matrix Param"
|
|
556
|
-
}]
|
|
557
|
-
}]
|
|
558
|
-
});
|
|
559
|
-
webhookAuthSelection.on("change", () => showSelectedAutnetication(webhookAuthSelection.val()));
|
|
560
|
-
showSelectedAutnetication(webhookAuthSelection.val());
|
|
561
|
-
let enableReverseProxy = $("#node-config-input-reverseProxies_enabled");
|
|
562
|
-
let reverseProxySection = $("#section_webhookconfig_reverseproxy");
|
|
563
|
-
enableReverseProxy.on("change", () => {
|
|
564
|
-
console.log("show / hide reverse proxy table");
|
|
565
|
-
if (enableReverseProxy.prop("checked")) {
|
|
566
|
-
reverseProxySection.show();
|
|
567
|
-
} else {
|
|
568
|
-
reverseProxySection.hide();
|
|
569
|
-
}
|
|
570
|
-
});
|
|
571
|
-
if (this.reverseProxies_enabled) {
|
|
572
|
-
reverseProxySection.show();
|
|
573
|
-
} else {
|
|
574
|
-
reverseProxySection.hide();
|
|
575
|
-
}
|
|
576
|
-
let getProxyTypes = async () => {
|
|
577
|
-
let types = [];
|
|
578
|
-
await $.ajax({
|
|
579
|
-
url: "nodetypeservice/find?tag=ReverseProxyType",
|
|
580
|
-
type: "GET",
|
|
581
|
-
contentType: "application/json; charset=utf-8",
|
|
582
|
-
data: JSON.stringify({
|
|
583
|
-
id: node.id
|
|
584
|
-
}),
|
|
585
|
-
success: (response) => {
|
|
586
|
-
types = response;
|
|
587
|
-
},
|
|
588
|
-
error: (jqXHR, textStatus, errorThrown) => {
|
|
589
|
-
console.log(jqXHR, textStatus, errorThrown);
|
|
590
|
-
},
|
|
591
|
-
});
|
|
592
|
-
return types;
|
|
593
|
-
}
|
|
594
|
-
getProxyTypes().then(types => {
|
|
595
|
-
if (types.length === 0) {
|
|
596
|
-
$("#section_reverseproxy_feature").hide();
|
|
597
|
-
}
|
|
598
|
-
});
|
|
599
|
-
let getProxies = async () => {
|
|
600
|
-
let proxies = [];
|
|
601
|
-
// get the list of types again.
|
|
602
|
-
let proxyTypes = (await getProxyTypes()).map(type => type.id);
|
|
603
|
-
// add all of the known proxies.
|
|
604
|
-
RED.nodes.eachConfig(cfg => {
|
|
605
|
-
if (proxyTypes.includes(cfg.type)) {
|
|
606
|
-
proxies.push({
|
|
607
|
-
id: cfg.id,
|
|
608
|
-
name: cfg.label(),
|
|
609
|
-
type: cfg.type
|
|
610
|
-
});
|
|
611
|
-
}
|
|
612
|
-
});
|
|
613
|
-
return proxies;
|
|
614
|
-
};
|
|
615
|
-
let reverseProxyList = $("#reverseproxylist_table");
|
|
616
|
-
reverseProxyList.editableList({
|
|
617
|
-
sortable: true,
|
|
618
|
-
removable: true,
|
|
619
|
-
height: 'auto',
|
|
620
|
-
scrollOnAdd: true,
|
|
621
|
-
addButton: 'Add ProxyHost',
|
|
622
|
-
header: $('<div>').append($.parseHTML(`
|
|
623
|
-
<div style='width:30%; margin-left:5%; display:inline-grid;'>Proxy</div>
|
|
624
|
-
<div style='width:auto; margin-right:5%; display:inline-grid;'>Domain Name</div>
|
|
625
|
-
`)),
|
|
626
|
-
buttons: [{
|
|
627
|
-
label: "Add Reverse Proxy",
|
|
628
|
-
icon: "fa fa-star",
|
|
629
|
-
title: "Add a reverse proxy configuration",
|
|
630
|
-
click: () => {
|
|
631
|
-
event.stopPropagation();
|
|
632
|
-
let $btn = $(event.target);
|
|
633
|
-
// Remove any existing dropdown
|
|
634
|
-
$('.proxy-dropdown').remove();
|
|
635
|
-
// Fetch the list of reverseproxy types.
|
|
636
|
-
getProxyTypes().then(proxyTypes => {
|
|
637
|
-
let $dropdown = $('<div class="proxy-dropdown red-ui-editor"></div>');
|
|
638
|
-
proxyTypes.forEach(proxyType => {
|
|
639
|
-
$('<div class="dropdown-item"></div>').text(proxyType.name).data('value', proxyType.id).css({
|
|
640
|
-
padding: '4px 8px',
|
|
641
|
-
cursor: 'pointer'
|
|
642
|
-
}).appendTo($dropdown);
|
|
643
|
-
});
|
|
644
|
-
// Position it near the button
|
|
645
|
-
$dropdown.css({
|
|
646
|
-
top: $btn.offset().top + $btn.height(),
|
|
647
|
-
left: $btn.offset().left
|
|
648
|
-
});
|
|
649
|
-
$('body').append($dropdown);
|
|
650
|
-
// Handle item selection
|
|
651
|
-
$dropdown.on('click', '.dropdown-item', function(e) {
|
|
652
|
-
e.stopPropagation();
|
|
653
|
-
const selectedValue = $(this).data('value');
|
|
654
|
-
const selectedText = $(this).text();
|
|
655
|
-
// Do whatever you need with the selection
|
|
656
|
-
$dropdown.remove();
|
|
657
|
-
RED.editor.editConfig("reverseproxy", selectedValue, "_ADD_");
|
|
658
|
-
});
|
|
659
|
-
})
|
|
660
|
-
},
|
|
661
|
-
}, {
|
|
662
|
-
label: "Edit Reverse Proxy",
|
|
663
|
-
icon: "fa fa-edit",
|
|
664
|
-
title: "Edit a reverse proxy configuration",
|
|
665
|
-
click: async (event) => {
|
|
666
|
-
event.stopPropagation();
|
|
667
|
-
// Remove any existing dropdown
|
|
668
|
-
$('.proxy-dropdown').remove();
|
|
669
|
-
// Build the dropdown from the select's options
|
|
670
|
-
const $dropdown = $('<div class="proxy-dropdown red-ui-editor"></div>');
|
|
671
|
-
(await getProxies()).forEach(proxy => {
|
|
672
|
-
$('<div class="dropdown-item"></div>').text(proxy.name).data('value', proxy.id).data('type', proxy.type).css({
|
|
673
|
-
padding: '4px 8px',
|
|
674
|
-
cursor: 'pointer'
|
|
675
|
-
}).appendTo($dropdown);
|
|
676
|
-
});
|
|
677
|
-
// Position it near the button
|
|
678
|
-
let $btn = $(event.target);
|
|
679
|
-
$dropdown.css({
|
|
680
|
-
top: $btn.offset().top + $btn.height(),
|
|
681
|
-
left: $btn.offset().left
|
|
682
|
-
});
|
|
683
|
-
$('body').append($dropdown);
|
|
684
|
-
// Handle item selection
|
|
685
|
-
$dropdown.on('click', '.dropdown-item', function(e) {
|
|
686
|
-
e.stopPropagation();
|
|
687
|
-
const selectedType = $(this).data('type');
|
|
688
|
-
const selectedValue = $(this).data('value');
|
|
689
|
-
const selectedText = $(this).text();
|
|
690
|
-
// Do whatever you need with the selection
|
|
691
|
-
$dropdown.remove();
|
|
692
|
-
RED.editor.editConfig("reverseproxy", selectedType, selectedValue);
|
|
693
|
-
});
|
|
694
|
-
}
|
|
695
|
-
}],
|
|
696
|
-
addItem: async function(container, i, proxy) {
|
|
697
|
-
let row = $('<div/>', {
|
|
698
|
-
class: 'form-row',
|
|
699
|
-
style: 'display: flex; margin-bottom: 0;'
|
|
700
|
-
}).appendTo(container);
|
|
701
|
-
let proxyColumn = $('<select/>', {
|
|
702
|
-
type: 'text',
|
|
703
|
-
name: i,
|
|
704
|
-
required: true,
|
|
705
|
-
style: 'margin-left: 5px; margin-bottom: 0;',
|
|
706
|
-
class: 'proxy-proxy'
|
|
707
|
-
}).appendTo(row);
|
|
708
|
-
(await getProxies()).forEach(proxy => {
|
|
709
|
-
$('<option value="' + proxy.id + '">' + proxy.name + '</option>').appendTo(proxyColumn);
|
|
710
|
-
});
|
|
711
|
-
proxyColumn.on("focus", async () => {
|
|
712
|
-
proxyColumn.empty();
|
|
713
|
-
(await getProxies()).forEach(proxy => {
|
|
714
|
-
$('<option value="' + proxy.id + '">' + proxy.name + '</option>').appendTo(proxyColumn);
|
|
715
|
-
})
|
|
716
|
-
});
|
|
717
|
-
proxyColumn.val(proxy.proxy);
|
|
718
|
-
// Add the Domain Name column
|
|
719
|
-
let domainnameColumn = $('<input/>', {
|
|
720
|
-
type: 'text',
|
|
721
|
-
name: i,
|
|
722
|
-
required: true,
|
|
723
|
-
style: 'margin-left: 5px; margin-bottom: 0;',
|
|
724
|
-
class: 'proxy-domainname'
|
|
725
|
-
}).appendTo(row)
|
|
726
|
-
domainnameColumn.val(proxy.domainname);
|
|
727
|
-
},
|
|
728
|
-
removeItem: function(data) {
|
|
729
|
-
// nothing to do here.
|
|
730
|
-
},
|
|
731
|
-
});
|
|
732
|
-
// Close dropdown when clicking anywhere else
|
|
733
|
-
$(document).on('click', function() {
|
|
734
|
-
$('.proxy-dropdown').remove();
|
|
735
|
-
});
|
|
736
|
-
this.reverseProxies_connections = (this.reverseProxies_connections) ? this.reverseProxies_connections : [];
|
|
737
|
-
reverseProxyList.editableList('addItems', this.reverseProxies_connections);
|
|
738
|
-
}
|
|
739
|
-
},
|
|
740
|
-
oneditsave: function() {
|
|
741
|
-
// **** webhook **** //
|
|
742
|
-
{
|
|
743
|
-
let node = this;
|
|
744
|
-
// pulling the values from the reverseproxy table.
|
|
745
|
-
let connectionList = $("#reverseproxylist_table").editableList('items');
|
|
746
|
-
node.reverseProxies_connections = [];
|
|
747
|
-
connectionList.each(function(i) {
|
|
748
|
-
node.reverseProxies_connections.push({
|
|
749
|
-
proxy: $(this).find('.proxy-proxy').val(),
|
|
750
|
-
domainname: $(this).find('.proxy-domainname').val(),
|
|
751
|
-
});
|
|
752
|
-
});
|
|
753
|
-
console.log(node.reverseProxies_connections);
|
|
754
|
-
}
|
|
755
|
-
},
|
|
756
|
-
oneditcancel: function() {},
|
|
757
|
-
oneditdelete: function() {},
|
|
758
|
-
});
|
|
759
|
-
|
|
760
|
-
</script>
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
<script type="text/html" data-template-name='MetricsConfigNode'>
|
|
764
|
-
<div id='section_MetricsConfigNode'>
|
|
765
|
-
<div id="MetricsConfig">
|
|
766
|
-
<div class="form-row">
|
|
767
|
-
<label class="towb_editorlabel" for="node-config-input-name"><i class="fa fa-font"></i> Name</label>
|
|
768
|
-
<input type="text" id="node-config-input-name" />
|
|
769
|
-
</div>
|
|
770
|
-
</div>
|
|
771
|
-
|
|
772
|
-
</div>
|
|
773
|
-
|
|
774
|
-
<div id='section_webhook'>
|
|
775
|
-
<div id="section_webhookconfig">
|
|
776
|
-
<div class="form-row editorsectionheading">
|
|
777
|
-
<i class="w-16 fa fa-eye"></i> <span>Webhook</span>
|
|
778
|
-
</div>
|
|
779
|
-
|
|
780
|
-
<div class="editorgroupborder">
|
|
781
|
-
<div class="form-row nomargin">
|
|
782
|
-
<label class="towb_editorlabel" for="node-config-input-webhook"><i class="fa fa-server"></i> Server</label>
|
|
783
|
-
<input id="node-config-input-webhook" placeholder="webhook" />
|
|
784
|
-
</div>
|
|
785
|
-
|
|
786
|
-
<div class="form-row">
|
|
787
|
-
<label class="towb_editorlabel" for="node-config-input-webhookPath"><i class="fa fa-link"></i> Path</label>
|
|
788
|
-
<input type="text" id="node-config-input-webhookPath" placeholder="/example" />
|
|
789
|
-
</div>
|
|
790
|
-
|
|
791
|
-
<div class="form-row">
|
|
792
|
-
<label class="towb_editorlabel" for="node-config-input-webhookAuth"><i class="fa fa-lock"></i> Authentication</label>
|
|
793
|
-
<input type="text" id="node-config-input-webhookAuth" placeholder="none" />
|
|
794
|
-
</div>
|
|
795
|
-
|
|
796
|
-
<div class="webhookauth webhookauth-none">
|
|
797
|
-
</div>
|
|
798
|
-
|
|
799
|
-
<div class="webhookauth webhookauth-basic">
|
|
800
|
-
<div class="form-row">
|
|
801
|
-
<label class="towb_editorlabel" for="node-config-input-webhookAuth_basic_username"><i class="fa fa-user"></i> Username</label>
|
|
802
|
-
<input type="text" id="node-config-input-webhookAuth_basic_username" placeholder="testUser" />
|
|
803
|
-
</div>
|
|
804
|
-
|
|
805
|
-
<div class="form-row">
|
|
806
|
-
<label class="towb_editorlabel" for="node-config-input-webhookAuth_basic_password"><i class="fa fa-key"></i> Password</label>
|
|
807
|
-
<input type="password" id="node-config-input-webhookAuth_basic_password" placeholder="password" />
|
|
808
|
-
</div>
|
|
809
|
-
</div>
|
|
810
|
-
|
|
811
|
-
<div class="webhookauth webhookauth-apikey">
|
|
812
|
-
<div class="form-row">
|
|
813
|
-
<label class="towb_editorlabel" for="node-config-input-webhookAuth_apikey_mechanism"><i class="fa fa-exchange"></i> Mechanism</label>
|
|
814
|
-
<input type="text" id="node-config-input-webhookAuth_apikey_mechanism" />
|
|
815
|
-
</div>
|
|
816
|
-
|
|
817
|
-
<div class="form-row">
|
|
818
|
-
<label class="towb_editorlabel" for="node-config-input-webhookAuth_apikey_key"><i class="fa fa-id-badge"></i> APIKey name</label>
|
|
819
|
-
<input type="text" id="node-config-input-webhookAuth_apikey_key" placeholder="x-api-key" />
|
|
820
|
-
</div>
|
|
821
|
-
|
|
822
|
-
<div class="form-row">
|
|
823
|
-
<label class="towb_editorlabel" for="node-config-input-webhookAuth_apikey_value"><i class="fa fa-lock"></i> APIKey value</label>
|
|
824
|
-
<input type="text" id="node-config-input-webhookAuth_apikey_value" placeholder="testvalue" />
|
|
825
|
-
</div>
|
|
826
|
-
</div>
|
|
827
|
-
|
|
828
|
-
<div id="section_reverseproxy_feature">
|
|
829
|
-
<div class="form-row">
|
|
830
|
-
<label>Reverse Proxy</label>
|
|
831
|
-
<input type="checkbox" id="node-config-input-reverseProxies_enabled" style="width:20px; margin-right:5px;" />
|
|
832
|
-
<label style="width:auto" for="node-config-input-reverseProxies_enabled"><span>Enable Reverse Proxy</span></label>
|
|
833
|
-
</div>
|
|
834
|
-
<div id="section_webhookconfig_reverseproxy" style="display:none">
|
|
835
|
-
<div class="form-row">
|
|
836
|
-
<label></label>
|
|
837
|
-
<ol id="reverseproxylist_table" class="theotherwillembotha-compact-table"></ol>
|
|
838
|
-
</div>
|
|
839
|
-
</div>
|
|
840
|
-
</div>
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
</div>
|
|
844
|
-
</div>
|
|
845
|
-
|
|
846
|
-
</div>
|
|
847
|
-
</script>
|
|
848
|
-
|
|
849
|
-
<script type="text/markdown" data-help-name='MetricsConfigNode'>
|
|
850
|
-
### Inputs
|
|
851
|
-
: *name* (string) : The common name for the metrics integration.
|
|
852
|
-
|
|
853
|
-
### Webhook
|
|
854
|
-
: *server* (webhookserverconfig) : the web server that this webhook will be bound to.
|
|
855
|
-
: *path* (string) : the url path eg '/service' that should be regeistered on the webserver for this webhook callback
|
|
856
|
-
: *authentication* (auth) : the authentication mechanism that should be used on this endpoint
|
|
857
|
-
: *enable reverse proxy* (boolean) : whether this webhook will be exposed using a reverse proxy or not.
|
|
858
|
-
: *reverse proxies* (reverse proxies) : the list of reverse proxies thie endpoint will be exposed on.
|
|
859
|
-
|
|
860
|
-
### Webhook Authentication
|
|
861
|
-
Three strategies are available for securing the webhook endpoint.
|
|
862
|
-
|
|
863
|
-
- None:
|
|
864
|
-
The endpoint accepts all incoming requests without any credential check.
|
|
865
|
-
|
|
866
|
-
- Basic Auth:
|
|
867
|
-
Validates the `Authorization` header on each incoming request against a username and password pair using HTTP Basic Authentication (RFC 7617).
|
|
868
|
-
: *username* (string) : the username expected in the `Authorization` header
|
|
869
|
-
: *password* (string) : the password expected in the `Authorization` header
|
|
870
|
-
|
|
871
|
-
- API Key:
|
|
872
|
-
Validates a key/value pair carried in the request. Only the `Header` mechanism is currently supported — the key is read from a named request header and compared against the configured value. Requests that do not supply the correct key receive a `401` response.
|
|
873
|
-
: *mechanism* (mechanism) : the transport mechanism for the key. Currently supported: `Header`
|
|
874
|
-
: *key name* (string) : the name of the request header carrying the key (e.g. `x-api-key`)
|
|
875
|
-
: *key value* (string) : the expected value — requests not matching this value are rejected
|
|
876
|
-
|
|
877
|
-
### Reverse Proxy
|
|
878
|
-
When *enable reverse proxy* is checked, the webhook endpoint is registered with one or more reverse proxy services installed in Node-RED. Reverse proxy types are discovered automatically from any plugin that registers a service tagged `ReverseProxyType` (e.g. an Nginx Proxy Manager integration). Each row in the list maps the internal webhook server to a public-facing domain.
|
|
879
|
-
|
|
880
|
-
: *proxy* (ReverseProxyType) : the reverse proxy service to register the endpoint with
|
|
881
|
-
: *domain name* (string) : the public domain name to expose the endpoint on
|
|
882
|
-
|
|
883
|
-
The *external host* and *external port* fields on the linked **Webhook Server** config node must be set correctly for the proxy registration to resolve to the right internal address.
|
|
884
|
-
</script>
|
|
885
|
-
<script type="text/javascript">
|
|
886
|
-
RED.nodes.registerType('CounterMetricConfigNode', {
|
|
887
|
-
category: 'config',
|
|
888
|
-
label: function() {
|
|
889
|
-
return this.name
|
|
890
|
-
},
|
|
891
|
-
paletteLabel: 'Counter Metric Config',
|
|
892
|
-
defaults: {
|
|
893
|
-
name: {
|
|
894
|
-
value: 'Counter Example',
|
|
895
|
-
required: true
|
|
896
|
-
},
|
|
897
|
-
description: {
|
|
898
|
-
value: 'an example couter',
|
|
899
|
-
required: false
|
|
900
|
-
},
|
|
901
|
-
reset: {
|
|
902
|
-
value: false,
|
|
903
|
-
required: false
|
|
904
|
-
},
|
|
905
|
-
metricsEnabled: {
|
|
906
|
-
value: false,
|
|
907
|
-
required: true
|
|
908
|
-
},
|
|
909
|
-
metricsReference: {
|
|
910
|
-
type: 'MetricsConfigNode',
|
|
911
|
-
required: false
|
|
912
|
-
},
|
|
913
|
-
},
|
|
914
|
-
oneditprepare: function() {
|
|
915
|
-
// **** CounterMetricConfigNode **** //
|
|
916
|
-
{
|
|
917
|
-
// enable the metrics by default and hide the Enable metrics button.
|
|
918
|
-
let metricsEnabled = $("#node-config-input-metricsEnabled");
|
|
919
|
-
metricsEnabled.prop('checked', true);
|
|
920
|
-
metricsEnabled.trigger("change");
|
|
921
|
-
$("#section_metricsconfig").find(".metricsEnableCheck").hide();
|
|
922
|
-
}
|
|
923
|
-
// **** metrics **** //
|
|
924
|
-
{
|
|
925
|
-
let node = this;
|
|
926
|
-
let metricsEnabled = $("#node-config-input-metricsEnabled");
|
|
927
|
-
let metricsEnabledSection = $("#section_metricsEnabled");
|
|
928
|
-
metricsEnabled.on('change', function() {
|
|
929
|
-
if (metricsEnabled.prop("checked")) {
|
|
930
|
-
metricsEnabledSection.show();
|
|
931
|
-
node._def.defaults.metricsReference.required = true;
|
|
932
|
-
} else {
|
|
933
|
-
metricsEnabledSection.hide()
|
|
934
|
-
node._def.defaults.metricsReference.required = false;
|
|
935
|
-
}
|
|
936
|
-
});
|
|
937
|
-
}
|
|
938
|
-
},
|
|
939
|
-
oneditsave: function() {
|
|
940
|
-
// **** metrics **** //
|
|
941
|
-
{}
|
|
942
|
-
},
|
|
943
|
-
oneditcancel: function() {},
|
|
944
|
-
oneditdelete: function() {},
|
|
945
|
-
});
|
|
946
|
-
|
|
947
|
-
</script>
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
<script type="text/html" data-template-name='CounterMetricConfigNode'>
|
|
951
|
-
<div id='section_CounterMetricConfigNode'>
|
|
952
|
-
<div id="MetricsConfig">
|
|
953
|
-
<div class="form-row">
|
|
954
|
-
<label class="towb_editorlabel" for="node-config-input-name"><i class="fa fa-font"></i> Name</label>
|
|
955
|
-
<input type="text" id="node-config-input-name" />
|
|
956
|
-
</div>
|
|
957
|
-
|
|
958
|
-
<div class="form-row">
|
|
959
|
-
<label class="towb_editorlabel" for="node-config-input-description"><i class="fa fa-info-circle"></i> Description</label>
|
|
960
|
-
<input type="text" id="node-config-input-description" />
|
|
961
|
-
</div>
|
|
962
|
-
|
|
963
|
-
<div class="form-row">
|
|
964
|
-
<label></label>
|
|
965
|
-
<input type="checkbox" id="node-config-input-reset" style="width:20px; margin-right:5px;" />
|
|
966
|
-
<label style="width:auto" for="node-config-input-reset"><span>Reset on Deploy</span></label>
|
|
967
|
-
</div>
|
|
968
|
-
</div>
|
|
969
|
-
|
|
970
|
-
</div>
|
|
971
|
-
|
|
972
|
-
<div id='section_metrics'>
|
|
973
|
-
<div id="section_metricsconfig">
|
|
974
|
-
<div class="form-row editorsectionheading">
|
|
975
|
-
<i class="w-16 fa fa-eye"></i> <span>Metrics</span>
|
|
976
|
-
</div>
|
|
977
|
-
<div class="editorgroupborder">
|
|
978
|
-
<div class="form-row nomargin metricsEnableCheck">
|
|
979
|
-
<input type="checkbox" id="node-config-input-metricsEnabled" value="false" style="margin:8px 0 10px 102px; width:20px;" />
|
|
980
|
-
<label style="width:auto" for="node-config-input-metricsEnabled"><span>Enable Metrics</span></label>
|
|
981
|
-
</div>
|
|
982
|
-
|
|
983
|
-
<div id="section_metricsEnabled">
|
|
984
|
-
<div class="form-row nomargin">
|
|
985
|
-
<label class="towb_editorlabel" for="node-config-input-metricsReference">Metric Collector</label>
|
|
986
|
-
<input id="node-config-input-metricsReference" placeholder="metrics" />
|
|
987
|
-
</div>
|
|
988
|
-
</div>
|
|
989
|
-
</div>
|
|
990
|
-
</div>
|
|
991
|
-
|
|
992
|
-
</div>
|
|
993
|
-
</script>
|
|
994
|
-
|
|
995
|
-
<script type="text/markdown" data-help-name='CounterMetricConfigNode'>
|
|
996
|
-
Configuration node for the Counter Metrics
|
|
997
|
-
|
|
998
|
-
### Inputs
|
|
999
|
-
: *name* (string) : The common name for the counter.
|
|
1000
|
-
: *description* (string) : A description for the given counter
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
### Metrics
|
|
1004
|
-
: *enable metrics* (boolean) : if checked, then the node will produce metrics output to the specified metrics provider.
|
|
1005
|
-
: *metric collector* (metricconfig) : the collection point or grouping where this particular metric will be attached.
|
|
1006
|
-
</script>
|
|
1007
|
-
<script type="text/javascript">
|
|
1008
|
-
RED.nodes.registerType('GaugeMetricConfigNode', {
|
|
1009
|
-
category: 'config',
|
|
1010
|
-
label: function() {
|
|
1011
|
-
return this.name
|
|
1012
|
-
},
|
|
1013
|
-
paletteLabel: 'Gauge Metric Config',
|
|
1014
|
-
defaults: {
|
|
1015
|
-
name: {
|
|
1016
|
-
value: 'Metrics Example',
|
|
1017
|
-
required: true
|
|
1018
|
-
},
|
|
1019
|
-
description: {
|
|
1020
|
-
value: 'an example gauge',
|
|
1021
|
-
required: false
|
|
1022
|
-
},
|
|
1023
|
-
reset: {
|
|
1024
|
-
value: false,
|
|
1025
|
-
required: false
|
|
1026
|
-
},
|
|
1027
|
-
metricsEnabled: {
|
|
1028
|
-
value: false,
|
|
1029
|
-
required: true
|
|
1030
|
-
},
|
|
1031
|
-
metricsReference: {
|
|
1032
|
-
type: 'MetricsConfigNode',
|
|
1033
|
-
required: false
|
|
1034
|
-
},
|
|
1035
|
-
},
|
|
1036
|
-
oneditprepare: function() {
|
|
1037
|
-
// **** GaugeMetricConfigNode **** //
|
|
1038
|
-
{
|
|
1039
|
-
// enable the metrics by default and hide the Enable metrics button.
|
|
1040
|
-
let metricsEnabled = $("#node-config-input-metricsEnabled");
|
|
1041
|
-
metricsEnabled.prop('checked', true);
|
|
1042
|
-
metricsEnabled.trigger("change");
|
|
1043
|
-
$("#section_metricsconfig").find(".metricsEnableCheck").hide();
|
|
1044
|
-
}
|
|
1045
|
-
// **** metrics **** //
|
|
1046
|
-
{
|
|
1047
|
-
let node = this;
|
|
1048
|
-
let metricsEnabled = $("#node-config-input-metricsEnabled");
|
|
1049
|
-
let metricsEnabledSection = $("#section_metricsEnabled");
|
|
1050
|
-
metricsEnabled.on('change', function() {
|
|
1051
|
-
if (metricsEnabled.prop("checked")) {
|
|
1052
|
-
metricsEnabledSection.show();
|
|
1053
|
-
node._def.defaults.metricsReference.required = true;
|
|
1054
|
-
} else {
|
|
1055
|
-
metricsEnabledSection.hide()
|
|
1056
|
-
node._def.defaults.metricsReference.required = false;
|
|
1057
|
-
}
|
|
1058
|
-
});
|
|
1059
|
-
}
|
|
1060
|
-
},
|
|
1061
|
-
oneditsave: function() {
|
|
1062
|
-
// **** metrics **** //
|
|
1063
|
-
{}
|
|
1064
|
-
},
|
|
1065
|
-
oneditcancel: function() {},
|
|
1066
|
-
oneditdelete: function() {},
|
|
1067
|
-
});
|
|
1068
|
-
|
|
1069
|
-
</script>
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
<script type="text/html" data-template-name='GaugeMetricConfigNode'>
|
|
1073
|
-
<div id='section_GaugeMetricConfigNode'>
|
|
1074
|
-
<div id="MetricsConfig">
|
|
1075
|
-
<div class="form-row">
|
|
1076
|
-
<label class="towb_editorlabel" for="node-config-input-name"><i class="fa fa-font"></i> Name</label>
|
|
1077
|
-
<input type="text" id="node-config-input-name">
|
|
1078
|
-
</div>
|
|
1079
|
-
|
|
1080
|
-
<div class="form-row">
|
|
1081
|
-
<label class="towb_editorlabel" for="node-config-input-description"><i class="fa fa-info-circle"></i> Description</label>
|
|
1082
|
-
<input type="text" id="node-config-input-description">
|
|
1083
|
-
</div>
|
|
1084
|
-
|
|
1085
|
-
<div class="form-row">
|
|
1086
|
-
<label></label>
|
|
1087
|
-
<input type="checkbox" id="node-config-input-reset" style="width:20px; margin-right:5px;">
|
|
1088
|
-
<label style="width:auto" for="node-config-input-reset"><span>Reset on Deploy</span></label>
|
|
1089
|
-
</div>
|
|
1090
|
-
</div>
|
|
1091
|
-
|
|
1092
|
-
</div>
|
|
1093
|
-
|
|
1094
|
-
<div id='section_metrics'>
|
|
1095
|
-
<div id="section_metricsconfig">
|
|
1096
|
-
<div class="form-row editorsectionheading">
|
|
1097
|
-
<i class="w-16 fa fa-eye"></i> <span>Metrics</span>
|
|
1098
|
-
</div>
|
|
1099
|
-
<div class="editorgroupborder">
|
|
1100
|
-
<div class="form-row nomargin metricsEnableCheck">
|
|
1101
|
-
<input type="checkbox" id="node-config-input-metricsEnabled" value="false" style="margin:8px 0 10px 102px; width:20px;" />
|
|
1102
|
-
<label style="width:auto" for="node-config-input-metricsEnabled"><span>Enable Metrics</span></label>
|
|
1103
|
-
</div>
|
|
1104
|
-
|
|
1105
|
-
<div id="section_metricsEnabled">
|
|
1106
|
-
<div class="form-row nomargin">
|
|
1107
|
-
<label class="towb_editorlabel" for="node-config-input-metricsReference">Metric Collector</label>
|
|
1108
|
-
<input id="node-config-input-metricsReference" placeholder="metrics" />
|
|
1109
|
-
</div>
|
|
1110
|
-
</div>
|
|
1111
|
-
</div>
|
|
1112
|
-
</div>
|
|
1113
|
-
|
|
1114
|
-
</div>
|
|
1115
|
-
</script>
|
|
1116
|
-
|
|
1117
|
-
<script type="text/markdown" data-help-name='GaugeMetricConfigNode'>
|
|
1118
|
-
Configuration node for the Gauge Metrics
|
|
1119
|
-
|
|
1120
|
-
### Inputs
|
|
1121
|
-
: *name* (string) : The common name for the gauge.
|
|
1122
|
-
: *description* (string) : A description for the given gauge.
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
### Metrics
|
|
1126
|
-
: *enable metrics* (boolean) : if checked, then the node will produce metrics output to the specified metrics provider.
|
|
1127
|
-
: *metric collector* (metricconfig) : the collection point or grouping where this particular metric will be attached.
|
|
1128
|
-
</script>
|
|
1129
|
-
<script type="text/javascript">
|
|
1130
|
-
RED.nodes.registerType('TimerMetricConfigNode', {
|
|
1131
|
-
category: 'config',
|
|
1132
|
-
label: function() {
|
|
1133
|
-
return this.name
|
|
1134
|
-
},
|
|
1135
|
-
paletteLabel: 'Timer Metric Config',
|
|
1136
|
-
defaults: {
|
|
1137
|
-
name: {
|
|
1138
|
-
value: 'Timer Example',
|
|
1139
|
-
required: true
|
|
1140
|
-
},
|
|
1141
|
-
description: {
|
|
1142
|
-
value: 'an example gauge',
|
|
1143
|
-
required: false
|
|
1144
|
-
},
|
|
1145
|
-
metricType: {
|
|
1146
|
-
required: true
|
|
1147
|
-
},
|
|
1148
|
-
buckettype: {
|
|
1149
|
-
value: 'Default',
|
|
1150
|
-
required: false
|
|
1151
|
-
},
|
|
1152
|
-
buckettype_manual_intervals: {
|
|
1153
|
-
value: '0.001, 0.01, 0.1, 1, 2, 5',
|
|
1154
|
-
required: false
|
|
1155
|
-
},
|
|
1156
|
-
buckettype_linear_start: {
|
|
1157
|
-
value: '0',
|
|
1158
|
-
required: false
|
|
1159
|
-
},
|
|
1160
|
-
buckettype_linear_interval: {
|
|
1161
|
-
value: '5',
|
|
1162
|
-
required: false
|
|
1163
|
-
},
|
|
1164
|
-
buckettype_linear_count: {
|
|
1165
|
-
value: '10',
|
|
1166
|
-
required: false
|
|
1167
|
-
},
|
|
1168
|
-
buckettype_exponential_start: {
|
|
1169
|
-
value: '1',
|
|
1170
|
-
required: false
|
|
1171
|
-
},
|
|
1172
|
-
buckettype_exponential_factor: {
|
|
1173
|
-
value: '2',
|
|
1174
|
-
required: false
|
|
1175
|
-
},
|
|
1176
|
-
buckettype_exponential_count: {
|
|
1177
|
-
value: '10',
|
|
1178
|
-
required: false
|
|
1179
|
-
},
|
|
1180
|
-
percentiletype: {
|
|
1181
|
-
value: 'Default',
|
|
1182
|
-
required: false
|
|
1183
|
-
},
|
|
1184
|
-
percentiletype_manual_intervals: {
|
|
1185
|
-
value: '0.01, 0.1, 0.9, 0.99',
|
|
1186
|
-
required: false
|
|
1187
|
-
},
|
|
1188
|
-
metricsEnabled: {
|
|
1189
|
-
value: false,
|
|
1190
|
-
required: true
|
|
1191
|
-
},
|
|
1192
|
-
metricsReference: {
|
|
1193
|
-
type: 'MetricsConfigNode',
|
|
1194
|
-
required: false
|
|
1195
|
-
},
|
|
1196
|
-
},
|
|
1197
|
-
oneditprepare: function() {
|
|
1198
|
-
// **** TimerMetricConfigNode **** //
|
|
1199
|
-
{
|
|
1200
|
-
let node = this;
|
|
1201
|
-
// bucket generator selection
|
|
1202
|
-
let selectBucketType = function(value) {
|
|
1203
|
-
$("#TimerMetricConfig").find(".metricsconfig_buckets").hide();
|
|
1204
|
-
$("#TimerMetricConfig").find(`.metricsconfig_buckets_${value}`).show();
|
|
1205
|
-
};
|
|
1206
|
-
let bucketTypeSelection = $("#node-config-input-buckettype");
|
|
1207
|
-
bucketTypeSelection.typedInput({
|
|
1208
|
-
type: "buckettype",
|
|
1209
|
-
types: [{
|
|
1210
|
-
value: "buckettype",
|
|
1211
|
-
options: [{
|
|
1212
|
-
value: "default",
|
|
1213
|
-
label: "Default"
|
|
1214
|
-
}, {
|
|
1215
|
-
value: "manual",
|
|
1216
|
-
label: "Manual"
|
|
1217
|
-
}, {
|
|
1218
|
-
value: "linear",
|
|
1219
|
-
label: "Linear"
|
|
1220
|
-
}, {
|
|
1221
|
-
value: "exponential",
|
|
1222
|
-
label: "Exponential"
|
|
1223
|
-
}, ]
|
|
1224
|
-
}]
|
|
1225
|
-
});
|
|
1226
|
-
bucketTypeSelection.on("change", () => selectBucketType(bucketTypeSelection.val()));
|
|
1227
|
-
selectBucketType(bucketTypeSelection.val());
|
|
1228
|
-
// percentile type selection.
|
|
1229
|
-
let selectPercentileType = function(value) {
|
|
1230
|
-
$("#TimerMetricConfig").find(".metricsconfig_percentiles").hide();
|
|
1231
|
-
$("#TimerMetricConfig").find(`.metricsconfig_percentiles_${value}`).show();
|
|
1232
|
-
}
|
|
1233
|
-
let percentileTypeSelection = $("#node-config-input-percentiletype");
|
|
1234
|
-
percentileTypeSelection.typedInput({
|
|
1235
|
-
type: "percentiletype",
|
|
1236
|
-
types: [{
|
|
1237
|
-
value: "percentiletype",
|
|
1238
|
-
options: [{
|
|
1239
|
-
value: "default",
|
|
1240
|
-
label: "Default"
|
|
1241
|
-
}, {
|
|
1242
|
-
value: "manual",
|
|
1243
|
-
label: "Manual"
|
|
1244
|
-
}, ]
|
|
1245
|
-
}]
|
|
1246
|
-
});
|
|
1247
|
-
percentileTypeSelection.on("change", () => selectPercentileType(percentileTypeSelection.val()));
|
|
1248
|
-
selectPercentileType(percentileTypeSelection.val());
|
|
1249
|
-
// metric type selection.
|
|
1250
|
-
let selectMetricType = function(value) {
|
|
1251
|
-
// show/hide the relevant metric type section.
|
|
1252
|
-
$("#TimerMetricConfig").find(`.metrictype`).hide();
|
|
1253
|
-
$("#TimerMetricConfig").find(`.metrictype_${value}`).show();
|
|
1254
|
-
bucketTypeSelection.trigger("change");
|
|
1255
|
-
percentileTypeSelection.trigger("change");
|
|
1256
|
-
}
|
|
1257
|
-
let metricTypeSelection = $("#node-config-input-metricType");
|
|
1258
|
-
metricTypeSelection.typedInput({
|
|
1259
|
-
type: "metricType",
|
|
1260
|
-
types: [{
|
|
1261
|
-
value: "metricType",
|
|
1262
|
-
options: [{
|
|
1263
|
-
value: "histogram",
|
|
1264
|
-
label: "Histogram"
|
|
1265
|
-
}, {
|
|
1266
|
-
value: "summary",
|
|
1267
|
-
label: "Summary"
|
|
1268
|
-
}, ]
|
|
1269
|
-
}]
|
|
1270
|
-
});
|
|
1271
|
-
metricTypeSelection.on("change", () => selectMetricType(metricTypeSelection.val()));
|
|
1272
|
-
selectMetricType(metricTypeSelection.val());
|
|
1273
|
-
// enable the metrics by default and hide the Enable metrics button.
|
|
1274
|
-
let metricsEnabled = $("#node-config-input-metricsEnabled");
|
|
1275
|
-
metricsEnabled.prop('checked', true);
|
|
1276
|
-
metricsEnabled.trigger("change");
|
|
1277
|
-
$("#section_metricsconfig").find(".metricsEnableCheck").hide();
|
|
1278
|
-
}
|
|
1279
|
-
// **** metrics **** //
|
|
1280
|
-
{
|
|
1281
|
-
let node = this;
|
|
1282
|
-
let metricsEnabled = $("#node-config-input-metricsEnabled");
|
|
1283
|
-
let metricsEnabledSection = $("#section_metricsEnabled");
|
|
1284
|
-
metricsEnabled.on('change', function() {
|
|
1285
|
-
if (metricsEnabled.prop("checked")) {
|
|
1286
|
-
metricsEnabledSection.show();
|
|
1287
|
-
node._def.defaults.metricsReference.required = true;
|
|
1288
|
-
} else {
|
|
1289
|
-
metricsEnabledSection.hide()
|
|
1290
|
-
node._def.defaults.metricsReference.required = false;
|
|
1291
|
-
}
|
|
1292
|
-
});
|
|
1293
|
-
}
|
|
1294
|
-
},
|
|
1295
|
-
oneditsave: function() {
|
|
1296
|
-
// **** metrics **** //
|
|
1297
|
-
{}
|
|
1298
|
-
},
|
|
1299
|
-
oneditcancel: function() {},
|
|
1300
|
-
oneditdelete: function() {},
|
|
1301
|
-
});
|
|
1302
|
-
|
|
1303
|
-
</script>
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
<script type="text/html" data-template-name='TimerMetricConfigNode'>
|
|
1307
|
-
<div id='section_TimerMetricConfigNode'>
|
|
1308
|
-
<div id="TimerMetricConfig">
|
|
1309
|
-
<div class="form-row">
|
|
1310
|
-
<label class="towb_editorlabel" for="node-config-input-name"><i class="fa fa-font"></i> Name</label>
|
|
1311
|
-
<input type="text" id="node-config-input-name" />
|
|
1312
|
-
</div>
|
|
1313
|
-
|
|
1314
|
-
<div class="form-row">
|
|
1315
|
-
<label class="towb_editorlabel" for="node-config-input-description"><i class="fa fa-info-circle"></i> Description</label>
|
|
1316
|
-
<input type="text" id="node-config-input-description" />
|
|
1317
|
-
</div>
|
|
1318
|
-
|
|
1319
|
-
<div class="form-row">
|
|
1320
|
-
<label class="towb_editorlabel" for="node-config-input-metricType"><i class="fa fa-bar-chart"></i> Type</label>
|
|
1321
|
-
<input type="text" id="node-config-input-metricType" />
|
|
1322
|
-
</div>
|
|
1323
|
-
|
|
1324
|
-
<div class="metrictype metrictype_histogram">
|
|
1325
|
-
<div class="form-row">
|
|
1326
|
-
<label class="towb_editorlabel" for="node-config-input-buckettype"><i class="fa fa-sliders"></i> Bucket Type</label>
|
|
1327
|
-
<input type="text" id="node-config-input-buckettype" />
|
|
1328
|
-
</div>
|
|
1329
|
-
|
|
1330
|
-
<div class="metricsconfig_buckets metricsconfig_buckets_default">
|
|
1331
|
-
<span>Default bucket sizes configured as 0.001, 0.01, 0.1, 1, 2, 5 seconds</span>
|
|
1332
|
-
</div>
|
|
1333
|
-
|
|
1334
|
-
<div class="metricsconfig_buckets metricsconfig_buckets_manual">
|
|
1335
|
-
<div class="form-row">
|
|
1336
|
-
<label class="towb_editorlabel" for="node-config-input-buckettype_manual_intervals"><i class="fa fa-sliders"></i> Buckets</label>
|
|
1337
|
-
<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" />
|
|
1338
|
-
</div>
|
|
1339
|
-
</div>
|
|
1340
|
-
|
|
1341
|
-
<div class="metricsconfig_buckets metricsconfig_buckets_linear">
|
|
1342
|
-
<div class="form-row">
|
|
1343
|
-
<label class="towb_editorlabel" for="node-config-input-buckettype_linear_start"><i class="fa fa-sliders"></i> Start</label>
|
|
1344
|
-
<input class="towb_editorfield_short" type="text" id="node-config-input-buckettype_linear_start" placeholder="0.000" , value="0.000" />
|
|
1345
|
-
</div>
|
|
1346
|
-
<div class="form-row">
|
|
1347
|
-
<label class="towb_editorlabel" for="node-config-input-buckettype_linear_interval"><i class="fa fa-sliders"></i> Interval</label>
|
|
1348
|
-
<input class="towb_editorfield_short" type="text" id="node-config-input-buckettype_linear_interval" placeholder="10" , value="10" />
|
|
1349
|
-
</div>
|
|
1350
|
-
<div class="form-row">
|
|
1351
|
-
<label class="towb_editorlabel" for="node-config-input-buckettype_linear_count"><i class="fa fa-sliders"></i> Count</label>
|
|
1352
|
-
<input class="towb_editorfield_short" type="text" id="node-config-input-buckettype_linear_count" placeholder="10" , value="10" />
|
|
1353
|
-
</div>
|
|
1354
|
-
</div>
|
|
1355
|
-
|
|
1356
|
-
<div class="metricsconfig_buckets metricsconfig_buckets_exponential">
|
|
1357
|
-
<div class="form-row">
|
|
1358
|
-
<label class="towb_editorlabel" for="node-config-input-buckettype_exponential_start"><i class="fa fa-sliders"></i> Start</label>
|
|
1359
|
-
<input class="towb_editorfield_short" type="text" id="node-config-input-buckettype_exponential_start" placeholder="1" , value="1" />
|
|
1360
|
-
</div>
|
|
1361
|
-
<div class="form-row">
|
|
1362
|
-
<label class="towb_editorlabel" for="node-config-input-buckettype_exponential_factor"><i class="fa fa-sliders"></i> Factor</label>
|
|
1363
|
-
<input class="towb_editorfield_short" type="text" id="node-config-input-buckettype_exponential_factor" placeholder="2" , value="2" />
|
|
1364
|
-
</div>
|
|
1365
|
-
<div class="form-row">
|
|
1366
|
-
<label class="towb_editorlabel" for="node-config-input-buckettype_exponential_count"><i class="fa fa-sliders"></i> Count</label>
|
|
1367
|
-
<input class="towb_editorfield_short" type="text" id="node-config-input-buckettype_exponential_count" placeholder="10" , value="10" />
|
|
1368
|
-
</div>
|
|
1369
|
-
</div>
|
|
1370
|
-
</div>
|
|
1371
|
-
|
|
1372
|
-
<div class="metrictype metrictype_summary">
|
|
1373
|
-
<div class="form-row">
|
|
1374
|
-
<label class="towb_editorlabel" for="node-config-input-percentiletype"><i class="fa fa-sliders"></i> Percentile Type</label>
|
|
1375
|
-
<input type="text" id="node-config-input-percentiletype" />
|
|
1376
|
-
</div>
|
|
1377
|
-
|
|
1378
|
-
<div class="metricsconfig_percentiles metricsconfig_percentiles_default">
|
|
1379
|
-
<span>Default percentille sizes configured as [0.01, 0.1, 0.9, 0.99]</span>
|
|
1380
|
-
</div>
|
|
1381
|
-
|
|
1382
|
-
<div class="metricsconfig_percentiles metricsconfig_percentiles_manual">
|
|
1383
|
-
<div class="form-row">
|
|
1384
|
-
<label class="towb_editorlabel" for="node-config-input-percentiletype_manual_intervals"><i class="fa fa-sliders"></i> Percentiles</label>
|
|
1385
|
-
<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" />
|
|
1386
|
-
</div>
|
|
1387
|
-
</div>
|
|
1388
|
-
</div>
|
|
1389
|
-
</div>
|
|
1390
|
-
|
|
1391
|
-
</div>
|
|
1392
|
-
|
|
1393
|
-
<div id='section_metrics'>
|
|
1394
|
-
<div id="section_metricsconfig">
|
|
1395
|
-
<div class="form-row editorsectionheading">
|
|
1396
|
-
<i class="w-16 fa fa-eye"></i> <span>Metrics</span>
|
|
1397
|
-
</div>
|
|
1398
|
-
<div class="editorgroupborder">
|
|
1399
|
-
<div class="form-row nomargin metricsEnableCheck">
|
|
1400
|
-
<input type="checkbox" id="node-config-input-metricsEnabled" value="false" style="margin:8px 0 10px 102px; width:20px;" />
|
|
1401
|
-
<label style="width:auto" for="node-config-input-metricsEnabled"><span>Enable Metrics</span></label>
|
|
1402
|
-
</div>
|
|
1403
|
-
|
|
1404
|
-
<div id="section_metricsEnabled">
|
|
1405
|
-
<div class="form-row nomargin">
|
|
1406
|
-
<label class="towb_editorlabel" for="node-config-input-metricsReference">Metric Collector</label>
|
|
1407
|
-
<input id="node-config-input-metricsReference" placeholder="metrics" />
|
|
1408
|
-
</div>
|
|
1409
|
-
</div>
|
|
1410
|
-
</div>
|
|
1411
|
-
</div>
|
|
1412
|
-
|
|
1413
|
-
</div>
|
|
1414
|
-
</script>
|
|
1415
|
-
|
|
1416
|
-
<script type="text/markdown" data-help-name='TimerMetricConfigNode'>
|
|
1417
|
-
Configuration node for the Timer Metrics
|
|
1418
|
-
|
|
1419
|
-
### Inputs
|
|
1420
|
-
: *name* (string) : The common name for the timer.
|
|
1421
|
-
: *description* (string) : A description for the timer
|
|
1422
|
-
: *type* (string) : the type of timer metric ie. Histogram or Summary
|
|
1423
|
-
|
|
1424
|
-
#### Histogram
|
|
1425
|
-
: *type* (string) : the type of timer metric ie. Histogram or Summary
|
|
1426
|
-
|
|
1427
|
-
#### Summary
|
|
1428
|
-
: *percentile type* (string) : the type of percentile strategy. currently supported are default and manual
|
|
1429
|
-
: *percentiles* (string) : a comma separated list of percentiles to group observations into. note that the scale goes from 0 to 1.
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
### Metrics
|
|
1433
|
-
: *enable metrics* (boolean) : if checked, then the node will produce metrics output to the specified metrics provider.
|
|
1434
|
-
: *metric collector* (metricconfig) : the collection point or grouping where this particular metric will be attached.
|
|
1435
|
-
</script>
|
|
1436
|
-
<!-- WebhookServerConfigNode -->
|
|
1437
|
-
<script type="text/javascript">
|
|
1438
|
-
RED.nodes.registerType('WebhookServerConfigNode', {
|
|
1439
|
-
category: 'config',
|
|
1440
|
-
label: function() {
|
|
1441
|
-
return this.name
|
|
1442
|
-
},
|
|
1443
|
-
paletteLabel: 'Webhook',
|
|
1444
|
-
defaults: {
|
|
1445
|
-
name: {
|
|
1446
|
-
value: 'Example Test Node',
|
|
1447
|
-
required: true
|
|
1448
|
-
},
|
|
1449
|
-
port: {
|
|
1450
|
-
value: 6644,
|
|
1451
|
-
required: true
|
|
1452
|
-
},
|
|
1453
|
-
externalHost: {
|
|
1454
|
-
value: 'localhost',
|
|
1455
|
-
required: true
|
|
1456
|
-
},
|
|
1457
|
-
externalPort: {
|
|
1458
|
-
value: 6644,
|
|
1459
|
-
required: true
|
|
1460
|
-
},
|
|
1461
|
-
},
|
|
1462
|
-
oneditprepare: function() {},
|
|
1463
|
-
oneditsave: function() {},
|
|
1464
|
-
oneditcancel: function() {},
|
|
1465
|
-
oneditdelete: function() {},
|
|
1466
|
-
});
|
|
1467
|
-
|
|
1468
|
-
</script>
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
<script type="text/html" data-template-name='WebhookServerConfigNode'>
|
|
1472
|
-
<div id='section_WebhookServerConfigNode'>
|
|
1473
|
-
<div id="WebhookServerConfig">
|
|
1474
|
-
<div class="form-row">
|
|
1475
|
-
<label class="towb_editorlabel" for="node-config-input-name"><i class="fa fa-font"></i> Name</label>
|
|
1476
|
-
<input type="text" id="node-config-input-name" />
|
|
1477
|
-
</div>
|
|
1478
|
-
|
|
1479
|
-
<div class="form-row">
|
|
1480
|
-
<label class="towb_editorlabel" for="node-config-input-port"><i class="fa fa-plug"></i> Port</label>
|
|
1481
|
-
<input type="number" id="node-config-input-port" />
|
|
1482
|
-
</div>
|
|
1483
|
-
|
|
1484
|
-
<div class="form-row">
|
|
1485
|
-
<label class="towb_editorlabel" for="node-config-input-externalHost"><i class="fa fa-globe"></i> External Host</label>
|
|
1486
|
-
<input type="text" id="node-config-input-externalHost" />
|
|
1487
|
-
</div>
|
|
1488
|
-
|
|
1489
|
-
<div class="form-row">
|
|
1490
|
-
<label class="towb_editorlabel" for="node-config-input-externalPort"><i class="fa fa-plug"></i> External Port</label>
|
|
1491
|
-
<input type="number" id="node-config-input-externalPort" />
|
|
1492
|
-
</div>
|
|
1493
|
-
<!-- add a button here to autmatically find an open port -->
|
|
1494
|
-
</div>
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
</div>
|
|
1498
|
-
</script>
|
|
1499
|
-
|
|
1500
|
-
<script type="text/markdown" data-help-name='WebhookServerConfigNode'>
|
|
1501
|
-
Configuration node for an Express HTTP server that webhook nodes attach to. A single server instance is shared by all webhook nodes that reference it. The server is started when the flow is first deployed and stopped when it is torn down.
|
|
1502
|
-
|
|
1503
|
-
### Inputs
|
|
1504
|
-
: *name* (string) : A descriptive name for this webhook server.
|
|
1505
|
-
: *port* (number) : The local port the HTTP server will listen on. Defaults to `6644`. Each server instance must use a unique port.
|
|
1506
|
-
|
|
1507
|
-
### Reverse Proxy
|
|
1508
|
-
When this server sits behind a reverse proxy, configure the following fields so that webhook nodes know the externally-visible address. This is used when registering endpoints with a reverse proxy service.
|
|
1509
|
-
|
|
1510
|
-
: *external host* (string) : The public hostname or IP of the reverse proxy (e.g. `myserver.example.com`).
|
|
1511
|
-
: *external port* (number) : The public port exposed by the reverse proxy.
|
|
1512
|
-
</script>
|
|
1513
|
-
|
|
1514
|
-
|
|
11
|
+
|