From 36da503be9f0413086925f9cb4738709948e0684 Mon Sep 17 00:00:00 2001 From: Andreas Huber Date: Sun, 29 Sep 2024 08:11:38 +0200 Subject: [PATCH] add date picker to dashboard page --- .../dashboard/dashboard.component.html | 17 +++++++++++++++- .../dashboard/dashboard.component.ts | 20 ++++++++++++++++--- .../plot-widget/plot-widget.component.ts | 5 ++--- 3 files changed, 35 insertions(+), 7 deletions(-) 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 8cdc4fd..e60a9fc 100644 --- a/pdb-js/src/app/dashboard-page/dashboard/dashboard.component.html +++ b/pdb-js/src/app/dashboard-page/dashboard/dashboard.component.html @@ -3,6 +3,16 @@ width: 100%; height: 100%; } + .toolbar { + display: flex; + flex-direction: row; + } + .toolbar #filter-date-range{ + flex-grow: 1; + display: flex; + align-items: center; + justify-content: flex-end; + } .center { position: absolute; top: 50%; @@ -37,6 +47,9 @@ flex-basis: 0; } + .editable { + padding: 0.5em; + } .editable-hovered { visibility: hidden; @@ -73,12 +86,14 @@ +
+ Date range: +

{{dashboard.name}}

{{dashboard.description}}

-
{ + r.widget.config.dateRange = e.value; + }); + this.loadImages(0, this.plotWidgetRenderData); + } + isDirty() { return this.pristineDashboardJSON !== JSON.stringify(this.dashboard); } @@ -70,10 +81,13 @@ export class DashboardComponent implements OnInit { if (plot.isAborted) { this.loadImages(index +1 , plotWidgetQueue); }else{ + + plot.plotResponse = undefined; // remove old image and show loading icon + const request = PlotWidget.createPlotRequest(plot.widget, plot.submitterId); this.plotService.sendPlotRequest(request).subscribe({ next: (response: PlotResponse)=> { - plot.plotResponse= response; + plot.plotResponse = response; }, error: (error:any)=> { plot.error = error; 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 ee1d241..c5c414f 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,4 +1,4 @@ -import { AfterViewInit, Component, EventEmitter, Input, Output, ViewChild } from '@angular/core'; +import { Component, EventEmitter, Input, Output, ViewChild, input } 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'; @@ -18,14 +18,13 @@ export class PlotWidgetComponent { public thumbnailUrl = ""; - @ViewChild("plotView") plotView!: PlotViewComponent; + //@ViewChild("plotView") plotView!: PlotViewComponent; @Output() deleted : EventEmitter = new EventEmitter(); constructor(private dialog: MatDialog, private service: PlotService){} - hasRender(name: string): boolean{ return this.data !== undefined && this.data.plotResponse !== undefined && this.data.plotResponse?.rendered[name] !== undefined; }