+
+
There was an error! This is a good time to panic!
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 563b2e8..2f7cb76 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,5 @@
import { AfterViewInit, Component, Input, OnInit, ViewChild } from '@angular/core';
-import { PlotWidget } from 'src/app/dashboard.service';
+import { PlotWidget, PlotWidgetRenderData } from 'src/app/dashboard.service';
import { PlotViewComponent } from 'src/app/plot-view/plot-view.component';
import { PlotRequest, PlotResponse, PlotService } from 'src/app/plot.service';
@@ -9,9 +9,9 @@ import { PlotRequest, PlotResponse, PlotService } from 'src/app/plot.service';
})
export class PlotWidgetComponent implements AfterViewInit {
@Input("data")
- data!: PlotWidget;
+ data!: PlotWidgetRenderData;
- thumbnailUrl = "";
+ public thumbnailUrl = "";
isError = false;
@@ -20,17 +20,17 @@ export class PlotWidgetComponent implements AfterViewInit {
constructor(private plotService : PlotService){}
ngAfterViewInit(): void {
-
-
+ /*
const plotRequest = this.createPlotRequest();
this.plotService.sendPlotRequest(plotRequest).subscribe({
next: (response: PlotResponse) => {
- this.thumbnailUrl = response.thumbnailUrl;
+ this.thumbnailUrl = response.imageUrl;
},
error: () => {
this.isError = true;
}
});
+ */
}
createPlotRequest(): PlotRequest {
@@ -38,15 +38,15 @@ export class PlotWidgetComponent implements AfterViewInit {
const height = window.innerHeight - 20;
const width = window. innerWidth - 20;
- const request = new PlotRequest(
- height,
- width,
- 600, // thumbnailMaxWidth
- 500, // thumbnailMaxHeight
- false, // keyOutside
- true, // generateThumbnail
- (
window).submitterId,
- this.data.config!);
+ const request = new PlotRequest(
+ 500,
+ 600,
+ 600, // thumbnailMaxWidth
+ 500, // thumbnailMaxHeight
+ false, // keyOutside
+ false, // generateThumbnail
+ (window).submitterId,
+ this.data.widget.config!);
return request;
}
diff --git a/pdb-js/src/app/dashboard-page/dashboard/text-widget/text-widget.component.ts b/pdb-js/src/app/dashboard-page/dashboard/text-widget/text-widget.component.ts
index 81b389c..9270699 100644
--- a/pdb-js/src/app/dashboard-page/dashboard/text-widget/text-widget.component.ts
+++ b/pdb-js/src/app/dashboard-page/dashboard/text-widget/text-widget.component.ts
@@ -9,6 +9,6 @@ export class TextWidgetComponent {
text = "";
lines(): string[]{
- return this.text.split(/\r?\n/);
+ return typeof this.text == 'string' ? this.text.split(/\r?\n/) : [];
}
}
diff --git a/pdb-js/src/app/dashboard.service.ts b/pdb-js/src/app/dashboard.service.ts
index ca40487..cef4c3e 100644
--- a/pdb-js/src/app/dashboard.service.ts
+++ b/pdb-js/src/app/dashboard.service.ts
@@ -1,7 +1,7 @@
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
-import { PlotConfig } from './plot.service';
+import { PlotConfig, PlotResponse } from './plot.service';
@Injectable({
providedIn: 'root'
@@ -41,20 +41,29 @@ export class DashboardList{
}
export abstract class BaseWidget {
- constructor(public type: 'TEXT'|'PLOT', public size: 'SMALL'|'MEDIUM'|'LARGE') {}
+ constructor(public type: PlotType, public size: PlotSize) {}
}
export class TextWidget extends BaseWidget {
- constructor(override size: 'SMALL'|'MEDIUM'|'LARGE', public text: string) {
+ constructor(override size: PlotSize, public text: string) {
super('TEXT', size);
}
}
export class PlotWidget extends BaseWidget {
- constructor(override size: 'SMALL'|'MEDIUM'|'LARGE', public config: PlotConfig) {
+ constructor(override size: PlotSize, public config: PlotConfig) {
super('PLOT', size);
}
}
+export type PlotSize = 'SMALL'|'MEDIUM'|'LARGE';
+
+export type PlotType = 'TEXT'|'PLOT';
+
+export class PlotWidgetRenderData {
+ constructor(public widget: PlotWidget, public plotResponse?: PlotResponse) {
+ }
+}
+
export class WidgetDimensions{
constructor(public width: number, public height: number){}
}
\ No newline at end of file