From ca7da9e396ff4aefab981c17834ab5ca40e642fb Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Fri, 11 Feb 2022 16:05:46 +0200 Subject: [PATCH] UI: Fixed image map widget - incorrect process first empty data --- .../home/components/widget/lib/maps/common-maps-utils.ts | 1 + .../home/components/widget/lib/maps/providers/image-map.ts | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/maps/common-maps-utils.ts b/ui-ngx/src/app/modules/home/components/widget/lib/maps/common-maps-utils.ts index 9747830cbe..7c56288ae7 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/maps/common-maps-utils.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/maps/common-maps-utils.ts @@ -123,6 +123,7 @@ export function aspectCache(imageUrl: string): Observable { return aspect; })); } + return of(0); } export type TranslateFunc = (key: string, defaultTranslation?: string) => string; diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/maps/providers/image-map.ts b/ui-ngx/src/app/modules/home/components/widget/lib/maps/providers/image-map.ts index 0109938794..b527691ed9 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/maps/providers/image-map.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/maps/providers/image-map.ts @@ -94,8 +94,10 @@ export class ImageMap extends LeafletMap { type: widgetType.latest, callbacks: { onDataUpdated: (subscription) => { - result.next([subscription.data[0]?.data, isUpdate]); - isUpdate = true; + if (subscription.data[0]?.data[0]?.length > 0) { + result.next([subscription.data[0].data, isUpdate]); + isUpdate = true; + } } } }; @@ -126,7 +128,6 @@ export class ImageMap extends LeafletMap { private imageFromAlias(alias: Observable<[DataSet, boolean]>): Observable { return alias.pipe( - filter(result => result[0].length > 0), mergeMap(res => { const mapImage: MapImage = { imageUrl: res[0][0][1],