Browse Source

Add help support for rule node script test dialog

pull/5333/head
Igor Kulikov 5 years ago
parent
commit
ea039008b1
  1. 4
      ui-ngx/proxy.conf.js
  2. 11
      ui-ngx/src/app/core/services/script/node-script-test.service.ts
  3. 1
      ui-ngx/src/app/shared/components/dialog/node-script-test-dialog.component.html
  4. 1
      ui-ngx/src/app/shared/components/dialog/node-script-test-dialog.component.ts

4
ui-ngx/proxy.conf.js

@ -26,6 +26,10 @@ const PROXY_CONFIG = {
"target": ruleNodeUiforwardUrl, "target": ruleNodeUiforwardUrl,
"secure": false, "secure": false,
}, },
"/assets/help/*/rulenode/**": {
"target": ruleNodeUiforwardUrl,
"secure": false,
},
"/static/widgets": { "/static/widgets": {
"target": forwardUrl, "target": forwardUrl,
"secure": false, "secure": false,

11
ui-ngx/src/app/core/services/script/node-script-test.service.ts

@ -35,7 +35,7 @@ export class NodeScriptTestService {
} }
testNodeScript(script: string, scriptType: string, functionTitle: string, testNodeScript(script: string, scriptType: string, functionTitle: string,
functionName: string, argNames: string[], ruleNodeId: string): Observable<string> { functionName: string, argNames: string[], ruleNodeId: string, helpId?: string): Observable<string> {
if (ruleNodeId) { if (ruleNodeId) {
return this.ruleChainService.getLatestRuleNodeDebugInput(ruleNodeId).pipe( return this.ruleChainService.getLatestRuleNodeDebugInput(ruleNodeId).pipe(
switchMap((debugIn) => { switchMap((debugIn) => {
@ -52,18 +52,18 @@ export class NodeScriptTestService {
msgType = debugIn.msgType; msgType = debugIn.msgType;
} }
return this.openTestScriptDialog(script, scriptType, functionTitle, return this.openTestScriptDialog(script, scriptType, functionTitle,
functionName, argNames, msg, metadata, msgType); functionName, argNames, msg, metadata, msgType, helpId);
}) })
); );
} else { } else {
return this.openTestScriptDialog(script, scriptType, functionTitle, return this.openTestScriptDialog(script, scriptType, functionTitle,
functionName, argNames); functionName, argNames, null, null, null, helpId);
} }
} }
private openTestScriptDialog(script: string, scriptType: string, private openTestScriptDialog(script: string, scriptType: string,
functionTitle: string, functionName: string, argNames: string[], functionTitle: string, functionName: string, argNames: string[],
msg?: any, metadata?: {[key: string]: string}, msgType?: string): Observable<string> { msg?: any, metadata?: {[key: string]: string}, msgType?: string, helpId?: string): Observable<string> {
if (!msg) { if (!msg) {
msg = { msg = {
temperature: 22.4, temperature: 22.4,
@ -94,7 +94,8 @@ export class NodeScriptTestService {
functionName, functionName,
script, script,
scriptType, scriptType,
argNames argNames,
helpId
} }
}).afterClosed(); }).afterClosed();
} }

1
ui-ngx/src/app/shared/components/dialog/node-script-test-dialog.component.html

@ -78,6 +78,7 @@
[functionArgs]="data.argNames" [functionArgs]="data.argNames"
[validationArgs]="[data.msg, data.metadata, data.msgType]" [validationArgs]="[data.msg, data.metadata, data.msgType]"
resultType="object" resultType="object"
[helpId]="data.helpId"
[fillHeight]="true"> [fillHeight]="true">
</tb-js-func> </tb-js-func>
</div> </div>

1
ui-ngx/src/app/shared/components/dialog/node-script-test-dialog.component.ts

@ -52,6 +52,7 @@ export interface NodeScriptTestDialogData {
msg?: any; msg?: any;
metadata?: {[key: string]: string}; metadata?: {[key: string]: string};
msgType?: string; msgType?: string;
helpId?: string;
} }
// @dynamic // @dynamic

Loading…
Cancel
Save