Commit 9bdc56f68c9d5ef6d1fcd866a9cd6e695217bfd6
1 parent
c88a4426
Add widgets help resources. Introduce datasources optional flag for widget type parameters.
Showing
31 changed files
with
1047 additions
and
21 deletions
... | ... | @@ -19,8 +19,8 @@ |
19 | 19 | "templateHtml": "<tb-alarms-table-widget \n [ctx]=\"ctx\">\n</tb-alarms-table-widget>", |
20 | 20 | "templateCss": "", |
21 | 21 | "controllerScript": "self.onInit = function() {\n}\n\nself.onDataUpdated = function() {\n self.ctx.$scope.alarmsTableWidget.onDataUpdated();\n}\n\nself.actionSources = function() {\n return {\n 'actionCellButton': {\n name: 'widget-action.action-cell-button',\n multiple: true,\n hasShowCondition: true\n },\n 'rowClick': {\n name: 'widget-action.row-click',\n multiple: false\n }\n };\n}\n\nself.onDestroy = function() {\n}\n", |
22 | - "settingsSchema": "{\n \"schema\": {\n \"type\": \"object\",\n \"title\": \"AlarmTableSettings\",\n \"properties\": {\n \"alarmsTitle\": {\n \"title\": \"Alarms table title\",\n \"type\": \"string\",\n \"default\": \"\"\n },\n \"enableSelection\": {\n \"title\": \"Enable alarms selection\",\n \"type\": \"boolean\",\n \"default\": true\n },\n \"enableSearch\": {\n \"title\": \"Enable alarms search\",\n \"type\": \"boolean\",\n \"default\": true\n },\n \"enableSelectColumnDisplay\": {\n \"title\": \"Enable select columns to display\",\n \"type\": \"boolean\",\n \"default\": true\n },\n \"enableFilter\": {\n \"title\": \"Enable alarm filter\",\n \"type\": \"boolean\",\n \"default\": true\n },\n \"enableStickyHeader\": {\n \"title\": \"Always display header\",\n \"type\": \"boolean\",\n \"default\": true\n },\n \"enableStickyAction\": {\n \"title\": \"Always display actions column\",\n \"type\": \"boolean\",\n \"default\": false\n },\n \"reserveSpaceForHiddenAction\": {\n \"title\": \"Hidden cell button actions display mode\",\n \"type\": \"string\",\n \"default\": \"true\"\n },\n \"displayDetails\": {\n \"title\": \"Display alarm details\",\n \"type\": \"boolean\",\n \"default\": true\n },\n \"allowAcknowledgment\": {\n \"title\": \"Allow alarms acknowledgment\",\n \"type\": \"boolean\",\n \"default\": true\n },\n \"allowClear\": {\n \"title\": \"Allow alarms clear\",\n \"type\": \"boolean\",\n \"default\": true\n },\n \"displayPagination\": {\n \"title\": \"Display pagination\",\n \"type\": \"boolean\",\n \"default\": true\n },\n \"defaultPageSize\": {\n \"title\": \"Default page size\",\n \"type\": \"number\",\n \"default\": 10\n },\n \"defaultSortOrder\": {\n \"title\": \"Default sort order\",\n \"type\": \"string\",\n \"default\": \"-createdTime\"\n },\n \"useRowStyleFunction\": {\n \"title\": \"Use row style function\",\n \"type\": \"boolean\",\n \"default\": false\n },\n \"rowStyleFunction\": {\n \"title\": \"Row style function: f(alarm, ctx)\",\n \"type\": \"string\",\n \"default\": \"\"\n }\n },\n \"required\": []\n },\n \"form\": [\n \"alarmsTitle\",\n \"enableSelection\",\n \"enableSearch\",\n \"enableSelectColumnDisplay\",\n \"enableFilter\",\n \"enableStickyHeader\",\n \"enableStickyAction\",\n {\n \"key\": \"reserveSpaceForHiddenAction\",\n \"type\": \"rc-select\",\n \"multiple\": false,\n \"items\": [\n {\n \"value\": \"true\",\n \"label\": \"Show empty space instead of hidden cell button action\"\n },\n {\n \"value\": \"false\",\n \"label\": \"Don't reserve space for hidden action buttons\"\n }\n ]\n },\n \"displayDetails\",\n \"allowAcknowledgment\",\n \"allowClear\",\n \"displayPagination\",\n \"defaultPageSize\",\n \"defaultSortOrder\",\n \"useRowStyleFunction\",\n {\n \"key\": \"rowStyleFunction\",\n \"type\": \"javascript\",\n \"condition\": \"model.useRowStyleFunction === true\"\n }\n ]\n}", | |
23 | - "dataKeySettingsSchema": "{\n \"schema\": {\n \"type\": \"object\",\n \"title\": \"DataKeySettings\",\n \"properties\": {\n \"columnWidth\": {\n \"title\": \"Column width (px or %)\",\n \"type\": \"string\",\n \"default\": \"0px\"\n },\n \"useCellStyleFunction\": {\n \"title\": \"Use cell style function\",\n \"type\": \"boolean\",\n \"default\": false\n },\n \"cellStyleFunction\": {\n \"title\": \"Cell style function: f(value, alarm, ctx)\",\n \"type\": \"string\",\n \"default\": \"\"\n },\n \"useCellContentFunction\": {\n \"title\": \"Use cell content function\",\n \"type\": \"boolean\",\n \"default\": false\n },\n \"cellContentFunction\": {\n \"title\": \"Cell content function: f(value, alarm, ctx)\",\n \"type\": \"string\",\n \"default\": \"\"\n },\n \"defaultColumnVisibility\": {\n \"title\": \"Default column visibility\",\n \"type\": \"string\",\n \"default\": \"visible\"\n },\n \"columnSelectionToDisplay\": {\n \"title\": \"Column selection in 'Columns to Display'\",\n \"type\": \"string\",\n \"default\": \"enabled\"\n }\n },\n \"required\": []\n },\n \"form\": [\n \"columnWidth\",\n \"useCellStyleFunction\",\n {\n \"key\": \"cellStyleFunction\",\n \"type\": \"javascript\",\n \"condition\": \"model.useCellStyleFunction === true\"\n },\n \"useCellContentFunction\",\n {\n \"key\": \"cellContentFunction\",\n \"type\": \"javascript\",\n \"condition\": \"model.useCellContentFunction === true\"\n },\n {\n \"key\": \"defaultColumnVisibility\",\n \"type\": \"rc-select\",\n \"multiple\": false,\n \"items\": [\n {\n \"value\": \"visible\",\n \"label\": \"Visible\"\n },\n {\n \"value\": \"hidden\",\n \"label\": \"Hidden\"\n } \n ]\n },\n {\n \"key\": \"columnSelectionToDisplay\",\n \"type\": \"rc-select\",\n \"multiple\": false,\n \"items\": [\n {\n \"value\": \"enabled\",\n \"label\": \"Enabled\"\n },\n {\n \"value\": \"disabled\",\n \"label\": \"Disabled\"\n } \n ]\n }\n ]\n}", | |
22 | + "settingsSchema": "{\n \"schema\": {\n \"type\": \"object\",\n \"title\": \"AlarmTableSettings\",\n \"properties\": {\n \"alarmsTitle\": {\n \"title\": \"Alarms table title\",\n \"type\": \"string\",\n \"default\": \"\"\n },\n \"enableSelection\": {\n \"title\": \"Enable alarms selection\",\n \"type\": \"boolean\",\n \"default\": true\n },\n \"enableSearch\": {\n \"title\": \"Enable alarms search\",\n \"type\": \"boolean\",\n \"default\": true\n },\n \"enableSelectColumnDisplay\": {\n \"title\": \"Enable select columns to display\",\n \"type\": \"boolean\",\n \"default\": true\n },\n \"enableFilter\": {\n \"title\": \"Enable alarm filter\",\n \"type\": \"boolean\",\n \"default\": true\n },\n \"enableStickyHeader\": {\n \"title\": \"Always display header\",\n \"type\": \"boolean\",\n \"default\": true\n },\n \"enableStickyAction\": {\n \"title\": \"Always display actions column\",\n \"type\": \"boolean\",\n \"default\": false\n },\n \"reserveSpaceForHiddenAction\": {\n \"title\": \"Hidden cell button actions display mode\",\n \"type\": \"string\",\n \"default\": \"true\"\n },\n \"displayDetails\": {\n \"title\": \"Display alarm details\",\n \"type\": \"boolean\",\n \"default\": true\n },\n \"allowAcknowledgment\": {\n \"title\": \"Allow alarms acknowledgment\",\n \"type\": \"boolean\",\n \"default\": true\n },\n \"allowClear\": {\n \"title\": \"Allow alarms clear\",\n \"type\": \"boolean\",\n \"default\": true\n },\n \"displayPagination\": {\n \"title\": \"Display pagination\",\n \"type\": \"boolean\",\n \"default\": true\n },\n \"defaultPageSize\": {\n \"title\": \"Default page size\",\n \"type\": \"number\",\n \"default\": 10\n },\n \"defaultSortOrder\": {\n \"title\": \"Default sort order\",\n \"type\": \"string\",\n \"default\": \"-createdTime\"\n },\n \"useRowStyleFunction\": {\n \"title\": \"Use row style function\",\n \"type\": \"boolean\",\n \"default\": false\n },\n \"rowStyleFunction\": {\n \"title\": \"Row style function: f(alarm, ctx)\",\n \"type\": \"string\",\n \"default\": \"\"\n }\n },\n \"required\": []\n },\n \"form\": [\n \"alarmsTitle\",\n \"enableSelection\",\n \"enableSearch\",\n \"enableSelectColumnDisplay\",\n \"enableFilter\",\n \"enableStickyHeader\",\n \"enableStickyAction\",\n {\n \"key\": \"reserveSpaceForHiddenAction\",\n \"type\": \"rc-select\",\n \"multiple\": false,\n \"items\": [\n {\n \"value\": \"true\",\n \"label\": \"Show empty space instead of hidden cell button action\"\n },\n {\n \"value\": \"false\",\n \"label\": \"Don't reserve space for hidden action buttons\"\n }\n ]\n },\n \"displayDetails\",\n \"allowAcknowledgment\",\n \"allowClear\",\n \"displayPagination\",\n \"defaultPageSize\",\n \"defaultSortOrder\",\n \"useRowStyleFunction\",\n {\n \"key\": \"rowStyleFunction\",\n \"type\": \"javascript\",\n \"helpId\": \"widget/lib/alarm/row_style_fn\",\n \"condition\": \"model.useRowStyleFunction === true\"\n }\n ]\n}", | |
23 | + "dataKeySettingsSchema": "{\n \"schema\": {\n \"type\": \"object\",\n \"title\": \"DataKeySettings\",\n \"properties\": {\n \"columnWidth\": {\n \"title\": \"Column width (px or %)\",\n \"type\": \"string\",\n \"default\": \"0px\"\n },\n \"useCellStyleFunction\": {\n \"title\": \"Use cell style function\",\n \"type\": \"boolean\",\n \"default\": false\n },\n \"cellStyleFunction\": {\n \"title\": \"Cell style function: f(value, alarm, ctx)\",\n \"type\": \"string\",\n \"default\": \"\"\n },\n \"useCellContentFunction\": {\n \"title\": \"Use cell content function\",\n \"type\": \"boolean\",\n \"default\": false\n },\n \"cellContentFunction\": {\n \"title\": \"Cell content function: f(value, alarm, ctx)\",\n \"type\": \"string\",\n \"default\": \"\"\n },\n \"defaultColumnVisibility\": {\n \"title\": \"Default column visibility\",\n \"type\": \"string\",\n \"default\": \"visible\"\n },\n \"columnSelectionToDisplay\": {\n \"title\": \"Column selection in 'Columns to Display'\",\n \"type\": \"string\",\n \"default\": \"enabled\"\n }\n },\n \"required\": []\n },\n \"form\": [\n \"columnWidth\",\n \"useCellStyleFunction\",\n {\n \"key\": \"cellStyleFunction\",\n \"type\": \"javascript\",\n \"helpId\": \"widget/lib/alarm/cell_style_fn\",\n \"condition\": \"model.useCellStyleFunction === true\"\n },\n \"useCellContentFunction\",\n {\n \"key\": \"cellContentFunction\",\n \"type\": \"javascript\",\n \"helpId\": \"widget/lib/alarm/cell_content_fn\",\n \"condition\": \"model.useCellContentFunction === true\"\n },\n {\n \"key\": \"defaultColumnVisibility\",\n \"type\": \"rc-select\",\n \"multiple\": false,\n \"items\": [\n {\n \"value\": \"visible\",\n \"label\": \"Visible\"\n },\n {\n \"value\": \"hidden\",\n \"label\": \"Hidden\"\n } \n ]\n },\n {\n \"key\": \"columnSelectionToDisplay\",\n \"type\": \"rc-select\",\n \"multiple\": false,\n \"items\": [\n {\n \"value\": \"enabled\",\n \"label\": \"Enabled\"\n },\n {\n \"value\": \"disabled\",\n \"label\": \"Disabled\"\n } \n ]\n }\n ]\n}", | |
24 | 24 | "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\":{\"enableSelection\":true,\"enableSearch\":true,\"displayDetails\":true,\"allowAcknowledgment\":true,\"allowClear\":true,\"displayPagination\":true,\"defaultPageSize\":10,\"defaultSortOrder\":\"-createdTime\",\"enableSelectColumnDisplay\":true,\"enableStickyAction\":false,\"enableFilter\":true},\"title\":\"Alarms table\",\"dropShadow\":true,\"enableFullscreen\":true,\"titleStyle\":{\"fontSize\":\"16px\",\"fontWeight\":400,\"padding\":\"5px 10px 5px 10px\"},\"useDashboardTimewindow\":false,\"showLegend\":false,\"alarmSource\":{\"type\":\"function\",\"dataKeys\":[{\"name\":\"createdTime\",\"type\":\"alarm\",\"label\":\"Created time\",\"color\":\"#2196f3\",\"settings\":{\"useCellStyleFunction\":false,\"cellStyleFunction\":\"\",\"useCellContentFunction\":false,\"cellContentFunction\":\"\"},\"_hash\":0.021092237451093787},{\"name\":\"originator\",\"type\":\"alarm\",\"label\":\"Originator\",\"color\":\"#4caf50\",\"settings\":{\"useCellStyleFunction\":false,\"cellStyleFunction\":\"\",\"useCellContentFunction\":false,\"cellContentFunction\":\"\"},\"_hash\":0.2780007688856758},{\"name\":\"type\",\"type\":\"alarm\",\"label\":\"Type\",\"color\":\"#f44336\",\"settings\":{\"useCellStyleFunction\":false,\"cellStyleFunction\":\"\",\"useCellContentFunction\":false,\"cellContentFunction\":\"\"},\"_hash\":0.7323586880398418},{\"name\":\"severity\",\"type\":\"alarm\",\"label\":\"Severity\",\"color\":\"#ffc107\",\"settings\":{\"useCellStyleFunction\":false,\"useCellContentFunction\":false},\"_hash\":0.09927019860088193},{\"name\":\"status\",\"type\":\"alarm\",\"label\":\"Status\",\"color\":\"#607d8b\",\"settings\":{\"useCellStyleFunction\":false,\"cellStyleFunction\":\"\",\"useCellContentFunction\":false,\"cellContentFunction\":\"\"},\"_hash\":0.6588418951443418}],\"entityAliasId\":null,\"name\":\"alarms\"},\"alarmSearchStatus\":\"ANY\",\"alarmsPollingInterval\":5,\"showTitleIcon\":false,\"titleIcon\":\"more_horiz\",\"iconColor\":\"rgba(0, 0, 0, 0.87)\",\"iconSize\":\"24px\",\"titleTooltip\":\"\",\"widgetStyle\":{},\"displayTimewindow\":true,\"actions\":{},\"alarmStatusList\":[],\"alarmSeverityList\":[],\"alarmTypeList\":[],\"searchPropagatedAlarms\":false}" |
25 | 25 | } |
26 | 26 | } | ... | ... |
... | ... | @@ -55,8 +55,8 @@ |
55 | 55 | "templateHtml": "<tb-timeseries-table-widget \n [ctx]=\"ctx\">\n</tb-timeseries-table-widget>", |
56 | 56 | "templateCss": "", |
57 | 57 | "controllerScript": "self.onInit = function() {\n}\n\nself.onDataUpdated = function() {\n self.ctx.$scope.timeseriesTableWidget.onDataUpdated();\n}\n\nself.typeParameters = function() {\n return {\n ignoreDataUpdateOnIntervalTick: true\n };\n}\n\nself.actionSources = function() {\n return {\n 'actionCellButton': {\n name: 'widget-action.action-cell-button',\n multiple: true,\n hasShowCondition: true\n },\n 'rowClick': {\n name: 'widget-action.row-click',\n multiple: false\n }\n };\n}\n\nself.onDestroy = function() {\n}", |
58 | - "settingsSchema": "{\n \"schema\": {\n \"type\": \"object\",\n \"title\": \"TimeseriesTableSettings\",\n \"properties\": {\n \"enableSearch\": {\n \"title\": \"Enable search\",\n \"type\": \"boolean\",\n \"default\": true\n },\n \"enableStickyHeader\": {\n \"title\": \"Always display header\",\n \"type\": \"boolean\",\n \"default\": true\n },\n \"enableStickyAction\": {\n \"title\": \"Always display actions column\",\n \"type\": \"boolean\",\n \"default\": true\n },\n \"reserveSpaceForHiddenAction\": {\n \"title\": \"Hidden cell button actions display mode\",\n \"type\": \"string\",\n \"default\": \"true\"\n },\n \"showTimestamp\": {\n \"title\": \"Display timestamp column\",\n \"type\": \"boolean\",\n \"default\": true\n },\n \"showMilliseconds\": {\n \"title\": \"Display timestamp milliseconds\",\n \"type\": \"boolean\",\n \"default\": false\n },\n \"displayPagination\": {\n \"title\": \"Display pagination\",\n \"type\": \"boolean\",\n \"default\": true\n }, \n \"useEntityLabel\": {\n \"title\": \"Use entity label in tab name\",\n \"type\": \"boolean\",\n \"default\": false\n },\n \"defaultPageSize\": {\n \"title\": \"Default page size\",\n \"type\": \"number\",\n \"default\": 10\n },\n \"hideEmptyLines\": {\n \"title\": \"Hide empty lines\",\n \"type\": \"boolean\",\n \"default\": false\n },\n \"disableStickyHeader\": {\n \"title\": \"Disable sticky header\",\n \"type\": \"boolean\",\n \"default\": false\n },\n \"useRowStyleFunction\": {\n \"title\": \"Use row style function\",\n \"type\": \"boolean\",\n \"default\": false\n },\n \"rowStyleFunction\": {\n \"title\": \"Row style function: f(rowData, ctx)\",\n \"type\": \"string\",\n \"default\": \"\"\n }\n },\n \"required\": []\n },\n \"form\": [\n \"enableSearch\",\n \"enableStickyHeader\",\n \"enableStickyAction\",\n {\n \"key\": \"reserveSpaceForHiddenAction\",\n \"type\": \"rc-select\",\n \"multiple\": false,\n \"items\": [\n {\n \"value\": \"true\",\n \"label\": \"Show empty space instead of hidden cell button action\"\n },\n {\n \"value\": \"false\",\n \"label\": \"Don't reserve space for hidden action buttons\"\n }\n ]\n },\n \"showTimestamp\",\n \"showMilliseconds\",\n \"displayPagination\",\n \"useEntityLabel\",\n \"defaultPageSize\",\n \"identifyDeviceSelector\",\n \"hideEmptyLines\",\n \"useRowStyleFunction\",\n {\n \"key\": \"rowStyleFunction\",\n \"type\": \"javascript\",\n \"condition\": \"model.useRowStyleFunction === true\"\n }\n ]\n}", | |
59 | - "dataKeySettingsSchema": "{\n \"schema\": {\n \"type\": \"object\",\n \"title\": \"DataKeySettings\",\n \"properties\": {\n \"useCellStyleFunction\": {\n \"title\": \"Use cell style function\",\n \"type\": \"boolean\",\n \"default\": false\n },\n \"cellStyleFunction\": {\n \"title\": \"Cell style function: f(value, rowData, ctx)\",\n \"type\": \"string\",\n \"default\": \"\"\n },\n \"useCellContentFunction\": {\n \"title\": \"Use cell content function\",\n \"type\": \"boolean\",\n \"default\": false\n },\n \"cellContentFunction\": {\n \"title\": \"Cell content function: f(value, rowData, ctx)\",\n \"type\": \"string\",\n \"default\": \"\"\n }\n },\n \"required\": []\n },\n \"form\": [\n \"useCellStyleFunction\",\n {\n \"key\": \"cellStyleFunction\",\n \"type\": \"javascript\",\n \"condition\": \"model.useCellStyleFunction === true\"\n },\n \"useCellContentFunction\",\n {\n \"key\": \"cellContentFunction\",\n \"type\": \"javascript\",\n \"condition\": \"model.useCellContentFunction === true\"\n }\n ]\n}", | |
58 | + "settingsSchema": "{\n \"schema\": {\n \"type\": \"object\",\n \"title\": \"TimeseriesTableSettings\",\n \"properties\": {\n \"enableSearch\": {\n \"title\": \"Enable search\",\n \"type\": \"boolean\",\n \"default\": true\n },\n \"enableStickyHeader\": {\n \"title\": \"Always display header\",\n \"type\": \"boolean\",\n \"default\": true\n },\n \"enableStickyAction\": {\n \"title\": \"Always display actions column\",\n \"type\": \"boolean\",\n \"default\": true\n },\n \"reserveSpaceForHiddenAction\": {\n \"title\": \"Hidden cell button actions display mode\",\n \"type\": \"string\",\n \"default\": \"true\"\n },\n \"showTimestamp\": {\n \"title\": \"Display timestamp column\",\n \"type\": \"boolean\",\n \"default\": true\n },\n \"showMilliseconds\": {\n \"title\": \"Display timestamp milliseconds\",\n \"type\": \"boolean\",\n \"default\": false\n },\n \"displayPagination\": {\n \"title\": \"Display pagination\",\n \"type\": \"boolean\",\n \"default\": true\n }, \n \"useEntityLabel\": {\n \"title\": \"Use entity label in tab name\",\n \"type\": \"boolean\",\n \"default\": false\n },\n \"defaultPageSize\": {\n \"title\": \"Default page size\",\n \"type\": \"number\",\n \"default\": 10\n },\n \"hideEmptyLines\": {\n \"title\": \"Hide empty lines\",\n \"type\": \"boolean\",\n \"default\": false\n },\n \"disableStickyHeader\": {\n \"title\": \"Disable sticky header\",\n \"type\": \"boolean\",\n \"default\": false\n },\n \"useRowStyleFunction\": {\n \"title\": \"Use row style function\",\n \"type\": \"boolean\",\n \"default\": false\n },\n \"rowStyleFunction\": {\n \"title\": \"Row style function: f(rowData, ctx)\",\n \"type\": \"string\",\n \"default\": \"\"\n }\n },\n \"required\": []\n },\n \"form\": [\n \"enableSearch\",\n \"enableStickyHeader\",\n \"enableStickyAction\",\n {\n \"key\": \"reserveSpaceForHiddenAction\",\n \"type\": \"rc-select\",\n \"multiple\": false,\n \"items\": [\n {\n \"value\": \"true\",\n \"label\": \"Show empty space instead of hidden cell button action\"\n },\n {\n \"value\": \"false\",\n \"label\": \"Don't reserve space for hidden action buttons\"\n }\n ]\n },\n \"showTimestamp\",\n \"showMilliseconds\",\n \"displayPagination\",\n \"useEntityLabel\",\n \"defaultPageSize\",\n \"identifyDeviceSelector\",\n \"hideEmptyLines\",\n \"useRowStyleFunction\",\n {\n \"key\": \"rowStyleFunction\",\n \"type\": \"javascript\",\n \"helpId\": \"widget/lib/timeseries/row_style_fn\",\n \"condition\": \"model.useRowStyleFunction === true\"\n }\n ]\n}", | |
59 | + "dataKeySettingsSchema": "{\n \"schema\": {\n \"type\": \"object\",\n \"title\": \"DataKeySettings\",\n \"properties\": {\n \"useCellStyleFunction\": {\n \"title\": \"Use cell style function\",\n \"type\": \"boolean\",\n \"default\": false\n },\n \"cellStyleFunction\": {\n \"title\": \"Cell style function: f(value, rowData, ctx)\",\n \"type\": \"string\",\n \"default\": \"\"\n },\n \"useCellContentFunction\": {\n \"title\": \"Use cell content function\",\n \"type\": \"boolean\",\n \"default\": false\n },\n \"cellContentFunction\": {\n \"title\": \"Cell content function: f(value, rowData, ctx)\",\n \"type\": \"string\",\n \"default\": \"\"\n }\n },\n \"required\": []\n },\n \"form\": [\n \"useCellStyleFunction\",\n {\n \"key\": \"cellStyleFunction\",\n \"type\": \"javascript\",\n \"helpId\": \"widget/lib/timeseries/cell_style_fn\",\n \"condition\": \"model.useCellStyleFunction === true\"\n },\n \"useCellContentFunction\",\n {\n \"key\": \"cellContentFunction\",\n \"type\": \"javascript\",\n \"helpId\": \"widget/lib/timeseries/cell_content_fn\",\n \"condition\": \"model.useCellContentFunction === true\"\n }\n ]\n}", | |
60 | 60 | "defaultConfig": "{\"datasources\":[{\"type\":\"function\",\"name\":\"function\",\"dataKeys\":[{\"name\":\"f(x)\",\"type\":\"function\",\"label\":\"Temperature °C\",\"color\":\"#2196f3\",\"settings\":{\"useCellStyleFunction\":true,\"cellStyleFunction\":\"if (value) {\\n var percent = (value + 60)/120 * 100;\\n var color = tinycolor.mix('blue', 'red', amount = percent);\\n color.setAlpha(.5);\\n return {\\n paddingLeft: '20px',\\n color: '#ffffff',\\n background: color.toRgbString(),\\n fontSize: '18px'\\n };\\n} else {\\n return {};\\n}\"},\"_hash\":0.8587686344902596,\"funcBody\":\"var value = prevValue + Math.random() * 40 - 20;\\nvar multiplier = Math.pow(10, 1 || 0);\\nvar value = Math.round(value * multiplier) / multiplier;\\nif (value < -60) {\\n\\tvalue = -60;\\n} else if (value > 60) {\\n\\tvalue = 60;\\n}\\nreturn value;\"},{\"name\":\"f(x)\",\"type\":\"function\",\"label\":\"Humidity, %\",\"color\":\"#ffc107\",\"settings\":{\"useCellStyleFunction\":true,\"cellStyleFunction\":\"if (value) {\\n var percent = value;\\n var backgroundColor = tinycolor('blue');\\n backgroundColor.setAlpha(value/100);\\n var color = 'blue';\\n if (value > 50) {\\n color = 'white';\\n }\\n \\n return {\\n paddingLeft: '20px',\\n color: color,\\n background: backgroundColor.toRgbString(),\\n fontSize: '18px'\\n };\\n} else {\\n return {};\\n}\",\"useCellContentFunction\":false},\"_hash\":0.12775350966079668,\"funcBody\":\"var value = prevValue + Math.random() * 20 - 10;\\nvar multiplier = Math.pow(10, 1 || 0);\\nvar value = Math.round(value * multiplier) / multiplier;\\nif (value < 5) {\\n\\tvalue = 5;\\n} else if (value > 100) {\\n\\tvalue = 100;\\n}\\nreturn value;\"}]}],\"timewindow\":{\"realtime\":{\"interval\":1000,\"timewindowMs\":60000},\"aggregation\":{\"type\":\"NONE\",\"limit\":200}},\"showTitle\":true,\"backgroundColor\":\"rgb(255, 255, 255)\",\"color\":\"rgba(0, 0, 0, 0.87)\",\"padding\":\"8px\",\"settings\":{\"showTimestamp\":true,\"displayPagination\":true,\"defaultPageSize\":10},\"title\":\"Timeseries table\",\"dropShadow\":true,\"enableFullscreen\":true,\"titleStyle\":{\"fontSize\":\"16px\",\"fontWeight\":400,\"padding\":\"5px 10px 5px 10px\"},\"useDashboardTimewindow\":false,\"showLegend\":false,\"widgetStyle\":{},\"actions\":{},\"showTitleIcon\":false,\"iconColor\":\"rgba(0, 0, 0, 0.87)\",\"iconSize\":\"24px\"}" |
61 | 61 | } |
62 | 62 | }, |
... | ... | @@ -127,8 +127,8 @@ |
127 | 127 | "templateHtml": "<tb-entities-table-widget \n [ctx]=\"ctx\">\n</tb-entities-table-widget>", |
128 | 128 | "templateCss": "", |
129 | 129 | "controllerScript": "self.onInit = function() {\n}\n\nself.onDataUpdated = function() {\n self.ctx.$scope.entitiesTableWidget.onDataUpdated();\n}\n\nself.typeParameters = function() {\n return {\n maxDatasources: 1,\n hasDataPageLink: true,\n warnOnPageDataOverflow: false,\n dataKeysOptional: true\n };\n}\n\nself.actionSources = function() {\n return {\n 'actionCellButton': {\n name: 'widget-action.action-cell-button',\n multiple: true,\n hasShowCondition: true\n },\n 'rowClick': {\n name: 'widget-action.row-click',\n multiple: false\n },\n 'rowDoubleClick': {\n name: 'widget-action.row-double-click',\n multiple: false\n }\n };\n}\n\nself.onDestroy = function() {\n}\n", |
130 | - "settingsSchema": "{\n \"schema\": {\n \"type\": \"object\",\n \"title\": \"EntitiesTableSettings\",\n \"properties\": {\n \"entitiesTitle\": {\n \"title\": \"Entities table title\",\n \"type\": \"string\",\n \"default\": \"\"\n },\n \"enableSearch\": {\n \"title\": \"Enable entities search\",\n \"type\": \"boolean\",\n \"default\": true\n },\n \"enableSelectColumnDisplay\": {\n \"title\": \"Enable select columns to display\",\n \"type\": \"boolean\",\n \"default\": true\n },\n \"enableStickyHeader\": {\n \"title\": \"Always display header\",\n \"type\": \"boolean\",\n \"default\": true\n },\n \"enableStickyAction\": {\n \"title\": \"Always display actions column\",\n \"type\": \"boolean\",\n \"default\": true\n },\n \"reserveSpaceForHiddenAction\": {\n \"title\": \"Hidden cell button actions display mode\",\n \"type\": \"string\",\n \"default\": \"true\"\n },\n \"displayEntityName\": {\n \"title\": \"Display entity name column\",\n \"type\": \"boolean\",\n \"default\": true\n },\n \"entityNameColumnTitle\": {\n \"title\": \"Entity name column title\",\n \"type\": \"string\",\n \"default\": \"\"\n },\n \"displayEntityLabel\": {\n \"title\": \"Display entity label column\",\n \"type\": \"boolean\",\n \"default\": false\n },\n \"entityLabelColumnTitle\": {\n \"title\": \"Entity label column title\",\n \"type\": \"string\",\n \"default\": \"\"\n },\n \"displayEntityType\": {\n \"title\": \"Display entity type column\",\n \"type\": \"boolean\",\n \"default\": true\n },\n \"displayPagination\": {\n \"title\": \"Display pagination\",\n \"type\": \"boolean\",\n \"default\": true\n },\n \"defaultPageSize\": {\n \"title\": \"Default page size\",\n \"type\": \"number\",\n \"default\": 10\n },\n \"defaultSortOrder\": {\n \"title\": \"Default sort order\",\n \"type\": \"string\",\n \"default\": \"entityName\"\n },\n \"useRowStyleFunction\": {\n \"title\": \"Use row style function\",\n \"type\": \"boolean\",\n \"default\": false\n },\n \"rowStyleFunction\": {\n \"title\": \"Row style function: f(entity, ctx)\",\n \"type\": \"string\",\n \"default\": \"\"\n }\n },\n \"required\": []\n },\n \"form\": [\n \"entitiesTitle\",\n \"enableSearch\",\n \"enableSelectColumnDisplay\",\n \"enableStickyHeader\",\n \"enableStickyAction\",\n {\n \"key\": \"reserveSpaceForHiddenAction\",\n \"type\": \"rc-select\",\n \"multiple\": false,\n \"items\": [\n {\n \"value\": \"true\",\n \"label\": \"Show empty space instead of hidden cell button action\"\n },\n {\n \"value\": \"false\",\n \"label\": \"Don't reserve space for hidden action buttons\"\n }\n ]\n },\n \"displayEntityName\",\n \"entityNameColumnTitle\",\n \"displayEntityLabel\",\n \"entityLabelColumnTitle\",\n \"displayEntityType\",\n \"displayPagination\",\n \"defaultPageSize\",\n \"defaultSortOrder\",\n \"useRowStyleFunction\",\n {\n \"key\": \"rowStyleFunction\",\n \"type\": \"javascript\",\n \"condition\": \"model.useRowStyleFunction === true\"\n }\n ]\n}", | |
131 | - "dataKeySettingsSchema": "{\n \"schema\": {\n \"type\": \"object\",\n \"title\": \"DataKeySettings\",\n \"properties\": {\n \"columnWidth\": {\n \"title\": \"Column width (px or %)\",\n \"type\": \"string\",\n \"default\": \"0px\"\n },\n \"useCellStyleFunction\": {\n \"title\": \"Use cell style function\",\n \"type\": \"boolean\",\n \"default\": false\n },\n \"cellStyleFunction\": {\n \"title\": \"Cell style function: f(value, entity, ctx)\",\n \"type\": \"string\",\n \"default\": \"\"\n },\n \"useCellContentFunction\": {\n \"title\": \"Use cell content function\",\n \"type\": \"boolean\",\n \"default\": false\n },\n \"cellContentFunction\": {\n \"title\": \"Cell content function: f(value, entity, ctx)\",\n \"type\": \"string\",\n \"default\": \"\"\n },\n \"defaultColumnVisibility\": {\n \"title\": \"Default column visibility\",\n \"type\": \"string\",\n \"default\": \"visible\"\n },\n \"columnSelectionToDisplay\": {\n \"title\": \"Column selection in 'Columns to Display'\",\n \"type\": \"string\",\n \"default\": \"enabled\"\n }\n },\n \"required\": []\n },\n \"form\": [\n \"columnWidth\",\n \"useCellStyleFunction\",\n {\n \"key\": \"cellStyleFunction\",\n \"type\": \"javascript\",\n \"condition\": \"model.useCellStyleFunction === true\"\n },\n \"useCellContentFunction\",\n {\n \"key\": \"cellContentFunction\",\n \"type\": \"javascript\",\n \"condition\": \"model.useCellContentFunction === true\"\n },\n {\n \"key\": \"defaultColumnVisibility\",\n \"type\": \"rc-select\",\n \"multiple\": false,\n \"items\": [\n {\n \"value\": \"visible\",\n \"label\": \"Visible\"\n },\n {\n \"value\": \"hidden\",\n \"label\": \"Hidden\"\n } \n ]\n },\n {\n \"key\": \"columnSelectionToDisplay\",\n \"type\": \"rc-select\",\n \"multiple\": false,\n \"items\": [\n {\n \"value\": \"enabled\",\n \"label\": \"Enabled\"\n },\n {\n \"value\": \"disabled\",\n \"label\": \"Disabled\"\n } \n ]\n }\n ]\n}", | |
130 | + "settingsSchema": "{\n \"schema\": {\n \"type\": \"object\",\n \"title\": \"EntitiesTableSettings\",\n \"properties\": {\n \"entitiesTitle\": {\n \"title\": \"Entities table title\",\n \"type\": \"string\",\n \"default\": \"\"\n },\n \"enableSearch\": {\n \"title\": \"Enable entities search\",\n \"type\": \"boolean\",\n \"default\": true\n },\n \"enableSelectColumnDisplay\": {\n \"title\": \"Enable select columns to display\",\n \"type\": \"boolean\",\n \"default\": true\n },\n \"enableStickyHeader\": {\n \"title\": \"Always display header\",\n \"type\": \"boolean\",\n \"default\": true\n },\n \"enableStickyAction\": {\n \"title\": \"Always display actions column\",\n \"type\": \"boolean\",\n \"default\": true\n },\n \"reserveSpaceForHiddenAction\": {\n \"title\": \"Hidden cell button actions display mode\",\n \"type\": \"string\",\n \"default\": \"true\"\n },\n \"displayEntityName\": {\n \"title\": \"Display entity name column\",\n \"type\": \"boolean\",\n \"default\": true\n },\n \"entityNameColumnTitle\": {\n \"title\": \"Entity name column title\",\n \"type\": \"string\",\n \"default\": \"\"\n },\n \"displayEntityLabel\": {\n \"title\": \"Display entity label column\",\n \"type\": \"boolean\",\n \"default\": false\n },\n \"entityLabelColumnTitle\": {\n \"title\": \"Entity label column title\",\n \"type\": \"string\",\n \"default\": \"\"\n },\n \"displayEntityType\": {\n \"title\": \"Display entity type column\",\n \"type\": \"boolean\",\n \"default\": true\n },\n \"displayPagination\": {\n \"title\": \"Display pagination\",\n \"type\": \"boolean\",\n \"default\": true\n },\n \"defaultPageSize\": {\n \"title\": \"Default page size\",\n \"type\": \"number\",\n \"default\": 10\n },\n \"defaultSortOrder\": {\n \"title\": \"Default sort order\",\n \"type\": \"string\",\n \"default\": \"entityName\"\n },\n \"useRowStyleFunction\": {\n \"title\": \"Use row style function\",\n \"type\": \"boolean\",\n \"default\": false\n },\n \"rowStyleFunction\": {\n \"title\": \"Row style function: f(entity, ctx)\",\n \"type\": \"string\",\n \"default\": \"\"\n }\n },\n \"required\": []\n },\n \"form\": [\n \"entitiesTitle\",\n \"enableSearch\",\n \"enableSelectColumnDisplay\",\n \"enableStickyHeader\",\n \"enableStickyAction\",\n {\n \"key\": \"reserveSpaceForHiddenAction\",\n \"type\": \"rc-select\",\n \"multiple\": false,\n \"items\": [\n {\n \"value\": \"true\",\n \"label\": \"Show empty space instead of hidden cell button action\"\n },\n {\n \"value\": \"false\",\n \"label\": \"Don't reserve space for hidden action buttons\"\n }\n ]\n },\n \"displayEntityName\",\n \"entityNameColumnTitle\",\n \"displayEntityLabel\",\n \"entityLabelColumnTitle\",\n \"displayEntityType\",\n \"displayPagination\",\n \"defaultPageSize\",\n \"defaultSortOrder\",\n \"useRowStyleFunction\",\n {\n \"key\": \"rowStyleFunction\",\n \"type\": \"javascript\",\n \"helpId\": \"widget/lib/entity/row_style_fn\",\n \"condition\": \"model.useRowStyleFunction === true\"\n }\n ]\n}", | |
131 | + "dataKeySettingsSchema": "{\n \"schema\": {\n \"type\": \"object\",\n \"title\": \"DataKeySettings\",\n \"properties\": {\n \"columnWidth\": {\n \"title\": \"Column width (px or %)\",\n \"type\": \"string\",\n \"default\": \"0px\"\n },\n \"useCellStyleFunction\": {\n \"title\": \"Use cell style function\",\n \"type\": \"boolean\",\n \"default\": false\n },\n \"cellStyleFunction\": {\n \"title\": \"Cell style function: f(value, entity, ctx)\",\n \"type\": \"string\",\n \"default\": \"\"\n },\n \"useCellContentFunction\": {\n \"title\": \"Use cell content function\",\n \"type\": \"boolean\",\n \"default\": false\n },\n \"cellContentFunction\": {\n \"title\": \"Cell content function: f(value, entity, ctx)\",\n \"type\": \"string\",\n \"default\": \"\"\n },\n \"defaultColumnVisibility\": {\n \"title\": \"Default column visibility\",\n \"type\": \"string\",\n \"default\": \"visible\"\n },\n \"columnSelectionToDisplay\": {\n \"title\": \"Column selection in 'Columns to Display'\",\n \"type\": \"string\",\n \"default\": \"enabled\"\n }\n },\n \"required\": []\n },\n \"form\": [\n \"columnWidth\",\n \"useCellStyleFunction\",\n {\n \"key\": \"cellStyleFunction\",\n \"type\": \"javascript\",\n \"helpId\": \"widget/lib/entity/cell_style_fn\",\n \"condition\": \"model.useCellStyleFunction === true\"\n },\n \"useCellContentFunction\",\n {\n \"key\": \"cellContentFunction\",\n \"type\": \"javascript\",\n \"helpId\": \"widget/lib/entity/cell_content_fn\",\n \"condition\": \"model.useCellContentFunction === true\"\n },\n {\n \"key\": \"defaultColumnVisibility\",\n \"type\": \"rc-select\",\n \"multiple\": false,\n \"items\": [\n {\n \"value\": \"visible\",\n \"label\": \"Visible\"\n },\n {\n \"value\": \"hidden\",\n \"label\": \"Hidden\"\n } \n ]\n },\n {\n \"key\": \"columnSelectionToDisplay\",\n \"type\": \"rc-select\",\n \"multiple\": false,\n \"items\": [\n {\n \"value\": \"enabled\",\n \"label\": \"Enabled\"\n },\n {\n \"value\": \"disabled\",\n \"label\": \"Disabled\"\n } \n ]\n }\n ]\n}", | |
132 | 132 | "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\":{\"enableSelection\":true,\"enableSearch\":true,\"displayDetails\":true,\"displayPagination\":true,\"defaultPageSize\":10,\"defaultSortOrder\":\"entityName\",\"displayEntityName\":true,\"displayEntityType\":true},\"title\":\"Entities table\",\"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;\"}]}]}" |
133 | 133 | } |
134 | 134 | }, |
... | ... | @@ -145,7 +145,7 @@ |
145 | 145 | "templateHtml": "<tb-entities-hierarchy-widget \n [ctx]=\"ctx\">\n</tb-entities-hierarchy-widget>", |
146 | 146 | "templateCss": "", |
147 | 147 | "controllerScript": "self.onInit = function() {\n}\n\nself.onDataUpdated = function() {\n self.ctx.$scope.entitiesHierarchyWidget.onDataUpdated();\n}\n\nself.typeParameters = function() {\n return {\n dataKeysOptional: true\n };\n}\n\nself.actionSources = function() {\n return {\n 'nodeSelected': {\n name: 'widget-action.node-selected',\n multiple: false\n }\n };\n}\n\nself.onDestroy = function() {\n}\n", |
148 | - "settingsSchema": "{\n \"schema\": {\n \"type\": \"object\",\n \"title\": \"EntitiesHierarchySettings\",\n \"properties\": {\n \"nodeRelationQueryFunction\": {\n \"title\": \"Node relations query function: f(nodeCtx)\",\n \"type\": \"string\",\n \"default\": \"\"\n },\n \"nodeHasChildrenFunction\": {\n \"title\": \"Node has children function: f(nodeCtx)\",\n \"type\": \"string\",\n \"default\": \"\"\n },\n \"nodeOpenedFunction\": {\n \"title\": \"Default node opened function: f(nodeCtx)\",\n \"type\": \"string\",\n \"default\": \"\"\n },\n \"nodeDisabledFunction\": {\n \"title\": \"Node disabled function: f(nodeCtx)\",\n \"type\": \"string\",\n \"default\": \"\"\n },\n \"nodeIconFunction\": {\n \"title\": \"Node icon function: f(nodeCtx)\",\n \"type\": \"string\",\n \"default\": \"\"\n },\n \"nodeTextFunction\": {\n \"title\": \"Node text function: f(nodeCtx)\",\n \"type\": \"string\",\n \"default\": \"\"\n },\n \"nodesSortFunction\": {\n \"title\": \"Nodes sort function: f(nodeCtx1, nodeCtx2)\",\n \"type\": \"string\",\n \"default\": \"\"\n }\n },\n \"required\": []\n },\n \"form\": [\n {\n \"key\": \"nodeRelationQueryFunction\",\n \"type\": \"javascript\"\n },\n {\n \"key\": \"nodeHasChildrenFunction\",\n \"type\": \"javascript\"\n },\n {\n \"key\": \"nodeOpenedFunction\",\n \"type\": \"javascript\"\n },\n {\n \"key\": \"nodeDisabledFunction\",\n \"type\": \"javascript\"\n },\n {\n \"key\": \"nodeIconFunction\",\n \"type\": \"javascript\"\n },\n {\n \"key\": \"nodeTextFunction\",\n \"type\": \"javascript\"\n },\n {\n \"key\": \"nodesSortFunction\",\n \"type\": \"javascript\"\n }\n ]\n}", | |
148 | + "settingsSchema": "{\n \"schema\": {\n \"type\": \"object\",\n \"title\": \"EntitiesHierarchySettings\",\n \"properties\": {\n \"nodeRelationQueryFunction\": {\n \"title\": \"Node relations query function: f(nodeCtx)\",\n \"type\": \"string\",\n \"default\": \"\"\n },\n \"nodeHasChildrenFunction\": {\n \"title\": \"Node has children function: f(nodeCtx)\",\n \"type\": \"string\",\n \"default\": \"\"\n },\n \"nodeOpenedFunction\": {\n \"title\": \"Default node opened function: f(nodeCtx)\",\n \"type\": \"string\",\n \"default\": \"\"\n },\n \"nodeDisabledFunction\": {\n \"title\": \"Node disabled function: f(nodeCtx)\",\n \"type\": \"string\",\n \"default\": \"\"\n },\n \"nodeIconFunction\": {\n \"title\": \"Node icon function: f(nodeCtx)\",\n \"type\": \"string\",\n \"default\": \"\"\n },\n \"nodeTextFunction\": {\n \"title\": \"Node text function: f(nodeCtx)\",\n \"type\": \"string\",\n \"default\": \"\"\n },\n \"nodesSortFunction\": {\n \"title\": \"Nodes sort function: f(nodeCtx1, nodeCtx2)\",\n \"type\": \"string\",\n \"default\": \"\"\n }\n },\n \"required\": []\n },\n \"form\": [\n {\n \"key\": \"nodeRelationQueryFunction\",\n \"type\": \"javascript\",\n \"helpId\": \"widget/lib/entities_hierarchy/node_relation_query_fn\"\n },\n {\n \"key\": \"nodeHasChildrenFunction\",\n \"type\": \"javascript\",\n \"helpId\": \"widget/lib/entities_hierarchy/node_has_children_fn\"\n },\n {\n \"key\": \"nodeOpenedFunction\",\n \"type\": \"javascript\",\n \"helpId\": \"widget/lib/entities_hierarchy/node_opened_fn\"\n },\n {\n \"key\": \"nodeDisabledFunction\",\n \"type\": \"javascript\",\n \"helpId\": \"widget/lib/entities_hierarchy/node_disabled_fn\"\n },\n {\n \"key\": \"nodeIconFunction\",\n \"type\": \"javascript\",\n \"helpId\": \"widget/lib/entities_hierarchy/node_icon_fn\"\n },\n {\n \"key\": \"nodeTextFunction\",\n \"type\": \"javascript\",\n \"helpId\": \"widget/lib/entities_hierarchy/node_text_fn\"\n },\n {\n \"key\": \"nodesSortFunction\",\n \"type\": \"javascript\",\n \"helpId\": \"widget/lib/entities_hierarchy/nodes_sort_fn\"\n }\n ]\n}", | |
149 | 149 | "dataKeySettingsSchema": "{\n \"schema\": {\n \"type\": \"object\",\n \"title\": \"DataKeySettings\",\n \"properties\": {},\n \"required\": []\n },\n \"form\": []\n}", |
150 | 150 | "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\":{\"nodeRelationQueryFunction\":\"/**\\n\\n// Function should return relations query object for current node used to fetch entity children.\\n// Function can return 'default' string value. In this case default relations query will be used.\\n\\n// The following example code will construct simple relations query that will fetch relations of type 'Contains'\\n// from the current entity.\\n\\nvar entity = nodeCtx.entity;\\nvar query = {\\n parameters: {\\n rootId: entity.id.id,\\n rootType: entity.id.entityType,\\n direction: \\\"FROM\\\",\\n maxLevel: 1\\n },\\n filters: [{\\n relationType: \\\"Contains\\\",\\n entityTypes: []\\n }]\\n};\\nreturn query;\\n\\n**/\\n\",\"nodeHasChildrenFunction\":\"/**\\n\\n// Function should return boolean value indicating whether current node has children (whether it can be expanded).\\n\\n// The following example code will restrict entities hierarchy expansion up to third level.\\n\\nreturn nodeCtx.level <= 2;\\n\\n// The next example code will restrict entities expansion according to the value of example 'nodeHasChildren' attribute.\\n\\nvar data = nodeCtx.data;\\nif (data.hasOwnProperty('nodeHasChildren') && data['nodeHasChildren'] !== null) {\\n return data['nodeHasChildren'] === 'true';\\n} else {\\n return true;\\n}\\n \\n**/\\n \",\"nodeTextFunction\":\"/**\\n\\n// Function should return text (can be HTML code) for the current node.\\n\\n// The following example code will generate node text consisting of entity name and temperature if temperature value is present in entity attributes/timeseries.\\n\\nvar data = nodeCtx.data;\\nvar entity = nodeCtx.entity;\\nvar text = entity.name;\\nif (data.hasOwnProperty('temperature') && data['temperature'] !== null) {\\n text += \\\" <b>\\\"+ data['temperature'] +\\\" °C</b>\\\";\\n}\\nreturn text;\\n\\n**/\",\"nodeIconFunction\":\"/** \\n\\n// Function should return node icon info object.\\n// Resulting object should contain either 'materialIcon' or 'iconUrl' property. \\n// Where:\\n - 'materialIcon' - name of the material icon to be used from the Material Icons Library (https://material.io/tools/icons);\\n - 'iconUrl' - url of the external image to be used as node icon.\\n// Function can return 'default' string value. In this case default icons according to entity type will be used.\\n\\n// The following example code shows how to use external image for devices which name starts with 'Test' and use \\n// default icons for the rest of entities.\\n\\nvar entity = nodeCtx.entity;\\nif (entity.id.entityType === 'DEVICE' && entity.name.startsWith('Test')) {\\n return {iconUrl: 'https://avatars1.githubusercontent.com/u/14793288?v=4&s=117'};\\n} else {\\n return 'default';\\n}\\n \\n**/\",\"nodeDisabledFunction\":\"/**\\n\\n// Function should return boolean value indicating whether current node should be disabled (not selectable).\\n\\n// The following example code will disable current node according to the value of example 'nodeDisabled' attribute.\\n\\nvar data = nodeCtx.data;\\nif (data.hasOwnProperty('nodeDisabled') && data['nodeDisabled'] !== null) {\\n return data['nodeDisabled'] === 'true';\\n} else {\\n return false;\\n}\\n \\n**/\\n\",\"nodesSortFunction\":\"/**\\n\\n// This function is used to sort nodes of the same level. Function should compare two nodes and return \\n// integer value: \\n// - less than 0 - sort nodeCtx1 to an index lower than nodeCtx2\\n// - 0 - leave nodeCtx1 and nodeCtx2 unchanged with respect to each other\\n// - greater than 0 - sort nodeCtx2 to an index lower than nodeCtx1\\n\\n// The following example code will sort entities first by entity type in alphabetical order then\\n// by entity name in alphabetical order.\\n\\nvar result = nodeCtx1.entity.id.entityType.localeCompare(nodeCtx2.entity.id.entityType);\\nif (result === 0) {\\n result = nodeCtx1.entity.name.localeCompare(nodeCtx2.entity.name);\\n}\\nreturn result;\\n \\n**/\",\"nodeOpenedFunction\":\"/**\\n\\n// Function should return boolean value indicating whether current node should be opened (expanded) when it first loaded.\\n\\n// The following example code will open by default nodes up to third level.\\n\\nreturn nodeCtx.level <= 2;\\n\\n**/\\n \"},\"title\":\"Entities hierarchy\",\"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\":{}}" |
151 | 151 | } |
... | ... | @@ -170,7 +170,7 @@ |
170 | 170 | }, |
171 | 171 | { |
172 | 172 | "alias": "markdown_card", |
173 | - "name": "Markdown Card", | |
173 | + "name": "Markdown/HTML Card", | |
174 | 174 | "image": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAACgCAYAAABJ/yOpAAAACXBIWXMAAA7DAAAOwwHHb6hkAAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAIABJREFUeJztnXl8E9Xax79pku4bLbuyVJGCQClgK2WnQAVFlgKCgvQqoiAKCO53ebkovF5fAVEvKiCIiEJBEES2Fig7CAUr+9qN0oWmadM2SbPN+0dsaNpM2pSCLPP9fPh86JkzZ54zk2fmnDO/eR6ZIAiCyWRCrVaj1+uxWCxISNyvuLm54enpSWBgIEqlEpnRaBRycnLw9PRELpff9AHq1atXB2ZKSPw1mM1mSktL0Wg0NG7cGIVara4z55CQuNuRy+X4+/sDoFarcdPr9ZJzSEhUwsfHB71ej5s055CQqIpcLsdiseD2VxsiIXEnIznInxiNRk6ePFltvXPnzqHVam+DRc4RBMHp9jvFzrudWjmITqdj165dLu2zefNmBEHg4MGDqFSqWpdXRq/X8/PPP9v+3rhxIzqdziXbALKysnj77berrffGG2+Ql5fncvt1SUZGBo8//jhpaWmidW7GTovFwpkzZ2pp3b2Fyw5y/vx5Jk+ezFdffVXjffR6PZ9//jkymYxPPvnEdvdztdwRmZmZvP/++2RkZJCVlcV7771HZmamq926q2jYsCETJ06kcePGt6T9kpISJk6ceEvavttQuFLZbDazYsUKnn32Wb755psa7ZOYmMixY8cAWLJkCRkZGfz+++8ALpX379/fYfs5OTl06dKFxMREFAoFnTt3Jj8/n9atW7N+/Xr27t2Lj48PsbGxdOnSBYDDhw+ze/durl+/jkKhYMaMGXZtGo1GvvnmG4YOHUqTJk1ISUlh7dq1yOVyNBqNrd6lS5f4/vvvk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xh+fLlHDx40DZvcUarVq2YOnUqHTp04MMPPyQrK4u+ffvi6+vL/Pnz2b17N99++y0HDhyw7TN48GD8/Pz44IMPOHjwIPHx8WzcuJHevXvbks5369aN7OxsGjduTNu2benQoQONGjXi6tWrtXYQuVxO165dyc7Opl+/fgD069ePzMxMFApFlRRtFe1NT0/n448/Zu/evcydO9du+5AhQ0hJSWHhwoXs2bOHTz75xG776NGj+e2335g3bx7JycksWbKEQYMG2W5zgRuiAAASx0lEQVRA/v7+pKenk5SUVOXJLlE9N+0gwcHB9OrVy7acWhl3d3c+/PBDcnJyiIuLY+3atURERFBWVmaXa1AMuVzORx99hNFo5K233sLHx4f58+dTWFjI5MmTWbdund2PLzg4mIULF6LVannxxReZNWsWPXr04KOPPrLV6dGjB25ubkRHRyOTyZDJZERHR+Pm5kZUVFStz0W5c0VHRwMQFhZG48aN6dSpk93cqiLleQ+/++47Jk+eTPPmze22T548mQEDBvD111/z6quv2pZp3dysl+7111/nb3/7GytXrmTs2LF8/fXXDBs2zLZwMXbsWDQaDZMmTaoy75OoHllaWppwOwLHmc1mCgsLq81FWFMEQUCtVtutYFWmsLAQpVKJj49PnRzzVlJaWopcLq/ynsJisaBWq3F3d0epVLJz505mzpzJggULGDRokK2e2WxGpVJVyXcC1rmK2WwWnctIOCY9Pb32cxBXkcvldeYcYF1mduYcwF21rCnmxD/++COLFi3imWeewd3dne+//54mTZpUWTKWy+W2IWRlxJ5eEtVz2xxEonYMGzaM3NxcEhMTMRqNdOvWjalTp9ZJAlSJ6rltQywJibsNKTavhEQ1SA4iIeEEyUEkJJwgOYiEhBMkB5GQcILkIBISTpAcRELCCZKDSEg4QXIQCQknSA4iIeEEyUEkJJzgsoMUFRUxb948Fi9eXGVbecC3ip/I1gSdTkebNm1Yv36903plZWW0adOG+Ph4l9q/GZKSkkhISKjzdiPnFJBRYMZkho+3laIzOP9E9pt9Ov75c0md21GZY2lGNv5eVm29fvPUnMmu/qO3ux2XHUSj0bBkyRLmz5/P+fPn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2m3Fzc8PN09PTLuK6hISENfGSp6cnboGBgWg0GjQajfQkkbjvMZvNaDQaiouLCQoKQiYIgmAymVCr1ej1etG0YhIS9wNubm54enoSFBSEXC7n/wF1srhlxTIbmgAAAABJRU5ErkJggg==", |
175 | 175 | "description": "Renders markdown/HTML using configurable pattern or function with applied attributes or timeseries values.", |
176 | 176 | "descriptor": { |
... | ... | @@ -180,10 +180,10 @@ |
180 | 180 | "resources": [], |
181 | 181 | "templateHtml": "<tb-markdown-widget \n [ctx]=\"ctx\">\n</tb-markdown-widget>", |
182 | 182 | "templateCss": "#container tb-markdown-widget {\n height: 100%;\n display: block;\n}\n\n#container tb-markdown-widget .tb-markdown-view {\n height: 100%;\n overflow: auto;\n}\n", |
183 | - "controllerScript": "self.onInit = function() {\n}\n\nself.onDataUpdated = function() {\n self.ctx.$scope.markdownWidget.onDataUpdated();\n}\n\nself.actionSources = function() {\n return {\n 'elementClick': {\n name: 'widget-action.element-click',\n multiple: true\n }\n };\n}\n\nself.onDestroy = function() {\n}\n\n", | |
184 | - "settingsSchema": "{\n \"schema\": {\n \"type\": \"object\",\n \"title\": \"Markdown card\",\n \"properties\": {\n \"markdownTextPattern\": {\n \"title\": \"Markdown pattern (markdown with variables, for ex. '${entityName} or ${keyName} - some text.')\",\n \"type\": \"string\",\n \"default\": \"# Markdown card \\n - **Current entity**: **${entityName}**. \\n - **Current value**: **${Random}**.\"\n },\n \"markdownCss\": {\n \"title\": \"Markdown CSS\",\n \"type\": \"string\",\n \"default\": \"\"\n },\n \"useMarkdownTextFunction\": {\n \"title\": \"Use markdown text function\",\n \"type\": \"boolean\",\n \"default\": false\n },\n \"markdownTextFunction\": {\n \"title\": \"Markdown text function: f(data)\",\n \"type\": \"string\",\n \"default\": \"return '# Some title\\\\n - Entity name: ' + data[0]['entityName'];\"\n }\n },\n \"required\": []\n },\n \"form\": [\n {\n \"key\": \"markdownTextPattern\",\n \"type\": \"markdown\"\n },\n {\n \"key\": \"markdownCss\",\n \"type\": \"css\"\n },\n \"useMarkdownTextFunction\",\n {\n \"key\": \"markdownTextFunction\",\n \"type\": \"javascript\"\n }\n ]\n}\n", | |
183 | + "controllerScript": "self.onInit = function() {\n}\n\nself.onDataUpdated = function() {\n self.ctx.$scope.markdownWidget.onDataUpdated();\n}\n\nself.actionSources = function() {\n return {\n 'elementClick': {\n name: 'widget-action.element-click',\n multiple: true\n }\n };\n}\n\nself.typeParameters = function() {\n return {\n dataKeysOptional: true,\n datasourcesOptional: true\n };\n}\n\nself.onDestroy = function() {\n}\n\n", | |
184 | + "settingsSchema": "{\n \"schema\": {\n \"type\": \"object\",\n \"title\": \"Markdown/HTML card\",\n \"properties\": {\n \"markdownTextPattern\": {\n \"title\": \"Markdown/HTML pattern (markdown or HTML with variables, for ex. '${entityName} or ${keyName} - some text.')\",\n \"type\": \"string\",\n \"default\": \"# Markdown/HTML card \\n - **Current entity**: **${entityName}**. \\n - **Current value**: **${Random}**.\"\n },\n \"markdownCss\": {\n \"title\": \"Markdown/HTML CSS\",\n \"type\": \"string\",\n \"default\": \"\"\n },\n \"useMarkdownTextFunction\": {\n \"title\": \"Use markdown/HTML value function\",\n \"type\": \"boolean\",\n \"default\": false\n },\n \"markdownTextFunction\": {\n \"title\": \"Markdown/HTML value function: f(data)\",\n \"type\": \"string\",\n \"default\": \"return '# Some title\\\\n - Entity name: ' + data[0]['entityName'];\"\n }\n },\n \"required\": []\n },\n \"form\": [\n {\n \"key\": \"markdownTextPattern\",\n \"type\": \"markdown\"\n },\n {\n \"key\": \"markdownCss\",\n \"type\": \"css\"\n },\n \"useMarkdownTextFunction\",\n {\n \"key\": \"markdownTextFunction\",\n \"type\": \"javascript\"\n }\n ]\n}\n", | |
185 | 185 | "dataKeySettingsSchema": "{}\n", |
186 | - "defaultConfig": "{\"datasources\":[{\"type\":\"function\",\"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\":\"#fff\",\"color\":\"rgba(0, 0, 0, 0.87)\",\"padding\":\"0px\",\"settings\":{\"markdownTextPattern\":\"### Markdown card\\n - **Current entity**: ${entityName}.\\n - **Current value**: ${Random}.\",\"markdownTextFunction\":\"return '# Some title\\\\n - Entity name: ' + data[0]['entityName'];\"},\"title\":\"Markdown Card\",\"showTitleIcon\":false,\"iconColor\":\"rgba(0, 0, 0, 0.87)\",\"iconSize\":\"24px\",\"titleTooltip\":\"\",\"dropShadow\":true,\"enableFullscreen\":true,\"widgetStyle\":{},\"titleStyle\":{\"fontSize\":\"16px\",\"fontWeight\":400},\"showLegend\":false}" | |
186 | + "defaultConfig": "{\"datasources\":[{\"type\":\"function\",\"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\":\"#fff\",\"color\":\"rgba(0, 0, 0, 0.87)\",\"padding\":\"0px\",\"settings\":{\"markdownTextPattern\":\"### Markdown/HTML card\\n - **Current entity**: ${entityName}.\\n - **Current value**: ${Random}.\",\"markdownTextFunction\":\"return '# Some title\\\\n - Entity name: ' + data[0]['entityName'];\"},\"title\":\"Markdown/HTML Card\",\"showTitleIcon\":false,\"iconColor\":\"rgba(0, 0, 0, 0.87)\",\"iconSize\":\"24px\",\"titleTooltip\":\"\",\"dropShadow\":true,\"enableFullscreen\":true,\"widgetStyle\":{},\"titleStyle\":{\"fontSize\":\"16px\",\"fontWeight\":400},\"showLegend\":false}" | |
187 | 187 | } |
188 | 188 | } |
189 | 189 | ] | ... | ... |
... | ... | @@ -323,6 +323,9 @@ export class AliasController implements IAliasController { |
323 | 323 | } |
324 | 324 | |
325 | 325 | resolveDatasources(datasources: Array<Datasource>, singleEntity?: boolean): Observable<Array<Datasource>> { |
326 | + if (!datasources || !datasources.length) { | |
327 | + return of([]); | |
328 | + } | |
326 | 329 | const toResolve = singleEntity ? [datasources[0]] : datasources; |
327 | 330 | const observables = new Array<Observable<Datasource>>(); |
328 | 331 | toResolve.forEach((datasource) => { | ... | ... |
... | ... | @@ -387,7 +387,7 @@ export class WidgetSubscription implements IWidgetSubscription { |
387 | 387 | } |
388 | 388 | |
389 | 389 | private prepareDataSubscriptions(): Observable<any> { |
390 | - if (this.hasDataPageLink) { | |
390 | + if (this.hasDataPageLink || !this.configuredDatasources || !this.configuredDatasources.length) { | |
391 | 391 | this.hasResolvedData = true; |
392 | 392 | this.notifyDataLoaded(); |
393 | 393 | return of(null); | ... | ... |
... | ... | @@ -873,6 +873,7 @@ export class DashboardPageComponent extends PageComponent implements IDashboardC |
873 | 873 | if (revert) { |
874 | 874 | this.dashboard = this.prevDashboard; |
875 | 875 | this.dashboardLogoCache = undefined; |
876 | + this.dashboardConfiguration = this.dashboard.configuration; | |
876 | 877 | } |
877 | 878 | } else { |
878 | 879 | this.resetHighlight(); | ... | ... |
... | ... | @@ -19,7 +19,7 @@ |
19 | 19 | |
20 | 20 | import { DataKey, Datasource, DatasourceData, JsonSettingsSchema } from '@shared/models/widget.models'; |
21 | 21 | import * as moment_ from 'moment'; |
22 | -import { DataKeyType } from "@shared/models/telemetry/telemetry.models"; | |
22 | +import { DataKeyType } from '@shared/models/telemetry/telemetry.models'; | |
23 | 23 | import { ComparisonDuration } from '@shared/models/time/time.models'; |
24 | 24 | |
25 | 25 | export declare type ChartType = 'line' | 'pie' | 'bar' | 'state' | 'graph'; |
... | ... | @@ -466,7 +466,7 @@ export function flotSettingsSchema(chartType: ChartType): JsonSettingsSchema { |
466 | 466 | schema.form.push({ |
467 | 467 | key: 'tooltipValueFormatter', |
468 | 468 | type: 'javascript', |
469 | - helpId: 'widget/lib/tooltip_value_format_fn' | |
469 | + helpId: 'widget/lib/flot/tooltip_value_format_fn' | |
470 | 470 | }); |
471 | 471 | schema.form.push('hideZeros'); |
472 | 472 | schema.form.push('showTooltip'); |
... | ... | @@ -516,7 +516,8 @@ export function flotSettingsSchema(chartType: ChartType): JsonSettingsSchema { |
516 | 516 | }, |
517 | 517 | { |
518 | 518 | key: 'yaxis.ticksFormatter', |
519 | - type: 'javascript' | |
519 | + type: 'javascript', | |
520 | + helpId: 'widget/lib/flot/ticks_formatter_fn' | |
520 | 521 | } |
521 | 522 | ] |
522 | 523 | }); |
... | ... | @@ -531,11 +532,11 @@ export function flotSettingsSchema(chartType: ChartType): JsonSettingsSchema { |
531 | 532 | schema.form.push(chartSettingsSchemaForComparison.form, chartSettingsSchemaForCustomLegend.form); |
532 | 533 | schema.groupInfoes.push({ |
533 | 534 | formIndex: schema.groupInfoes.length, |
534 | - GroupTitle:'Comparison Settings' | |
535 | + GroupTitle: 'Comparison Settings' | |
535 | 536 | }); |
536 | 537 | schema.groupInfoes.push({ |
537 | 538 | formIndex: schema.groupInfoes.length, |
538 | - GroupTitle:'Custom Legend Settings' | |
539 | + GroupTitle: 'Custom Legend Settings' | |
539 | 540 | }); |
540 | 541 | } |
541 | 542 | return schema; |
... | ... | @@ -981,13 +982,15 @@ export function flotDatakeySettingsSchema(defaultShowLines: boolean, chartType: |
981 | 982 | }, |
982 | 983 | { |
983 | 984 | key: 'pointShapeFormatter', |
984 | - type: 'javascript' | |
985 | + type: 'javascript', | |
986 | + helpId: 'widget/lib/flot/point_shape_format_fn' | |
985 | 987 | }, |
986 | 988 | 'showPointsLineWidth', |
987 | 989 | 'showPointsRadius', |
988 | 990 | { |
989 | 991 | key: 'tooltipValueFormatter', |
990 | - type: 'javascript' | |
992 | + type: 'javascript', | |
993 | + helpId: 'widget/lib/flot/tooltip_value_format_fn' | |
991 | 994 | }, |
992 | 995 | 'showSeparateAxis', |
993 | 996 | 'axisMin', |
... | ... | @@ -1012,7 +1015,8 @@ export function flotDatakeySettingsSchema(defaultShowLines: boolean, chartType: |
1012 | 1015 | }, |
1013 | 1016 | { |
1014 | 1017 | key: 'axisTicksFormatter', |
1015 | - type: 'javascript' | |
1018 | + type: 'javascript', | |
1019 | + helpId: 'widget/lib/flot/ticks_formatter_fn' | |
1016 | 1020 | } |
1017 | 1021 | ] |
1018 | 1022 | }; | ... | ... |
... | ... | @@ -491,6 +491,9 @@ export class WidgetComponentService { |
491 | 491 | if (isUndefined(result.typeParameters.dataKeysOptional)) { |
492 | 492 | result.typeParameters.dataKeysOptional = false; |
493 | 493 | } |
494 | + if (isUndefined(result.typeParameters.datasourcesOptional)) { | |
495 | + result.typeParameters.datasourcesOptional = false; | |
496 | + } | |
494 | 497 | if (isUndefined(result.typeParameters.stateData)) { |
495 | 498 | result.typeParameters.stateData = false; |
496 | 499 | } | ... | ... |
... | ... | @@ -894,7 +894,7 @@ export class WidgetConfigComponent extends PageComponent implements OnInit, Cont |
894 | 894 | }; |
895 | 895 | } |
896 | 896 | } else if (this.widgetType !== widgetType.static && this.modelValue.isDataEnabled) { |
897 | - if (!config.datasources || !config.datasources.length) { | |
897 | + if (!this.modelValue.typeParameters.datasourcesOptional && (!config.datasources || !config.datasources.length)) { | |
898 | 898 | return { |
899 | 899 | datasources: { |
900 | 900 | valid: false | ... | ... |
... | ... | @@ -152,6 +152,7 @@ export interface WidgetTypeParameters { |
152 | 152 | useCustomDatasources?: boolean; |
153 | 153 | maxDatasources?: number; |
154 | 154 | maxDataKeys?: number; |
155 | + datasourcesOptional?: boolean; | |
155 | 156 | dataKeysOptional?: boolean; |
156 | 157 | stateData?: boolean; |
157 | 158 | hasDataPageLink?: boolean; | ... | ... |
1 | +#### Cell content function | |
2 | + | |
3 | +<div class="divider"></div> | |
4 | +<br/> | |
5 | + | |
6 | +*function (value, alarm, ctx): string* | |
7 | + | |
8 | +A JavaScript function used to compute alarm cell content HTML depending on alarm field value. | |
9 | + | |
10 | +**Parameters:** | |
11 | + | |
12 | +<ul> | |
13 | + <li><b>value:</b> <code>any</code> - An alarm field value displayed in the cell. | |
14 | + </li> | |
15 | + <li><b>alarm:</b> <code><a href="https://github.com/thingsboard/thingsboard/blob/e264f7b8ddff05bda85c4833bf497f47f447496e/ui-ngx/src/app/shared/models/alarm.models.ts#L108" target="_blank">AlarmDataInfo</a></code> - An | |
16 | + <a href="https://github.com/thingsboard/thingsboard/blob/e264f7b8ddff05bda85c4833bf497f47f447496e/ui-ngx/src/app/shared/models/alarm.models.ts#L108" target="_blank">AlarmDataInfo</a> object | |
17 | + presenting basic alarm properties (ex. <code>type</code>, <code>severity</code>, <code>originator</code>, etc.) and <br> provides access to other alarm or originator entity fields/attributes/timeseries declared in widget datasource configuration. | |
18 | + </li> | |
19 | + <li><b>ctx:</b> <code><a href="https://github.com/thingsboard/thingsboard/blob/5bb6403407aa4898084832d6698aa9ea6d484889/ui-ngx/src/app/modules/home/models/widget-component.models.ts#L107" target="_blank">WidgetContext</a></code> - A reference to <a href="https://github.com/thingsboard/thingsboard/blob/5bb6403407aa4898084832d6698aa9ea6d484889/ui-ngx/src/app/modules/home/models/widget-component.models.ts#L107" target="_blank">WidgetContext</a> that has all necessary API | |
20 | + and data used by widget instance. | |
21 | + </li> | |
22 | +</ul> | |
23 | + | |
24 | +**Returns:** | |
25 | + | |
26 | +Should return string value presenting cell content HTML. | |
27 | + | |
28 | +<div class="divider"></div> | |
29 | + | |
30 | +##### Examples | |
31 | + | |
32 | +* Format alarm start time using date/time pattern: | |
33 | + | |
34 | +```javascript | |
35 | +var startTime = value; | |
36 | +return startTime ? ctx.date.transform(startTime, 'yyyy-MM-dd HH:mm:ss') : ''; | |
37 | +{:copy-code} | |
38 | +``` | |
39 | + | |
40 | +* Styled cell content for originator alarm field: | |
41 | + | |
42 | +```javascript | |
43 | +var originator = value; | |
44 | +return '<div style="border: 2px solid #0072ff; ' + | |
45 | + 'border-radius: 10px; padding: 5px; ' + | |
46 | + 'background-color: #e0e1ff; ' + | |
47 | + 'text-align: center;">' + originator + '</div>'; | |
48 | +{:copy-code} | |
49 | +``` | |
50 | + | |
51 | +<br> | |
52 | +<br> | ... | ... |
1 | +#### Cell style function | |
2 | + | |
3 | +<div class="divider"></div> | |
4 | +<br/> | |
5 | + | |
6 | +*function (value, alarm, ctx): {[key: string]: string}* | |
7 | + | |
8 | +A JavaScript function used to compute alarm cell style depending on alarm field value. | |
9 | + | |
10 | +**Parameters:** | |
11 | + | |
12 | +<ul> | |
13 | + <li><b>value:</b> <code>any</code> - An alarm field value displayed in the cell. | |
14 | + </li> | |
15 | + <li><b>alarm:</b> <code><a href="https://github.com/thingsboard/thingsboard/blob/e264f7b8ddff05bda85c4833bf497f47f447496e/ui-ngx/src/app/shared/models/alarm.models.ts#L108" target="_blank">AlarmDataInfo</a></code> - An | |
16 | + <a href="https://github.com/thingsboard/thingsboard/blob/e264f7b8ddff05bda85c4833bf497f47f447496e/ui-ngx/src/app/shared/models/alarm.models.ts#L108" target="_blank">AlarmDataInfo</a> object | |
17 | + presenting basic alarm properties (ex. <code>type</code>, <code>severity</code>, <code>originator</code>, etc.) and <br> provides access to other alarm or originator entity fields/attributes/timeseries declared in widget datasource configuration. | |
18 | + </li> | |
19 | + <li><b>ctx:</b> <code><a href="https://github.com/thingsboard/thingsboard/blob/5bb6403407aa4898084832d6698aa9ea6d484889/ui-ngx/src/app/modules/home/models/widget-component.models.ts#L107" target="_blank">WidgetContext</a></code> - A reference to <a href="https://github.com/thingsboard/thingsboard/blob/5bb6403407aa4898084832d6698aa9ea6d484889/ui-ngx/src/app/modules/home/models/widget-component.models.ts#L107" target="_blank">WidgetContext</a> that has all necessary API | |
20 | + and data used by widget instance. | |
21 | + </li> | |
22 | +</ul> | |
23 | + | |
24 | +**Returns:** | |
25 | + | |
26 | +Should return key/value object presenting style attributes. | |
27 | + | |
28 | +<div class="divider"></div> | |
29 | + | |
30 | +##### Examples | |
31 | + | |
32 | +* Set color depending on alarm severity: | |
33 | + | |
34 | +```javascript | |
35 | +var severity = value; | |
36 | +var color = 'black'; | |
37 | +switch (severity) { | |
38 | + case 'CRITICAL': | |
39 | + color = 'red'; | |
40 | + break; | |
41 | + case 'MAJOR': | |
42 | + color = 'orange'; | |
43 | + break; | |
44 | + case 'MINOR': | |
45 | + color = '#ffca3d'; | |
46 | + break; | |
47 | + case 'WARNING': | |
48 | + color = '#abab00'; | |
49 | + break; | |
50 | + case 'INDETERMINATE': | |
51 | + color = 'green'; | |
52 | + break; | |
53 | +} | |
54 | +return { | |
55 | + fontWeight: 'bold', | |
56 | + color: color | |
57 | +}; | |
58 | +{:copy-code} | |
59 | +``` | |
60 | + | |
61 | +<br> | |
62 | +<br> | ... | ... |
1 | +#### Row style function | |
2 | + | |
3 | +<div class="divider"></div> | |
4 | +<br/> | |
5 | + | |
6 | +*function (alarm, ctx): {[key: string]: string}* | |
7 | + | |
8 | +A JavaScript function used to compute alarm row style depending on alarm value. | |
9 | + | |
10 | +**Parameters:** | |
11 | + | |
12 | +<ul> | |
13 | + <li><b>alarm:</b> <code><a href="https://github.com/thingsboard/thingsboard/blob/e264f7b8ddff05bda85c4833bf497f47f447496e/ui-ngx/src/app/shared/models/alarm.models.ts#L108" target="_blank">AlarmDataInfo</a></code> - An | |
14 | + <a href="https://github.com/thingsboard/thingsboard/blob/e264f7b8ddff05bda85c4833bf497f47f447496e/ui-ngx/src/app/shared/models/alarm.models.ts#L108" target="_blank">AlarmDataInfo</a> object | |
15 | + presenting basic alarm properties (ex. <code>type</code>, <code>severity</code>, <code>originator</code>, etc.) and <br> provides access to other alarm or originator entity fields/attributes/timeseries declared in widget datasource configuration. | |
16 | + </li> | |
17 | + <li><b>ctx:</b> <code><a href="https://github.com/thingsboard/thingsboard/blob/5bb6403407aa4898084832d6698aa9ea6d484889/ui-ngx/src/app/modules/home/models/widget-component.models.ts#L107" target="_blank">WidgetContext</a></code> - A reference to <a href="https://github.com/thingsboard/thingsboard/blob/5bb6403407aa4898084832d6698aa9ea6d484889/ui-ngx/src/app/modules/home/models/widget-component.models.ts#L107" target="_blank">WidgetContext</a> that has all necessary API | |
18 | + and data used by widget instance. | |
19 | + </li> | |
20 | +</ul> | |
21 | + | |
22 | +**Returns:** | |
23 | + | |
24 | +Should return key/value object presenting style attributes. | |
25 | + | |
26 | +<div class="divider"></div> | |
27 | + | |
28 | +##### Examples | |
29 | + | |
30 | +* Set row background color depending on alarm severity: | |
31 | + | |
32 | +```javascript | |
33 | +var severity = alarm.severity; | |
34 | +var color = '#fff'; | |
35 | +switch (severity) { | |
36 | + case 'CRITICAL': | |
37 | + color = 'red'; | |
38 | + break; | |
39 | + case 'MAJOR': | |
40 | + color = 'orange'; | |
41 | + break; | |
42 | + case 'MINOR': | |
43 | + color = '#ffca3d'; | |
44 | + break; | |
45 | + case 'WARNING': | |
46 | + color = '#abab00'; | |
47 | + break; | |
48 | + case 'INDETERMINATE': | |
49 | + color = 'green'; | |
50 | + break; | |
51 | +} | |
52 | +return { | |
53 | + backgroundColor: color | |
54 | +}; | |
55 | +{:copy-code} | |
56 | +``` | |
57 | + | |
58 | +<br> | |
59 | +<br> | ... | ... |
1 | +#### Node disabled function | |
2 | + | |
3 | +<div class="divider"></div> | |
4 | +<br/> | |
5 | + | |
6 | +*function (nodeCtx): boolean* | |
7 | + | |
8 | +A JavaScript function evaluating whether current node should be disabled (not selectable). | |
9 | + | |
10 | +**Parameters:** | |
11 | + | |
12 | +<ul> | |
13 | + <li><b>nodeCtx:</b> <code><a href="https://github.com/thingsboard/thingsboard/blob/e264f7b8ddff05bda85c4833bf497f47f447496e/ui-ngx/src/app/modules/home/components/widget/lib/entities-hierarchy-widget.models.ts#L35" target="_blank">HierarchyNodeContext</a></code> - An | |
14 | + <a href="https://github.com/thingsboard/thingsboard/blob/e264f7b8ddff05bda85c4833bf497f47f447496e/ui-ngx/src/app/modules/home/components/widget/lib/entities-hierarchy-widget.models.ts#L35" target="_blank">HierarchyNodeContext</a> object | |
15 | + containing <code>entity</code> field holding basic entity properties <br> (ex. <code>id</code>, <code>name</code>, <code>label</code>) and <code>data</code> field holding other entity attributes/timeseries declared in widget datasource configuration. | |
16 | + </li> | |
17 | +</ul> | |
18 | + | |
19 | +**Returns:** | |
20 | + | |
21 | +`true` if node should be disabled (not selectable), `false` otherwise. | |
22 | + | |
23 | +<div class="divider"></div> | |
24 | + | |
25 | +##### Examples | |
26 | + | |
27 | +* Disable current node according to the value of example `nodeDisabled` attribute: | |
28 | + | |
29 | +```javascript | |
30 | +var data = nodeCtx.data; | |
31 | +if (data.hasOwnProperty('nodeDisabled') && data['nodeDisabled'] !== null) { | |
32 | + return data['nodeDisabled'] === 'true'; | |
33 | +} else { | |
34 | + return false; | |
35 | +} | |
36 | +{:copy-code} | |
37 | +``` | |
38 | + | |
39 | +<br> | |
40 | +<br> | ... | ... |
1 | +#### Node has children function | |
2 | + | |
3 | +<div class="divider"></div> | |
4 | +<br/> | |
5 | + | |
6 | +*function (nodeCtx): boolean* | |
7 | + | |
8 | +A JavaScript function evaluating whether current node has children (whether it can be expanded). | |
9 | + | |
10 | +**Parameters:** | |
11 | + | |
12 | +<ul> | |
13 | + <li><b>nodeCtx:</b> <code><a href="https://github.com/thingsboard/thingsboard/blob/e264f7b8ddff05bda85c4833bf497f47f447496e/ui-ngx/src/app/modules/home/components/widget/lib/entities-hierarchy-widget.models.ts#L35" target="_blank">HierarchyNodeContext</a></code> - An | |
14 | + <a href="https://github.com/thingsboard/thingsboard/blob/e264f7b8ddff05bda85c4833bf497f47f447496e/ui-ngx/src/app/modules/home/components/widget/lib/entities-hierarchy-widget.models.ts#L35" target="_blank">HierarchyNodeContext</a> object | |
15 | + containing <code>entity</code> field holding basic entity properties <br> (ex. <code>id</code>, <code>name</code>, <code>label</code>) and <code>data</code> field holding other entity attributes/timeseries declared in widget datasource configuration. | |
16 | + </li> | |
17 | +</ul> | |
18 | + | |
19 | +**Returns:** | |
20 | + | |
21 | +`true` if node should have children, `false` otherwise. | |
22 | + | |
23 | +<div class="divider"></div> | |
24 | + | |
25 | +##### Examples | |
26 | + | |
27 | +* Restrict entities hierarchy expansion up to third level: | |
28 | + | |
29 | +```javascript | |
30 | +return nodeCtx.level <= 2; | |
31 | +{:copy-code} | |
32 | +``` | |
33 | + | |
34 | +* Restrict entities expansion according to the value of example `nodeHasChildren` attribute: | |
35 | + | |
36 | +```javascript | |
37 | +var data = nodeCtx.data; | |
38 | +if (data.hasOwnProperty('nodeHasChildren') && data['nodeHasChildren'] !== null) { | |
39 | + return data['nodeHasChildren'] === 'true'; | |
40 | +} else { | |
41 | + return true; | |
42 | +} | |
43 | +{:copy-code} | |
44 | +``` | |
45 | + | |
46 | +<br> | |
47 | +<br> | ... | ... |
1 | +#### Node icon function | |
2 | + | |
3 | +<div class="divider"></div> | |
4 | +<br/> | |
5 | + | |
6 | +*function (nodeCtx): {iconUrl?: string, materialIcon?: string} | 'default'* | |
7 | + | |
8 | +A JavaScript function used to compute node icon info. | |
9 | + | |
10 | +**Parameters:** | |
11 | + | |
12 | +<ul> | |
13 | + <li><b>nodeCtx:</b> <code><a href="https://github.com/thingsboard/thingsboard/blob/e264f7b8ddff05bda85c4833bf497f47f447496e/ui-ngx/src/app/modules/home/components/widget/lib/entities-hierarchy-widget.models.ts#L35" target="_blank">HierarchyNodeContext</a></code> - An | |
14 | + <a href="https://github.com/thingsboard/thingsboard/blob/e264f7b8ddff05bda85c4833bf497f47f447496e/ui-ngx/src/app/modules/home/components/widget/lib/entities-hierarchy-widget.models.ts#L35" target="_blank">HierarchyNodeContext</a> object | |
15 | + containing <code>entity</code> field holding basic entity properties <br> (ex. <code>id</code>, <code>name</code>, <code>label</code>) and <code>data</code> field holding other entity attributes/timeseries declared in widget datasource configuration. | |
16 | + </li> | |
17 | +</ul> | |
18 | + | |
19 | +**Returns:** | |
20 | + | |
21 | +Should return node icon info object with the following structure: | |
22 | + | |
23 | +```typescript | |
24 | +{ | |
25 | + iconUrl?: string, | |
26 | + materialIcon?: string | |
27 | +} | |
28 | +``` | |
29 | +Resulting object should contain either `materialIcon` or `iconUrl` property.<br> | |
30 | +Where: | |
31 | + - `materialIcon` - name of the material icon to be used from the [Material Icons Library{:target="_blank"}](https://material.io/tools/icons); | |
32 | + - `iconUrl` - url of the external image to be used as node icon. | |
33 | + | |
34 | +Function can return `default` string value. In this case default icons according to entity type will be used. | |
35 | + | |
36 | +<div class="divider"></div> | |
37 | + | |
38 | +##### Examples | |
39 | + | |
40 | +* Use external image for devices which name starts with `Test` and use default icons for the rest of entities: | |
41 | + | |
42 | +```javascript | |
43 | +var entity = nodeCtx.entity; | |
44 | +if (entity.id.entityType === 'DEVICE' && entity.name.startsWith('Test')) { | |
45 | + return {iconUrl: 'https://avatars1.githubusercontent.com/u/14793288?v=4&s=117'}; | |
46 | +} else { | |
47 | + return 'default'; | |
48 | +} | |
49 | +{:copy-code} | |
50 | +``` | |
51 | + | |
52 | +<br> | |
53 | +<br> | ... | ... |
1 | +#### Node opened by default function | |
2 | + | |
3 | +<div class="divider"></div> | |
4 | +<br/> | |
5 | + | |
6 | +*function (nodeCtx): boolean* | |
7 | + | |
8 | +A JavaScript function evaluating whether current node should be opened (expanded) when it first loaded. | |
9 | + | |
10 | +**Parameters:** | |
11 | + | |
12 | +<ul> | |
13 | + <li><b>nodeCtx:</b> <code><a href="https://github.com/thingsboard/thingsboard/blob/e264f7b8ddff05bda85c4833bf497f47f447496e/ui-ngx/src/app/modules/home/components/widget/lib/entities-hierarchy-widget.models.ts#L35" target="_blank">HierarchyNodeContext</a></code> - An | |
14 | + <a href="https://github.com/thingsboard/thingsboard/blob/e264f7b8ddff05bda85c4833bf497f47f447496e/ui-ngx/src/app/modules/home/components/widget/lib/entities-hierarchy-widget.models.ts#L35" target="_blank">HierarchyNodeContext</a> object | |
15 | + containing <code>entity</code> field holding basic entity properties <br> (ex. <code>id</code>, <code>name</code>, <code>label</code>) and <code>data</code> field holding other entity attributes/timeseries declared in widget datasource configuration. | |
16 | + </li> | |
17 | +</ul> | |
18 | + | |
19 | +**Returns:** | |
20 | + | |
21 | +`true` if node should be opened (expanded), `false` otherwise. | |
22 | + | |
23 | +<div class="divider"></div> | |
24 | + | |
25 | +##### Examples | |
26 | + | |
27 | +* Open by default nodes up to third level: | |
28 | + | |
29 | +```javascript | |
30 | +return nodeCtx.level <= 2; | |
31 | +{:copy-code} | |
32 | +``` | |
33 | + | |
34 | +<br> | |
35 | +<br> | ... | ... |
1 | +#### Node relations query function | |
2 | + | |
3 | +<div class="divider"></div> | |
4 | +<br/> | |
5 | + | |
6 | +*function (nodeCtx): [EntityRelationsQuery{:target="_blank"}](https://github.com/thingsboard/thingsboard/blob/dda61383933cac9aa6821a77ff9b19291e69db9f/ui-ngx/src/app/shared/models/relation.models.ts#L69) | 'default'* | |
7 | + | |
8 | +A JavaScript function used to compute child nodes relations query for current node. | |
9 | + | |
10 | +**Parameters:** | |
11 | + | |
12 | +<ul> | |
13 | + <li><b>nodeCtx:</b> <code><a href="https://github.com/thingsboard/thingsboard/blob/e264f7b8ddff05bda85c4833bf497f47f447496e/ui-ngx/src/app/modules/home/components/widget/lib/entities-hierarchy-widget.models.ts#L35" target="_blank">HierarchyNodeContext</a></code> - An | |
14 | + <a href="https://github.com/thingsboard/thingsboard/blob/e264f7b8ddff05bda85c4833bf497f47f447496e/ui-ngx/src/app/modules/home/components/widget/lib/entities-hierarchy-widget.models.ts#L35" target="_blank">HierarchyNodeContext</a> object | |
15 | + containing <code>entity</code> field holding basic entity properties <br> (ex. <code>id</code>, <code>name</code>, <code>label</code>) and <code>data</code> field holding other entity attributes/timeseries declared in widget datasource configuration. | |
16 | + </li> | |
17 | +</ul> | |
18 | + | |
19 | +**Returns:** | |
20 | + | |
21 | +Should return [EntityRelationsQuery{:target="_blank"}](https://github.com/thingsboard/thingsboard/blob/dda61383933cac9aa6821a77ff9b19291e69db9f/ui-ngx/src/app/shared/models/relation.models.ts#L69) for current node used to fetch entity children.<br> | |
22 | +Function can return `default` string value. In this case default relations query will be used. | |
23 | + | |
24 | +<div class="divider"></div> | |
25 | + | |
26 | +##### Examples | |
27 | + | |
28 | +* Fetch child entities having relations of type `Contains` from the current entity: | |
29 | + | |
30 | +```javascript | |
31 | +var entity = nodeCtx.entity; | |
32 | +var query = { | |
33 | + parameters: { | |
34 | + rootId: entity.id.id, | |
35 | + rootType: entity.id.entityType, | |
36 | + direction: "FROM", | |
37 | + maxLevel: 1 | |
38 | + }, | |
39 | + filters: [{ | |
40 | + relationType: "Contains", | |
41 | + entityTypes: [] | |
42 | + }] | |
43 | +}; | |
44 | +return query; | |
45 | +{:copy-code} | |
46 | +``` | |
47 | + | |
48 | +<br> | |
49 | +<br> | ... | ... |
1 | +#### Node text function | |
2 | + | |
3 | +<div class="divider"></div> | |
4 | +<br/> | |
5 | + | |
6 | +*function (nodeCtx): string* | |
7 | + | |
8 | +A JavaScript function used to compute text or HTML code for the current node. | |
9 | + | |
10 | +**Parameters:** | |
11 | + | |
12 | +<ul> | |
13 | + <li><b>nodeCtx:</b> <code><a href="https://github.com/thingsboard/thingsboard/blob/e264f7b8ddff05bda85c4833bf497f47f447496e/ui-ngx/src/app/modules/home/components/widget/lib/entities-hierarchy-widget.models.ts#L35" target="_blank">HierarchyNodeContext</a></code> - An | |
14 | + <a href="https://github.com/thingsboard/thingsboard/blob/e264f7b8ddff05bda85c4833bf497f47f447496e/ui-ngx/src/app/modules/home/components/widget/lib/entities-hierarchy-widget.models.ts#L35" target="_blank">HierarchyNodeContext</a> object | |
15 | + containing <code>entity</code> field holding basic entity properties <br> (ex. <code>id</code>, <code>name</code>, <code>label</code>) and <code>data</code> field holding other entity attributes/timeseries declared in widget datasource configuration. | |
16 | + </li> | |
17 | +</ul> | |
18 | + | |
19 | +**Returns:** | |
20 | + | |
21 | +Should return string value presenting text or HTML for the current node. | |
22 | + | |
23 | +<div class="divider"></div> | |
24 | + | |
25 | +##### Examples | |
26 | + | |
27 | +* Display entity name and optionally temperature value if it is present in entity attributes/timeseries: | |
28 | + | |
29 | +```javascript | |
30 | +var data = nodeCtx.data; | |
31 | +var entity = nodeCtx.entity; | |
32 | +var text = entity.name; | |
33 | +if (data.hasOwnProperty('temperature') && data['temperature'] !== null) { | |
34 | + text += " <b>"+ data['temperature'] +" °C</b>"; | |
35 | +} | |
36 | +return text; | |
37 | +{:copy-code} | |
38 | +``` | |
39 | + | |
40 | +<br> | |
41 | +<br> | ... | ... |
1 | +#### Nodes sort function | |
2 | + | |
3 | +<div class="divider"></div> | |
4 | +<br/> | |
5 | + | |
6 | +*function (nodeCtx1, nodeCtx2): number* | |
7 | + | |
8 | +A JavaScript function used to compare nodes of the same level when sorting. | |
9 | + | |
10 | +**Parameters:** | |
11 | + | |
12 | +<ul> | |
13 | + <li><b>nodeCtx1:</b> <code><a href="https://github.com/thingsboard/thingsboard/blob/e264f7b8ddff05bda85c4833bf497f47f447496e/ui-ngx/src/app/modules/home/components/widget/lib/entities-hierarchy-widget.models.ts#L35" target="_blank">HierarchyNodeContext</a></code> - First | |
14 | + node object to be compared. | |
15 | + </li> | |
16 | + <li><b>nodeCtx2:</b> <code><a href="https://github.com/thingsboard/thingsboard/blob/e264f7b8ddff05bda85c4833bf497f47f447496e/ui-ngx/src/app/modules/home/components/widget/lib/entities-hierarchy-widget.models.ts#L35" target="_blank">HierarchyNodeContext</a></code> - Second | |
17 | + node object to be compared. | |
18 | + </li> | |
19 | +</ul> | |
20 | + | |
21 | +**Returns:** | |
22 | + | |
23 | +Should return integer value presenting nodes comparison result: | |
24 | +- **less than 0** - sort `nodeCtx1` to an index lower than `nodeCtx2`; | |
25 | +- **0** - leave `nodeCtx1` and `nodeCtx2` unchanged with respect to each other; | |
26 | +- **greater than 0** - sort `nodeCtx2` to an index lower than `nodeCtx1`; | |
27 | + | |
28 | +<div class="divider"></div> | |
29 | + | |
30 | +##### Examples | |
31 | + | |
32 | +* Sort entities first by entity type in alphabetical order then by entity name in alphabetical order: | |
33 | + | |
34 | +```javascript | |
35 | +var result = nodeCtx1.entity.id.entityType.localeCompare(nodeCtx2.entity.id.entityType); | |
36 | +if (result === 0) { | |
37 | + result = nodeCtx1.entity.name.localeCompare(nodeCtx2.entity.name); | |
38 | +} | |
39 | +return result; | |
40 | +{:copy-code} | |
41 | +``` | |
42 | + | |
43 | +<br> | |
44 | +<br> | ... | ... |
1 | +#### Cell content function | |
2 | + | |
3 | +<div class="divider"></div> | |
4 | +<br/> | |
5 | + | |
6 | +*function (value, entity, ctx): string* | |
7 | + | |
8 | +A JavaScript function used to compute entity cell content HTML depending on entity field value. | |
9 | + | |
10 | +**Parameters:** | |
11 | + | |
12 | +<ul> | |
13 | + <li><b>value:</b> <code>any</code> - An entity field value displayed in the cell. | |
14 | + </li> | |
15 | + <li><b>entity:</b> <code><a href="https://github.com/thingsboard/thingsboard/blob/e264f7b8ddff05bda85c4833bf497f47f447496e/ui-ngx/src/app/modules/home/components/widget/lib/table-widget.models.ts#L61" target="_blank">EntityData</a></code> - An | |
16 | + <a href="https://github.com/thingsboard/thingsboard/blob/e264f7b8ddff05bda85c4833bf497f47f447496e/ui-ngx/src/app/modules/home/components/widget/lib/table-widget.models.ts#L61" target="_blank">EntityData</a> object | |
17 | + presenting basic entity properties (ex. <code>id</code>, <code>entityName</code>) and <br> provides access to other entity attributes/timeseries declared in widget datasource configuration. | |
18 | + </li> | |
19 | + <li><b>ctx:</b> <code><a href="https://github.com/thingsboard/thingsboard/blob/5bb6403407aa4898084832d6698aa9ea6d484889/ui-ngx/src/app/modules/home/models/widget-component.models.ts#L107" target="_blank">WidgetContext</a></code> - A reference to <a href="https://github.com/thingsboard/thingsboard/blob/5bb6403407aa4898084832d6698aa9ea6d484889/ui-ngx/src/app/modules/home/models/widget-component.models.ts#L107" target="_blank">WidgetContext</a> that has all necessary API | |
20 | + and data used by widget instance. | |
21 | + </li> | |
22 | +</ul> | |
23 | + | |
24 | +**Returns:** | |
25 | + | |
26 | +Should return string value presenting cell content HTML. | |
27 | + | |
28 | +<div class="divider"></div> | |
29 | + | |
30 | +##### Examples | |
31 | + | |
32 | +* Format entity created time using date/time pattern: | |
33 | + | |
34 | +```javascript | |
35 | +var createdTime = value; | |
36 | +return createdTime ? ctx.date.transform(createdTime, 'yyyy-MM-dd HH:mm:ss') : ''; | |
37 | +{:copy-code} | |
38 | +``` | |
39 | + | |
40 | +* Styled cell content for device type field: | |
41 | + | |
42 | +```javascript | |
43 | +var deviceType = value; | |
44 | +var color = '#fff'; | |
45 | +switch (deviceType) { | |
46 | + case 'thermostat': | |
47 | + color = 'orange'; | |
48 | + break; | |
49 | + case 'default': | |
50 | + color = '#abab00'; | |
51 | + break; | |
52 | +} | |
53 | +return '<div style="border: 2px solid #0072ff; ' + | |
54 | + 'border-radius: 10px; padding: 5px; ' + | |
55 | + 'background-color: '+ color +'; ' + | |
56 | + 'text-align: center;">' + deviceType + '</div>'; | |
57 | +{:copy-code} | |
58 | +``` | |
59 | + | |
60 | +<br> | |
61 | +<br> | ... | ... |
1 | +#### Cell style function | |
2 | + | |
3 | +<div class="divider"></div> | |
4 | +<br/> | |
5 | + | |
6 | +*function (value, entity, ctx): {[key: string]: string}* | |
7 | + | |
8 | +A JavaScript function used to compute entity cell style depending on entity field value. | |
9 | + | |
10 | +**Parameters:** | |
11 | + | |
12 | +<ul> | |
13 | + <li><b>value:</b> <code>any</code> - An entity field value displayed in the cell. | |
14 | + </li> | |
15 | + <li><b>entity:</b> <code><a href="https://github.com/thingsboard/thingsboard/blob/e264f7b8ddff05bda85c4833bf497f47f447496e/ui-ngx/src/app/modules/home/components/widget/lib/table-widget.models.ts#L61" target="_blank">EntityData</a></code> - An | |
16 | + <a href="https://github.com/thingsboard/thingsboard/blob/e264f7b8ddff05bda85c4833bf497f47f447496e/ui-ngx/src/app/modules/home/components/widget/lib/table-widget.models.ts#L61" target="_blank">EntityData</a> object | |
17 | + presenting basic entity properties (ex. <code>id</code>, <code>entityName</code>) and <br> provides access to other entity attributes/timeseries declared in widget datasource configuration. | |
18 | + </li> | |
19 | + <li><b>ctx:</b> <code><a href="https://github.com/thingsboard/thingsboard/blob/5bb6403407aa4898084832d6698aa9ea6d484889/ui-ngx/src/app/modules/home/models/widget-component.models.ts#L107" target="_blank">WidgetContext</a></code> - A reference to <a href="https://github.com/thingsboard/thingsboard/blob/5bb6403407aa4898084832d6698aa9ea6d484889/ui-ngx/src/app/modules/home/models/widget-component.models.ts#L107" target="_blank">WidgetContext</a> that has all necessary API | |
20 | + and data used by widget instance. | |
21 | + </li> | |
22 | +</ul> | |
23 | + | |
24 | +**Returns:** | |
25 | + | |
26 | +Should return key/value object presenting style attributes. | |
27 | + | |
28 | +<div class="divider"></div> | |
29 | + | |
30 | +##### Examples | |
31 | + | |
32 | +* Set color depending on device temperature value: | |
33 | + | |
34 | +```javascript | |
35 | +var temperature = value; | |
36 | +var color = 'black'; | |
37 | +if (temperature) { | |
38 | + if (temperature > 25) { | |
39 | + color = 'red'; | |
40 | + } else { | |
41 | + color = 'green'; | |
42 | + } | |
43 | +} | |
44 | +return { | |
45 | + fontWeight: 'bold', | |
46 | + color: color | |
47 | +}; | |
48 | +{:copy-code} | |
49 | +``` | |
50 | + | |
51 | +<br> | |
52 | +<br> | ... | ... |
1 | +#### Row style function | |
2 | + | |
3 | +<div class="divider"></div> | |
4 | +<br/> | |
5 | + | |
6 | +*function (entity, ctx): {[key: string]: string}* | |
7 | + | |
8 | +A JavaScript function used to compute entity row style depending on entity value. | |
9 | + | |
10 | +**Parameters:** | |
11 | + | |
12 | +<ul> | |
13 | + <li><b>entity:</b> <code><a href="https://github.com/thingsboard/thingsboard/blob/e264f7b8ddff05bda85c4833bf497f47f447496e/ui-ngx/src/app/modules/home/components/widget/lib/table-widget.models.ts#L61" target="_blank">EntityData</a></code> - An | |
14 | + <a href="https://github.com/thingsboard/thingsboard/blob/e264f7b8ddff05bda85c4833bf497f47f447496e/ui-ngx/src/app/modules/home/components/widget/lib/table-widget.models.ts#L61" target="_blank">EntityData</a> object | |
15 | + presenting basic entity properties (ex. <code>id</code>, <code>entityName</code>) and <br> provides access to other entity attributes/timeseries declared in widget datasource configuration. | |
16 | + </li> | |
17 | + <li><b>ctx:</b> <code><a href="https://github.com/thingsboard/thingsboard/blob/5bb6403407aa4898084832d6698aa9ea6d484889/ui-ngx/src/app/modules/home/models/widget-component.models.ts#L107" target="_blank">WidgetContext</a></code> - A reference to <a href="https://github.com/thingsboard/thingsboard/blob/5bb6403407aa4898084832d6698aa9ea6d484889/ui-ngx/src/app/modules/home/models/widget-component.models.ts#L107" target="_blank">WidgetContext</a> that has all necessary API | |
18 | + and data used by widget instance. | |
19 | + </li> | |
20 | +</ul> | |
21 | + | |
22 | +**Returns:** | |
23 | + | |
24 | +Should return key/value object presenting style attributes. | |
25 | + | |
26 | +<div class="divider"></div> | |
27 | + | |
28 | +##### Examples | |
29 | + | |
30 | +* Set row background color depending on device type: | |
31 | + | |
32 | +```javascript | |
33 | +var deviceType = entity.Type; | |
34 | +var color = '#fff'; | |
35 | +switch (deviceType) { | |
36 | + case 'thermostat': | |
37 | + color = 'orange'; | |
38 | + break; | |
39 | + case 'default': | |
40 | + color = '#abab00'; | |
41 | + break; | |
42 | +} | |
43 | +return { | |
44 | + backgroundColor: color | |
45 | +}; | |
46 | +{:copy-code} | |
47 | +``` | |
48 | + | |
49 | +<br> | |
50 | +<br> | ... | ... |
1 | +#### Point shape draw function | |
2 | + | |
3 | +<div class="divider"></div> | |
4 | +<br/> | |
5 | + | |
6 | +*function (ctx, x, y, radius, shadow): void* | |
7 | + | |
8 | +A JavaScript function used to draw custom shapes for chart points when `Custom function` for point shape is selected. | |
9 | + | |
10 | +**Parameters:** | |
11 | + | |
12 | +<ul> | |
13 | + <li> | |
14 | + <b>ctx:</b> <code><a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D">CanvasRenderingContext2D</a></code> - A canvas drawing context. | |
15 | + </li> | |
16 | + <li> | |
17 | + <b>x</b> <code>number</code> - point center X coordinate. | |
18 | + </li> | |
19 | + <li> | |
20 | + <b>y</b> <code>number</code> - point center Y coordinate. | |
21 | + </li> | |
22 | + <li> | |
23 | + <b>radius</b> <code>number</code> - point radius. | |
24 | + </li> | |
25 | + <li> | |
26 | + <b>shadow</b> <code>boolean</code> - whether to draw shadow. | |
27 | + </li> | |
28 | +</ul> | |
29 | + | |
30 | +<div class="divider"></div> | |
31 | + | |
32 | +##### Examples | |
33 | + | |
34 | +* Draw square: | |
35 | + | |
36 | +```javascript | |
37 | +var size = radius * Math.sqrt(Math.PI) / 2; | |
38 | +ctx.rect(x - size, y - size, size + size, size + size); | |
39 | +{:copy-code} | |
40 | +``` | |
41 | + | |
42 | +* Draw circle: | |
43 | + | |
44 | +```javascript | |
45 | +ctx.moveTo(x + radius, y); | |
46 | +ctx.arc(x, y, radius, 0, shadow ? Math.PI : Math.PI * 2, false); | |
47 | +{:copy-code} | |
48 | +``` | |
49 | + | |
50 | +* Draw diamond: | |
51 | + | |
52 | +```javascript | |
53 | +var size = radius * Math.sqrt(Math.PI / 2); | |
54 | +ctx.moveTo(x - size, y); | |
55 | +ctx.lineTo(x, y - size); | |
56 | +ctx.lineTo(x + size, y); | |
57 | +ctx.lineTo(x, y + size); | |
58 | +ctx.lineTo(x - size, y); | |
59 | +ctx.lineTo(x, y - size); | |
60 | +{:copy-code} | |
61 | +``` | |
62 | + | |
63 | +* Draw triangle: | |
64 | + | |
65 | +```javascript | |
66 | +var size = radius * Math.sqrt(2 * Math.PI / Math.sin(Math.PI / 3)); | |
67 | +var height = size * Math.sin(Math.PI / 3); | |
68 | +ctx.moveTo(x - size / 2, y + height / 2); | |
69 | +ctx.lineTo(x + size / 2, y + height / 2); | |
70 | +if (!shadow) { | |
71 | + ctx.lineTo(x, y - height / 2); | |
72 | + ctx.lineTo(x - size / 2, y + height / 2); | |
73 | + ctx.lineTo(x + size / 2, y + height / 2); | |
74 | +} | |
75 | +{:copy-code} | |
76 | +``` | |
77 | + | |
78 | +* Draw cross: | |
79 | + | |
80 | +```javascript | |
81 | +var size = radius * Math.sqrt(Math.PI) / 2; | |
82 | +ctx.moveTo(x - size, y - size); | |
83 | +ctx.lineTo(x + size, y + size); | |
84 | +ctx.moveTo(x - size, y + size); | |
85 | +ctx.lineTo(x + size, y - size); | |
86 | +{:copy-code} | |
87 | +``` | |
88 | + | |
89 | +* Draw ellipse: | |
90 | + | |
91 | +```javascript | |
92 | +if (!shadow) { | |
93 | + ctx.moveTo(x + radius, y); | |
94 | + ctx.arc(x, y, radius, 0, Math.PI * 2, false); | |
95 | +} | |
96 | +{:copy-code} | |
97 | +``` | |
98 | + | |
99 | +* Draw plus: | |
100 | + | |
101 | +```javascript | |
102 | +var size = radius * Math.sqrt(Math.PI / 2); | |
103 | +ctx.moveTo(x - size, y); | |
104 | +ctx.lineTo(x + size, y); | |
105 | +ctx.moveTo(x, y + size); | |
106 | +ctx.lineTo(x, y - size); | |
107 | +{:copy-code} | |
108 | +``` | |
109 | + | |
110 | +<br> | |
111 | +<br> | ... | ... |
1 | +#### Ticks formatter function | |
2 | + | |
3 | +<div class="divider"></div> | |
4 | +<br/> | |
5 | + | |
6 | +*function (value): string* | |
7 | + | |
8 | +A JavaScript function used to format Y axis ticks. | |
9 | + | |
10 | +**Parameters:** | |
11 | + | |
12 | +<ul> | |
13 | + <li><b>value:</b> <code>number</code> - A tick value that should be formatted. | |
14 | + </li> | |
15 | +</ul> | |
16 | + | |
17 | +**Returns:** | |
18 | + | |
19 | +A string presenting the formatted value to be displayed as Y axis tick. | |
20 | + | |
21 | +<div class="divider"></div> | |
22 | + | |
23 | +##### Examples | |
24 | + | |
25 | +* Display ticks as is: | |
26 | + | |
27 | +```javascript | |
28 | +return value; | |
29 | +{:copy-code} | |
30 | +``` | |
31 | + | |
32 | +* Present ticks in Amperage (A) units and two decimal places: | |
33 | + | |
34 | +```javascript | |
35 | +return value.toFixed(2) + ' A'; | |
36 | +{:copy-code} | |
37 | +``` | |
38 | + | |
39 | +* Disable ticks: | |
40 | + | |
41 | +```javascript | |
42 | +return ''; | |
43 | +{:copy-code} | |
44 | +``` | |
45 | + | |
46 | +<ul> | |
47 | +<li> | |
48 | +To present axis ticks for true / false or 1 / 0 data.<br> | |
49 | +Display <code>On</code> when value > <code>0</code> and <= <code>1</code>,<br> | |
50 | +<code>Off</code> when value = <code>0</code>,<br> | |
51 | +disable for all other values.<br> | |
52 | +<strong>Note: </strong> To avoid duplicates among Y axis ticks it is recommended to set <strong><i>Steps size between ticks</i></strong> to <code>1</code>: | |
53 | +</li> | |
54 | +</ul> | |
55 | + | |
56 | +```javascript | |
57 | +if (value > 0 && value <= 1) { | |
58 | + return 'On'; | |
59 | +} else if (value === 0) { | |
60 | + return 'Off'; | |
61 | +} else { | |
62 | + return ''; | |
63 | +} | |
64 | +{:copy-code} | |
65 | +``` | |
66 | + | |
67 | +<ul> | |
68 | +<li> | |
69 | +To present axis ticks for state or level data.<br> | |
70 | +Display <code>High</code> when value >= <code>2</code>,<br> | |
71 | +<code>Medium</code> when value >= <code>1</code> and < <code>2</code>,<br> | |
72 | +<code>Low</code> when value >= <code>0</code> and < <code>1</code>,<br> | |
73 | +disable for all other values.<br> | |
74 | +<strong>Note: </strong> To avoid duplicates among Y axis ticks it is recommended to set <strong><i>Steps size between ticks</i></strong> to <code>1</code><br> | |
75 | +or other suitable value depending on your case: | |
76 | +</li> | |
77 | +</ul> | |
78 | + | |
79 | +```javascript | |
80 | +if (value >= 2) { | |
81 | + return 'High'; | |
82 | +} else if (value >= 1) { | |
83 | + return 'Medium'; | |
84 | +} else if (value >= 0) { | |
85 | + return 'Low'; | |
86 | +} else { | |
87 | + return ''; | |
88 | +} | |
89 | +{:copy-code} | |
90 | +``` | |
91 | + | |
92 | +<br> | |
93 | +<br> | ... | ... |
ui-ngx/src/assets/help/en_US/widget/lib/flot/tooltip_value_format_fn.md
renamed from
ui-ngx/src/assets/help/en_US/widget/lib/tooltip_value_format_fn.md
1 | +#### Cell content function | |
2 | + | |
3 | +<div class="divider"></div> | |
4 | +<br/> | |
5 | + | |
6 | +*function (value, rowData, ctx): string* | |
7 | + | |
8 | +A JavaScript function used to compute timeseries cell content HTML depending on timeseries field value. | |
9 | + | |
10 | +**Parameters:** | |
11 | + | |
12 | +<ul> | |
13 | + <li><b>value:</b> <code>any</code> - An entity field value displayed in the cell. | |
14 | + </li> | |
15 | + <li><b>rowData:</b> <code><a href="https://github.com/thingsboard/thingsboard/blob/e264f7b8ddff05bda85c4833bf497f47f447496e/ui-ngx/src/app/modules/home/components/widget/lib/timeseries-table-widget.component.ts#L80" target="_blank">TimeseriesRow</a></code> - A | |
16 | + <a href="https://github.com/thingsboard/thingsboard/blob/e264f7b8ddff05bda85c4833bf497f47f447496e/ui-ngx/src/app/modules/home/components/widget/lib/timeseries-table-widget.component.ts#L80" target="_blank">TimeseriesRow</a> object | |
17 | + presenting <code>formattedTs</code> (a string value of formatted timestamp) and <br> timeseries values for each column declared in widget datasource configuration. | |
18 | + </li> | |
19 | + <li><b>ctx:</b> <code><a href="https://github.com/thingsboard/thingsboard/blob/5bb6403407aa4898084832d6698aa9ea6d484889/ui-ngx/src/app/modules/home/models/widget-component.models.ts#L107" target="_blank">WidgetContext</a></code> - A reference to <a href="https://github.com/thingsboard/thingsboard/blob/5bb6403407aa4898084832d6698aa9ea6d484889/ui-ngx/src/app/modules/home/models/widget-component.models.ts#L107" target="_blank">WidgetContext</a> that has all necessary API | |
20 | + and data used by widget instance. | |
21 | + </li> | |
22 | +</ul> | |
23 | + | |
24 | +**Returns:** | |
25 | + | |
26 | +Should return string value presenting cell content HTML. | |
27 | + | |
28 | +<div class="divider"></div> | |
29 | + | |
30 | +##### Examples | |
31 | + | |
32 | +* Styled cell content for temperature field: | |
33 | + | |
34 | +```javascript | |
35 | +var temperature = value; | |
36 | +var color = '#fff'; | |
37 | +if (temperature) { | |
38 | + if (temperature > 25) { | |
39 | + color = 'red'; | |
40 | + } else { | |
41 | + color = 'green'; | |
42 | + } | |
43 | +} | |
44 | +return '<div style="border: 2px solid #0072ff; ' + | |
45 | + 'border-radius: 10px; padding: 5px; ' + | |
46 | + 'color: #fff; ' + | |
47 | + 'background-color: '+ color +'; ' + | |
48 | + 'text-align: center;">' + temperature + '</div>'; | |
49 | +{:copy-code} | |
50 | +``` | |
51 | + | |
52 | +<br> | |
53 | +<br> | ... | ... |
1 | +#### Cell style function | |
2 | + | |
3 | +<div class="divider"></div> | |
4 | +<br/> | |
5 | + | |
6 | +*function (value, rowData, ctx): {[key: string]: string}* | |
7 | + | |
8 | +A JavaScript function used to compute timeseries cell style depending on timeseries field value. | |
9 | + | |
10 | +**Parameters:** | |
11 | + | |
12 | +<ul> | |
13 | + <li><b>value:</b> <code>any</code> - An timeseries field value displayed in the cell. | |
14 | + </li> | |
15 | + <li><b>rowData:</b> <code><a href="https://github.com/thingsboard/thingsboard/blob/e264f7b8ddff05bda85c4833bf497f47f447496e/ui-ngx/src/app/modules/home/components/widget/lib/timeseries-table-widget.component.ts#L80" target="_blank">TimeseriesRow</a></code> - A | |
16 | + <a href="https://github.com/thingsboard/thingsboard/blob/e264f7b8ddff05bda85c4833bf497f47f447496e/ui-ngx/src/app/modules/home/components/widget/lib/timeseries-table-widget.component.ts#L80" target="_blank">TimeseriesRow</a> object | |
17 | + presenting <code>formattedTs</code> (a string value of formatted timestamp) and <br> timeseries values for each column declared in widget datasource configuration. | |
18 | + </li> | |
19 | + <li><b>ctx:</b> <code><a href="https://github.com/thingsboard/thingsboard/blob/5bb6403407aa4898084832d6698aa9ea6d484889/ui-ngx/src/app/modules/home/models/widget-component.models.ts#L107" target="_blank">WidgetContext</a></code> - A reference to <a href="https://github.com/thingsboard/thingsboard/blob/5bb6403407aa4898084832d6698aa9ea6d484889/ui-ngx/src/app/modules/home/models/widget-component.models.ts#L107" target="_blank">WidgetContext</a> that has all necessary API | |
20 | + and data used by widget instance. | |
21 | + </li> | |
22 | +</ul> | |
23 | + | |
24 | +**Returns:** | |
25 | + | |
26 | +Should return key/value object presenting style attributes. | |
27 | + | |
28 | +<div class="divider"></div> | |
29 | + | |
30 | +##### Examples | |
31 | + | |
32 | +* Set color depending on temperature value: | |
33 | + | |
34 | +```javascript | |
35 | +var temperature = value; | |
36 | +var color = 'black'; | |
37 | +if (temperature) { | |
38 | + if (temperature > 25) { | |
39 | + color = 'red'; | |
40 | + } else { | |
41 | + color = 'green'; | |
42 | + } | |
43 | +} | |
44 | +return { | |
45 | + fontWeight: 'bold', | |
46 | + color: color | |
47 | +}; | |
48 | +{:copy-code} | |
49 | +``` | |
50 | + | |
51 | +<br> | |
52 | +<br> | ... | ... |
1 | +#### Row style function | |
2 | + | |
3 | +<div class="divider"></div> | |
4 | +<br/> | |
5 | + | |
6 | +*function (rowData, ctx): {[key: string]: string}* | |
7 | + | |
8 | +A JavaScript function used to compute timeseries row style depending on row value. | |
9 | + | |
10 | +**Parameters:** | |
11 | + | |
12 | +<ul> | |
13 | + <li><b>rowData:</b> <code><a href="https://github.com/thingsboard/thingsboard/blob/e264f7b8ddff05bda85c4833bf497f47f447496e/ui-ngx/src/app/modules/home/components/widget/lib/timeseries-table-widget.component.ts#L80" target="_blank">TimeseriesRow</a></code> - A | |
14 | + <a href="https://github.com/thingsboard/thingsboard/blob/e264f7b8ddff05bda85c4833bf497f47f447496e/ui-ngx/src/app/modules/home/components/widget/lib/timeseries-table-widget.component.ts#L80" target="_blank">TimeseriesRow</a> object | |
15 | + presenting <code>formattedTs</code> (a string value of formatted timestamp) and <br> timeseries values for each column declared in widget datasource configuration. | |
16 | + </li> | |
17 | + <li><b>ctx:</b> <code><a href="https://github.com/thingsboard/thingsboard/blob/5bb6403407aa4898084832d6698aa9ea6d484889/ui-ngx/src/app/modules/home/models/widget-component.models.ts#L107" target="_blank">WidgetContext</a></code> - A reference to <a href="https://github.com/thingsboard/thingsboard/blob/5bb6403407aa4898084832d6698aa9ea6d484889/ui-ngx/src/app/modules/home/models/widget-component.models.ts#L107" target="_blank">WidgetContext</a> that has all necessary API | |
18 | + and data used by widget instance. | |
19 | + </li> | |
20 | +</ul> | |
21 | + | |
22 | +**Returns:** | |
23 | + | |
24 | +Should return key/value object presenting style attributes. | |
25 | + | |
26 | +<div class="divider"></div> | |
27 | + | |
28 | +##### Examples | |
29 | + | |
30 | +* Set row background color depending on temperature value: | |
31 | + | |
32 | +```javascript | |
33 | +var temperature = rowData.temperature; | |
34 | +var color = '#fff'; | |
35 | +if (temperature) { | |
36 | + if (temperature > 25) { | |
37 | + color = 'red'; | |
38 | + } else { | |
39 | + color = 'green'; | |
40 | + } | |
41 | +} | |
42 | +return { | |
43 | + backgroundColor: color | |
44 | +}; | |
45 | +{:copy-code} | |
46 | +``` | |
47 | + | |
48 | +<br> | |
49 | +<br> | ... | ... |