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

@@ -18,7 +18,6 @@ export class AddTextDialogComponent {
this.dialogRef.close(undefined);
}
onSaveClick(): void {
this.dialogRef.close(this.text);
}

View File

@@ -4,8 +4,8 @@ import { Component, ElementRef, OnInit } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
import { MatSnackBar } from '@angular/material/snack-bar';
import { ActivatedRoute } from '@angular/router';
import { BaseWidget, Dashboard, DashboardCreationData, DashboardService, PlotSize, PlotWidget, PlotWidgetRenderData, TextWidget } from 'src/app/dashboard.service';
import { PlotConfig, PlotRequest, PlotResponse, PlotService, RenderOptions } from 'src/app/plot.service';
import { Dashboard, DashboardCreationData, DashboardService, PlotWidget, PlotWidgetRenderData, TextWidget } from 'src/app/dashboard.service';
import { PlotConfig, PlotResponse, PlotService } from 'src/app/plot.service';
import { NewDashboardComponent } from '../new-dashboard/new-dashboard.component';
import { AddPlotDialogComponent } from './add-plot-dialog/add-plot-dialog.component';
import { AddTextDialogComponent } from './add-text-dialog/add-text-dialog.component';
@@ -71,48 +71,6 @@ export class DashboardComponent implements OnInit {
}
}
/*
createPlotRequest(plotWidget: PlotWidget): PlotRequest {
const height = this.height(plotWidget.size);
const width = this.width(plotWidget.size);
const fullWidth = window.innerWidth-30;
const fullHeight = window.innerHeight-30;
const request = new PlotRequest(
(<any>window).submitterId+crypto.randomUUID(),
plotWidget.config,
{
'main': new RenderOptions(height,width, false, true),
'fullScreen': new RenderOptions(fullHeight,fullWidth, false, true)
}
);
return request;
}
height(size: PlotSize): number{
switch (size) {
case 'SMALL':
return 300;
case 'MEDIUM':
return 400;
case 'LARGE':
return 600;
}
}
width(size: PlotSize): number{
switch (size) {
case 'SMALL':
return 400;
case 'MEDIUM':
return 600;
case 'LARGE':
return 900;
}
}
*/
private repairArrangement(){
const arrangement = this.dashboard!.arrangement || [];
if (arrangement.length == 0){
@@ -220,7 +178,6 @@ export class DashboardComponent implements OnInit {
this.dashboard!.description = result.description;
}
});
}
isTextWidget(id: string): boolean {

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(() => {
});