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 2021/09/21 12:29:36 UTC

[incubator-streampipes] branch dev updated: [STREAMPIPES-402] Display selectable fields in visConfig as listt

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


The following commit(s) were added to refs/heads/dev by this push:
     new dfce829  [STREAMPIPES-402] Display selectable fields in visConfig as listt
dfce829 is described below

commit dfce829d5c6f43946de205bfa95aaf820a1e34b1
Author: Dominik Riemer <ri...@fzi.de>
AuthorDate: Tue Sep 21 14:29:26 2021 +0200

    [STREAMPIPES-402] Display selectable fields in visConfig as listt
---
 .../config/line-chart-widget-config.component.html | 29 ----------------
 .../select-properties.component.css                |  7 ++++
 .../select-properties.component.html               | 31 +++++++++++------
 .../select-properties.component.ts                 | 40 ++++++++++++++++++----
 4 files changed, 62 insertions(+), 45 deletions(-)

diff --git a/ui/src/app/data-explorer/components/widgets/line-chart/config/line-chart-widget-config.component.html b/ui/src/app/data-explorer/components/widgets/line-chart/config/line-chart-widget-config.component.html
index e15f9bd..0172cb7 100644
--- a/ui/src/app/data-explorer/components/widgets/line-chart/config/line-chart-widget-config.component.html
+++ b/ui/src/app/data-explorer/components/widgets/line-chart/config/line-chart-widget-config.component.html
@@ -30,38 +30,9 @@
     <sp-select-properties
             label="Select Properties"
             multiple=true
-            class="mr-10"
             (changeSelectedProperties)="setSelectedProperties($event)"
             [availableProperties]="fieldProvider.numericFields"
             [selectedProperties]="currentlyConfiguredWidget.visualizationConfig.selectedLineChartProperties">
     </sp-select-properties>
 
-<!--    <div>-->
-<!--        <mat-checkbox color="accent" [(ngModel)]="currentlyConfiguredWidget.dataConfig.autoAggregate">Auto-Aggregate-->
-<!--        </mat-checkbox>-->
-<!--    </div>-->
-
-<!--    <sp-aggregate-configuration class="mt-10"-->
-<!--            *ngIf="!currentlyConfiguredWidget.dataConfig.autoAggregate"-->
-<!--            [(aggregationValue)]="currentlyConfiguredWidget.dataConfig.aggregationValue"-->
-<!--            [(aggregationTimeUnit)]="currentlyConfiguredWidget.dataConfig.aggregationTimeUnit"-->
-<!--            [(aggregationFunction)]="currentlyConfiguredWidget.dataConfig.aggregationFunction">-->
-<!--    </sp-aggregate-configuration>-->
-
-<!--&lt;!&ndash;    <sp-group-configuration&ndash;&gt;-->
-<!--&lt;!&ndash;            [dimensionProperties]="currentlyConfiguredWidget.dataConfig.dimensionProperties"&ndash;&gt;-->
-<!--&lt;!&ndash;            *ngIf="!currentlyConfiguredWidget.dataConfig.autoAggregate"&ndash;&gt;-->
-<!--&lt;!&ndash;            [(groupValue)]="currentlyConfiguredWidget.dataConfig.groupValue"&ndash;&gt;-->
-<!--&lt;!&ndash;            [(showCountValue)]="currentlyConfiguredWidget.dataConfig.showCountValue">&ndash;&gt;-->
-<!--&lt;!&ndash;    </sp-group-configuration>&ndash;&gt;-->
-<!--    <button *ngIf="!currentlyConfiguredWidget.dataConfig.autoAggregate"-->
-<!--            (click)="triggerDataRefresh()" mat-button mat-raised-button color="accent">-->
-<!--        <mat-icon>autorenew</mat-icon>-->
-<!--        <span>Reload</span>-->
-<!--    </button>-->
-<!--    <mat-hint *ngIf="!currentlyConfiguredWidget.dataConfig.autoAggregate">Max. 3000 results will be shown.</mat-hint>-->
-
-
-    <!--    <mat-slide-toggle color="primary" [(ngModel)]="currentlyConfiguredWidget.dataConfig.labelingModeOn" (change)="toggleLabelingMode()">Label-->
-    <!--    </mat-slide-toggle>-->
 </div>
diff --git a/ui/src/app/data-explorer/components/widgets/utils/select-properties/select-properties.component.css b/ui/src/app/data-explorer/components/widgets/utils/select-properties/select-properties.component.css
index 4cd1a79..af98709 100644
--- a/ui/src/app/data-explorer/components/widgets/utils/select-properties/select-properties.component.css
+++ b/ui/src/app/data-explorer/components/widgets/utils/select-properties/select-properties.component.css
@@ -19,3 +19,10 @@
 /deep/ .mat-form-field-wrapper {
     padding-bottom: 0em;
 }
