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 2022/08/22 09:41:08 UTC

[incubator-streampipes] branch dev updated: [STREAMPIPES-578] Reflect index changes in data download dialog

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 a1a4c1ec7 [STREAMPIPES-578] Reflect index changes in data download dialog
a1a4c1ec7 is described below

commit a1a4c1ec740eccb3b98c7d6df6f0bfc98c81320c
Author: Dominik Riemer <do...@gmail.com>
AuthorDate: Mon Aug 22 11:40:50 2022 +0200

    [STREAMPIPES-578] Reflect index changes in data download dialog
---
 .../datalake-configuration.component.ts             |  2 +-
 .../data-download-dialog.component.ts               | 21 ++++++++++++++-------
 .../data-explorer-dashboard-widget.component.ts     |  1 -
 3 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/ui/src/app/configuration/datalake-configuration/datalake-configuration.component.ts b/ui/src/app/configuration/datalake-configuration/datalake-configuration.component.ts
index c1ec6d271..d1792ac60 100644
--- a/ui/src/app/configuration/datalake-configuration/datalake-configuration.component.ts
+++ b/ui/src/app/configuration/datalake-configuration/datalake-configuration.component.ts
@@ -161,7 +161,7 @@ export class DatalakeConfigurationComponent implements OnInit {
       title: 'Download data',
       width: '50vw',
       data: {
-        'index': measurementName,
+        'measureName': measurementName,
       }
     });
   }
diff --git a/ui/src/app/core-ui/data-download-dialog/data-download-dialog.component.ts b/ui/src/app/core-ui/data-download-dialog/data-download-dialog.component.ts
index 092c87899..b68aadd47 100644
--- a/ui/src/app/core-ui/data-download-dialog/data-download-dialog.component.ts
+++ b/ui/src/app/core-ui/data-download-dialog/data-download-dialog.component.ts
@@ -37,12 +37,17 @@ import { DialogRef } from '@streampipes/shared-ui';
 // tslint:disable-next-line:component-class-suffix
 export class DataDownloadDialogComponent implements OnInit {
 
-  @Input() index: string;
-  @Input() date: DateRange;
+  /**
+   * Provide either measureName without additional configuration
+   * or dataConfig to allow selection of multiple sources
+   */
+  @Input() measureName: string;
   @Input() dataConfig: DataExplorerDataConfig;
 
+  @Input() date: DateRange;
+
   downloadFormat = 'csv';
-  delimiter = ',';
+  delimiter = 'comma';
   selectedData = 'visible';
   downloadFinish = false;
   downloadedMBs: number = undefined;
@@ -75,6 +80,8 @@ export class DataDownloadDialogComponent implements OnInit {
   }
 
   downloadData() {
+    const index = !this.dataConfig ?
+      this.measureName : this.dataConfig.sourceConfigs[this.selectedQueryIndex].measureName;
     this.nextStep();
     const startTime = this.date.startDate.getTime();
     const endTime = this.date.endDate.getTime();
@@ -83,13 +90,13 @@ export class DataDownloadDialogComponent implements OnInit {
     switch (this.selectedData) {
       case 'all':
         this.performRequest(this.datalakeRestService.downloadRawData(
-          this.index,
+          index,
           this.downloadFormat,
           this.delimiter), '', '');
         break;
       case 'customInterval':
         this.performRequest(this.datalakeRestService.downloadRawData(
-            this.index,
+            index,
             this.downloadFormat,
             this.delimiter,
             startTime,
@@ -100,7 +107,7 @@ export class DataDownloadDialogComponent implements OnInit {
         this.performRequest(
           this.datalakeRestService
             .downloadQueriedData(
-              this.index,
+              index,
               this.downloadFormat,
               this.delimiter,
               this.generateQueryRequest(startTime, endTime)
@@ -127,7 +134,7 @@ export class DataDownloadDialogComponent implements OnInit {
 
       // finished
       if (event.type === HttpEventType.Response) {
-        this.createFile(event.body, this.downloadFormat, this.index, startDate, endDate);
+        this.createFile(event.body, this.downloadFormat, this.measureName, startDate, endDate);
         this.downloadFinish = true;
       }
     });
diff --git a/ui/src/app/data-explorer/components/widget/data-explorer-dashboard-widget.component.ts b/ui/src/app/data-explorer/components/widget/data-explorer-dashboard-widget.component.ts
index fb112b1e7..186e9d6d2 100644
--- a/ui/src/app/data-explorer/components/widget/data-explorer-dashboard-widget.component.ts
+++ b/ui/src/app/data-explorer/components/widget/data-explorer-dashboard-widget.component.ts
@@ -155,7 +155,6 @@ export class DataExplorerDashboardWidgetComponent implements OnInit {
       title: 'Download data',
       width: '50vw',
       data: {
-        'index': this.dataLakeMeasure.measureName,
         'date': DateRange.fromTimeSettings(this.timeSettings),
         'dataConfig': this.configuredWidget.dataConfig as DataExplorerDataConfig
       }