From 949d283744e5caa9651fe4f2227a5ad78ca6d95a Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Mon, 11 Jan 2021 18:39:49 +0200 Subject: [PATCH 1/2] UI: Refactoring code; Fixed not work setting: "Show cumulative values in stacking mode" --- .../home/components/widget/lib/flot-widget.ts | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/flot-widget.ts b/ui-ngx/src/app/modules/home/components/widget/lib/flot-widget.ts index 2e45f7b725..390ac26d5c 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/flot-widget.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/flot-widget.ts @@ -388,7 +388,7 @@ export class TbFlot { item.settings = {}; }); subscription.datasources.forEach((item) => { - let datasource: Datasource = { + const datasource: Datasource = { type: item.type, entityType: item.entityType, entityId: item.entityId, @@ -829,7 +829,7 @@ export class TbFlot { useDashboardTimewindow: false, type: widgetType.latest, callbacks: { - onDataUpdated: (subscription) => {this.thresholdsSourcesDataUpdated(subscription.data)} + onDataUpdated: (subscription) => this.thresholdsSourcesDataUpdated(subscription.data) } }; this.ctx.subscriptionApi.createSubscription(thresholdsSourcesSubscriptionOptions, true).subscribe( @@ -896,7 +896,7 @@ export class TbFlot { type: widgetType.latest, callbacks: { onDataUpdated: (subscription) => { - this.labelPatternsParamsDataUpdated(subscription.data) + this.labelPatternsParamsDataUpdated(subscription.data); } } }; @@ -918,22 +918,22 @@ export class TbFlot { } private substituteLabelPatterns(series: TbFlotSeries, seriesIndex: number) { - let seriesLabelPatternsSourcesData = this.labelPatternsSourcesData.filter((item) => { + const seriesLabelPatternsSourcesData = this.labelPatternsSourcesData.filter((item) => { return item.datasource.entityId === series.datasource.entityId; }); let label = createLabelFromDatasource(series.datasource, series.dataKey.pattern); for (let i = 0; i < seriesLabelPatternsSourcesData.length; i++) { - let keyData = seriesLabelPatternsSourcesData[i]; + const keyData = seriesLabelPatternsSourcesData[i]; if (keyData && keyData.data && keyData.data[0]) { - let attrValue = keyData.data[0][1]; - let attrName = keyData.dataKey.name; + const attrValue = keyData.data[0][1]; + const attrName = keyData.dataKey.name; if (isDefined(attrValue) && (attrValue !== null)) { label = insertVariable(label, attrName, attrValue); } } } if (isDefined(this.subscription.legendData)) { - let targetLegendKeyIndex = this.subscription.legendData.keys.findIndex((key) => { + const targetLegendKeyIndex = this.subscription.legendData.keys.findIndex((key) => { return key.dataIndex === seriesIndex; }); if (targetLegendKeyIndex !== -1) { @@ -1098,7 +1098,7 @@ export class TbFlot { flex: '1' }); let columnContent = ''; - for (let i = c*maxRows; i < (c+1)*maxRows; i++) { + for (let i = c * maxRows; i < (c + 1) * maxRows; i++) { if (i >= hoverData.seriesHover.length) { break; } @@ -1287,7 +1287,7 @@ export class TbFlot { let minTimeHistorical: any; let hoverData: TbFlotSeriesHoverInfo; let value: any; - let lastValue: any; + let lastValue = 0; let minDistanceHistorical: number; const results: TbFlotHoverInfo[] = [{ seriesHover: [] From 5186c756ce6971b5162e7286f43c4d08b79a84b5 Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Mon, 11 Jan 2021 18:44:14 +0200 Subject: [PATCH 2/2] UI: Fixed updated marker tooltip function in map widgets --- .../app/modules/home/components/widget/lib/maps/leaflet-map.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/maps/leaflet-map.ts b/ui-ngx/src/app/modules/home/components/widget/lib/maps/leaflet-map.ts index 1f462a5386..be3551b51f 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/maps/leaflet-map.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/maps/leaflet-map.ts @@ -581,10 +581,10 @@ export default abstract class LeafletMap { const marker: Marker = this.markers.get(key); const location = this.convertPosition(data); marker.updateMarkerPosition(location); + marker.setDataSources(data, dataSources); if (settings.showTooltip) { marker.updateMarkerTooltip(data); } - marker.setDataSources(data, dataSources); marker.updateMarkerIcon(settings); return marker; }