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 2020/06/08 06:07:06 UTC
[incubator-streampipes] 03/05: Change time range selector
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
commit 6823724bb63b698bc900159db71eacd38ecdd8a8
Author: Philipp Zehnder <ze...@fzi.de>
AuthorDate: Mon Jun 1 08:33:16 2020 +0200
Change time range selector
---
.../widgets/renderer/renderer.component.ts | 4 ++-
.../time-selector/timeRangeSelector.component.ts | 5 +++-
.../line-chart/line-chart-widget.component.html | 3 +++
.../line-chart/line-chart-widget.component.ts | 30 +++++++++++++++++++++-
4 files changed, 39 insertions(+), 3 deletions(-)
diff --git a/ui/src/app/dashboard/components/widgets/renderer/renderer.component.ts b/ui/src/app/dashboard/components/widgets/renderer/renderer.component.ts
index 0aa8407..f187485 100644
--- a/ui/src/app/dashboard/components/widgets/renderer/renderer.component.ts
+++ b/ui/src/app/dashboard/components/widgets/renderer/renderer.component.ts
@@ -260,8 +260,10 @@ export class RendererComponent implements OnInit {
"height": 27,
"width": 40
},
- "type": "KLT"
+ "type": "Cardboard"
}
+
+ // TODO uncomment next line
data = add_item(data,item)
var boxes = convert(data);
diff --git a/ui/src/app/data-explorer-v2/components/time-selector/timeRangeSelector.component.ts b/ui/src/app/data-explorer-v2/components/time-selector/timeRangeSelector.component.ts
index 657f03f..f488fd1 100644
--- a/ui/src/app/data-explorer-v2/components/time-selector/timeRangeSelector.component.ts
+++ b/ui/src/app/data-explorer-v2/components/time-selector/timeRangeSelector.component.ts
@@ -75,7 +75,10 @@ export class TimeRangeSelectorComponent implements OnInit {
changeCustomDateRange() {
this.selectedTimeButton = this.possibleTimeButtons[this.possibleTimeButtons.length - 1];
- this.dateRange = new DateRange(this.dateRange.startDate, this.dateRange.endDate)
+ const newStartTime = new Date(this.dateRange.startDate.getTime());
+ const newEndTime = new Date(this.dateRange.endDate.getTime());
+
+ this.dateRange = new DateRange(newStartTime, newEndTime);
this.reloadData();
}
diff --git a/ui/src/app/data-explorer-v2/components/widgets/line-chart/line-chart-widget.component.html b/ui/src/app/data-explorer-v2/components/widgets/line-chart/line-chart-widget.component.html
index fcddbb6..7eba186 100644
--- a/ui/src/app/data-explorer-v2/components/widgets/line-chart/line-chart-widget.component.html
+++ b/ui/src/app/data-explorer-v2/components/widgets/line-chart/line-chart-widget.component.html
@@ -23,6 +23,9 @@
<button mat-icon-button matTooltip="Download data" class="icon" (click)="downloadDataAsFile()" color="white">
<i class="material-icons">get_app</i>
</button>
+ <button mat-button mat-icon-button color="white" (click)="changeResolution()">
+ <i class="material-icons">autorenew</i>
+ </button>
<button mat-button mat-icon-button color="white" (click)="removeWidget()">
<i class="material-icons">clear</i>
</button>
diff --git a/ui/src/app/data-explorer-v2/components/widgets/line-chart/line-chart-widget.component.ts b/ui/src/app/data-explorer-v2/components/widgets/line-chart/line-chart-widget.component.ts
index e433508..1032e05 100644
--- a/ui/src/app/data-explorer-v2/components/widgets/line-chart/line-chart-widget.component.ts
+++ b/ui/src/app/data-explorer-v2/components/widgets/line-chart/line-chart-widget.component.ts
@@ -121,7 +121,7 @@ export class LineChartWidgetComponent extends BaseDataExplorerWidget implements
}
};
-
+
ngOnInit(): void {
this.availableColumns = this.getNumericProperty(this.dataExplorerWidget.dataLakeMeasure.eventSchema);
@@ -133,6 +133,34 @@ export class LineChartWidgetComponent extends BaseDataExplorerWidget implements
this.updateData();
}
+ changeResolution() {
+ console.log('Change Resolution');
+
+ this.setShownComponents(false, false, true);
+ this.dataLakeRestService.getData(
+ this.dataExplorerWidget.dataLakeMeasure.measureName, this.viewDateRange.startDate.getTime(), this.viewDateRange.endDate.getTime()
+ , 's', 1)
+ .subscribe((res: DataResult) => {
+
+ if (res.total === 0) {
+ this.setShownComponents(true, false, false);
+ } else {
+ res.measureName = this.dataExplorerWidget.dataLakeMeasure.measureName;
+ const tmp = this.transformData(res, this.xKey);
+ this.data = this.displayData(tmp, this.yKeys);
+ this.data['measureName'] = tmp.measureName;
+ this.data['labels'] = tmp.labels;
+
+ if (this.data['labels'] !== undefined && this.data['labels'].length > 0) {
+ this.addInitialColouredShapesToGraph();
+ }
+
+ this.setShownComponents(false, true, false);
+ }
+
+ }
+ );
+ }
updateData() {