@theotherwillembotha/node-red-plugincore 0.0.54 → 0.1.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 +9 -9
- package/build/GenerateNodes.js +0 -1
- package/build/Nodes.html +23 -162
- package/build/Nodes.js +0 -2
- package/build/Plugins.js +2 -3
- package/build/core/NodeConstructor.d.ts +1 -0
- package/build/core/NodeConstructor.d.ts.map +1 -1
- package/build/core/NodeConstructor.js +20 -62
- package/build/core/NodeGenerator.d.ts.map +1 -1
- package/build/core/NodeGenerator.js +8 -11
- package/build/core/logger/LoggerDecorator.d.ts.map +1 -1
- package/build/core/logger/LoggerDecorator.js +34 -38
- package/build/core/logger/node/ConsoleLoggerConfigNode.d.ts +11 -7
- package/build/core/logger/node/ConsoleLoggerConfigNode.d.ts.map +1 -1
- package/build/core/logger/node/ConsoleLoggerConfigNode.js +24 -10
- package/build/core/logger/node/RestLoggerConfigNode.d.ts +22 -6
- package/build/core/logger/node/RestLoggerConfigNode.d.ts.map +1 -1
- package/build/core/logger/node/RestLoggerConfigNode.js +93 -23
- package/build/core/logger/service/LoggerService.d.ts +59 -68
- package/build/core/logger/service/LoggerService.d.ts.map +1 -1
- package/build/core/logger/service/LoggerService.js +76 -165
- package/build/core/logger/template/LoggerTemplate.d.ts +9 -1
- package/build/core/logger/template/LoggerTemplate.d.ts.map +1 -1
- package/build/core/metrics/node/CounterMetricConfigNode.js +0 -2
- package/build/core/metrics/node/GaugeMetricConfigNode.js +0 -2
- package/build/core/metrics/node/MetricsConfigNode.js +0 -1
- package/build/core/metrics/node/TimerMetricConfigNode.js +0 -2
- package/build/core/metrics/service/MetricsService.js +10 -24
- package/build/core/other/service/SettingsService.js +0 -2
- package/build/core/tagging/service/NodeTypeService.js +1 -2
- package/build/core/webhook/WebhookDecorator.d.ts.map +1 -1
- package/build/core/webhook/WebhookDecorator.js +47 -10
- package/build/core/webhook/node/WebhookServerConfigNode.js +0 -1
- package/build/core/webhook/service/ReverseProxyTypeService.d.ts +1 -2
- package/build/core/webhook/service/ReverseProxyTypeService.d.ts.map +1 -1
- package/build/core/webhook/service/ReverseProxyTypeService.js +1 -6
- package/build/core/webhook/service/WebhookServerService.d.ts +1 -1
- package/build/core/webhook/service/WebhookServerService.d.ts.map +1 -1
- package/build/core/webhook/service/WebhookServerService.js +6 -14
- package/build/core/webhook/template/WebhookTemplate.d.ts +1 -1
- package/build/core/webhook/template/WebhookTemplate.d.ts.map +1 -1
- package/build/index.d.ts +1 -2
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1 -2
- package/build/resources/editorLanguageExtension.js +1 -2
- package/package.json +6 -5
- package/resources/editorLanguageExtension.js +1 -2
- package/src/GenerateNodes.ts +2 -2
- package/src/core/NodeConstructor.ts +7 -14
- package/src/core/NodeGenerator.ts +2 -3
- package/src/core/logger/LoggerDecorator.ts +56 -53
- package/src/core/logger/node/ConsoleLoggerConfigNode.ts +39 -14
- package/src/core/logger/node/RestLoggerConfigNode.ts +128 -25
- package/src/core/logger/service/LoggerService.ts +103 -239
- package/src/core/logger/template/LoggerTemplate.html +2 -2
- package/src/core/logger/template/LoggerTemplate.ts +11 -1
- package/src/core/metrics/node/TimerMetricConfigNode.html +2 -2
- package/src/core/other/template/BasicTemplate.html +5 -2
- package/src/core/webhook/WebhookDecorator.ts +54 -13
- package/src/core/webhook/service/ReverseProxyTypeService.ts +1 -4
- package/src/core/webhook/service/WebhookServerService.ts +1 -6
- package/src/core/webhook/template/WebhookTemplate.html +1 -1
- package/src/core/webhook/template/WebhookTemplate.ts +1 -1
- package/src/index.ts +2 -2
- package/build/core/logger/node/ConsoleLoggerConfigNode.html +0 -90
- package/build/core/logger/node/LokiLoggerConfigNode.d.ts +0 -20
- package/build/core/logger/node/LokiLoggerConfigNode.d.ts.map +0 -1
- package/build/core/logger/node/LokiLoggerConfigNode.html +0 -117
- package/build/core/logger/node/LokiLoggerConfigNode.js +0 -53
- package/build/core/logger/node/RestLoggerConfigNode.html +0 -183
- package/build/core/logger/service/LoggerServiceTypes.d.ts +0 -24
- package/build/core/logger/service/LoggerServiceTypes.d.ts.map +0 -1
- package/build/core/logger/service/LoggerServiceTypes.js +0 -30
- package/build/core/logger/template/LoggerTemplate.html +0 -331
- package/build/core/metrics/node/CounterMetricConfigNode.html +0 -48
- package/build/core/metrics/node/GaugeMetricConfigNode.html +0 -48
- package/build/core/metrics/node/MetricsConfigNode.html +0 -21
- package/build/core/metrics/node/TimerMetricConfigNode.html +0 -190
- package/build/core/metrics/template/CounterMetricTemplate.html +0 -40
- package/build/core/metrics/template/GaugeMetricTemplate.html +0 -39
- package/build/core/metrics/template/MetricsTemplate.html +0 -54
- package/build/core/metrics/template/TimerMetricTemplate.html +0 -39
- package/build/core/other/node/DelegatedConfigReferenceNode.html +0 -1
- package/build/core/other/template/BasicTemplate.html +0 -76
- package/build/core/other/template/SettingsTemplate.html +0 -128
- package/build/core/ui/template/ScriptEditorTemplate.html +0 -50
- package/build/core/ui/template/UIHelperTemplate.html +0 -229
- package/build/core/webhook/node/WebhookServerConfigNode.html +0 -61
- package/build/core/webhook/template/WebhookTemplate.html +0 -442
- package/documentation/LokiLoggerConfigNode.png +0 -0
- package/src/core/logger/node/LokiLoggerConfigNode.html +0 -117
- package/src/core/logger/node/LokiLoggerConfigNode.ts +0 -58
- package/src/core/logger/service/LoggerServiceTypes.ts +0 -26
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
<script type="text/javascript" template-section="onCompose">
|
|
2
|
-
node
|
|
3
|
-
.addDefault("name", { value:"Timer Example", required:true})
|
|
4
|
-
.addDefault("description", {value:"an example gauge", required:false})
|
|
5
|
-
.addDefault("metricType", {required:true})
|
|
6
|
-
.addDefault("buckettype", {value:"Default", required:false})
|
|
7
|
-
.addDefault("buckettype_manual_intervals", {value:"0.001, 0.01, 0.1, 1, 2, 5", required:false})
|
|
8
|
-
.addDefault("buckettype_linear_start", {value:"0", required:false})
|
|
9
|
-
.addDefault("buckettype_linear_interval", {value:"5", required:false})
|
|
10
|
-
.addDefault("buckettype_linear_count", {value:"10", required:false})
|
|
11
|
-
.addDefault("buckettype_exponential_start", {value:"1", required:false})
|
|
12
|
-
.addDefault("buckettype_exponential_factor", {value:"2", required:false})
|
|
13
|
-
.addDefault("buckettype_exponential_count", {value:"10", required:false})
|
|
14
|
-
.addDefault("percentiletype", {value:"Default", required:false})
|
|
15
|
-
.addDefault("percentiletype_manual_intervals", {value:"0.01, 0.1, 0.9, 0.99", required:false})
|
|
16
|
-
|
|
17
|
-
.setPaletteLabel("Timer Metric Config")
|
|
18
|
-
.setLabel(function() {return this.name })
|
|
19
|
-
|
|
20
|
-
</script>
|
|
21
|
-
|
|
22
|
-
<script type="text/javascript" template-section="onIncludeEditPrepare">
|
|
23
|
-
{
|
|
24
|
-
let node = this;
|
|
25
|
-
|
|
26
|
-
// bucket generator selection
|
|
27
|
-
let selectBucketType = function(value){
|
|
28
|
-
$("#TimerMetricConfig").find(".metricsconfig_buckets").hide();
|
|
29
|
-
$("#TimerMetricConfig").find(`.metricsconfig_buckets_${value}`).show();
|
|
30
|
-
};
|
|
31
|
-
let bucketTypeSelection = $("#node-config-input-buckettype");
|
|
32
|
-
bucketTypeSelection.typedInput({type:"buckettype", types:[{
|
|
33
|
-
value: "buckettype",
|
|
34
|
-
options: [
|
|
35
|
-
{ value: "default", label: "Default"},
|
|
36
|
-
{ value: "manual", label: "Manual"},
|
|
37
|
-
{ value: "linear", label: "Linear"},
|
|
38
|
-
{ value: "exponential", label: "Exponential"},
|
|
39
|
-
]
|
|
40
|
-
}]});
|
|
41
|
-
bucketTypeSelection.on("change", () => selectBucketType(bucketTypeSelection.val()));
|
|
42
|
-
selectBucketType(bucketTypeSelection.val());
|
|
43
|
-
|
|
44
|
-
// percentile type selection.
|
|
45
|
-
let selectPercentileType = function(value){
|
|
46
|
-
$("#TimerMetricConfig").find(".metricsconfig_percentiles").hide();
|
|
47
|
-
$("#TimerMetricConfig").find(`.metricsconfig_percentiles_${value}`).show();
|
|
48
|
-
}
|
|
49
|
-
let percentileTypeSelection = $("#node-config-input-percentiletype");
|
|
50
|
-
percentileTypeSelection.typedInput({type:"percentiletype", types:[{
|
|
51
|
-
value: "percentiletype",
|
|
52
|
-
options: [
|
|
53
|
-
{ value: "default", label: "Default"},
|
|
54
|
-
{ value: "manual", label: "Manual"},
|
|
55
|
-
]
|
|
56
|
-
}]});
|
|
57
|
-
percentileTypeSelection.on("change", () => selectPercentileType(percentileTypeSelection.val()));
|
|
58
|
-
selectPercentileType(percentileTypeSelection.val());
|
|
59
|
-
|
|
60
|
-
// metric type selection.
|
|
61
|
-
let selectMetricType = function(value){
|
|
62
|
-
// show/hide the relevant metric type section.
|
|
63
|
-
$("#TimerMetricConfig").find(`.metrictype`).hide();
|
|
64
|
-
$("#TimerMetricConfig").find(`.metrictype_${value}`).show();
|
|
65
|
-
|
|
66
|
-
bucketTypeSelection.trigger("change");
|
|
67
|
-
percentileTypeSelection.trigger("change");
|
|
68
|
-
}
|
|
69
|
-
let metricTypeSelection = $("#node-config-input-metricType");
|
|
70
|
-
metricTypeSelection.typedInput({type:"metricType", types:[{
|
|
71
|
-
value: "metricType",
|
|
72
|
-
options: [
|
|
73
|
-
{ value: "histogram", label: "Histogram"},
|
|
74
|
-
{ value: "summary", label: "Summary"},
|
|
75
|
-
]
|
|
76
|
-
}]});
|
|
77
|
-
metricTypeSelection.on("change", () => selectMetricType(metricTypeSelection.val()));
|
|
78
|
-
selectMetricType(metricTypeSelection.val());
|
|
79
|
-
|
|
80
|
-
// enable the metrics by default and hide the Enable metrics button.
|
|
81
|
-
let metricsEnabled = $("#node-config-input-metricsEnabled");
|
|
82
|
-
metricsEnabled.prop('checked', true);
|
|
83
|
-
metricsEnabled.trigger("change");
|
|
84
|
-
$("#section_metricsconfig").find(".metricsEnableCheck").hide();
|
|
85
|
-
}
|
|
86
|
-
</script>
|
|
87
|
-
|
|
88
|
-
<script type="text/html" template-section="onIncludeEditForm">
|
|
89
|
-
<div id="TimerMetricConfig">
|
|
90
|
-
<div class="form-row">
|
|
91
|
-
<label class="towb_editorlabel" for="node-config-input-name"><i class="fa fa-font"></i> Name</label>
|
|
92
|
-
<input type="text" id="node-config-input-name" />
|
|
93
|
-
</div>
|
|
94
|
-
|
|
95
|
-
<div class="form-row">
|
|
96
|
-
<label class="towb_editorlabel" for="node-config-input-description"><i class="fa fa-info-circle"></i> Description</label>
|
|
97
|
-
<input type="text" id="node-config-input-description" />
|
|
98
|
-
</div>
|
|
99
|
-
|
|
100
|
-
<div class="form-row">
|
|
101
|
-
<label class="towb_editorlabel" for="node-config-input-metricType"><i class="fa fa-bar-chart"></i> Type</label>
|
|
102
|
-
<input class="towb_editorfield" type="text" id="node-config-input-metricType" />
|
|
103
|
-
</div>
|
|
104
|
-
|
|
105
|
-
<div class="metrictype metrictype_histogram">
|
|
106
|
-
<div class="form-row">
|
|
107
|
-
<label class="towb_editorlabel" for="node-config-input-buckettype"><i class="fa fa-sliders"></i> Bucket Type</label>
|
|
108
|
-
<input class="towb_editorfield" type="text" id="node-config-input-buckettype" />
|
|
109
|
-
</div>
|
|
110
|
-
|
|
111
|
-
<div class="metricsconfig_buckets metricsconfig_buckets_default">
|
|
112
|
-
<span>Default bucket sizes configured as 0.001, 0.01, 0.1, 1, 2, 5 seconds</span>
|
|
113
|
-
</div>
|
|
114
|
-
|
|
115
|
-
<div class="metricsconfig_buckets metricsconfig_buckets_manual">
|
|
116
|
-
<div class="form-row">
|
|
117
|
-
<label class="towb_editorlabel" for="node-config-input-buckettype_manual_intervals"><i class="fa fa-sliders"></i> Buckets</label>
|
|
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
|
-
</div>
|
|
120
|
-
</div>
|
|
121
|
-
|
|
122
|
-
<div class="metricsconfig_buckets metricsconfig_buckets_linear">
|
|
123
|
-
<div class="form-row">
|
|
124
|
-
<label class="towb_editorlabel" for="node-config-input-buckettype_linear_start"><i class="fa fa-sliders"></i> Start</label>
|
|
125
|
-
<input class="towb_editorfield_short" type="text" id="node-config-input-buckettype_linear_start" placeholder="0.000", value="0.000"/>
|
|
126
|
-
</div>
|
|
127
|
-
<div class="form-row">
|
|
128
|
-
<label class="towb_editorlabel" for="node-config-input-buckettype_linear_interval"><i class="fa fa-sliders"></i> Interval</label>
|
|
129
|
-
<input class="towb_editorfield_short" type="text" id="node-config-input-buckettype_linear_interval" placeholder="10", value="10"/>
|
|
130
|
-
</div>
|
|
131
|
-
<div class="form-row">
|
|
132
|
-
<label class="towb_editorlabel" for="node-config-input-buckettype_linear_count"><i class="fa fa-sliders"></i> Count</label>
|
|
133
|
-
<input class="towb_editorfield_short" type="text" id="node-config-input-buckettype_linear_count" placeholder="10", value="10"/>
|
|
134
|
-
</div>
|
|
135
|
-
</div>
|
|
136
|
-
|
|
137
|
-
<div class="metricsconfig_buckets metricsconfig_buckets_exponential">
|
|
138
|
-
<div class="form-row">
|
|
139
|
-
<label class="towb_editorlabel" for="node-config-input-buckettype_exponential_start"><i class="fa fa-sliders"></i> Start</label>
|
|
140
|
-
<input class="towb_editorfield_short" type="text" id="node-config-input-buckettype_exponential_start" placeholder="1", value="1"/>
|
|
141
|
-
</div>
|
|
142
|
-
<div class="form-row">
|
|
143
|
-
<label class="towb_editorlabel" for="node-config-input-buckettype_exponential_factor"><i class="fa fa-sliders"></i> Factor</label>
|
|
144
|
-
<input class="towb_editorfield_short" type="text" id="node-config-input-buckettype_exponential_factor" placeholder="2", value="2"/>
|
|
145
|
-
</div>
|
|
146
|
-
<div class="form-row">
|
|
147
|
-
<label class="towb_editorlabel" for="node-config-input-buckettype_exponential_count"><i class="fa fa-sliders"></i> Count</label>
|
|
148
|
-
<input class="towb_editorfield_short" type="text" id="node-config-input-buckettype_exponential_count" placeholder="10", value="10"/>
|
|
149
|
-
</div>
|
|
150
|
-
</div>
|
|
151
|
-
</div>
|
|
152
|
-
|
|
153
|
-
<div class="metrictype metrictype_summary">
|
|
154
|
-
<div class="form-row">
|
|
155
|
-
<label class="towb_editorlabel" for="node-config-input-percentiletype"><i class="fa fa-sliders"></i> Percentile Type</label>
|
|
156
|
-
<input type="text" id="node-config-input-percentiletype" />
|
|
157
|
-
</div>
|
|
158
|
-
|
|
159
|
-
<div class="metricsconfig_percentiles metricsconfig_percentiles_default">
|
|
160
|
-
<span>Default percentille sizes configured as [0.01, 0.1, 0.9, 0.99]</span>
|
|
161
|
-
</div>
|
|
162
|
-
|
|
163
|
-
<div class="metricsconfig_percentiles metricsconfig_percentiles_manual">
|
|
164
|
-
<div class="form-row">
|
|
165
|
-
<label class="towb_editorlabel" for="node-config-input-percentiletype_manual_intervals"><i class="fa fa-sliders"></i> Percentiles</label>
|
|
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
|
-
</div>
|
|
168
|
-
</div>
|
|
169
|
-
</div>
|
|
170
|
-
</div>
|
|
171
|
-
</script>
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
<script type="text/markdown" template-section="onIncludeDocumentation">
|
|
175
|
-
Configuration node for the Timer Metrics
|
|
176
|
-
|
|
177
|
-
### Inputs
|
|
178
|
-
: *name* (string) : The common name for the timer.
|
|
179
|
-
: *description* (string) : A description for the timer
|
|
180
|
-
: *type* (string) : the type of timer metric ie. Histogram or Summary
|
|
181
|
-
|
|
182
|
-
#### Histogram
|
|
183
|
-
: *type* (string) : the type of timer metric ie. Histogram or Summary
|
|
184
|
-
|
|
185
|
-
#### Summary
|
|
186
|
-
: *percentile type* (string) : the type of percentile strategy. currently supported are default and manual
|
|
187
|
-
: *percentiles* (string) : a comma separated list of percentiles to group observations into. note that the scale goes from 0 to 1.
|
|
188
|
-
|
|
189
|
-
</script>
|
|
190
|
-
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
<script type="text/javascript" template-section="onCompose">
|
|
2
|
-
node
|
|
3
|
-
.addDefault("counterConfig", { type:"CounterMetricConfigNode", required: true })
|
|
4
|
-
</script>
|
|
5
|
-
|
|
6
|
-
<script type="text/javascript" template-section="onIncludeEditPrepare">
|
|
7
|
-
|
|
8
|
-
let metricsEnabled = $("#node-{{#if config.isConfigNode}}config-{{/if}}input-metricsEnabled");
|
|
9
|
-
let metricsEnabledSection = $("#section_metricsEnabled");
|
|
10
|
-
|
|
11
|
-
metricsEnabled.on('change', function() {
|
|
12
|
-
if(metricsEnabled.prop("checked")){
|
|
13
|
-
metricsEnabledSection.show();
|
|
14
|
-
node._def.defaults.metricsReference.required = true;
|
|
15
|
-
}
|
|
16
|
-
else{
|
|
17
|
-
metricsEnabledSection.hide()
|
|
18
|
-
node._def.defaults.metricsReference.required = false;
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
</script>
|
|
22
|
-
|
|
23
|
-
<script type="text/javascript" template-section="onIncludeEditSave">
|
|
24
|
-
|
|
25
|
-
</script>
|
|
26
|
-
|
|
27
|
-
<script type="text/html" template-section="onIncludeEditForm">
|
|
28
|
-
<!-- CounterMetric -->
|
|
29
|
-
<div id="section_countermetricconfig">
|
|
30
|
-
<div class="form-row">
|
|
31
|
-
<label class="towb_editorlabel" for="node-input-counterConfig"><i class="fa fa-bar-chart"></i> Counter</label>
|
|
32
|
-
<input type="text" id="node-input-counterConfig" />
|
|
33
|
-
</div>
|
|
34
|
-
</div>
|
|
35
|
-
</script>
|
|
36
|
-
|
|
37
|
-
<script type="text/markdown" template-section="onIncludeDocumentation">
|
|
38
|
-
### Counter
|
|
39
|
-
: *counter* (counterconfig) : the counter that would be incremented whenever a message is received.
|
|
40
|
-
</script>
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
<script type="text/javascript" template-section="onCompose">
|
|
2
|
-
node
|
|
3
|
-
.addDefault("gaugeConfig", { type:"GaugeMetricConfigNode", required: true })
|
|
4
|
-
</script>
|
|
5
|
-
|
|
6
|
-
<script type="text/javascript" template-section="onIncludeEditPrepare">
|
|
7
|
-
let metricsEnabled = $("#node-{{#if config.isConfigNode}}config-{{/if}}input-metricsEnabled");
|
|
8
|
-
let metricsEnabledSection = $("#section_metricsEnabled");
|
|
9
|
-
|
|
10
|
-
metricsEnabled.on('change', function() {
|
|
11
|
-
if(metricsEnabled.prop("checked")){
|
|
12
|
-
metricsEnabledSection.show();
|
|
13
|
-
node._def.defaults.metricsReference.required = true;
|
|
14
|
-
}
|
|
15
|
-
else{
|
|
16
|
-
metricsEnabledSection.hide()
|
|
17
|
-
node._def.defaults.metricsReference.required = false;
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
</script>
|
|
21
|
-
|
|
22
|
-
<script type="text/javascript" template-section="onIncludeEditSave">
|
|
23
|
-
|
|
24
|
-
</script>
|
|
25
|
-
|
|
26
|
-
<script type="text/html" template-section="onIncludeEditForm">
|
|
27
|
-
<!-- GaugeMetric -->
|
|
28
|
-
<div id="section_gaugemetricconfig">
|
|
29
|
-
<div class="form-row">
|
|
30
|
-
<label class="towb_editorlabel" for="node-input-gaugeConfig"><i class="fa fa-bar-chart"></i> Gauge</label>
|
|
31
|
-
<input type="text" id="node-input-gaugeConfig" />
|
|
32
|
-
</div>
|
|
33
|
-
</div>
|
|
34
|
-
</script>
|
|
35
|
-
|
|
36
|
-
<script type="text/markdown" template-section="onIncludeDocumentation">
|
|
37
|
-
### Gauge
|
|
38
|
-
: *gauge* (gaugeconfig) : the gauge that would be incremented / decremented whenever a message is received.
|
|
39
|
-
</script>
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
<script type="text/javascript" template-section="onCompose">
|
|
2
|
-
node
|
|
3
|
-
.addDefault("metricsEnabled", { value:false, required:true})
|
|
4
|
-
.addDefault("metricsReference", {type:"MetricsConfigNode", required:false})
|
|
5
|
-
</script>
|
|
6
|
-
|
|
7
|
-
<script type="text/javascript" template-section="onIncludeEditPrepare">
|
|
8
|
-
let node = this;
|
|
9
|
-
|
|
10
|
-
let metricsEnabled = $("#{{defaults.metricsEnabled}}");
|
|
11
|
-
let metricsEnabledSection = $("#section_metricsEnabled");
|
|
12
|
-
|
|
13
|
-
metricsEnabled.on('change', function() {
|
|
14
|
-
if(metricsEnabled.prop("checked")){
|
|
15
|
-
metricsEnabledSection.show();
|
|
16
|
-
node._def.defaults.metricsReference.required = true;
|
|
17
|
-
}
|
|
18
|
-
else{
|
|
19
|
-
metricsEnabledSection.hide()
|
|
20
|
-
node._def.defaults.metricsReference.required = false;
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
</script>
|
|
24
|
-
|
|
25
|
-
<script type="text/javascript" template-section="onIncludeEditSave">
|
|
26
|
-
|
|
27
|
-
</script>
|
|
28
|
-
|
|
29
|
-
<script type="text/html" template-section="onIncludeEditForm">
|
|
30
|
-
<div id="section_metricsconfig">
|
|
31
|
-
<div class="form-row editorsectionheading">
|
|
32
|
-
<i class="w-16 fa fa-eye"></i> <span>Metrics</span>
|
|
33
|
-
</div>
|
|
34
|
-
<div class="editorgroupborder">
|
|
35
|
-
<div class="form-row nomargin metricsEnableCheck">
|
|
36
|
-
<input type="checkbox" id="{{defaults.metricsEnabled}}" value="false" style="margin:8px 0 10px 102px; width:20px;" />
|
|
37
|
-
<label style="width:auto" for="{{defaults.metricsEnabled}}"><span>Enable Metrics</span></label>
|
|
38
|
-
</div>
|
|
39
|
-
|
|
40
|
-
<div id="section_metricsEnabled">
|
|
41
|
-
<div class="form-row nomargin">
|
|
42
|
-
<label class="towb_editorlabel" for="{{defaults.metricsReference}}">Metric Collector</label>
|
|
43
|
-
<input id="{{defaults.metricsReference}}" placeholder="metrics" />
|
|
44
|
-
</div>
|
|
45
|
-
</div>
|
|
46
|
-
</div>
|
|
47
|
-
</div>
|
|
48
|
-
</script>
|
|
49
|
-
|
|
50
|
-
<script type="text/markdown" template-section="onIncludeDocumentation">
|
|
51
|
-
### Metrics
|
|
52
|
-
: *enable metrics* (boolean) : if checked, then the node will produce metrics output to the specified metrics provider.
|
|
53
|
-
: *metric collector* (metricconfig) : the collection point or grouping where this particular metric will be attached.
|
|
54
|
-
</script>
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
<script type="text/javascript" template-section="onCompose">
|
|
2
|
-
node
|
|
3
|
-
.addDefault("timerConfig", { type:"TimerMetricConfigNode", required: true })
|
|
4
|
-
</script>
|
|
5
|
-
|
|
6
|
-
<script type="text/javascript" template-section="onIncludeEditPrepare">
|
|
7
|
-
let metricsEnabled = $("#node-{{#if config.isConfigNode}}config-{{/if}}input-metricsEnabled");
|
|
8
|
-
let metricsEnabledSection = $("#section_metricsEnabled");
|
|
9
|
-
|
|
10
|
-
metricsEnabled.on('change', function() {
|
|
11
|
-
if(metricsEnabled.prop("checked")){
|
|
12
|
-
metricsEnabledSection.show();
|
|
13
|
-
node._def.defaults.metricsReference.required = true;
|
|
14
|
-
}
|
|
15
|
-
else{
|
|
16
|
-
metricsEnabledSection.hide()
|
|
17
|
-
node._def.defaults.metricsReference.required = false;
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
</script>
|
|
21
|
-
|
|
22
|
-
<script type="text/javascript" template-section="onIncludeEditSave">
|
|
23
|
-
|
|
24
|
-
</script>
|
|
25
|
-
|
|
26
|
-
<script type="text/html" template-section="onIncludeEditForm">
|
|
27
|
-
|
|
28
|
-
<div id="section_timermetricconfig">
|
|
29
|
-
<div class="form-row">
|
|
30
|
-
<label class="towb_editorlabel" for="node-input-timerConfig"><i class="fa fa-clock-o"></i> Timer</label>
|
|
31
|
-
<input type="text" id="node-input-timerConfig" />
|
|
32
|
-
</div>
|
|
33
|
-
</div>
|
|
34
|
-
</script>
|
|
35
|
-
|
|
36
|
-
<script type="text/markdown" template-section="onIncludeDocumentation">
|
|
37
|
-
### Timer
|
|
38
|
-
: *timer* (timerconfig) : the trimer that will be incremented / decremented / observed every time the node is entered.
|
|
39
|
-
</script>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<!-- This section is intentionally left blank -->
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
<div template-section="onIncludeOnce">
|
|
3
|
-
<!-- BasicTemplate:includeOnce -->
|
|
4
|
-
<style>
|
|
5
|
-
.editorgroupborder {
|
|
6
|
-
border-width:1px;
|
|
7
|
-
border-style:solid;
|
|
8
|
-
border-color:lightgray;
|
|
9
|
-
padding: 3px;
|
|
10
|
-
margin-top: 2px;
|
|
11
|
-
margin-bottom: 2px;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
.editorsectionheading {
|
|
15
|
-
font-weight: 600;
|
|
16
|
-
margin-bottom:1px !important;
|
|
17
|
-
margin-top:6px !important;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
.nomargin {
|
|
21
|
-
margin-bottom:1px !important;
|
|
22
|
-
margin-top:1px !important;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.slidecontainer {
|
|
26
|
-
width: 100%;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
.slider {
|
|
30
|
-
-webkit-appearance: none;
|
|
31
|
-
appearance: none;
|
|
32
|
-
width: 100%;
|
|
33
|
-
height: 25px;
|
|
34
|
-
background: #d3d3d3;
|
|
35
|
-
outline: none;
|
|
36
|
-
opacity: 0.7;
|
|
37
|
-
-webkit-transition: .2s;
|
|
38
|
-
transition: opacity .2s;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.slider:hover {
|
|
42
|
-
opacity: 1;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
.slider::-webkit-slider-thumb {
|
|
46
|
-
-webkit-appearance: none;
|
|
47
|
-
appearance: none;
|
|
48
|
-
width: 25px;
|
|
49
|
-
height: 25px;
|
|
50
|
-
background: #04AA6D;
|
|
51
|
-
cursor: pointer;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
.slider::-moz-range-thumb {
|
|
55
|
-
width: 25px;
|
|
56
|
-
height: 25px;
|
|
57
|
-
background: #04AA6D;
|
|
58
|
-
cursor: pointer;
|
|
59
|
-
}
|
|
60
|
-
</style>
|
|
61
|
-
|
|
62
|
-
<style>
|
|
63
|
-
.towb_editorlabel {
|
|
64
|
-
width: 120px !important;
|
|
65
|
-
}
|
|
66
|
-
.towb_editorfield {
|
|
67
|
-
width: 70% !important;
|
|
68
|
-
}
|
|
69
|
-
.towb_editorfield_short {
|
|
70
|
-
width: 30% !important;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
</style>
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
</div>
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
<script type="text/javascript" template-section="onCompose">
|
|
3
|
-
node
|
|
4
|
-
.addDefault("settingsTimestamp", { value:0})
|
|
5
|
-
</script>
|
|
6
|
-
|
|
7
|
-
<div template-section="onIncludeOnce">
|
|
8
|
-
<script type="text/javascript">
|
|
9
|
-
getNodeSettings = function(nodeId, callback){
|
|
10
|
-
console.log("Rerieving settings for node id: " + nodeId);
|
|
11
|
-
|
|
12
|
-
$.ajax({
|
|
13
|
-
url: "utils/getNodeSettings" ,
|
|
14
|
-
type: "POST",
|
|
15
|
-
data: JSON.stringify({nodeId:nodeId}),
|
|
16
|
-
contentType: "application/json; charset=utf-8",
|
|
17
|
-
success: function (response) {
|
|
18
|
-
callback(response.settings);
|
|
19
|
-
},
|
|
20
|
-
error: function (jqXHR, textStatus, errorThrown) {
|
|
21
|
-
console.log(jqXHR);
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
handleNodeSettings = function(node){
|
|
27
|
-
|
|
28
|
-
// if "settingsTimestamp" is "0" then there shouldnt be any settings to retrieve.
|
|
29
|
-
if(node.settingsTimestamp === undefined || node.settingsTimestamp === 0){
|
|
30
|
-
console.log("settingstimestamp = 0. No settings to retrieve");
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// if "settingsTimestamp" is not "0", retieve the settings.
|
|
35
|
-
console.log("settingstimestamp != 0. Load settings");
|
|
36
|
-
getNodeSettings(node.id, settings => {
|
|
37
|
-
//console.log("settings retrieved: " + JSON.stringify(settings, null, 2));
|
|
38
|
-
// if the settings is undefined, it means that the node has not been persisted yet.
|
|
39
|
-
if(settings === undefined){
|
|
40
|
-
console.log("no settings retrieved");
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
console.log("Settings timestamp: " + settings.settingsTimestamp);
|
|
45
|
-
console.log("Node timestamp: " + node.settingsTimestamp);
|
|
46
|
-
|
|
47
|
-
if(settings.settingsTimestamp !== node.settingsTimestamp){
|
|
48
|
-
// if "settingsTimestamp" is different than the one that was returned by getSettings(),
|
|
49
|
-
// then dont replace the current values with settings.
|
|
50
|
-
console.log("config timestamp different than settings timestamp. no update")
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
// TODO:
|
|
55
|
-
// if "settingsTimestamp" is the same as the one returned by getSettings(), then replace the config values with those from settings.
|
|
56
|
-
console.log("Replacing Settings");
|
|
57
|
-
|
|
58
|
-
// go through the defaults and find the elements and their types that are assigned to them.
|
|
59
|
-
let inputValueSetters = {
|
|
60
|
-
"text" : (input, value) => { input.val(value) },
|
|
61
|
-
"number" : (input, value) => { input.val(value) },
|
|
62
|
-
"select-one" : (input, value) => { input.val(value) },
|
|
63
|
-
"hidden" : (input, value) => { input.val(value) },
|
|
64
|
-
"checkbox" : (input, value) => { input.val(value).prop("checked", value).trigger('change') },
|
|
65
|
-
// todo: add the other types of inputs here.
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
let prefix = (node._def.category === "config") ? "#node-config-input-" : "#node-input-";
|
|
69
|
-
Object.keys(node._def.defaults)
|
|
70
|
-
.filter(entry => settings.hasOwnProperty(entry))
|
|
71
|
-
.forEach(entry => {
|
|
72
|
-
try{
|
|
73
|
-
// get the field.
|
|
74
|
-
let field = $(prefix + entry);
|
|
75
|
-
|
|
76
|
-
if(!field[0]){
|
|
77
|
-
console.log("field " + (prefix + entry) + "[0] not found");
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
// get the setter for the field.
|
|
82
|
-
let setValue = inputValueSetters[field[0].type];
|
|
83
|
-
if(setValue){
|
|
84
|
-
try{
|
|
85
|
-
//console.log("setting " + prefix + entry + " to " + settings[entry]);
|
|
86
|
-
setValue(field, settings[entry]);
|
|
87
|
-
}
|
|
88
|
-
catch(error){
|
|
89
|
-
console.log(error);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
else{
|
|
93
|
-
console.log("no setter for type: " + field[0].type + " (" + entry + ")")
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
catch(error){
|
|
97
|
-
console.log(error);
|
|
98
|
-
}
|
|
99
|
-
})
|
|
100
|
-
return;
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
</script>
|
|
104
|
-
</div>
|
|
105
|
-
|
|
106
|
-
<script type="text/javascript" template-section="onIncludeEditPrepare">
|
|
107
|
-
handleNodeSettings(node);
|
|
108
|
-
</script>
|
|
109
|
-
|
|
110
|
-
<script type="text/javascript" template-section="onIncludeEditSave">
|
|
111
|
-
// set the value for "settingsTimestamp" to now() - this will ensure that values are not overwritten if the editor is opened again before a deploy.
|
|
112
|
-
|
|
113
|
-
// NOTE on ONDEPLOY on the server side:
|
|
114
|
-
// when the deployment is being done and there are no settings, then this is a first deployment. Do the intialization and persist to settings (remember to include 'settingsTimestamp')
|
|
115
|
-
// when the deployment is being done and 'settingsTimestamp' from config is the same as 'settingsTimestamp' from settings, then nothing actually changed. its a redeployment
|
|
116
|
-
// when the deployment is being done and 'settingsTimestamp' from config is different from 'settingsTimestamp' from settings then its an update. (save to settings + include settingsTimestap)
|
|
117
|
-
$("#node-config-input-settingsTimestamp").val(new Date().getTime());
|
|
118
|
-
$("#node-input-settingsTimestamp").val(new Date().getTime());
|
|
119
|
-
</script>
|
|
120
|
-
|
|
121
|
-
<script type="text/html" template-section="onIncludeEditForm">
|
|
122
|
-
<input type="hidden" id="node-config-input-settingsTimestamp" />
|
|
123
|
-
<input type="hidden" id="node-input-settingsTimestamp" />
|
|
124
|
-
</script>
|
|
125
|
-
|
|
126
|
-
<script type="text/markdown" template-section="onIncludeDocumentation">
|
|
127
|
-
|
|
128
|
-
</script>
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
<div template-section="onIncludeOnce">
|
|
3
|
-
|
|
4
|
-
<script src="resources/@theotherwillembotha/node-red-plugincore/editorLanguageExtension.js"></script>
|
|
5
|
-
|
|
6
|
-
<script type="text/javascript">
|
|
7
|
-
|
|
8
|
-
window.PluginCore = window.PluginCore || {};
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* PluginCore.createScriptEditor(elementId, template, initialValue)
|
|
12
|
-
*
|
|
13
|
-
* Creates a Monaco editor instance with TypeScript-aware diagnostics,
|
|
14
|
-
* completions, and hover info scoped to the provided type template.
|
|
15
|
-
*
|
|
16
|
-
* @param {string} elementId - DOM id of the container element.
|
|
17
|
-
* @param {string} template - TypeScript template string. Use `${script}`
|
|
18
|
-
* as the placeholder for the user's code.
|
|
19
|
-
* @param {string} initialValue - The starting content of the editor.
|
|
20
|
-
* @returns \{{ getValue(): string, dispose(): void \}}
|
|
21
|
-
*/
|
|
22
|
-
PluginCore.createScriptEditor = function(elementId, template, initialValue) {
|
|
23
|
-
var editorInstance = null;
|
|
24
|
-
var currentValue = initialValue || '';
|
|
25
|
-
|
|
26
|
-
ScriptEditorLanguageManager.createLanguage(monaco, template).then(function(language) {
|
|
27
|
-
editorInstance = monaco.editor.create(document.getElementById(elementId), {
|
|
28
|
-
value: currentValue,
|
|
29
|
-
language: language.getName(),
|
|
30
|
-
automaticLayout: true,
|
|
31
|
-
wordBasedSuggestions: 'currentDocument',
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
return {
|
|
36
|
-
getValue: function() {
|
|
37
|
-
return editorInstance ? editorInstance.getValue() : currentValue;
|
|
38
|
-
},
|
|
39
|
-
dispose: function() {
|
|
40
|
-
if (editorInstance) {
|
|
41
|
-
editorInstance.dispose();
|
|
42
|
-
editorInstance = null;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
</script>
|
|
49
|
-
|
|
50
|
-
</div>
|