Browse Source

Added automatic creation of relations for demo dashboard

pull/2694/head
Andrii Shvaika 6 years ago
parent
commit
5fa2e2fc49
  1. 13
      application/src/main/data/json/demo/dashboards/thermostats.json
  2. 86
      application/src/main/data/json/demo/rule_chains/root_rule_chain.json

13
application/src/main/data/json/demo/dashboards/thermostats.json

@ -985,8 +985,8 @@
"showTooltip": true,
"autocloseTooltip": true,
"defaultCenterPosition": [
0,
0
37.7749,
-122.4194
],
"customProviderTileUrl": "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
"showTooltipAction": "click",
@ -999,10 +999,11 @@
"animate": true,
"maxClusterRadius": 80,
"removeOutsideVisibleBounds": true,
"defaultZoomLevel": 12,
"defaultZoomLevel": 5,
"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>'",
"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;",
"useLabelFunction": true
"useLabelFunction": true,
"useDefaultCenterPosition": true
},
"title": "New Markers Placement - OpenStreetMap",
"dropShadow": true,
@ -1182,7 +1183,7 @@
"alias": "Thermostat-alarm",
"filter": {
"type": "entityName",
"resolveMultiple": true,
"resolveMultiple": false,
"entityType": "ASSET",
"entityNameFilter": "Thermostat Alarms"
}
@ -1223,4 +1224,4 @@
}
},
"name": "Thermostats"
}
}

86
application/src/main/data/json/demo/rule_chains/root_rule_chain.json

@ -3,13 +3,25 @@
"additionalInfo": null,
"name": "Root Rule Chain",
"firstRuleNodeId": null,
"root": true,
"root": false,
"debugMode": false,
"configuration": null
},
"metadata": {
"firstNodeIndex": 2,
"firstNodeIndex": 3,
"nodes": [
{
"additionalInfo": {
"layoutX": 1069,
"layoutY": 267
},
"type": "org.thingsboard.rule.engine.filter.TbJsFilterNode",
"name": "Is Thermostat?",
"debugMode": true,
"configuration": {
"jsScript": "return msg.id.entityType === \"DEVICE\" && msg.type === \"thermostat\";"
}
},
{
"additionalInfo": {
"layoutX": 824,
@ -48,8 +60,8 @@
},
{
"additionalInfo": {
"layoutX": 825,
"layoutY": 266
"layoutX": 839,
"layoutY": 345
},
"type": "org.thingsboard.rule.engine.action.TbLogNode",
"name": "Log RPC from Device",
@ -60,8 +72,8 @@
},
{
"additionalInfo": {
"layoutX": 825,
"layoutY": 379
"layoutX": 832,
"layoutY": 407
},
"type": "org.thingsboard.rule.engine.action.TbLogNode",
"name": "Log Other",
@ -93,51 +105,81 @@
"configuration": {
"jsScript": "return metadata[\"deviceType\"] === \"thermostat\";"
}
},
{
"additionalInfo": {
"layoutX": 1090,
"layoutY": 360
},
"type": "org.thingsboard.rule.engine.action.TbCreateRelationNode",
"name": "Relate to Asset",
"debugMode": true,
"configuration": {
"direction": "FROM",
"relationType": "ToAlarmPropagationAsset",
"entityType": "ASSET",
"entityNamePattern": "Thermostat Alarms",
"entityTypePattern": "AlarmPropagationAsset",
"entityCacheExpiration": 300,
"createEntityIfNotExists": true,
"changeOriginatorToRelatedEntity": false,
"removeCurrentRelations": false
}
}
],
"connections": [
{
"fromIndex": 0,
"toIndex": 6,
"toIndex": 8,
"type": "True"
},
{
"fromIndex": 1,
"toIndex": 7,
"type": "Success"
},
{
"fromIndex": 2,
"toIndex": 4,
"fromIndex": 3,
"toIndex": 5,
"type": "Other"
},
{
"fromIndex": 2,
"toIndex": 1,
"fromIndex": 3,
"toIndex": 2,
"type": "Post attributes"
},
{
"fromIndex": 2,
"toIndex": 0,
"fromIndex": 3,
"toIndex": 1,
"type": "Post telemetry"
},
{
"fromIndex": 2,
"toIndex": 3,
"fromIndex": 3,
"toIndex": 4,
"type": "RPC Request from Device"
},
{
"fromIndex": 2,
"toIndex": 5,
"fromIndex": 3,
"toIndex": 6,
"type": "RPC Request to Device"
},
{
"fromIndex": 3,
"toIndex": 0,
"type": "Entity Created"
}
],
"ruleChainConnections": [
{
"fromIndex": 6,
"fromIndex": 7,
"targetRuleChainId": {
"entityType": "RULE_CHAIN",
"id": "83d42540-85fd-11ea-aee2-794850541ced"
"id": "25e26570-89ed-11ea-a650-cd6e14e633bd"
},
"additionalInfo": {
"layoutX": 1088,
"layoutY": 203,
"ruleChainNodeId": "rule-chain-node-9"
"layoutX": 1109,
"layoutY": 182,
"ruleChainNodeId": "rule-chain-node-10"
},
"type": "True"
}

Loading…
Cancel
Save