You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by ze...@apache.org on 2021/08/20 16:33:24 UTC
[incubator-streampipes] branch dev updated: [hotfix] Minor code
improvements in the data explorer
This is an automated email from the ASF dual-hosted git repository.
zehnder 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 6639619 [hotfix] Minor code improvements in the data explorer
new 764d3c3 Merge branch 'dev' of github.com:apache/incubator-streampipes into dev
6639619 is described below
commit 6639619a04daf288e0d0dc29c5c3c8de46f6176e
Author: Philipp Zehnder <ze...@fzi.de>
AuthorDate: Fri Aug 20 18:31:25 2021 +0200
[hotfix] Minor code improvements in the data explorer
---
.../data-explorer-designer-panel.component.ts | 12 +++---
...data-explorer-widget-data-settings.component.ts | 18 ++++----
.../components/widgets/base/base-widget-config.ts | 38 ++++++++---------
.../config/line-chart-widget-config.component.html | 4 +-
.../line-chart/line-chart-widget.component.ts | 49 +++++++++++-----------
5 files changed, 59 insertions(+), 62 deletions(-)
diff --git a/ui/src/app/data-explorer/components/designer-panel/data-explorer-designer-panel.component.ts b/ui/src/app/data-explorer/components/designer-panel/data-explorer-designer-panel.component.ts
index 11922bf..3f00e43 100644
--- a/ui/src/app/data-explorer/components/designer-panel/data-explorer-designer-panel.component.ts
+++ b/ui/src/app/data-explorer/components/designer-panel/data-explorer-designer-panel.component.ts
@@ -17,23 +17,21 @@
*/
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
-import {
- DataExplorerWidgetModel,
- DataLakeMeasure
-} from '../../../core-model/gen/streampipes-model';
+import { DataExplorerWidgetModel, DataLakeMeasure } from '../../../core-model/gen/streampipes-model';
import { Tuple2 } from '../../../core-model/base/Tuple2';
@Component({
selector: 'sp-data-explorer-designer-panel',
templateUrl: './data-explorer-designer-panel.component.html',
- styleUrls: ['./data-explorer-designer-panel.component.scss'],
+ styleUrls: ['./data-explorer-designer-panel.component.scss']
})
export class DataExplorerDesignerPanelComponent implements OnInit {
@Input() currentlyConfiguredWidget: DataExplorerWidgetModel;
@Input() dataLakeMeasure: DataLakeMeasure;
- @Output() addWidgetEmitter: EventEmitter<Tuple2<DataLakeMeasure, DataExplorerWidgetModel>> = new EventEmitter<Tuple2<DataLakeMeasure, DataExplorerWidgetModel>>();
+ @Output() addWidgetEmitter: EventEmitter<Tuple2<DataLakeMeasure, DataExplorerWidgetModel>> =
+ new EventEmitter<Tuple2<DataLakeMeasure, DataExplorerWidgetModel>>();
selectedIndex = 0;
newWidgetMode = false;
@@ -58,7 +56,7 @@ export class DataExplorerDesignerPanelComponent implements OnInit {
createNewWidget() {
this.newWidgetMode = false;
- this.addWidgetEmitter.emit({a: this.dataLakeMeasure, b: this.currentlyConfiguredWidget});
+ this.addWidgetEmitter.emit({ a: this.dataLakeMeasure, b: this.currentlyConfiguredWidget });
}
}
diff --git a/ui/src/app/data-explorer/components/designer-panel/data-settings/data-explorer-widget-data-settings.component.ts b/ui/src/app/data-explorer/components/designer-panel/data-settings/data-explorer-widget-data-settings.component.ts
index 8b9854c..9dfc2fd 100644
--- a/ui/src/app/data-explorer/components/designer-panel/data-settings/data-explorer-widget-data-settings.component.ts
+++ b/ui/src/app/data-explorer/components/designer-panel/data-settings/data-explorer-widget-data-settings.component.ts
@@ -17,10 +17,7 @@
*/
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
-import {
- DataExplorerWidgetModel,
- DataLakeMeasure
-} from '../../../../core-model/gen/streampipes-model';
+import { DataExplorerWidgetModel, DataLakeMeasure } from '../../../../core-model/gen/streampipes-model';
import { DataViewDataExplorerService } from '../../../services/data-view-data-explorer.service';
import { DatalakeRestService } from '../../../../core-services/datalake/datalake-rest.service';
import { MatSelectChange } from '@angular/material/select';
@@ -29,7 +26,7 @@ import { Tuple2 } from '../../../../core-model/base/Tuple2';
@Component({
selector: 'sp-data-explorer-widget-data-settings',
templateUrl: './data-explorer-widget-data-settings.component.html',
- styleUrls: ['./data-explorer-widget-data-settings.component.scss'],
+ styleUrls: ['./data-explorer-widget-data-settings.component.scss']
})
export class DataExplorerWidgetDataSettingsComponent implements OnInit {
@@ -37,12 +34,13 @@ export class DataExplorerWidgetDataSettingsComponent implements OnInit {
@Input() dataLakeMeasure: DataLakeMeasure;
@Input() newWidgetMode: boolean;
- @Output() createWidgetEmitter: EventEmitter<Tuple2<DataLakeMeasure, DataExplorerWidgetModel>> = new EventEmitter<Tuple2<DataLakeMeasure, DataExplorerWidgetModel>>();
+ @Output() createWidgetEmitter: EventEmitter<Tuple2<DataLakeMeasure, DataExplorerWidgetModel>> =
+ new EventEmitter<Tuple2<DataLakeMeasure, DataExplorerWidgetModel>>();
@Output() dataLakeMeasureChange: EventEmitter<DataLakeMeasure> = new EventEmitter<DataLakeMeasure>();
@Output() configureVisualizationEmitter: EventEmitter<void> = new EventEmitter<void>();
- availablePipelines: Array<DataLakeMeasure>;
- availableMeasurements: Array<DataLakeMeasure>;
+ availablePipelines: DataLakeMeasure[];
+ availableMeasurements: DataLakeMeasure[];
sourceSelection: 'pipeline' | 'measurement' = 'pipeline';
@@ -77,7 +75,7 @@ export class DataExplorerWidgetDataSettingsComponent implements OnInit {
findMeasure(measureName) {
return this.availablePipelines.find(pipeline => pipeline.measureName === measureName) ||
- this.availableMeasurements.find(m => m.measureName === measureName);
+ this.availableMeasurements.find(m => m.measureName === measureName);
}
configureVis(event: MatSelectChange) {
@@ -97,7 +95,7 @@ export class DataExplorerWidgetDataSettingsComponent implements OnInit {
}
createWidget() {
- this.createWidgetEmitter.emit({a: this.dataLakeMeasure, b: this.currentlyConfiguredWidget});
+ this.createWidgetEmitter.emit({ a: this.dataLakeMeasure, b: this.currentlyConfiguredWidget });
}
}
diff --git a/ui/src/app/data-explorer/components/widgets/base/base-widget-config.ts b/ui/src/app/data-explorer/components/widgets/base/base-widget-config.ts
index 5bf3c10..2116825 100644
--- a/ui/src/app/data-explorer/components/widgets/base/base-widget-config.ts
+++ b/ui/src/app/data-explorer/components/widgets/base/base-widget-config.ts
@@ -16,7 +16,7 @@
*
*/
-import { Directive, Input, OnChanges, SimpleChanges } from "@angular/core";
+import { Directive, Input, OnChanges, SimpleChanges } from '@angular/core';
import {
DataExplorerWidgetModel,
DataLakeMeasure,
@@ -24,10 +24,11 @@ import {
EventPropertyPrimitive,
EventPropertyUnion,
EventSchema
-} from "../../../../core-model/gen/streampipes-model";
-import { WidgetConfigurationService } from "../../../services/widget-configuration.service";
+} from '../../../../core-model/gen/streampipes-model';
+import { WidgetConfigurationService } from '../../../services/widget-configuration.service';
@Directive()
+// tslint:disable-next-line:directive-class-suffix
export abstract class BaseWidgetConfig<T extends DataExplorerWidgetModel> implements OnChanges {
@Input() currentlyConfiguredWidget: T;
@@ -40,17 +41,17 @@ export abstract class BaseWidgetConfig<T extends DataExplorerWidgetModel> implem
}
ngOnChanges(changes: SimpleChanges) {
- if (changes.dataLakeMeasure && changes.dataLakeMeasure.currentValue.measureName !== this.dataLakeMeasure.measureName) {
- this.updateWidgetConfigOptions();
- }
+ if (changes.dataLakeMeasure && changes.dataLakeMeasure.currentValue.measureName !== this.dataLakeMeasure.measureName) {
+ this.updateWidgetConfigOptions();
+ }
}
triggerDataRefresh() {
- this.widgetConfigurationService.notify({widgetId: this.currentlyConfiguredWidget._id, refreshData: true, refreshView: false});
+ this.widgetConfigurationService.notify({ widgetId: this.currentlyConfiguredWidget._id, refreshData: true, refreshView: false });
}
triggerViewRefresh() {
- this.widgetConfigurationService.notify({widgetId: this.currentlyConfiguredWidget._id, refreshData: false, refreshView: true});
+ this.widgetConfigurationService.notify({ widgetId: this.currentlyConfiguredWidget._id, refreshData: false, refreshView: true });
}
@@ -80,7 +81,7 @@ export abstract class BaseWidgetConfig<T extends DataExplorerWidgetModel> implem
getNonNumericProperties(eventSchema: EventSchema): EventPropertyUnion[] {
const result: EventPropertyUnion[] = [];
const b = new EventPropertyPrimitive();
- b["@class"] = "org.apache.streampipes.model.schema.EventPropertyPrimitive";
+ b['@class'] = 'org.apache.streampipes.model.schema.EventPropertyPrimitive';
b.runtimeType = 'https://www.w3.org/2001/XMLSchema#string';
b.runtimeName = '';
@@ -118,12 +119,11 @@ export abstract class BaseWidgetConfig<T extends DataExplorerWidgetModel> implem
}
-
getTimestampProperty(eventSchema: EventSchema) {
const propertyKeys: string[] = [];
const result = eventSchema.eventProperties.find(p =>
- this.isTimestamp(p)
+ this.isTimestamp(p)
);
return result;
@@ -134,15 +134,15 @@ export abstract class BaseWidgetConfig<T extends DataExplorerWidgetModel> implem
const runtimeType = (p as EventPropertyPrimitive).runtimeType;
return runtimeType === 'http://schema.org/Number' ||
- runtimeType === 'http://www.w3.org/2001/XMLSchema#float' ||
- runtimeType === 'http://www.w3.org/2001/XMLSchema#double' ||
- runtimeType === 'http://www.w3.org/2001/XMLSchema#integer' ||
- runtimeType === 'https://schema.org/Number' ||
- runtimeType === 'https://www.w3.org/2001/XMLSchema#float' ||
- runtimeType === 'https://www.w3.org/2001/XMLSchema#double' ||
- runtimeType === 'https://www.w3.org/2001/XMLSchema#integer';
+ runtimeType === 'http://www.w3.org/2001/XMLSchema#float' ||
+ runtimeType === 'http://www.w3.org/2001/XMLSchema#double' ||
+ runtimeType === 'http://www.w3.org/2001/XMLSchema#integer' ||
+ runtimeType === 'https://schema.org/Number' ||
+ runtimeType === 'https://www.w3.org/2001/XMLSchema#float' ||
+ runtimeType === 'https://www.w3.org/2001/XMLSchema#double' ||
+ runtimeType === 'https://www.w3.org/2001/XMLSchema#integer';
} else {
- return false;
+ return false;
}
}
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 f37e87c..265fded 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
@@ -68,6 +68,6 @@
</mat-slide-toggle>
</div>
- <mat-slide-toggle color="primary" [(ngModel)]="currentlyConfiguredWidget.dataConfig.labelingModeOn" (change)="toggleLabelingMode()">Label
- </mat-slide-toggle>
+ <!-- <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/line-chart/line-chart-widget.component.ts b/ui/src/app/data-explorer/components/widgets/line-chart/line-chart-widget.component.ts
index 8fa6b29..3ad9196 100644
--- a/ui/src/app/data-explorer/components/widgets/line-chart/line-chart-widget.component.ts
+++ b/ui/src/app/data-explorer/components/widgets/line-chart/line-chart-widget.component.ts
@@ -123,14 +123,14 @@ export class LineChartWidgetComponent extends BaseDataExplorerWidget<LineChartWi
}
],
direction: 'left',
- pad: {'r': 10, 't': 10},
+ pad: { 'r': 10, 't': 10 },
showactive: true,
type: 'buttons',
x: 0.0,
xanchor: 'left',
y: 1.3,
yanchor: 'top',
- font: {color: this.dataExplorerWidget.baseAppearanceConfig.textColor},
+ font: { color: this.dataExplorerWidget.baseAppearanceConfig.textColor },
bgcolor: this.dataExplorerWidget.baseAppearanceConfig.backgroundColor,
bordercolor: '#000'
}];
@@ -161,6 +161,7 @@ export class LineChartWidgetComponent extends BaseDataExplorerWidget<LineChartWi
if (this.dataExplorerWidget.dataConfig.labelingModeOn) {
this.backgroundColorPropertyKey = 'sp_internal_label';
}
+
this.colorPropertyStringValues = this.loadBackgroundColor(tmp, this.backgroundColorPropertyKey);
this.addBackgroundColorToGraph(this.data, this.colorPropertyStringValues, this.backgroundColorPropertyKey);
this.data['measureName'] = tmp.measureName;
@@ -177,7 +178,7 @@ export class LineChartWidgetComponent extends BaseDataExplorerWidget<LineChartWi
this.data = this.displayGroupedData(tmp);
if (this.data !== undefined &&
- this.data['colorPropertyStringValues'] !== undefined && this.data['colorPropertyStringValues'].length > 0) {
+ this.data['colorPropertyStringValues'] !== undefined && this.data['colorPropertyStringValues'].length > 0) {
this.addInitialColouredShapesToGraph(this.colorPropertyStringValues, this.colorService.getColor);
}
@@ -469,7 +470,7 @@ export class LineChartWidgetComponent extends BaseDataExplorerWidget<LineChartWi
// fetching path of labeling button icon
const path = modeBarButtons[i].getElementsByClassName('icon').item(0)
- .getElementsByTagName('path').item(0);
+ .getElementsByTagName('path').item(0);
// adding 'clicked' to class list
modeBarButtons[i].classList.add('clicked');
@@ -494,7 +495,7 @@ export class LineChartWidgetComponent extends BaseDataExplorerWidget<LineChartWi
// fetching path of labeling button icon
const path = modeBarButtons[i].getElementsByClassName('icon').item(0)
- .getElementsByTagName('path').item(0);
+ .getElementsByTagName('path').item(0);
// removing 'clicked' from class list
modeBarButtons[i].classList.remove('clicked');
@@ -515,17 +516,17 @@ export class LineChartWidgetComponent extends BaseDataExplorerWidget<LineChartWi
const enddate = new Date(end_X).getTime() + 1;
this.dataLakeRestService.saveLabelsInDatabase(
- this.data['measureName'],
- 'sp_internal_label',
- startdate,
- enddate,
- label,
- this.dataExplorerWidget.dataConfig.xKey
+ this.data['measureName'],
+ 'sp_internal_label',
+ startdate,
+ enddate,
+ label,
+ this.dataExplorerWidget.dataConfig.xKey
).subscribe(
- res => {
- // TODO add pop up similar to images
- // console.log('Successfully wrote label ' + currentLabel + ' into database.');
- }
+ res => {
+ // TODO add pop up similar to images
+ // console.log('Successfully wrote label ' + currentLabel + ' into database.');
+ }
);
}
@@ -641,19 +642,19 @@ export class LineChartWidgetComponent extends BaseDataExplorerWidget<LineChartWi
if (!this.advancedSettingsActive) {
this.setShownComponents(false, false, true);
this.dataLakeRestService.getDataAutoAggregation(
- this.dataLakeMeasure.measureName, this.timeSettings.startTime, this.timeSettings.endTime)
- .subscribe((res: DataResult) => {
- this.processNonGroupedData(res);
- });
+ this.dataLakeMeasure.measureName, this.timeSettings.startTime, this.timeSettings.endTime)
+ .subscribe((res: DataResult) => {
+ this.processNonGroupedData(res);
+ });
} else {
if (this.dataExplorerWidget.dataConfig.groupValue === 'None') {
this.setShownComponents(false, false, true);
this.dataLakeRestService.getData(
- this.dataLakeMeasure.measureName, this.timeSettings.startTime, this.timeSettings.endTime,
- this.dataExplorerWidget.dataConfig.aggregationTimeUnit, this.dataExplorerWidget.dataConfig.aggregationValue)
- .subscribe((res: DataResult) => {
- this.processNonGroupedData(res);
- });
+ this.dataLakeMeasure.measureName, this.timeSettings.startTime, this.timeSettings.endTime,
+ this.dataExplorerWidget.dataConfig.aggregationTimeUnit, this.dataExplorerWidget.dataConfig.aggregationValue)
+ .subscribe((res: DataResult) => {
+ this.processNonGroupedData(res);
+ });
} else {
// this.dataLakeRestService.getGroupedData(
// this.dataExplorerWidget.dataLakeMeasure.measureName, this.viewDateRange.startDate.getTime(), this.viewDateRange.endDate.getTime(),