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/10/21 20:35:13 UTC
[incubator-streampipes] branch dev updated: [hotfix] Fix multiple
data sources for table view in 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 2c3232b [hotfix] Fix multiple data sources for table view in data explorer
2c3232b is described below
commit 2c3232bf42b84035a8d97e4574154a4133deeebd
Author: Philipp Zehnder <ze...@fzi.de>
AuthorDate: Thu Oct 21 22:34:29 2021 +0200
[hotfix] Fix multiple data sources for table view in data explorer
---
.../widgets/base/base-data-explorer-widget.ts | 4 +-
.../line-chart/line-chart-widget.component.ts | 48 +++++++++++++---------
.../widgets/table/table-widget.component.ts | 8 +++-
3 files changed, 37 insertions(+), 23 deletions(-)
diff --git a/ui/src/app/data-explorer/components/widgets/base/base-data-explorer-widget.ts b/ui/src/app/data-explorer/components/widgets/base/base-data-explorer-widget.ts
index ce1db4c..bd5dddb 100644
--- a/ui/src/app/data-explorer/components/widgets/base/base-data-explorer-widget.ts
+++ b/ui/src/app/data-explorer/components/widgets/base/base-data-explorer-widget.ts
@@ -133,7 +133,7 @@ export abstract class BaseDataExplorerWidget<T extends DataExplorerWidgetModel>
this.timerCallback.emit(true);
zip(...observables).subscribe(results => {
results.forEach((result, index) => result.sourceIndex = index);
- this.onDataReceived(results[0]);
+ this.onDataReceived(results);
this.refreshView();
this.timerCallback.emit(false);
});
@@ -181,7 +181,7 @@ export abstract class BaseDataExplorerWidget<T extends DataExplorerWidgetModel>
public abstract beforeDataFetched();
- public abstract onDataReceived(spQueryResult: SpQueryResult);
+ public abstract onDataReceived(spQueryResult: SpQueryResult[]);
public abstract onResize(width: number, height: number);
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 561a4d8..8a61168 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,15 +123,15 @@ export class LineChartWidgetComponent extends BaseDataExplorerWidget<LineChartWi
});
}
- private processNonGroupedData(spQueryResult: SpQueryResult
- ) {
- if (spQueryResult.total === 0) {
- this.setShownComponents(true, false, false);
- } else {
- this.data = this.transformData(spQueryResult, spQueryResult.sourceIndex);
- this.setShownComponents(false, true, false);
- }
- }
+ // private processNonGroupedData(spQueryResult: SpQueryResult
+ // ) {
+ // if (spQueryResult.total === 0) {
+ // this.setShownComponents(true, false, false);
+ // } else {
+ // this.data = this.transformData(spQueryResult, spQueryResult.sourceIndex);
+ // this.setShownComponents(false, true, false);
+ // }
+ // }
// private processGroupedData(res: GroupedDataResult) {
// if (res.total === 0) {
@@ -238,16 +238,16 @@ export class LineChartWidgetComponent extends BaseDataExplorerWidget<LineChartWi
if (this.data) {
this.data.forEach(d => d.mode = this.dataExplorerWidget.visualizationConfig.chartMode);
this.dataExplorerWidget.visualizationConfig.selectedLineChartProperties.map((p, index) => {
- if (this.data[index] !== undefined) {
- this.data[index]['marker'] = {'color' : ''};
+ if (this.data[index] !== undefined) {
+ this.data[index]['marker'] = { 'color': '' };
- if (!(p.runtimeName in this.dataExplorerWidget.visualizationConfig.chosenColor)) {
- this.dataExplorerWidget.visualizationConfig.chosenColor[p.runtimeName] = this.presetColors[index];
- }
+ if (!(p.runtimeName in this.dataExplorerWidget.visualizationConfig.chosenColor)) {
+ this.dataExplorerWidget.visualizationConfig.chosenColor[p.runtimeName] = this.presetColors[index];
+ }
- this.data[index].marker.color = this.dataExplorerWidget.visualizationConfig.chosenColor[p.runtimeName];
- }
- });
+ this.data[index].marker.color = this.dataExplorerWidget.visualizationConfig.chosenColor[p.runtimeName];
+ }
+ });
}
}
@@ -266,9 +266,19 @@ export class LineChartWidgetComponent extends BaseDataExplorerWidget<LineChartWi
this.setShownComponents(false, false, true);
}
- onDataReceived(spQueryResult: SpQueryResult) {
+ onDataReceived(spQueryResults: SpQueryResult[]) {
this.data = [];
- this.processNonGroupedData(spQueryResult);
+
+ // if (spQueryResult.total === 0) {
+ this.setShownComponents(true, false, false);
+ // } else {
+ spQueryResults.forEach(spQueryResult => {
+ this.data = this.data.concat(this.transformData(spQueryResult, spQueryResult.sourceIndex));
+ });
+ this.setShownComponents(false, true, false);
+ // }
+
+ // this.processNonGroupedData(spQueryResult);
// spQueryResult.allDataSeries.forEach((result, index) => {
// this.processNonGroupedData(result, index);
// });
diff --git a/ui/src/app/data-explorer/components/widgets/table/table-widget.component.ts b/ui/src/app/data-explorer/components/widgets/table/table-widget.component.ts
index 1bc1e98..5215657 100644
--- a/ui/src/app/data-explorer/components/widgets/table/table-widget.component.ts
+++ b/ui/src/app/data-explorer/components/widgets/table/table-widget.component.ts
@@ -99,9 +99,13 @@ export class TableWidgetComponent extends BaseDataExplorerWidget<TableWidgetMode
this.setShownComponents(false, false, true);
}
- onDataReceived(spQueryResult: SpQueryResult) {
+ onDataReceived(spQueryResults: SpQueryResult[]) {
this.columnNames = ['time'].concat(this.dataExplorerWidget.visualizationConfig.selectedColumns.map(c => c.fullDbName));
- this.dataSource.data = this.transformData(spQueryResult);
+ this.dataSource.data = [];
+ spQueryResults.forEach(spQueryResult => {
+ this.dataSource.data = this.dataSource.data.concat(this.transformData(spQueryResult));
+ });
+
}
handleUpdatedFields(addedFields: DataExplorerField[],