Commit 7ec1e6ed8885e231097e8558fbe4b00fccd8c3ed

Authored by ww
1 parent d05ba0c9

perf: 变更节点默认值

... ... @@ -27,8 +27,11 @@ export const ClearAlarmConfig: NodeItemConfigType = {
27 27 ruleChainNode: false,
28 28 defaultConfiguration: {
29 29 alarmType: 'General Alarm',
  30 + scriptLang: 'TBEL',
30 31 alarmDetailsBuildJs:
31 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 36 uiResources: ['static/rulenode/rulenode-core-config.js'],
34 37 configDirective: 'tbActionNodeClearAlarmConfig',
... ...
... ... @@ -27,8 +27,11 @@ export const CreateAlarmConfig: NodeItemConfigType = {
27 27 ruleChainNode: false,
28 28 defaultConfiguration: {
29 29 alarmType: 'General Alarm',
  30 + scriptLang: 'TBEL',
30 31 alarmDetailsBuildJs:
31 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 severity: 'CRITICAL',
33 36 propagate: false,
34 37 propagateToOwner: false,
... ...
... ... @@ -31,8 +31,11 @@ export const GeneratorConfig: NodeItemConfigType = {
31 31 periodInSeconds: 1,
32 32 originatorId: null,
33 33 originatorType: null,
  34 + scriptLang: 'TBEL',
34 35 jsScript:
35 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 40 uiResources: ['static/rulenode/rulenode-core-config.js'],
38 41 configDirective: 'tbActionNodeGeneratorConfig',
... ...
... ... @@ -26,8 +26,11 @@ export const LogConfig: NodeItemConfigType = {
26 26 customRelations: false,
27 27 ruleChainNode: false,
28 28 defaultConfiguration: {
  29 + scriptLang: 'TBEL',
29 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 35 uiResources: ['static/rulenode/rulenode-core-config.js'],
33 36 configDirective: 'tbActionNodeLogConfig',
... ...
... ... @@ -26,7 +26,9 @@ export const ScriptConfig: NodeItemConfigType = {
26 26 customRelations: false,
27 27 ruleChainNode: false,
28 28 defaultConfiguration: {
  29 + scriptLang: 'TBEL',
29 30 jsScript: 'return msg.temperature > 20;',
  31 + tbelScript: 'return msg.temperature > 20;',
30 32 },
31 33 uiResources: ['static/rulenode/rulenode-core-config.js'],
32 34 configDirective: 'tbFilterNodeScriptConfig',
... ...
... ... @@ -26,8 +26,11 @@ export const SwitchConfig: NodeItemConfigType = {
26 26 customRelations: true,
27 27 ruleChainNode: false,
28 28 defaultConfiguration: {
  29 + scriptLang: 'TBEL',
29 30 jsScript:
30 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 35 uiResources: ['static/rulenode/rulenode-core-config.js'],
33 36 configDirective: 'tbFilterNodeSwitchConfig',
... ...