Showing
9 changed files
with
21 additions
and
20 deletions
... | ... | @@ -47,7 +47,7 @@ |
47 | 47 | "resources": [], |
48 | 48 | "templateHtml": "<tb-timeseries-table-widget \n [ctx]=\"ctx\">\n</tb-timeseries-table-widget>", |
49 | 49 | "templateCss": "", |
50 | - "controllerScript": "self.onInit = function() {\n}\n\nself.onDataUpdated = function() {\n self.ctx.$scope.timeseriesTableWidget.onDataUpdated();\n}\n\nself.typeParameters = function() {\n return {\n reloadOnlyOnDataUpdated: true\n };\n}\n\nself.actionSources = function() {\n return {\n 'actionCellButton': {\n name: 'widget-action.action-cell-button',\n multiple: true\n },\n 'rowClick': {\n name: 'widget-action.row-click',\n multiple: false\n }\n };\n}\n\nself.onDestroy = function() {\n}", | |
50 | + "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 },\n 'rowClick': {\n name: 'widget-action.row-click',\n multiple: false\n }\n };\n}\n\nself.onDestroy = function() {\n}", | |
51 | 51 | "settingsSchema": "{\n \"schema\": {\n \"type\": \"object\",\n \"title\": \"TimeseriesTableSettings\",\n \"properties\": {\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 \"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 },\n \"required\": []\n },\n \"form\": [\n \"showTimestamp\",\n \"showMilliseconds\",\n \"displayPagination\",\n \"defaultPageSize\",\n \"hideEmptyLines\"\n ]\n}", |
52 | 52 | "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)\",\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 },\n \"useCellContentFunction\",\n {\n \"key\": \"cellContentFunction\",\n \"type\": \"javascript\"\n }\n ]\n}", |
53 | 53 | "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\"}" | ... | ... |
... | ... | @@ -92,7 +92,7 @@ export class DataAggregator { |
92 | 92 | private interval: number, |
93 | 93 | private stateData: boolean, |
94 | 94 | private utils: UtilsService, |
95 | - private isReloadOnlyOnDataUpdated: boolean) { | |
95 | + private ignoreDataUpdateOnIntervalTick: boolean) { | |
96 | 96 | this.tsKeyNames.forEach((key) => { |
97 | 97 | this.dataBuffer[key] = []; |
98 | 98 | }); |
... | ... | @@ -205,7 +205,7 @@ export class DataAggregator { |
205 | 205 | } else { |
206 | 206 | this.data = this.updateData(); |
207 | 207 | } |
208 | - if (this.onDataCb && (!this.isReloadOnlyOnDataUpdated || this.updatedData)) { | |
208 | + if (this.onDataCb && (!this.ignoreDataUpdateOnIntervalTick || this.updatedData)) { | |
209 | 209 | this.onDataCb(this.data, detectChanges); |
210 | 210 | this.updatedData = false; |
211 | 211 | } | ... | ... |
... | ... | @@ -66,7 +66,7 @@ export interface EntityDataSubscriptionOptions { |
66 | 66 | type: widgetType; |
67 | 67 | entityFilter?: EntityFilter; |
68 | 68 | isPaginatedDataSubscription?: boolean; |
69 | - isReloadOnlyOnDataUpdated?: boolean; | |
69 | + ignoreDataUpdateOnIntervalTick?: boolean; | |
70 | 70 | pageLink?: EntityDataPageLink; |
71 | 71 | keyFilters?: Array<KeyFilter>; |
72 | 72 | additionalKeyFilters?: Array<KeyFilter>; |
... | ... | @@ -673,7 +673,7 @@ export class EntityDataSubscription { |
673 | 673 | subsTw.aggregation.interval, |
674 | 674 | subsTw.aggregation.stateData, |
675 | 675 | this.utils, |
676 | - this.entityDataSubscriptionOptions.isReloadOnlyOnDataUpdated | |
676 | + this.entityDataSubscriptionOptions.ignoreDataUpdateOnIntervalTick | |
677 | 677 | ); |
678 | 678 | } |
679 | 679 | ... | ... |
... | ... | @@ -61,7 +61,7 @@ export class EntityDataService { |
61 | 61 | private utils: UtilsService) {} |
62 | 62 | |
63 | 63 | public prepareSubscription(listener: EntityDataListener, |
64 | - isReloadOnlyOnDataUpdated = false): Observable<EntityDataLoadResult> { | |
64 | + ignoreDataUpdateOnIntervalTick = false): Observable<EntityDataLoadResult> { | |
65 | 65 | const datasource = listener.configDatasource; |
66 | 66 | listener.subscriptionOptions = this.createSubscriptionOptions( |
67 | 67 | datasource, |
... | ... | @@ -70,7 +70,7 @@ export class EntityDataService { |
70 | 70 | datasource.keyFilters, |
71 | 71 | null, |
72 | 72 | false, |
73 | - isReloadOnlyOnDataUpdated); | |
73 | + ignoreDataUpdateOnIntervalTick); | |
74 | 74 | if (datasource.type === DatasourceType.entity && (!datasource.entityFilter || !datasource.pageLink)) { |
75 | 75 | return of(null); |
76 | 76 | } |
... | ... | @@ -90,7 +90,7 @@ export class EntityDataService { |
90 | 90 | public subscribeForPaginatedData(listener: EntityDataListener, |
91 | 91 | pageLink: EntityDataPageLink, |
92 | 92 | keyFilters: KeyFilter[], |
93 | - isReloadOnlyOnDataUpdated = false): Observable<EntityDataLoadResult> { | |
93 | + ignoreDataUpdateOnIntervalTick = false): Observable<EntityDataLoadResult> { | |
94 | 94 | const datasource = listener.configDatasource; |
95 | 95 | listener.subscriptionOptions = this.createSubscriptionOptions( |
96 | 96 | datasource, |
... | ... | @@ -99,7 +99,7 @@ export class EntityDataService { |
99 | 99 | datasource.keyFilters, |
100 | 100 | keyFilters, |
101 | 101 | true, |
102 | - isReloadOnlyOnDataUpdated); | |
102 | + ignoreDataUpdateOnIntervalTick); | |
103 | 103 | if (datasource.type === DatasourceType.entity && (!datasource.entityFilter || !pageLink)) { |
104 | 104 | listener.dataLoaded(emptyPageData<EntityData>(), [], |
105 | 105 | listener.configDatasourceIndex, listener.subscriptionOptions.pageLink); |
... | ... | @@ -124,7 +124,7 @@ export class EntityDataService { |
124 | 124 | keyFilters: KeyFilter[], |
125 | 125 | additionalKeyFilters: KeyFilter[], |
126 | 126 | isPaginatedDataSubscription: boolean, |
127 | - isReloadOnlyOnDataUpdated: boolean): EntityDataSubscriptionOptions { | |
127 | + ignoreDataUpdateOnIntervalTick: boolean): EntityDataSubscriptionOptions { | |
128 | 128 | const subscriptionDataKeys: Array<SubscriptionDataKey> = []; |
129 | 129 | datasource.dataKeys.forEach((dataKey) => { |
130 | 130 | const subscriptionDataKey: SubscriptionDataKey = { |
... | ... | @@ -147,7 +147,7 @@ export class EntityDataService { |
147 | 147 | entityDataSubscriptionOptions.additionalKeyFilters = additionalKeyFilters; |
148 | 148 | } |
149 | 149 | entityDataSubscriptionOptions.isPaginatedDataSubscription = isPaginatedDataSubscription; |
150 | - entityDataSubscriptionOptions.isReloadOnlyOnDataUpdated = isReloadOnlyOnDataUpdated; | |
150 | + entityDataSubscriptionOptions.ignoreDataUpdateOnIntervalTick = ignoreDataUpdateOnIntervalTick; | |
151 | 151 | return entityDataSubscriptionOptions; |
152 | 152 | } |
153 | 153 | } | ... | ... |
... | ... | @@ -226,7 +226,7 @@ export interface WidgetSubscriptionOptions { |
226 | 226 | hasDataPageLink?: boolean; |
227 | 227 | singleEntity?: boolean; |
228 | 228 | warnOnPageDataOverflow?: boolean; |
229 | - reloadOnlyOnDataUpdated?: boolean; | |
229 | + ignoreDataUpdateOnIntervalTick?: boolean; | |
230 | 230 | targetDeviceAliasIds?: Array<string>; |
231 | 231 | targetDeviceIds?: Array<string>; |
232 | 232 | useDashboardTimewindow?: boolean; | ... | ... |
... | ... | @@ -83,7 +83,7 @@ export class WidgetSubscription implements IWidgetSubscription { |
83 | 83 | hasDataPageLink: boolean; |
84 | 84 | singleEntity: boolean; |
85 | 85 | warnOnPageDataOverflow: boolean; |
86 | - reloadOnlyOnDataUpdated: boolean; | |
86 | + ignoreDataUpdateOnIntervalTick: boolean; | |
87 | 87 | |
88 | 88 | datasourcePages: PageData<Datasource>[]; |
89 | 89 | dataPages: PageData<Array<DatasourceData>>[]; |
... | ... | @@ -201,7 +201,7 @@ export class WidgetSubscription implements IWidgetSubscription { |
201 | 201 | this.hasDataPageLink = options.hasDataPageLink; |
202 | 202 | this.singleEntity = options.singleEntity; |
203 | 203 | this.warnOnPageDataOverflow = options.warnOnPageDataOverflow; |
204 | - this.reloadOnlyOnDataUpdated = options.reloadOnlyOnDataUpdated; | |
204 | + this.ignoreDataUpdateOnIntervalTick = options.ignoreDataUpdateOnIntervalTick; | |
205 | 205 | this.datasourcePages = []; |
206 | 206 | this.datasources = []; |
207 | 207 | this.dataPages = []; |
... | ... | @@ -425,7 +425,7 @@ export class WidgetSubscription implements IWidgetSubscription { |
425 | 425 | } |
426 | 426 | }; |
427 | 427 | this.entityDataListeners.push(listener); |
428 | - return this.ctx.entityDataService.prepareSubscription(listener, this.reloadOnlyOnDataUpdated); | |
428 | + return this.ctx.entityDataService.prepareSubscription(listener, this.ignoreDataUpdateOnIntervalTick); | |
429 | 429 | }); |
430 | 430 | return forkJoin(resolveResultObservables).pipe( |
431 | 431 | map((resolveResults) => { |
... | ... | @@ -817,7 +817,8 @@ export class WidgetSubscription implements IWidgetSubscription { |
817 | 817 | } |
818 | 818 | }; |
819 | 819 | this.entityDataListeners[datasourceIndex] = entityDataListener; |
820 | - return this.ctx.entityDataService.subscribeForPaginatedData(entityDataListener, pageLink, keyFilters, this.reloadOnlyOnDataUpdated); | |
820 | + return this.ctx.entityDataService.subscribeForPaginatedData(entityDataListener, pageLink, keyFilters, | |
821 | + this.ignoreDataUpdateOnIntervalTick); | |
821 | 822 | } else { |
822 | 823 | return of(null); |
823 | 824 | } | ... | ... |
... | ... | @@ -485,8 +485,8 @@ export class WidgetComponentService { |
485 | 485 | if (isUndefined(result.typeParameters.warnOnPageDataOverflow)) { |
486 | 486 | result.typeParameters.warnOnPageDataOverflow = true; |
487 | 487 | } |
488 | - if (isUndefined(result.typeParameters.reloadOnlyOnDataUpdated)) { | |
489 | - result.typeParameters.reloadOnlyOnDataUpdated = false; | |
488 | + if (isUndefined(result.typeParameters.ignoreDataUpdateOnIntervalTick)) { | |
489 | + result.typeParameters.ignoreDataUpdateOnIntervalTick = false; | |
490 | 490 | } |
491 | 491 | if (isUndefined(result.typeParameters.dataKeysOptional)) { |
492 | 492 | result.typeParameters.dataKeysOptional = false; | ... | ... |
... | ... | @@ -895,7 +895,7 @@ export class WidgetComponent extends PageComponent implements OnInit, AfterViewI |
895 | 895 | hasDataPageLink: this.typeParameters.hasDataPageLink, |
896 | 896 | singleEntity: this.typeParameters.singleEntity, |
897 | 897 | warnOnPageDataOverflow: this.typeParameters.warnOnPageDataOverflow, |
898 | - reloadOnlyOnDataUpdated: this.typeParameters.reloadOnlyOnDataUpdated, | |
898 | + ignoreDataUpdateOnIntervalTick: this.typeParameters.ignoreDataUpdateOnIntervalTick, | |
899 | 899 | comparisonEnabled: comparisonSettings.comparisonEnabled, |
900 | 900 | timeForComparison: comparisonSettings.timeForComparison |
901 | 901 | }; | ... | ... |
... | ... | @@ -154,7 +154,7 @@ export interface WidgetTypeParameters { |
154 | 154 | hasDataPageLink?: boolean; |
155 | 155 | singleEntity?: boolean; |
156 | 156 | warnOnPageDataOverflow?: boolean; |
157 | - reloadOnlyOnDataUpdated?: boolean; | |
157 | + ignoreDataUpdateOnIntervalTick?: boolean; | |
158 | 158 | } |
159 | 159 | |
160 | 160 | export interface WidgetControllerDescriptor { | ... | ... |