Browse Source

Merge pull request #9606 from Dmitriymush/bug-fix/liquid-level-widget

Fixed liquid level widget additional checkup for datasources
pull/9611/head
Igor Kulikov 3 years ago
committed by GitHub
parent
commit
7ee15e15d7
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 42
      ui-ngx/src/app/modules/home/components/widget/lib/indicator/liquid-level-widget.component.ts

42
ui-ngx/src/app/modules/home/components/widget/lib/indicator/liquid-level-widget.component.ts

@ -160,26 +160,30 @@ export class LiquidLevelWidgetComponent implements OnInit {
} }
private getData(): Observable<{ svg: string; volume: number; units: string }> { private getData(): Observable<{ svg: string; volume: number; units: string }> {
const entityId: EntityId = { if (this.ctx.datasources?.length) {
entityType: this.ctx.datasources[0].entityType, const entityId: EntityId = {
id: this.ctx.datasources[0].entityId entityType: this.ctx.datasources[0].entityType,
}; id: this.ctx.datasources[0].entityId
};
return this.getShape(entityId).pipe(
switchMap(shape => {
this.shape = shape;
this.svgParams = svgMapping.get(shape);
if (this.svgParams) {
return forkJoin([
this.resourcesService.loadJsonResource<string>(this.svgParams.svg),
this.getTankersParams(entityId)
]).pipe(
map(params => ({svg: params[0], ...params[1]}))
);
}
return of(null);
})
);
}
return this.getShape(entityId).pipe( return of(null);
switchMap(shape => {
this.shape = shape;
this.svgParams = svgMapping.get(shape);
if (this.svgParams) {
return forkJoin([
this.resourcesService.loadJsonResource<string>(this.svgParams.svg),
this.getTankersParams(entityId)
]).pipe(
map(params => ({svg: params[0], ...params[1]}))
);
}
return of(null);
})
);
} }
public onInit() { public onInit() {

Loading…
Cancel
Save