Browse Source

Edge widget updates

pull/3811/head
Artem Babak 6 years ago
parent
commit
ea9f149168
  1. 8
      application/src/main/data/json/system/widget_bundles/edge_widgets.json
  2. 2
      ui-ngx/src/app/modules/home/components/widget/lib/edges-overview-widget.component.ts

8
application/src/main/data/json/system/widget_bundles/edge_widgets.json

@ -7,7 +7,7 @@
"widgetTypes": [ "widgetTypes": [
{ {
"alias": "edges_overview", "alias": "edges_overview",
"name": "Edges Quick Overview", "name": "Edge Quick Overview",
"descriptor": { "descriptor": {
"type": "latest", "type": "latest",
"sizeX": 7.5, "sizeX": 7.5,
@ -15,10 +15,10 @@
"resources": [], "resources": [],
"templateHtml": "<tb-edges-overview-widget \n [ctx]=\"ctx\">\n</tb-edges-overview-widget>", "templateHtml": "<tb-edges-overview-widget \n [ctx]=\"ctx\">\n</tb-edges-overview-widget>",
"templateCss": "", "templateCss": "",
"controllerScript": "self.onInit = function() {\n};\n\nself.onDestroy = function() {\n};\n", "controllerScript": "self.onInit = function() {\n};\n\nself.typeParameters = function() {\n return {\n maxDatasources: 1,\n dataKeysOptional: true\n };\n}\n\nself.onDestroy = function() {\n};\n",
"settingsSchema": "{}", "settingsSchema": "{}\n",
"dataKeySettingsSchema": "{}\n", "dataKeySettingsSchema": "{}\n",
"defaultConfig": "{\"timewindow\":{\"realtime\":{\"interval\":1000,\"timewindowMs\":86400000},\"aggregation\":{\"type\":\"NONE\",\"limit\":200}},\"showTitle\":true,\"backgroundColor\":\"rgb(255, 255, 255)\",\"color\":\"rgba(0, 0, 0, 0.87)\",\"padding\":\"4px\",\"settings\":{},\"title\":\"Edges Quick Overview\",\"dropShadow\":true,\"enableFullscreen\":true,\"titleStyle\":{\"fontSize\":\"16px\",\"fontWeight\":400,\"padding\":\"5px 10px 5px 10px\"},\"useDashboardTimewindow\":false,\"showLegend\":false,\"datasources\":[{\"type\":\"function\",\"name\":\"Simulated\",\"dataKeys\":[{\"name\":\"f(x)\",\"type\":\"function\",\"label\":\"Sin\",\"color\":\"#2196f3\",\"settings\":{\"columnWidth\":\"0px\",\"useCellStyleFunction\":false,\"cellStyleFunction\":\"\",\"useCellContentFunction\":false,\"cellContentFunction\":\"\"},\"_hash\":0.472295003170325,\"funcBody\":\"return Math.round(1000*Math.sin(time/5000));\"},{\"name\":\"f(x)\",\"type\":\"function\",\"label\":\"Cos\",\"color\":\"#4caf50\",\"settings\":{\"columnWidth\":\"0px\",\"useCellStyleFunction\":false,\"cellStyleFunction\":\"\",\"useCellContentFunction\":false,\"cellContentFunction\":\"\"},\"_hash\":0.8926244886945558,\"funcBody\":\"return Math.round(1000*Math.cos(time/5000));\"},{\"name\":\"f(x)\",\"type\":\"function\",\"label\":\"Random\",\"color\":\"#f44336\",\"settings\":{\"columnWidth\":\"0px\",\"useCellStyleFunction\":false,\"cellStyleFunction\":\"\",\"useCellContentFunction\":false,\"cellContentFunction\":\"\"},\"_hash\":0.6401141393938932,\"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;\"}]}],\"widgetStyle\":{},\"actions\":{}}" "defaultConfig": "{\"timewindow\":{\"realtime\":{\"interval\":1000,\"timewindowMs\":86400000},\"aggregation\":{\"type\":\"NONE\",\"limit\":200}},\"showTitle\":true,\"showTitleIcon\":true,\"titleIcon\":\"router\",\"backgroundColor\":\"rgb(255, 255, 255)\",\"color\":\"rgba(0, 0, 0, 0.87)\",\"padding\":\"4px\",\"settings\":{},\"title\":\"Edge Quick Overview\",\"dropShadow\":true,\"enableFullscreen\":true,\"titleStyle\":{\"fontSize\":\"16px\",\"fontWeight\":400,\"padding\":\"5px 10px 5px 10px\"},\"useDashboardTimewindow\":false,\"showLegend\":false,\"datasources\":[{\"type\":\"function\",\"name\":\"Simulated\",\"dataKeys\":[{\"name\":\"f(x)\",\"type\":\"function\",\"label\":\"Sin\",\"color\":\"#2196f3\",\"settings\":{\"columnWidth\":\"0px\",\"useCellStyleFunction\":false,\"cellStyleFunction\":\"\",\"useCellContentFunction\":false,\"cellContentFunction\":\"\"},\"_hash\":0.472295003170325,\"funcBody\":\"return Math.round(1000*Math.sin(time/5000));\"}]}],\"widgetStyle\":{},\"actions\":{}}"
} }
} }
] ]

2
ui-ngx/src/app/modules/home/components/widget/lib/edges-overview-widget.component.ts

@ -87,7 +87,7 @@ export class EdgesOverviewWidgetComponent extends PageComponent implements OnIni
if (datasource.type === DatasourceType.entity && datasource.entity.id.entityType === EntityType.EDGE) { if (datasource.type === DatasourceType.entity && datasource.entity.id.entityType === EntityType.EDGE) {
var selectedEdge: BaseData<EntityId> = datasource.entity; var selectedEdge: BaseData<EntityId> = datasource.entity;
this.getCustomerTitle(selectedEdge.id.id); this.getCustomerTitle(selectedEdge.id.id);
this.ctx.widgetTitle = selectedEdge.name; this.ctx.widgetTitle = `${selectedEdge.name} Quick Overview`;
cb(this.loadNodesForEdge(selectedEdge.id.id, selectedEdge)); cb(this.loadNodesForEdge(selectedEdge.id.id, selectedEdge));
} else if (datasource.type === DatasourceType.function) { } else if (datasource.type === DatasourceType.function) {
cb(this.loadNodesForEdge(datasource.entityId, datasource.entity)); cb(this.loadNodesForEdge(datasource.entityId, datasource.entity));

Loading…
Cancel
Save