Commit 5fa2e2fc49a7fb6f62da9db8aafa208c0f2edee8
1 parent
7944191f
Added automatic creation of relations for demo dashboard
Showing
2 changed files
with
71 additions
and
28 deletions
... | ... | @@ -985,8 +985,8 @@ |
985 | 985 | "showTooltip": true, |
986 | 986 | "autocloseTooltip": true, |
987 | 987 | "defaultCenterPosition": [ |
988 | - 0, | |
989 | - 0 | |
988 | + 37.7749, | |
989 | + -122.4194 | |
990 | 990 | ], |
991 | 991 | "customProviderTileUrl": "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", |
992 | 992 | "showTooltipAction": "click", |
... | ... | @@ -999,10 +999,11 @@ |
999 | 999 | "animate": true, |
1000 | 1000 | "maxClusterRadius": 80, |
1001 | 1001 | "removeOutsideVisibleBounds": true, |
1002 | - "defaultZoomLevel": 12, | |
1002 | + "defaultZoomLevel": 5, | |
1003 | 1003 | "labelFunction": "var color;\nif(dsData[dsIndex].active !== \"true\"){\n color = 'rgb(255, 0, 0)';\n} else {\n color = 'rgb(39, 134, 34)';\n}\nreturn '<span style=\"border: solid ' + color + '; border-radius: 10px; color: ' + color + '; background-color: #fff; padding: 3px 5px; font-size: 14px\">' + \n '${entityLabel}' + \n '</span>'", |
1004 | 1004 | "markerImageFunction": "var res;\nif(dsData[dsIndex].active !== \"true\"){\n\tvar res = {\n\t url: images[0],\n\t size: 48\n\t}\n} else {\n var res = {\n\t url: images[1],\n\t size: 48\n\t}\n}\nreturn res;", |
1005 | - "useLabelFunction": true | |
1005 | + "useLabelFunction": true, | |
1006 | + "useDefaultCenterPosition": true | |
1006 | 1007 | }, |
1007 | 1008 | "title": "New Markers Placement - OpenStreetMap", |
1008 | 1009 | "dropShadow": true, |
... | ... | @@ -1182,7 +1183,7 @@ |
1182 | 1183 | "alias": "Thermostat-alarm", |
1183 | 1184 | "filter": { |
1184 | 1185 | "type": "entityName", |
1185 | - "resolveMultiple": true, | |
1186 | + "resolveMultiple": false, | |
1186 | 1187 | "entityType": "ASSET", |
1187 | 1188 | "entityNameFilter": "Thermostat Alarms" |
1188 | 1189 | } |
... | ... | @@ -1223,4 +1224,4 @@ |
1223 | 1224 | } |
1224 | 1225 | }, |
1225 | 1226 | "name": "Thermostats" |
1226 | -} | |
1227 | +} | |
\ No newline at end of file | ... | ... |
... | ... | @@ -3,15 +3,27 @@ |
3 | 3 | "additionalInfo": null, |
4 | 4 | "name": "Root Rule Chain", |
5 | 5 | "firstRuleNodeId": null, |
6 | - "root": true, | |
6 | + "root": false, | |
7 | 7 | "debugMode": false, |
8 | 8 | "configuration": null |
9 | 9 | }, |
10 | 10 | "metadata": { |
11 | - "firstNodeIndex": 2, | |
11 | + "firstNodeIndex": 3, | |
12 | 12 | "nodes": [ |
13 | 13 | { |
14 | 14 | "additionalInfo": { |
15 | + "layoutX": 1069, | |
16 | + "layoutY": 267 | |
17 | + }, | |
18 | + "type": "org.thingsboard.rule.engine.filter.TbJsFilterNode", | |
19 | + "name": "Is Thermostat?", | |
20 | + "debugMode": true, | |
21 | + "configuration": { | |
22 | + "jsScript": "return msg.id.entityType === \"DEVICE\" && msg.type === \"thermostat\";" | |
23 | + } | |
24 | + }, | |
25 | + { | |
26 | + "additionalInfo": { | |
15 | 27 | "layoutX": 824, |
16 | 28 | "layoutY": 156 |
17 | 29 | }, |
... | ... | @@ -48,8 +60,8 @@ |
48 | 60 | }, |
49 | 61 | { |
50 | 62 | "additionalInfo": { |
51 | - "layoutX": 825, | |
52 | - "layoutY": 266 | |
63 | + "layoutX": 839, | |
64 | + "layoutY": 345 | |
53 | 65 | }, |
54 | 66 | "type": "org.thingsboard.rule.engine.action.TbLogNode", |
55 | 67 | "name": "Log RPC from Device", |
... | ... | @@ -60,8 +72,8 @@ |
60 | 72 | }, |
61 | 73 | { |
62 | 74 | "additionalInfo": { |
63 | - "layoutX": 825, | |
64 | - "layoutY": 379 | |
75 | + "layoutX": 832, | |
76 | + "layoutY": 407 | |
65 | 77 | }, |
66 | 78 | "type": "org.thingsboard.rule.engine.action.TbLogNode", |
67 | 79 | "name": "Log Other", |
... | ... | @@ -93,51 +105,81 @@ |
93 | 105 | "configuration": { |
94 | 106 | "jsScript": "return metadata[\"deviceType\"] === \"thermostat\";" |
95 | 107 | } |
108 | + }, | |
109 | + { | |
110 | + "additionalInfo": { | |
111 | + "layoutX": 1090, | |
112 | + "layoutY": 360 | |
113 | + }, | |
114 | + "type": "org.thingsboard.rule.engine.action.TbCreateRelationNode", | |
115 | + "name": "Relate to Asset", | |
116 | + "debugMode": true, | |
117 | + "configuration": { | |
118 | + "direction": "FROM", | |
119 | + "relationType": "ToAlarmPropagationAsset", | |
120 | + "entityType": "ASSET", | |
121 | + "entityNamePattern": "Thermostat Alarms", | |
122 | + "entityTypePattern": "AlarmPropagationAsset", | |
123 | + "entityCacheExpiration": 300, | |
124 | + "createEntityIfNotExists": true, | |
125 | + "changeOriginatorToRelatedEntity": false, | |
126 | + "removeCurrentRelations": false | |
127 | + } | |
96 | 128 | } |
97 | 129 | ], |
98 | 130 | "connections": [ |
99 | 131 | { |
100 | 132 | "fromIndex": 0, |
101 | - "toIndex": 6, | |
133 | + "toIndex": 8, | |
134 | + "type": "True" | |
135 | + }, | |
136 | + { | |
137 | + "fromIndex": 1, | |
138 | + "toIndex": 7, | |
102 | 139 | "type": "Success" |
103 | 140 | }, |
104 | 141 | { |
105 | - "fromIndex": 2, | |
106 | - "toIndex": 4, | |
142 | + "fromIndex": 3, | |
143 | + "toIndex": 5, | |
107 | 144 | "type": "Other" |
108 | 145 | }, |
109 | 146 | { |
110 | - "fromIndex": 2, | |
111 | - "toIndex": 1, | |
147 | + "fromIndex": 3, | |
148 | + "toIndex": 2, | |
112 | 149 | "type": "Post attributes" |
113 | 150 | }, |
114 | 151 | { |
115 | - "fromIndex": 2, | |
116 | - "toIndex": 0, | |
152 | + "fromIndex": 3, | |
153 | + "toIndex": 1, | |
117 | 154 | "type": "Post telemetry" |
118 | 155 | }, |
119 | 156 | { |
120 | - "fromIndex": 2, | |
121 | - "toIndex": 3, | |
157 | + "fromIndex": 3, | |
158 | + "toIndex": 4, | |
122 | 159 | "type": "RPC Request from Device" |
123 | 160 | }, |
124 | 161 | { |
125 | - "fromIndex": 2, | |
126 | - "toIndex": 5, | |
162 | + "fromIndex": 3, | |
163 | + "toIndex": 6, | |
127 | 164 | "type": "RPC Request to Device" |
165 | + }, | |
166 | + { | |
167 | + "fromIndex": 3, | |
168 | + "toIndex": 0, | |
169 | + "type": "Entity Created" | |
128 | 170 | } |
129 | 171 | ], |
130 | 172 | "ruleChainConnections": [ |
131 | 173 | { |
132 | - "fromIndex": 6, | |
174 | + "fromIndex": 7, | |
133 | 175 | "targetRuleChainId": { |
134 | 176 | "entityType": "RULE_CHAIN", |
135 | - "id": "83d42540-85fd-11ea-aee2-794850541ced" | |
177 | + "id": "25e26570-89ed-11ea-a650-cd6e14e633bd" | |
136 | 178 | }, |
137 | 179 | "additionalInfo": { |
138 | - "layoutX": 1088, | |
139 | - "layoutY": 203, | |
140 | - "ruleChainNodeId": "rule-chain-node-9" | |
180 | + "layoutX": 1109, | |
181 | + "layoutY": 182, | |
182 | + "ruleChainNodeId": "rule-chain-node-10" | |
141 | 183 | }, |
142 | 184 | "type": "True" |
143 | 185 | } | ... | ... |