You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by ri...@apache.org on 2020/02/12 14:00:41 UTC

[incubator-streampipes] branch dev updated (379d162 -> 843da92)

This is an automated email from the ASF dual-hosted git repository.

riemer pushed a change to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git.


    from 379d162  STREAMPIPES-58: Dashboard widgets can be removed
     new 56db2ac  STREAMPIPES-58: Set default color for color selections
     new 843da92  Improve configuration of resizable charts

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../widgets/base/base-ngx-charts-widget.ts         | 34 ++++++++++++++++++++++
 .../components/widgets/line/line-config.ts         |  6 ++--
 .../widgets/line/line-widget.component.html        |  4 +--
 .../widgets/line/line-widget.component.ts          | 26 +++--------------
 .../components/widgets/number/number-config.ts     |  2 +-
 .../dashboard-v2/registry/widget-config-builder.ts |  6 +++-
 6 files changed, 49 insertions(+), 29 deletions(-)
 create mode 100644 ui/src/app/dashboard-v2/components/widgets/base/base-ngx-charts-widget.ts


[incubator-streampipes] 02/02: Improve configuration of resizable charts

Posted by ri...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

riemer pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git

commit 843da92b9d15142eef07f0f30f1eca1664826107
Author: Dominik Riemer <ri...@fzi.de>
AuthorDate: Wed Feb 12 15:00:30 2020 +0100

    Improve configuration of resizable charts
---
 .../widgets/base/base-ngx-charts-widget.ts         | 34 ++++++++++++++++++++++
 .../components/widgets/line/line-config.ts         |  6 ++--
 .../widgets/line/line-widget.component.html        |  4 +--
 .../widgets/line/line-widget.component.ts          | 26 +++--------------
 4 files changed, 43 insertions(+), 27 deletions(-)

diff --git a/ui/src/app/dashboard-v2/components/widgets/base/base-ngx-charts-widget.ts b/ui/src/app/dashboard-v2/components/widgets/base/base-ngx-charts-widget.ts
new file mode 100644
index 0000000..783dcf3
--- /dev/null
+++ b/ui/src/app/dashboard-v2/components/widgets/base/base-ngx-charts-widget.ts
@@ -0,0 +1,34 @@
+import {BaseStreamPipesWidget} from "./base-widget";
+import {RxStompService} from "@stomp/ng2-stompjs";
+import {ResizeService} from "../../../services/resize.service";
+import {GridsterInfo} from "../../../models/gridster-info.model";
+
+export abstract class BaseNgxChartsStreamPipesWidget extends BaseStreamPipesWidget {
+
+    view: any[] = [];
+    displayChart: boolean = false;
+
+    constructor(rxStompService: RxStompService, protected resizeService: ResizeService) {
+        super(rxStompService);
+    }
+
+    ngOnInit() {
+        super.ngOnInit();
+        this.view = [this.gridsterItem.width, this.gridsterItem.height];
+        this.displayChart = true;
+        this.resizeService.resizeSubject.subscribe(info => {
+            this.onResize(info);
+        });
+    }
+
+    onResize(info: GridsterInfo) {
+        if (info.gridsterItem.id === this.gridsterItem.id) {
+            setTimeout(() => {
+                this.displayChart = false;
+                this.view = [info.gridsterItemComponent.width, info.gridsterItemComponent.height];
+                this.displayChart = true;
+            }, 100);
+        }
+    }
+
+}
\ No newline at end of file
diff --git a/ui/src/app/dashboard-v2/components/widgets/line/line-config.ts b/ui/src/app/dashboard-v2/components/widgets/line/line-config.ts
index 709614b..de783d4 100644
--- a/ui/src/app/dashboard-v2/components/widgets/line/line-config.ts
+++ b/ui/src/app/dashboard-v2/components/widgets/line/line-config.ts
@@ -19,9 +19,9 @@ export class LineConfig extends WidgetConfig {
                 .requiredPropertyWithUnaryMapping(LineConfig.TIMESTAMP_MAPPING_KEY, "Timestamp field", "", EpRequirements.timestampReq())
                 .requiredPropertyWithUnaryMapping(LineConfig.NUMBER_MAPPING_KEY, "Number field", "", EpRequirements.numberReq())
                 .build())
-            .requiredTextParameter(LineConfig.TITLE_KEY, "hi", "hi")
-            .requiredIntegerParameter(LineConfig.MIN_Y_AXIS_KEY, "Y-axis range (min)", "")
-            .requiredIntegerParameter(LineConfig.MAX_Y_AXIS_KEY, "Y-axis range (min)", "")
+            .requiredTextParameter(LineConfig.TITLE_KEY, "Line Chart Title", "The title of the cart")
+            //.requiredIntegerParameter(LineConfig.MIN_Y_AXIS_KEY, "Y-axis range (min)", "")
+            //.requiredIntegerParameter(LineConfig.MAX_Y_AXIS_KEY, "Y-axis range (min)", "")
             .build();
     }
 
diff --git a/ui/src/app/dashboard-v2/components/widgets/line/line-widget.component.html b/ui/src/app/dashboard-v2/components/widgets/line/line-widget.component.html
index 610c2ac..1186c59 100644
--- a/ui/src/app/dashboard-v2/components/widgets/line/line-widget.component.html
+++ b/ui/src/app/dashboard-v2/components/widgets/line/line-widget.component.html
@@ -1,5 +1,5 @@
-<div fxFlex="100" fxLayoutAlign="center center" fxLayout="column" class="main-panel" #pbgChartContainer>
-    <ngx-charts-line-chart *ngIf="displayChart" #chart
+<div fxFlex="100" fxLayoutAlign="center center" fxLayout="column" class="main-panel">
+    <ngx-charts-line-chart *ngIf="displayChart"
                            [showXAxisLabel]="false"
                            [showYAxisLabel]="false"
                            [timeline]="true"
