diff --git a/pdb-js/src/app/dashboard-page/dashboard/dashboard.component.html b/pdb-js/src/app/dashboard-page/dashboard/dashboard.component.html index c82d61c..f16ddcd 100644 --- a/pdb-js/src/app/dashboard-page/dashboard/dashboard.component.html +++ b/pdb-js/src/app/dashboard-page/dashboard/dashboard.component.html @@ -61,7 +61,6 @@
-
+ [data]="getPlotWidget(id)!" (deleted)="delete($event)">
diff --git a/pdb-js/src/app/dashboard-page/dashboard/plot-widget/plot-widget.component.html b/pdb-js/src/app/dashboard-page/dashboard/plot-widget/plot-widget.component.html index edebe8a..6206456 100644 --- a/pdb-js/src/app/dashboard-page/dashboard/plot-widget/plot-widget.component.html +++ b/pdb-js/src/app/dashboard-page/dashboard/plot-widget/plot-widget.component.html @@ -20,7 +20,6 @@ cursor: zoom-in; } - .editable-hovered { position: absolute; right: 0; @@ -35,7 +34,10 @@ }
- +
+ + +
diff --git a/pdb-js/src/app/dashboard-page/dashboard/plot-widget/plot-widget.component.ts b/pdb-js/src/app/dashboard-page/dashboard/plot-widget/plot-widget.component.ts index 1444f87..bf4223c 100644 --- a/pdb-js/src/app/dashboard-page/dashboard/plot-widget/plot-widget.component.ts +++ b/pdb-js/src/app/dashboard-page/dashboard/plot-widget/plot-widget.component.ts @@ -1,5 +1,6 @@ -import { AfterViewInit, Component, Input, ViewChild } from '@angular/core'; +import { AfterViewInit, Component, EventEmitter, Input, Output, ViewChild } from '@angular/core'; import { MatDialog } from '@angular/material/dialog'; +import { ConfirmationDialogComponent } from 'src/app/confirmation-dialog/confirmation-dialog.component'; import { PlotWidget, PlotWidgetRenderData } from 'src/app/dashboard.service'; import { PlotViewComponent } from 'src/app/plot-view/plot-view.component'; import { PlotConfig, PlotResponse, PlotService } from 'src/app/plot.service'; @@ -20,6 +21,9 @@ export class PlotWidgetComponent { @ViewChild("plotView") plotView!: PlotViewComponent; + @Output() + deleted : EventEmitter = new EventEmitter(); + constructor(private dialog: MatDialog, private service: PlotService){} @@ -41,7 +45,18 @@ export class PlotWidgetComponent { }); } - + delete() { + this.dialog + .open(ConfirmationDialogComponent, { + data: {title: "", text: "Delete plot?", btnOkLabel: "Delete", btnCancelLabel: "Cancel"} + }) + .afterClosed() + .subscribe((result: boolean) => { + if (result === true) { + this.deleted.emit(this.data.widget.id); + } + }); + } edit() { this.dialog.open(AddPlotDialogComponent, { diff --git a/pdb-js/src/app/dashboard-page/dashboard/text-widget/text-widget.component.html b/pdb-js/src/app/dashboard-page/dashboard/text-widget/text-widget.component.html index 18568c5..22eba88 100644 --- a/pdb-js/src/app/dashboard-page/dashboard/text-widget/text-widget.component.html +++ b/pdb-js/src/app/dashboard-page/dashboard/text-widget/text-widget.component.html @@ -25,7 +25,7 @@ }
-
+