diff --git a/ui-ngx/src/app/core/services/script/node-script-test.service.ts b/ui-ngx/src/app/core/services/script/node-script-test.service.ts index 3efa935c2e..d946425698 100644 --- a/ui-ngx/src/app/core/services/script/node-script-test.service.ts +++ b/ui-ngx/src/app/core/services/script/node-script-test.service.ts @@ -18,13 +18,16 @@ import { Injectable } from '@angular/core'; import { Observable, of } from 'rxjs'; import { RuleChainService } from '@core/http/rule-chain.service'; import { map, switchMap } from 'rxjs/operators'; +import { MatDialog } from '@angular/material'; +import { NodeScriptTestDialogComponent, NodeScriptTestDialogData } from '@shared/components/dialog/node-script-test-dialog.component'; @Injectable({ providedIn: 'root' }) export class NodeScriptTestService { - constructor(private ruleChainService: RuleChainService) { + constructor(private ruleChainService: RuleChainService, + public dialog: MatDialog) { } testNodeScript(script: string, scriptType: string, functionTitle: string, @@ -73,8 +76,21 @@ export class NodeScriptTestService { if (!msgType) { msgType = 'POST_TELEMETRY_REQUEST'; } - console.log(`testNodeScript TODO: ${script}`); - return of(script); + return this.dialog.open(NodeScriptTestDialogComponent, + { + disableClose: true, + panelClass: ['tb-dialog', 'tb-fullscreen-dialog', 'tb-fullscreen-dialog-gt-sm'], + data: { + msg, + metadata, + msgType, + functionTitle, + functionName, + script, + scriptType, + argNames + } + }).afterClosed(); } } diff --git a/ui-ngx/src/app/core/services/script/node-script-test-dialog.component.html b/ui-ngx/src/app/shared/components/dialog/node-script-test-dialog.component.html similarity index 95% rename from ui-ngx/src/app/core/services/script/node-script-test-dialog.component.html rename to ui-ngx/src/app/shared/components/dialog/node-script-test-dialog.component.html index 8a3e17247b..c1b20aef19 100644 --- a/ui-ngx/src/app/core/services/script/node-script-test-dialog.component.html +++ b/ui-ngx/src/app/shared/components/dialog/node-script-test-dialog.component.html @@ -15,7 +15,8 @@ limitations under the License. --> -
+

{{ 'rulenode.test-script-function' | translate }}

@@ -43,8 +44,8 @@
- TODO: metadataForm
+ TODO: metadataForm
@@ -72,7 +73,6 @@ @@ -85,6 +85,7 @@