-
Notifications
You must be signed in to change notification settings - Fork 7
/
send_message.json
18 lines (18 loc) · 1.78 KB
/
send_message.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
{
"alias": "send_event_button",
"name": "Send Message",
"image": null,
"description": null,
"descriptor": {
"type": "static",
"sizeX": 7.5,
"sizeY": 3,
"resources": [],
"templateHtml": "<div>\r\n <button mat-raised-button color=\"primary\" (click)=\"sendMessage()\">发送消息</button>\r\n</div>",
"templateCss": "",
"controllerScript": "self.onInit = function() {\n self.ctx.$scope.sendMessage = function() {\n const $injector = self.ctx.$scope.$injector;\n const broadcastService = $injector.get(self.ctx.servicesMap.get('broadcastService'));\n broadcastService.broadcast('SOME_CUSTOM_EVENT', {\n message: 'Hello ThingsBoard'\n });\n }\n}\n",
"settingsSchema": "{\n}",
"dataKeySettingsSchema": "{}\n",
"defaultConfig": "{\"datasources\":[{\"type\":\"static\",\"name\":\"function\",\"dataKeys\":[{\"name\":\"f(x)\",\"type\":\"function\",\"label\":\"Random\",\"color\":\"#2196f3\",\"settings\":{},\"_hash\":0.15479322438769105,\"funcBody\":\"var value = prevValue + Math.random() * 100 - 50;\\nvar multiplier = Math.pow(10, 2 || 0);\\nvar value = Math.round(value * multiplier) / multiplier;\\nif (value < -1000) {\\n\\tvalue = -1000;\\n} else if (value > 1000) {\\n\\tvalue = 1000;\\n}\\nreturn value;\"}]}],\"timewindow\":{\"realtime\":{\"timewindowMs\":60000}},\"showTitle\":false,\"backgroundColor\":\"rgb(255, 255, 255)\",\"color\":\"rgba(0, 0, 0, 0.87)\",\"padding\":\"8px\",\"settings\":{\"cardHtml\":\"<div class='card'>HTML code here</div>\",\"cardCss\":\".card {\\n font-weight: bold;\\n font-size: 32px;\\n color: #999;\\n width: 100%;\\n height: 100%;\\n display: flex;\\n align-items: center;\\n justify-content: center;\\n}\"},\"title\":\"Send Message\",\"dropShadow\":true}"
}
}