Browse Source
Merge pull request #5360 from smatvienko-tb/clear_alarm_node_default_script_changed_to_avoid_infinite_metadata_grow
Clear alarm node default script changed to avoid infinite metadata grow
pull/5552/head
Andrew Shvayka
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
9 additions and
1 deletions
-
rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/action/TbClearAlarmNodeConfiguration.java
|
|
|
@ -25,10 +25,18 @@ public class TbClearAlarmNodeConfiguration extends TbAbstractAlarmNodeConfigurat |
|
|
|
@Override |
|
|
|
public TbClearAlarmNodeConfiguration defaultConfiguration() { |
|
|
|
TbClearAlarmNodeConfiguration configuration = new TbClearAlarmNodeConfiguration(); |
|
|
|
configuration.setAlarmDetailsBuildJs("var details = {};\n" + |
|
|
|
configuration.setAlarmDetailsBuildJs("" + |
|
|
|
"//***DO NOT CHANGE THIS LINES***\n" + |
|
|
|
"var details = {};\n" + |
|
|
|
"if (metadata.prevAlarmDetails) {\n" + |
|
|
|
" details = JSON.parse(metadata.prevAlarmDetails);\n" + |
|
|
|
" //remove prevAlarmDetails from metadata\n" + |
|
|
|
" delete metadata.prevAlarmDetails;\n" + |
|
|
|
" //now metadata is the same as it comes IN this rule node" + |
|
|
|
"}\n" + |
|
|
|
"//***PLACE YOUR CODE BELOW***\n" + |
|
|
|
"\n" + |
|
|
|
"\n" + |
|
|
|
"return details;"); |
|
|
|
configuration.setAlarmType("General Alarm"); |
|
|
|
return configuration; |
|
|
|
|