+
+.field-scroll-panel {
+    max-height: 200px;
+    overflow-y:auto;
+    overflow-x: hidden;
+}
+
diff --git a/ui/src/app/data-explorer/components/widgets/utils/select-properties/select-properties.component.html b/ui/src/app/data-explorer/components/widgets/utils/select-properties/select-properties.component.html
index 126a3a5..e5c4da6 100644
--- a/ui/src/app/data-explorer/components/widgets/utils/select-properties/select-properties.component.html
+++ b/ui/src/app/data-explorer/components/widgets/utils/select-properties/select-properties.component.html
@@ -16,13 +16,24 @@
   ~
   -->
 
-<mat-form-field fxFlex="100" color="accent">
-    <mat-label>{{this.label}}</mat-label>
-    <mat-select [ngModel]="selectedProperties" (selectionChange)="triggerSelectedProperties($event.value)"
-                [multiple]="multiple" [compareWith]="compare">
-        <mat-option *ngFor="let column of availableProperties" [value]="column" style="background-color: #FFFFFF">
-            <b>{{column.runtimeName}}</b>
-            {{'(' +(column.aggregation ? column.aggregation + ', ': '') + column.measure +')'}}
-        </mat-option>
-    </mat-select>
-</mat-form-field>
+<div fxFlex="100" fxLayout="column">
+    <div fxLayout="row" fxLayoutAlign="start center">
+        <span class="data-explorer-header">Fields </span>
+        <div fxLayout="row" fxLayoutAlign="start center">
+            <button mat-button mat-raised-button color="accent" class="small-button"
+                    style="margin-right:10px;"
+                    (click)="selectAllFields()">Select all
+            </button>
+            <button mat-button mat-raised-button class="small-button mat-basic"
+                    style="margin-right:10px;"
+                    (click)="deselectAllFields()">Deselect all
+            </button>
+        </div>
+    </div>
+    <div fxLayout="column" class="field-scroll-panel">
+        <mat-checkbox color="accent" *ngFor="let field of availableProperties" [checked]="isSelected(field)" (change)="toggleFieldSelection(field)">
+            <b>{{field.runtimeName}}</b>
+            {{'(' +(field.aggregation ? field.aggregation + ', ': '') + field.measure +')'}}
+        </mat-checkbox>
+    </div>
+</div>
diff --git a/ui/src/app/data-explorer/components/widgets/utils/select-properties/select-properties.component.ts b/ui/src/app/data-explorer/components/widgets/utils/select-properties/select-properties.component.ts
index 692bdfc..7d594aa 100644
--- a/ui/src/app/data-explorer/components/widgets/utils/select-properties/select-properties.component.ts
+++ b/ui/src/app/data-explorer/components/widgets/utils/select-properties/select-properties.component.ts
@@ -16,7 +16,7 @@
  *
  */
 
-import { Component, EventEmitter, Input, Output } from '@angular/core';
+import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
 import { DataExplorerField } from '../../../../models/dataview-dashboard.model';
 
 @Component({
@@ -24,7 +24,7 @@ import { DataExplorerField } from '../../../../models/dataview-dashboard.model';
   templateUrl: './select-properties.component.html',
   styleUrls: ['./select-properties.component.css']
 })
-export class SelectPropertiesComponent {
+export class SelectPropertiesComponent implements OnInit {
 
   @Output() changeSelectedProperties: EventEmitter<DataExplorerField[]> = new EventEmitter();
 
@@ -35,12 +35,40 @@ export class SelectPropertiesComponent {
 
   constructor() { }
 
-  triggerSelectedProperties(fields: DataExplorerField[]) {
-    this.changeSelectedProperties.emit(fields);
+  ngOnInit(): void {
+    if (!this.selectedProperties) {
+      this.selectedProperties = [];
+    }
   }
 
-  compare(available: DataExplorerField, selected: DataExplorerField) {
-    return (available.fullDbName === selected.fullDbName);
+  triggerSelectedProperties() {
+    this.changeSelectedProperties.emit(this.selectedProperties);
+  }
+
+  selectAllFields() {
+    this.selectFields(true);
+  }
+
+  deselectAllFields() {
+    this.selectFields(false);
+  }
+
+  selectFields(selected: boolean) {
+    this.selectedProperties = selected ? this.availableProperties : [];
+    this.triggerSelectedProperties();
+  }
+
+  isSelected(field: DataExplorerField): boolean {
+    return this.selectedProperties.find(sp => sp.fullDbName === field.fullDbName) !== undefined;
+  }
+
+  toggleFieldSelection(field: DataExplorerField) {
+    if (this.isSelected(field)) {
+      this.selectedProperties = this.selectedProperties.filter(sp => !(sp.fullDbName === field.fullDbName));
+    } else {
+      this.selectedProperties.push(field);
+    }
+    this.triggerSelectedProperties();
   }
 
 }