diff --git a/ui/src/app/dashboard-v2/components/widgets/line/line-widget.component.ts b/ui/src/app/dashboard-v2/components/widgets/line/line-widget.component.ts
index 9bdfa28..ea8b839 100644
--- a/ui/src/app/dashboard-v2/components/widgets/line/line-widget.component.ts
+++ b/ui/src/app/dashboard-v2/components/widgets/line/line-widget.component.ts
@@ -6,38 +6,29 @@ import {LineConfig} from "./line-config";
 import {ResizeService} from "../../../services/resize.service";
 import {GridsterInfo} from "../../../models/gridster-info.model";
 import {NumberCardComponent} from "@swimlane/ngx-charts";
+import {BaseNgxChartsStreamPipesWidget} from "../base/base-ngx-charts-widget";
 
 @Component({
     selector: 'line-widget',
     templateUrl: './line-widget.component.html',
     styleUrls: ['./line-widget.component.css']
 })
-export class LineWidgetComponent extends BaseStreamPipesWidget implements OnInit, OnDestroy {
-
-    @ViewChild('pbgChartContainer') pbgChartContainer: ElementRef;
-    @ViewChild('chart') chart: NumberCardComponent;
+export class LineWidgetComponent extends BaseNgxChartsStreamPipesWidget implements OnInit, OnDestroy {
 
     multi:any = [];
-    view: any[] = [];
 
     selectedNumberProperty: string;
     selectedTimestampProperty: string;
     title: string;
     minYAxisRange: number;
     maxYAxisRange: number;
-    displayChart: boolean = false;
 
-    constructor(rxStompService: RxStompService, private resizeService: ResizeService) {
-        super(rxStompService);
+    constructor(rxStompService: RxStompService, resizeService: ResizeService) {
+        super(rxStompService, resizeService);
     }
 
     ngOnInit(): void {
         super.ngOnInit();
-        this.view = [this.gridsterItem.width, this.gridsterItem.height];
-        this.displayChart = true;
-        this.resizeService.resizeSubject.subscribe(info => {
-            this.onResize(info);
-        });
         this.multi = [
             {
                 "name": this.selectedNumberProperty,
@@ -78,13 +69,4 @@ export class LineWidgetComponent extends BaseStreamPipesWidget implements OnInit
         return timeString;
     }
 
-    onResize(info: GridsterInfo) {
-        if (info.gridsterItem.id === this.gridsterItem.id) {
-            setTimeout(() => {
-                this.displayChart = false;
-                this.view = [info.gridsterItemComponent.width, info.gridsterItemComponent.height];
-                this.displayChart = true;
-            }, 100);
-        }
-    }
 }
\ No newline at end of file


[incubator-streampipes] 01/02: STREAMPIPES-58: Set default color for color selections

Posted by ri...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

riemer pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git

commit 56db2ac3d225843aa72225c71ec50e08e7e90610
Author: Dominik Riemer <ri...@fzi.de>
AuthorDate: Wed Feb 12 14:48:11 2020 +0100

    STREAMPIPES-58: Set default color for color selections
---
 ui/src/app/dashboard-v2/components/widgets/number/number-config.ts | 2 +-
 ui/src/app/dashboard-v2/registry/widget-config-builder.ts          | 6 +++++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/ui/src/app/dashboard-v2/components/widgets/number/number-config.ts b/ui/src/app/dashboard-v2/components/widgets/number/number-config.ts
index 1fb3788..0d49699 100644
--- a/ui/src/app/dashboard-v2/components/widgets/number/number-config.ts
+++ b/ui/src/app/dashboard-v2/components/widgets/number/number-config.ts
@@ -21,7 +21,7 @@ export class NumberConfig extends WidgetConfig {
                 .requiredPropertyWithUnaryMapping(NumberConfig.NUMBER_MAPPING_KEY, "Select property", "", EpRequirements.numberReq())
                 .build())
             .requiredTextParameter(NumberConfig.TITLE_KEY, "Title", "The title")
-            .requiredColorParameter(NumberConfig.COLOR_KEY, "Background color", "The background color")
+            .requiredColorParameter(NumberConfig.COLOR_KEY, "Background color", "The background color", "#000000")
             .build();
     }
 
diff --git a/ui/src/app/dashboard-v2/registry/widget-config-builder.ts b/ui/src/app/dashboard-v2/registry/widget-config-builder.ts
index bce7475..d5872ea 100644
--- a/ui/src/app/dashboard-v2/registry/widget-config-builder.ts
+++ b/ui/src/app/dashboard-v2/registry/widget-config-builder.ts
@@ -27,15 +27,19 @@ export class WidgetConfigBuilder {
         return this;
     }
 
-    requiredColorParameter(id: string, label: string, description: string): WidgetConfigBuilder {
+    requiredColorParameter(id: string, label: string, description: string, defaultColor?: string): WidgetConfigBuilder {
         let csp = new ColorPickerStaticProperty();
         csp.internalName = id;
         csp.label = label;
         csp.description = description;
+        if (defaultColor) {
+            csp.selectedColor = defaultColor;
+        }
         this.widget.config.push(csp);
         return this;
     }
 
+
     requiredIntegerParameter(id: string, label: string, description: string): WidgetConfigBuilder {
         let fst: FreeTextStaticProperty = this.prepareStaticProperty(id, label, description, Datatypes.Integer.toUri())
         this.widget.config.push(fst);