This commit is contained in:
2023-03-12 08:32:42 +01:00
parent b5028e03be
commit 96ed788793
5 changed files with 23 additions and 77 deletions

View File

@@ -1,8 +1,8 @@
import { AfterViewInit, Component, Input, OnInit, ViewChild } from '@angular/core';
import { AfterViewInit, Component, Input, ViewChild } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
import { PlotSize, PlotWidget, PlotWidgetRenderData } from 'src/app/dashboard.service';
import { PlotWidget, PlotWidgetRenderData } from 'src/app/dashboard.service';
import { PlotViewComponent } from 'src/app/plot-view/plot-view.component';
import { PlotConfig, PlotRequest, PlotResponse, PlotService, RenderOptions } from 'src/app/plot.service';
import { PlotConfig, PlotResponse, PlotService } from 'src/app/plot.service';
import { AddPlotDialogComponent } from '../add-plot-dialog/add-plot-dialog.component';
import { FullScreenPlotDialogComponent } from '../full-screen-plot-dialog/full-screen-plot-dialog.component';
@@ -10,7 +10,7 @@ import { FullScreenPlotDialogComponent } from '../full-screen-plot-dialog/full-s
selector: 'app-plot-widget',
templateUrl: './plot-widget.component.html'
})
export class PlotWidgetComponent implements AfterViewInit {
export class PlotWidgetComponent {
@Input("data")
data!: PlotWidgetRenderData;
@@ -22,25 +22,20 @@ export class PlotWidgetComponent implements AfterViewInit {
constructor(private dialog: MatDialog, private service: PlotService){}
ngAfterViewInit(): void {
}
hasRender(name: string): boolean{
const hasRender = this.data !== undefined && this.data.plotResponse !== undefined && this.data.plotResponse?.rendered[name] !== undefined;
return hasRender;
return this.data !== undefined && this.data.plotResponse !== undefined && this.data.plotResponse?.rendered[name] !== undefined;
}
getImageUrl(name: string ): string | undefined {
return this.data?.plotResponse?.rendered[name];
}
showFullScreenImage(){
showFullScreenImage() {
this.dialog.open(FullScreenPlotDialogComponent,{
width: 'calc(100% - 15px)',
height: 'calc(100% - 15px)',
'data': {'imageUrl': this.getImageUrl('fullScreen')}
data: {'imageUrl': this.getImageUrl('fullScreen')}
}).afterClosed().subscribe(() => {
});