Update rule node config UI
This commit is contained in:
parent
e21e37469b
commit
4ea96fa289
@ -25,7 +25,7 @@ import java.util.Set;
|
||||
@Data
|
||||
public class TbJsSwitchNodeConfiguration implements NodeConfiguration<TbJsSwitchNodeConfiguration> {
|
||||
|
||||
private static final String DEFAULT_SCRIPT = "function nextRelation(metadata, msg) {\n" +
|
||||
private static final String DEFAULT_JS_SCRIPT = "function nextRelation(metadata, msg) {\n" +
|
||||
" return ['one','nine'];\n" +
|
||||
"}\n" +
|
||||
"if(msgType === 'POST_TELEMETRY_REQUEST') {\n" +
|
||||
@ -33,6 +33,14 @@ public class TbJsSwitchNodeConfiguration implements NodeConfiguration<TbJsSwitch
|
||||
"}\n" +
|
||||
"return nextRelation(metadata, msg);";
|
||||
|
||||
private static final String DEFAULT_MVEL_SCRIPT = "function nextRelation(metadata, msg) {\n" +
|
||||
" return ['one','nine'];\n" +
|
||||
"}\n" +
|
||||
"if(msgType == 'POST_TELEMETRY_REQUEST') {\n" +
|
||||
" return ['two'];\n" +
|
||||
"}\n" +
|
||||
"return nextRelation(metadata, msg);";
|
||||
|
||||
private ScriptLanguage scriptLang;
|
||||
private String jsScript;
|
||||
private String mvelScript;
|
||||
@ -41,8 +49,8 @@ public class TbJsSwitchNodeConfiguration implements NodeConfiguration<TbJsSwitch
|
||||
public TbJsSwitchNodeConfiguration defaultConfiguration() {
|
||||
TbJsSwitchNodeConfiguration configuration = new TbJsSwitchNodeConfiguration();
|
||||
configuration.setScriptLang(ScriptLanguage.MVEL);
|
||||
configuration.setJsScript(DEFAULT_SCRIPT);
|
||||
configuration.setMvelScript(DEFAULT_SCRIPT);
|
||||
configuration.setJsScript(DEFAULT_JS_SCRIPT);
|
||||
configuration.setMvelScript(DEFAULT_MVEL_SCRIPT);
|
||||
return configuration;
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -54,7 +54,7 @@ export class NodeScriptTestService {
|
||||
msgType = debugIn.msgType;
|
||||
}
|
||||
return this.openTestScriptDialog(script, scriptType, functionTitle,
|
||||
functionName, argNames, msg, metadata, msgType, helpId);
|
||||
functionName, argNames, msg, metadata, msgType, helpId, scriptLang);
|
||||
})
|
||||
);
|
||||
} else {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user