UI: liquid level widget added additional checkup for datasources
This commit is contained in:
parent
f1195c16da
commit
8dce7dcad2
@ -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(
|
return this.getShape(entityId).pipe(
|
||||||
switchMap(shape => {
|
switchMap(shape => {
|
||||||
this.shape = shape;
|
this.shape = shape;
|
||||||
this.svgParams = svgMapping.get(shape);
|
this.svgParams = svgMapping.get(shape);
|
||||||
if (this.svgParams) {
|
if (this.svgParams) {
|
||||||
return forkJoin([
|
return forkJoin([
|
||||||
this.resourcesService.loadJsonResource<string>(this.svgParams.svg),
|
this.resourcesService.loadJsonResource<string>(this.svgParams.svg),
|
||||||
this.getTankersParams(entityId)
|
this.getTankersParams(entityId)
|
||||||
]).pipe(
|
]).pipe(
|
||||||
map(params => ({svg: params[0], ...params[1]}))
|
map(params => ({svg: params[0], ...params[1]}))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return of(null);
|
return of(null);
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return of(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public onInit() {
|
public onInit() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user