fix adding of plots

This commit is contained in:
2023-03-09 20:13:55 +01:00
parent 0bd22233a1
commit 6c62436753
7 changed files with 27 additions and 13 deletions

View File

@@ -12,11 +12,15 @@
width: 602px;
height: 402px;
}
.size-small {
width: 402px;
height: 302px;
}
img {
cursor: zoom-in;
}
</style>
<div class="dashboard-card" [ngClass]="{'size-medium' : data.widget.size=='MEDIUM'}">
<div class="dashboard-card" [ngClass]="{'size-medium' : true}">
<mat-spinner *ngIf="!hasRender('main') && !isError"></mat-spinner>
<img *ngIf="hasRender('main')" [src]="getImageUrl('main')" (click)="showFullScreenImage()" />
<div *ngIf="isError">

View File

@@ -26,11 +26,12 @@ export class PlotWidgetComponent implements AfterViewInit {
}
hasRender(name: string): boolean{
return this.data.plotResponse!.rendered[name] !== undefined;
const hasRender = this.data !== undefined && this.data.plotResponse !== undefined && this.data.plotResponse?.rendered[name] !== undefined;
return hasRender;
}
getImageUrl(name: string ): string {
return this.data.plotResponse!.rendered[name];
getImageUrl(name: string ): string | undefined {
return this.data?.plotResponse?.rendered[name];
}
showFullScreenImage(){