node-script-test.tpl.html
6.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<!--
Copyright © 2016-2018 The Thingsboard Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<md-dialog class="tb-node-script-test-dialog"
aria-label="{{ 'rulenode.test-script-function' | translate }}" style="width: 800px;">
<form flex name="theForm" ng-submit="vm.save()">
<md-toolbar>
<div class="md-toolbar-tools">
<h2>{{ 'rulenode.test-script-function' | translate }}</h2>
<span flex></span>
<md-button class="md-icon-button" ng-click="vm.cancel()">
<ng-md-icon icon="close" aria-label="{{ 'dialog.close' | translate }}"></ng-md-icon>
</md-button>
</div>
</md-toolbar>
<md-dialog-content flex style="position: relative;">
<div class="tb-absolute-fill">
<div id="top_panel" class="tb-split tb-split-vertical">
<div id="top_left_panel" class="tb-split tb-content">
<div class="tb-resize-container">
<div class="tb-editor-area-title-panel">
<label translate>rulenode.message</label>
</div>
<ng-form name="payloadForm">
<div layout="column" style="height: 100%;">
<div layout="row">
<tb-message-type-autocomplete
style="margin-bottom: 0px; min-width: 300px;"
ng-required="true"
ng-model="vm.inputParams.msgType"
the-form="payloadForm">
</tb-message-type-autocomplete>
</div>
<tb-json-content flex
ng-model="vm.inputParams.msg"
label="{{ 'rulenode.message' | translate }}"
content-type="vm.types.contentType.JSON.value"
validate-content="true"
validation-trigger-arg="validatePayload"
fill-height="true">
</tb-json-content>
</div>
</ng-form>
</div>
</div>
<div id="top_right_panel" class="tb-split tb-content">
<div class="tb-resize-container" id="metadata-panel">
<div class="tb-editor-area-title-panel">
<label translate>rulenode.metadata</label>
</div>
<ng-form name="metadataForm">
<tb-key-val-map title-text="rulenode.metadata" ng-disabled="$root.loading"
key-val-map="vm.inputParams.metadata"></tb-key-val-map>
</ng-form>
</div>
</div>
</div>
<div id="bottom_panel" class="tb-split tb-split-vertical">
<div id="bottom_left_panel" class="tb-split tb-content">
<div class="tb-resize-container">
<div class="tb-editor-area-title-panel tb-js-function">
<label>{{ vm.functionTitle }}</label>
</div>
<ng-form name="funcBodyForm">
<tb-js-func id="funcBodyInput" ng-model="vm.inputParams.script"
function-name="{{vm.inputParams.functionName}}"
function-args="{{ vm.inputParams.argNames }}"
validation-args="{{ [[vm.inputParams.msg, vm.inputParams.metadata, vm.inputParams.msgType]] }}"
validation-trigger-arg="validateFuncBody"
result-type="object"
fill-height="true">
</tb-js-func>
</ng-form>
</div>
</div>
<div id="bottom_right_panel" class="tb-split tb-content">
<div class="tb-resize-container">
<div class="tb-editor-area-title-panel">
<label translate>rulenode.output</label>
</div>
<tb-json-content ng-model="vm.output"
label="{{ 'rulenode.output' | translate }}"
content-type="vm.types.contentType.JSON.value"
validate-content="false"
ng-readonly="true"
fill-height="true">
</tb-json-content>generateReport
</div>
</div>
</div>
</div>
</md-dialog-content>
<md-dialog-actions layout="row">
<md-button ng-disabled="$root.loading || theForm.$invalid" ng-click="vm.test()" class="md-raised md-primary">
{{ 'rulenode.test' | translate }}
</md-button>
<span flex></span>
<md-button ng-disabled="$root.loading || theForm.funcBodyForm.$invalid || !theForm.funcBodyForm.$dirty" type="submit" class="md-raised md-primary">
{{ 'action.save' | translate }}
</md-button>
<md-button ng-disabled="$root.loading" ng-click="vm.cancel()" style="margin-right:20px;">{{ 'action.cancel' | translate }}</md-button>
</md-dialog-actions>
</form>
</md-dialog>