Showing
6 changed files
with
18 additions
and
1 deletions
@@ -27,8 +27,11 @@ export const ClearAlarmConfig: NodeItemConfigType = { | @@ -27,8 +27,11 @@ export const ClearAlarmConfig: NodeItemConfigType = { | ||
27 | ruleChainNode: false, | 27 | ruleChainNode: false, |
28 | defaultConfiguration: { | 28 | defaultConfiguration: { |
29 | alarmType: 'General Alarm', | 29 | alarmType: 'General Alarm', |
30 | + scriptLang: 'TBEL', | ||
30 | alarmDetailsBuildJs: | 31 | alarmDetailsBuildJs: |
31 | 'var details = {};\nif (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}\n\n\nreturn details;', | 32 | 'var details = {};\nif (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}\n\n\nreturn details;', |
33 | + alarmDetailsBuildTbel: | ||
34 | + "var details = {};\nif (metadata.prevAlarmDetails != null) {\n details = JSON.parse(metadata.prevAlarmDetails);\n //remove prevAlarmDetails from metadata\n metadata.remove('prevAlarmDetails');\n //now metadata is the same as it comes IN this rule node\n}\n\n\nreturn details;", | ||
32 | }, | 35 | }, |
33 | uiResources: ['static/rulenode/rulenode-core-config.js'], | 36 | uiResources: ['static/rulenode/rulenode-core-config.js'], |
34 | configDirective: 'tbActionNodeClearAlarmConfig', | 37 | configDirective: 'tbActionNodeClearAlarmConfig', |
@@ -27,8 +27,11 @@ export const CreateAlarmConfig: NodeItemConfigType = { | @@ -27,8 +27,11 @@ export const CreateAlarmConfig: NodeItemConfigType = { | ||
27 | ruleChainNode: false, | 27 | ruleChainNode: false, |
28 | defaultConfiguration: { | 28 | defaultConfiguration: { |
29 | alarmType: 'General Alarm', | 29 | alarmType: 'General Alarm', |
30 | + scriptLang: 'TBEL', | ||
30 | alarmDetailsBuildJs: | 31 | alarmDetailsBuildJs: |
31 | 'var details = {};\nif (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}\n\n\nreturn details;', | 32 | 'var details = {};\nif (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}\n\n\nreturn details;', |
33 | + alarmDetailsBuildTbel: | ||
34 | + "var details = {};\nif (metadata.prevAlarmDetails != null) {\n details = JSON.parse(metadata.prevAlarmDetails);\n //remove prevAlarmDetails from metadata\n metadata.remove('prevAlarmDetails');\n //now metadata is the same as it comes IN this rule node\n}\n\n\nreturn details;", | ||
32 | severity: 'CRITICAL', | 35 | severity: 'CRITICAL', |
33 | propagate: false, | 36 | propagate: false, |
34 | propagateToOwner: false, | 37 | propagateToOwner: false, |
@@ -31,8 +31,11 @@ export const GeneratorConfig: NodeItemConfigType = { | @@ -31,8 +31,11 @@ export const GeneratorConfig: NodeItemConfigType = { | ||
31 | periodInSeconds: 1, | 31 | periodInSeconds: 1, |
32 | originatorId: null, | 32 | originatorId: null, |
33 | originatorType: null, | 33 | originatorType: null, |
34 | + scriptLang: 'TBEL', | ||
34 | jsScript: | 35 | jsScript: |
35 | 'var msg = { temp: 42, humidity: 77 };\nvar metadata = { data: 40 };\nvar msgType = "POST_TELEMETRY_REQUEST";\n\nreturn { msg: msg, metadata: metadata, msgType: msgType };', | 36 | 'var msg = { temp: 42, humidity: 77 };\nvar metadata = { data: 40 };\nvar msgType = "POST_TELEMETRY_REQUEST";\n\nreturn { msg: msg, metadata: metadata, msgType: msgType };', |
37 | + tbelScript: | ||
38 | + 'var msg = { temp: 42, humidity: 77 };\nvar metadata = { data: 40 };\nvar msgType = "POST_TELEMETRY_REQUEST";\n\nreturn { msg: msg, metadata: metadata, msgType: msgType };', | ||
36 | }, | 39 | }, |
37 | uiResources: ['static/rulenode/rulenode-core-config.js'], | 40 | uiResources: ['static/rulenode/rulenode-core-config.js'], |
38 | configDirective: 'tbActionNodeGeneratorConfig', | 41 | configDirective: 'tbActionNodeGeneratorConfig', |
@@ -26,8 +26,11 @@ export const LogConfig: NodeItemConfigType = { | @@ -26,8 +26,11 @@ export const LogConfig: NodeItemConfigType = { | ||
26 | customRelations: false, | 26 | customRelations: false, |
27 | ruleChainNode: false, | 27 | ruleChainNode: false, |
28 | defaultConfiguration: { | 28 | defaultConfiguration: { |
29 | + scriptLang: 'TBEL', | ||
29 | jsScript: | 30 | jsScript: |
30 | - "return 'Incoming message:\\n' + JSON.stringify(msg) + '\\nIncoming metadata:\\n' + JSON.stringify(metadata);", | 31 | + "return '\\nIncoming message:\\n' + JSON.stringify(msg) + '\\nIncoming metadata:\\n' + JSON.stringify(metadata);", |
32 | + tbelScript: | ||
33 | + "return '\\nIncoming message:\\n' + JSON.stringify(msg) + '\\nIncoming metadata:\\n' + JSON.stringify(metadata);", | ||
31 | }, | 34 | }, |
32 | uiResources: ['static/rulenode/rulenode-core-config.js'], | 35 | uiResources: ['static/rulenode/rulenode-core-config.js'], |
33 | configDirective: 'tbActionNodeLogConfig', | 36 | configDirective: 'tbActionNodeLogConfig', |
@@ -26,7 +26,9 @@ export const ScriptConfig: NodeItemConfigType = { | @@ -26,7 +26,9 @@ export const ScriptConfig: NodeItemConfigType = { | ||
26 | customRelations: false, | 26 | customRelations: false, |
27 | ruleChainNode: false, | 27 | ruleChainNode: false, |
28 | defaultConfiguration: { | 28 | defaultConfiguration: { |
29 | + scriptLang: 'TBEL', | ||
29 | jsScript: 'return msg.temperature > 20;', | 30 | jsScript: 'return msg.temperature > 20;', |
31 | + tbelScript: 'return msg.temperature > 20;', | ||
30 | }, | 32 | }, |
31 | uiResources: ['static/rulenode/rulenode-core-config.js'], | 33 | uiResources: ['static/rulenode/rulenode-core-config.js'], |
32 | configDirective: 'tbFilterNodeScriptConfig', | 34 | configDirective: 'tbFilterNodeScriptConfig', |
@@ -26,8 +26,11 @@ export const SwitchConfig: NodeItemConfigType = { | @@ -26,8 +26,11 @@ export const SwitchConfig: NodeItemConfigType = { | ||
26 | customRelations: true, | 26 | customRelations: true, |
27 | ruleChainNode: false, | 27 | ruleChainNode: false, |
28 | defaultConfiguration: { | 28 | defaultConfiguration: { |
29 | + scriptLang: 'TBEL', | ||
29 | jsScript: | 30 | jsScript: |
30 | "function nextRelation(metadata, msg) {\n return ['one','nine'];\n}\nif(msgType === 'POST_TELEMETRY_REQUEST') {\n return ['two'];\n}\nreturn nextRelation(metadata, msg);", | 31 | "function nextRelation(metadata, msg) {\n return ['one','nine'];\n}\nif(msgType === 'POST_TELEMETRY_REQUEST') {\n return ['two'];\n}\nreturn nextRelation(metadata, msg);", |
32 | + tbelScript: | ||
33 | + "function nextRelation(metadata, msg) {\n return ['one','nine'];\n}\nif(msgType == 'POST_TELEMETRY_REQUEST') {\n return ['two'];\n}\nreturn nextRelation(metadata, msg);", | ||
31 | }, | 34 | }, |
32 | uiResources: ['static/rulenode/rulenode-core-config.js'], | 35 | uiResources: ['static/rulenode/rulenode-core-config.js'], |
33 | configDirective: 'tbFilterNodeSwitchConfig', | 36 | configDirective: 'tbFilterNodeSwitchConfig', |