fix adding of plots
This commit is contained in:
@@ -1,3 +1,8 @@
|
|||||||
|
<style>
|
||||||
|
mat-form-field textarea {
|
||||||
|
height: 7em;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
<h1 mat-dialog-title>Add Text</h1>
|
<h1 mat-dialog-title>Add Text</h1>
|
||||||
<div mat-dialog-content>
|
<div mat-dialog-content>
|
||||||
<mat-form-field class="pdb-form-full-width">
|
<mat-form-field class="pdb-form-full-width">
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
textarea {
|
|
||||||
height: 5em;
|
|
||||||
}
|
|
||||||
@@ -3,8 +3,7 @@ import { MatDialogRef } from '@angular/material/dialog';
|
|||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-add-text-dialog',
|
selector: 'app-add-text-dialog',
|
||||||
templateUrl: './add-text-dialog.component.html',
|
templateUrl: './add-text-dialog.component.html'
|
||||||
styleUrls: ['./add-text-dialog.component.scss']
|
|
||||||
})
|
})
|
||||||
export class AddTextDialogComponent {
|
export class AddTextDialogComponent {
|
||||||
text = "";
|
text = "";
|
||||||
|
|||||||
@@ -143,7 +143,9 @@ export class DashboardComponent implements OnInit {
|
|||||||
this.dialog.open(AddTextDialogComponent,{
|
this.dialog.open(AddTextDialogComponent,{
|
||||||
width: '600px'
|
width: '600px'
|
||||||
}).afterClosed().subscribe((text: string) => {
|
}).afterClosed().subscribe((text: string) => {
|
||||||
this.dashboard!.texts.push(new TextWidget(crypto.randomUUID(),'MEDIUM', text));
|
const widget = new TextWidget(crypto.randomUUID(),'MEDIUM', text);
|
||||||
|
this.dashboard!.texts.push(widget);
|
||||||
|
this.dashboard!.arrangement[0].push(widget.id);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -151,8 +153,14 @@ export class DashboardComponent implements OnInit {
|
|||||||
this.dialog.open(AddPlotDialogComponent,{
|
this.dialog.open(AddPlotDialogComponent,{
|
||||||
width: 'calc(100% - 1em)',
|
width: 'calc(100% - 1em)',
|
||||||
height: 'calc(100% - 1em)'
|
height: 'calc(100% - 1em)'
|
||||||
}).afterClosed().subscribe((config: PlotConfig) => {
|
}).afterClosed().subscribe((config: PlotConfig | "") => {
|
||||||
this.dashboard!.plots.push(new PlotWidget(crypto.randomUUID(), 'MEDIUM', config));
|
if (config != "" && config.query.length > 0) {
|
||||||
|
const widget = new PlotWidget(crypto.randomUUID(), 'MEDIUM', config);
|
||||||
|
this.dashboard!.plots.push(widget);
|
||||||
|
this.dashboard!.arrangement[0].push(widget.id);
|
||||||
|
this.plotWidgetRenderData.push(new PlotWidgetRenderData(widget));
|
||||||
|
this.loadImages(this.plotWidgetRenderData.length-1, this.plotWidgetRenderData);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,11 +12,15 @@
|
|||||||
width: 602px;
|
width: 602px;
|
||||||
height: 402px;
|
height: 402px;
|
||||||
}
|
}
|
||||||
|
.size-small {
|
||||||
|
width: 402px;
|
||||||
|
height: 302px;
|
||||||
|
}
|
||||||
img {
|
img {
|
||||||
cursor: zoom-in;
|
cursor: zoom-in;
|
||||||
}
|
}
|
||||||
</style>
|
</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>
|
<mat-spinner *ngIf="!hasRender('main') && !isError"></mat-spinner>
|
||||||
<img *ngIf="hasRender('main')" [src]="getImageUrl('main')" (click)="showFullScreenImage()" />
|
<img *ngIf="hasRender('main')" [src]="getImageUrl('main')" (click)="showFullScreenImage()" />
|
||||||
<div *ngIf="isError">
|
<div *ngIf="isError">
|
||||||
|
|||||||
@@ -26,11 +26,12 @@ export class PlotWidgetComponent implements AfterViewInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
hasRender(name: string): boolean{
|
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 {
|
getImageUrl(name: string ): string | undefined {
|
||||||
return this.data.plotResponse!.rendered[name];
|
return this.data?.plotResponse?.rendered[name];
|
||||||
}
|
}
|
||||||
|
|
||||||
showFullScreenImage(){
|
showFullScreenImage(){
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ export class TextWidget extends BaseWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
export class PlotWidget extends BaseWidget {
|
export class PlotWidget extends BaseWidget {
|
||||||
constructor(override id: string, override size: PlotSize, public config: PlotConfig) {
|
constructor(override id: string, override size: 'SMALL'|'MEDIUM'|'LARGE', public config: PlotConfig) {
|
||||||
super(id, 'PLOT', size);
|
super(id, 'PLOT', size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user