Commit 5fa2e2fc49a7fb6f62da9db8aafa208c0f2edee8

Authored by Andrii Shvaika
1 parent 7944191f

Added automatic creation of relations for demo dashboard

@@ -985,8 +985,8 @@ @@ -985,8 +985,8 @@
985 "showTooltip": true, 985 "showTooltip": true,
986 "autocloseTooltip": true, 986 "autocloseTooltip": true,
987 "defaultCenterPosition": [ 987 "defaultCenterPosition": [
988 - 0,  
989 - 0 988 + 37.7749,
  989 + -122.4194
990 ], 990 ],
991 "customProviderTileUrl": "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", 991 "customProviderTileUrl": "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
992 "showTooltipAction": "click", 992 "showTooltipAction": "click",
@@ -999,10 +999,11 @@ @@ -999,10 +999,11 @@
999 "animate": true, 999 "animate": true,
1000 "maxClusterRadius": 80, 1000 "maxClusterRadius": 80,
1001 "removeOutsideVisibleBounds": true, 1001 "removeOutsideVisibleBounds": true,
1002 - "defaultZoomLevel": 12, 1002 + "defaultZoomLevel": 5,
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>'", 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 "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;", 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 "title": "New Markers Placement - OpenStreetMap", 1008 "title": "New Markers Placement - OpenStreetMap",
1008 "dropShadow": true, 1009 "dropShadow": true,
@@ -1182,7 +1183,7 @@ @@ -1182,7 +1183,7 @@
1182 "alias": "Thermostat-alarm", 1183 "alias": "Thermostat-alarm",
1183 "filter": { 1184 "filter": {
1184 "type": "entityName", 1185 "type": "entityName",
1185 - "resolveMultiple": true, 1186 + "resolveMultiple": false,
1186 "entityType": "ASSET", 1187 "entityType": "ASSET",
1187 "entityNameFilter": "Thermostat Alarms" 1188 "entityNameFilter": "Thermostat Alarms"
1188 } 1189 }
@@ -1223,4 +1224,4 @@ @@ -1223,4 +1224,4 @@
1223 } 1224 }
1224 }, 1225 },
1225 "name": "Thermostats" 1226 "name": "Thermostats"
1226 -} 1227 +}
@@ -3,15 +3,27 @@ @@ -3,15 +3,27 @@
3 "additionalInfo": null, 3 "additionalInfo": null,
4 "name": "Root Rule Chain", 4 "name": "Root Rule Chain",
5 "firstRuleNodeId": null, 5 "firstRuleNodeId": null,
6 - "root": true, 6 + "root": false,
7 "debugMode": false, 7 "debugMode": false,
8 "configuration": null 8 "configuration": null
9 }, 9 },
10 "metadata": { 10 "metadata": {
11 - "firstNodeIndex": 2, 11 + "firstNodeIndex": 3,
12 "nodes": [ 12 "nodes": [
13 { 13 {
14 "additionalInfo": { 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 "layoutX": 824, 27 "layoutX": 824,
16 "layoutY": 156 28 "layoutY": 156
17 }, 29 },
@@ -48,8 +60,8 @@ @@ -48,8 +60,8 @@
48 }, 60 },
49 { 61 {
50 "additionalInfo": { 62 "additionalInfo": {
51 - "layoutX": 825,  
52 - "layoutY": 266 63 + "layoutX": 839,
  64 + "layoutY": 345
53 }, 65 },
54 "type": "org.thingsboard.rule.engine.action.TbLogNode", 66 "type": "org.thingsboard.rule.engine.action.TbLogNode",
55 "name": "Log RPC from Device", 67 "name": "Log RPC from Device",
@@ -60,8 +72,8 @@ @@ -60,8 +72,8 @@
60 }, 72 },
61 { 73 {
62 "additionalInfo": { 74 "additionalInfo": {
63 - "layoutX": 825,  
64 - "layoutY": 379 75 + "layoutX": 832,
  76 + "layoutY": 407
65 }, 77 },
66 "type": "org.thingsboard.rule.engine.action.TbLogNode", 78 "type": "org.thingsboard.rule.engine.action.TbLogNode",
67 "name": "Log Other", 79 "name": "Log Other",
@@ -93,51 +105,81 @@ @@ -93,51 +105,81 @@
93 "configuration": { 105 "configuration": {
94 "jsScript": "return metadata[\"deviceType\"] === \"thermostat\";" 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 "connections": [ 130 "connections": [
99 { 131 {
100 "fromIndex": 0, 132 "fromIndex": 0,
101 - "toIndex": 6, 133 + "toIndex": 8,
  134 + "type": "True"
  135 + },
  136 + {
  137 + "fromIndex": 1,
  138 + "toIndex": 7,
102 "type": "Success" 139 "type": "Success"
103 }, 140 },
104 { 141 {
105 - "fromIndex": 2,  
106 - "toIndex": 4, 142 + "fromIndex": 3,
  143 + "toIndex": 5,
107 "type": "Other" 144 "type": "Other"
108 }, 145 },
109 { 146 {
110 - "fromIndex": 2,  
111 - "toIndex": 1, 147 + "fromIndex": 3,
  148 + "toIndex": 2,
112 "type": "Post attributes" 149 "type": "Post attributes"
113 }, 150 },
114 { 151 {
115 - "fromIndex": 2,  
116 - "toIndex": 0, 152 + "fromIndex": 3,
  153 + "toIndex": 1,
117 "type": "Post telemetry" 154 "type": "Post telemetry"
118 }, 155 },
119 { 156 {
120 - "fromIndex": 2,  
121 - "toIndex": 3, 157 + "fromIndex": 3,
  158 + "toIndex": 4,
122 "type": "RPC Request from Device" 159 "type": "RPC Request from Device"
123 }, 160 },
124 { 161 {
125 - "fromIndex": 2,  
126 - "toIndex": 5, 162 + "fromIndex": 3,
  163 + "toIndex": 6,
127 "type": "RPC Request to Device" 164 "type": "RPC Request to Device"
  165 + },
  166 + {
  167 + "fromIndex": 3,
  168 + "toIndex": 0,
  169 + "type": "Entity Created"
128 } 170 }
129 ], 171 ],
130 "ruleChainConnections": [ 172 "ruleChainConnections": [
131 { 173 {
132 - "fromIndex": 6, 174 + "fromIndex": 7,
133 "targetRuleChainId": { 175 "targetRuleChainId": {
134 "entityType": "RULE_CHAIN", 176 "entityType": "RULE_CHAIN",
135 - "id": "83d42540-85fd-11ea-aee2-794850541ced" 177 + "id": "25e26570-89ed-11ea-a650-cd6e14e633bd"
136 }, 178 },
137 "additionalInfo": { 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 "type": "True" 184 "type": "True"
143 } 185 }