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

@@ -143,7 +143,9 @@ export class DashboardComponent implements OnInit {
this.dialog.open(AddTextDialogComponent,{
width: '600px'
}).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,{
width: 'calc(100% - 1em)',
height: 'calc(100% - 1em)'
}).afterClosed().subscribe((config: PlotConfig) => {
this.dashboard!.plots.push(new PlotWidget(crypto.randomUUID(), 'MEDIUM', config));
}).afterClosed().subscribe((config: PlotConfig | "") => {
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);
}
});
}