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 2022/09/23 07:38:24 UTC

[incubator-streampipes] branch STREAMPIPES-583 updated (ca4ed0e50 -> 323814be3)

This is an automated email from the ASF dual-hosted git repository.

zehnder pushed a change to branch STREAMPIPES-583
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git


    from ca4ed0e50 Merge branch 'dev' into STREAMPIPES-583
     add 0f7152e2e update snakeyaml due to CVEs
     add 72c10f170 Merge pull request #109 from pjfanning/patch-1
     new eed5a5a53 Merge branch 'dev' into STREAMPIPES-583
     add 82cc17842 [hotfix] Fix flickering in data explorer slide view
     add 24f60b733 Merge branch 'dev' of github.com:apache/incubator-streampipes into dev
     new 9f94cead3 Merge branch 'dev' into STREAMPIPES-583
     add e45f577d4 [STREAMPIPES-585] Improve error handling for runtime exceptions
     add 5d1945b02 [STREAMPIPES-585] Minor refactoring in InfluxStore
     new 149ba5bb5 Merge branch 'dev' into STREAMPIPES-583
     new 323814be3 [WIP] STREAMPIPS-583 working on download service

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../dataexplorer/commons/influx/InfluxStore.java   | 284 +++++++++++----------
 streampipes-maven-plugin/pom.xml                   |   2 +-
 .../apache/streampipes/model/runtime/Event.java    |   3 +-
 .../routing/StandaloneSpInputCollector.java        |   4 -
 .../runtime/StandaloneEventProcessorRuntime.java   |  40 +--
 .../runtime/StandaloneEventSinkRuntime.java        |  20 +-
 .../StandaloneExternalEventProcessorRuntime.java   |   2 +-
 .../StandaloneExternalEventSinkRuntime.java        |   2 +-
 .../wrapper/routing/RawDataProcessor.java          |   4 +-
 .../datalake-configuration.component.ts            |   4 +-
 ui/src/app/core-ui/core-ui.module.ts               |  10 +-
 .../download/download.component.html               |  12 +-
 .../download/download.component.scss               |   0
 .../download/download.component.ts                 |  11 +
 .../select-data-missing-values.component.html      |   2 +-
 .../select-data-missing-values.component.scss      |   9 -
 .../select-data-missing-values.component.ts        |   6 +-
 .../select-data-range.component.html               |  88 +++++++
 .../select-data-range.component.scss}              |   0
 .../select-data-range.component.ts                 |  37 +--
 .../select-data/select-data.component.html         |   7 +-
 .../select-data/select-data.component.scss         |   2 +-
 .../select-data/select-data.component.ts           |  19 +-
 .../select-format/select-format.component.html     |  20 +-
 .../select-format/select-format.component.scss     |   0
 .../select-format/select-format.component.ts       |   7 +-
 .../data-download-dialog.component.html            |  47 +---
 .../data-download-dialog.component.ts              | 218 ++--------------
 .../export-data-configuration.model.ts             |  28 --
 .../data-download-dialog.model.ts}                 |  25 +-
 .../model/data-export-config.model.ts              |  45 ++++
 .../model/export-config.model.ts                   |  44 ++++
 .../model/format-export-config.model.ts            |  48 ++++
 .../select-data-range.component.html               |  86 -------
 .../select-data-range.component.scss               |  33 ---
 .../services/data-export.service.ts                | 167 ++++++++++++
 ...ta-explorer-dashboard-slide-view.component.html |   2 +-
 ...ta-explorer-dashboard-slide-view.component.scss |   5 +
 .../data-explorer-dashboard-widget.component.html  |   2 +-
 .../data-explorer-dashboard-widget.component.scss  |   5 +
 .../data-explorer-dashboard-widget.component.ts    |   6 +-
 41 files changed, 749 insertions(+), 607 deletions(-)
 rename ui/src/app/core-ui/data-download-dialog/{ => components}/download/download.component.html (59%)
 rename ui/src/app/core-ui/data-download-dialog/{ => components}/download/download.component.scss (100%)
 rename ui/src/app/core-ui/data-download-dialog/{ => components}/download/download.component.ts (82%)
 rename ui/src/app/core-ui/data-download-dialog/{ => components}/select-data/select-data-missing-values/select-data-missing-values.component.html (95%)
 rename ui/src/app/core-ui/data-download-dialog/{ => components}/select-data/select-data-missing-values/select-data-missing-values.component.scss (86%)
 rename ui/src/app/core-ui/data-download-dialog/{ => components}/select-data/select-data-missing-values/select-data-missing-values.component.ts (82%)
 create mode 100644 ui/src/app/core-ui/data-download-dialog/components/select-data/select-data-range/select-data-range.component.html
 copy ui/src/app/core-ui/data-download-dialog/{select-format/select-format.component.scss => components/select-data/select-data-range/select-data-range.component.scss} (100%)
 rename ui/src/app/core-ui/data-download-dialog/{ => components}/select-data/select-data-range/select-data-range.component.ts (56%)
 rename ui/src/app/core-ui/data-download-dialog/{ => components}/select-data/select-data.component.html (82%)
 rename ui/src/app/core-ui/data-download-dialog/{ => components}/select-data/select-data.component.scss (95%)
 rename ui/src/app/core-ui/data-download-dialog/{ => components}/select-data/select-data.component.ts (70%)
 rename ui/src/app/core-ui/data-download-dialog/{ => components}/select-format/select-format.component.html (51%)
 rename ui/src/app/core-ui/data-download-dialog/{ => components}/select-format/select-format.component.scss (100%)
 copy ui/src/app/core-ui/data-download-dialog/{ => components}/select-format/select-format.component.ts (78%)
 delete mode 100644 ui/src/app/core-ui/data-download-dialog/export-data-configuration.model.ts
 rename ui/src/app/core-ui/data-download-dialog/{select-format/select-format.component.ts => model/data-download-dialog.model.ts} (64%)
 create mode 100644 ui/src/app/core-ui/data-download-dialog/model/data-export-config.model.ts
 create mode 100644 ui/src/app/core-ui/data-download-dialog/model/export-config.model.ts
 create mode 100644 ui/src/app/core-ui/data-download-dialog/model/format-export-config.model.ts
 delete mode 100644 ui/src/app/core-ui/data-download-dialog/select-data/select-data-range/select-data-range.component.html
 delete mode 100644 ui/src/app/core-ui/data-download-dialog/select-data/select-data-range/select-data-range.component.scss
 create mode 100644 ui/src/app/core-ui/data-download-dialog/services/data-export.service.ts


[incubator-streampipes] 01/04: Merge branch 'dev' into STREAMPIPES-583

Posted by ze...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

zehnder pushed a commit to branch STREAMPIPES-583
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git

commit eed5a5a536849cf34ef31d28f21c2ba0ccaa1ed1
Merge: ca4ed0e50 72c10f170
Author: Philipp Zehnder <ze...@fzi.de>
AuthorDate: Mon Sep 19 07:54:17 2022 +0200

    Merge branch 'dev' into STREAMPIPES-583

 streampipes-maven-plugin/pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


[incubator-streampipes] 02/04: Merge branch 'dev' into STREAMPIPES-583

Posted by ze...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

zehnder pushed a commit to branch STREAMPIPES-583
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git

commit 9f94cead31f67ea6f423e91ca8f1754d9271fea1
Merge: eed5a5a53 24f60b733
Author: Philipp Zehnder <ze...@fzi.de>
AuthorDate: Tue Sep 20 17:23:04 2022 +0200

    Merge branch 'dev' into STREAMPIPES-583

 .../slide-view/data-explorer-dashboard-slide-view.component.html     | 2 +-
 .../slide-view/data-explorer-dashboard-slide-view.component.scss     | 5 +++++
 .../components/widget/data-explorer-dashboard-widget.component.html  | 2 +-
 .../components/widget/data-explorer-dashboard-widget.component.scss  | 5 +++++
 4 files changed, 12 insertions(+), 2 deletions(-)


[incubator-streampipes] 04/04: [WIP] STREAMPIPS-583 working on download service

Posted by ze...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

zehnder pushed a commit to branch STREAMPIPES-583
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git

commit 323814be3dbc31a52183e4094c7977c24d7eaea6
Author: Philipp Zehnder <ze...@fzi.de>
AuthorDate: Fri Sep 23 09:37:58 2022 +0200

    [WIP] STREAMPIPS-583 working on download service
---
 .../datalake-configuration.component.ts            |   4 +-
 ui/src/app/core-ui/core-ui.module.ts               |  10 +-
 .../download/download.component.html               |  12 +-
 .../download/download.component.scss               |   0
 .../download/download.component.ts                 |  11 ++
 .../select-data-missing-values.component.html      |   2 +-
 .../select-data-missing-values.component.scss      |   9 -
 .../select-data-missing-values.component.ts        |   6 +-
 .../select-data-range.component.html               |  88 +++++++++
 .../select-data-range.component.scss}              |   0
 .../select-data-range.component.ts                 |  37 ++--
 .../select-data/select-data.component.html         |   7 +-
 .../select-data/select-data.component.scss         |   2 +-
 .../select-data/select-data.component.ts           |  19 +-
 .../select-format/select-format.component.html     |  20 +-
 .../select-format/select-format.component.scss     |   0
 .../select-format/select-format.component.ts       |   7 +-
 .../data-download-dialog.component.html            |  47 +----
 .../data-download-dialog.component.ts              | 218 +++------------------
 .../export-data-configuration.model.ts             |  28 ---
 .../data-download-dialog.model.ts}                 |  27 ++-
 .../model/data-export-config.model.ts              |  45 +++++
 .../model/export-config.model.ts                   |  44 +++++
 .../model/format-export-config.model.ts            |  48 +++++
 .../select-data-range.component.html               |  86 --------
 .../select-data-range.component.scss               |  33 ----
 .../services/data-export.service.ts                | 167 ++++++++++++++++
 .../data-explorer-dashboard-widget.component.ts    |   6 +-
 28 files changed, 540 insertions(+), 443 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 d1792ac60..0473b4883 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,9 @@ export class DatalakeConfigurationComponent implements OnInit {
       title: 'Download data',
       width: '50vw',
       data: {
-        'measureName': measurementName,
+        'dataDownloadDialogModel': {
+          'measureName': measurementName,
+        }
       }
     });
   }
diff --git a/ui/src/app/core-ui/core-ui.module.ts b/ui/src/app/core-ui/core-ui.module.ts
index 7d2318936..5b5bfd027 100644
--- a/ui/src/app/core-ui/core-ui.module.ts
+++ b/ui/src/app/core-ui/core-ui.module.ts
@@ -92,11 +92,11 @@ import { PipelineElementTemplateConfigComponent } from './pipeline-element-templ
 import { PipelineElementTemplatePipe } from './pipeline-element-template-config/pipeline-element-template.pipe';
 import { DataDownloadDialogComponent } from './data-download-dialog/data-download-dialog.component';
 import { OwlDateTimeModule, OwlNativeDateTimeModule } from '@danielmoncada/angular-datetime-picker';
-import { SelectDataComponent } from './data-download-dialog/select-data/select-data.component';
-import { SelectFormatComponent } from './data-download-dialog/select-format/select-format.component';
-import { DownloadComponent } from './data-download-dialog/download/download.component';
-import { SelectDataRangeComponent } from './data-download-dialog/select-data/select-data-range/select-data-range.component';
-import { SelectDataMissingValuesComponent } from './data-download-dialog/select-data/select-data-missing-values/select-data-missing-values.component';
+import { SelectDataComponent } from './data-download-dialog/components/select-data/select-data.component';
+import { SelectFormatComponent } from './data-download-dialog/components/select-format/select-format.component';
+import { DownloadComponent } from './data-download-dialog/components/download/download.component';
+import { SelectDataRangeComponent } from './data-download-dialog/components/select-data/select-data-range/select-data-range.component';
+import { SelectDataMissingValuesComponent } from './data-download-dialog/components/select-data/select-data-missing-values/select-data-missing-values.component';
 
 @NgModule({
   imports: [
diff --git a/ui/src/app/core-ui/data-download-dialog/download/download.component.html b/ui/src/app/core-ui/data-download-dialog/components/download/download.component.html
similarity index 59%
rename from ui/src/app/core-ui/data-download-dialog/download/download.component.html
rename to ui/src/app/core-ui/data-download-dialog/components/download/download.component.html
index 4a4c90cd7..eb80bd758 100644
--- a/ui/src/app/core-ui/data-download-dialog/download/download.component.html
+++ b/ui/src/app/core-ui/data-download-dialog/components/download/download.component.html
@@ -15,5 +15,13 @@
   ~  limitations under the License.
   ~
   -->
-
-<p>download works!</p>
+<ng-template matStepLabel>Download</ng-template>
+<div fxFlex="100" fxLayout="column" fxLayoutAlign="center center" *ngIf="!downloadFinish" class="mt-35">
+  <mat-spinner [diameter]="30" color="accent"></mat-spinner>
+  <label *ngIf="downloadedMBs !== undefined">{{downloadedMBs | number : '1.0-2' }} Mb</label>
+  <button mat-button warn color="warn" (click)="cancelDownload()">Cancel</button>
+</div>
+<div fxLayout="column" fxLayoutAlign="space-around center" *ngIf="downloadFinish">
+  <mat-icon class="icon-check">check</mat-icon>
+  <h5>Download successful</h5>
+</div>
diff --git a/ui/src/app/core-ui/data-download-dialog/download/download.component.scss b/ui/src/app/core-ui/data-download-dialog/components/download/download.component.scss
similarity index 100%
rename from ui/src/app/core-ui/data-download-dialog/download/download.component.scss
rename to ui/src/app/core-ui/data-download-dialog/components/download/download.component.scss
diff --git a/ui/src/app/core-ui/data-download-dialog/download/download.component.ts b/ui/src/app/core-ui/data-download-dialog/components/download/download.component.ts
similarity index 82%
rename from ui/src/app/core-ui/data-download-dialog/download/download.component.ts
rename to ui/src/app/core-ui/data-download-dialog/components/download/download.component.ts
index 3287e3616..33966d4a8 100644
--- a/ui/src/app/core-ui/data-download-dialog/download/download.component.ts
+++ b/ui/src/app/core-ui/data-download-dialog/components/download/download.component.ts
@@ -25,10 +25,21 @@ import { Component, OnInit } from '@angular/core';
 })
 export class DownloadComponent implements OnInit {
 
+  downloadFinish = false;
+  downloadedMBs: number = undefined;
+  downloadHttpRequestSubscription;
+
   constructor() {
   }
 
   ngOnInit(): void {
   }
 
+  cancelDownload() {
+  try {
+    this.downloadHttpRequestSubscription.unsubscribe();
+  } finally {
+    // this.exitDialog();
+  }
+}
 }
diff --git a/ui/src/app/core-ui/data-download-dialog/select-data/select-data-missing-values/select-data-missing-values.component.html b/ui/src/app/core-ui/data-download-dialog/components/select-data/select-data-missing-values/select-data-missing-values.component.html
similarity index 95%
rename from ui/src/app/core-ui/data-download-dialog/select-data/select-data-missing-values/select-data-missing-values.component.html
rename to ui/src/app/core-ui/data-download-dialog/components/select-data/select-data-missing-values/select-data-missing-values.component.html
index c04e98a24..0667b5a20 100644
--- a/ui/src/app/core-ui/data-download-dialog/select-data/select-data-missing-values/select-data-missing-values.component.html
+++ b/ui/src/app/core-ui/data-download-dialog/components/select-data/select-data-missing-values/select-data-missing-values.component.html
@@ -19,7 +19,7 @@
 <h5>Behaviour in case of missing values</h5>
 <mat-radio-group
     class="sp-radio-group"
-    [ngModel]="missingValueBehaviour">
+    [(ngModel)]="dataExportConfig.missingValueBehaviour">
   <mat-radio-button
       value="ignore"
       class="sp-radio-button">
diff --git a/ui/src/app/core-ui/data-download-dialog/select-data/select-data-missing-values/select-data-missing-values.component.scss b/ui/src/app/core-ui/data-download-dialog/components/select-data/select-data-missing-values/select-data-missing-values.component.scss
similarity index 86%
rename from ui/src/app/core-ui/data-download-dialog/select-data/select-data-missing-values/select-data-missing-values.component.scss
rename to ui/src/app/core-ui/data-download-dialog/components/select-data/select-data-missing-values/select-data-missing-values.component.scss
index f3ca9ce86..3974deeee 100644
--- a/ui/src/app/core-ui/data-download-dialog/select-data/select-data-missing-values/select-data-missing-values.component.scss
+++ b/ui/src/app/core-ui/data-download-dialog/components/select-data/select-data-missing-values/select-data-missing-values.component.scss
@@ -15,14 +15,5 @@
  *  limitations under the License.
  *
  */
-.sp-radio-group {
-  display: flex;
-  flex-direction: column;
-  margin: 15px 0;
-}
 
-.sp-radio-button {
-  margin: 5px;
-  width: 100%;
-}
 
diff --git a/ui/src/app/core-ui/data-download-dialog/select-data/select-data-missing-values/select-data-missing-values.component.ts b/ui/src/app/core-ui/data-download-dialog/components/select-data/select-data-missing-values/select-data-missing-values.component.ts
similarity index 82%
copy from ui/src/app/core-ui/data-download-dialog/select-data/select-data-missing-values/select-data-missing-values.component.ts
copy to ui/src/app/core-ui/data-download-dialog/components/select-data/select-data-missing-values/select-data-missing-values.component.ts
index 0c51dbe5c..dd64dbb01 100644
--- a/ui/src/app/core-ui/data-download-dialog/select-data/select-data-missing-values/select-data-missing-values.component.ts
+++ b/ui/src/app/core-ui/data-download-dialog/components/select-data/select-data-missing-values/select-data-missing-values.component.ts
@@ -17,15 +17,17 @@
  */
 
 import { Component, Input, OnInit } from '@angular/core';
+import { DataExportConfig } from '../../../model/data-export-config.model';
 
 @Component({
   selector: 'sp-select-data-missing-values',
   templateUrl: './select-data-missing-values.component.html',
-  styleUrls: ['./select-data-missing-values.component.scss']
+  styleUrls: ['./select-data-missing-values.component.scss',
+              '../select-data.component.scss']
 })
 export class SelectDataMissingValuesComponent implements OnInit {
 
-  @Input() missingValueBehaviour: 'ignore' | 'default' | 'empty';
+  @Input() dataExportConfig: DataExportConfig;
 
   constructor() {
   }
diff --git a/ui/src/app/core-ui/data-download-dialog/components/select-data/select-data-range/select-data-range.component.html b/ui/src/app/core-ui/data-download-dialog/components/select-data/select-data-range/select-data-range.component.html
new file mode 100644
index 000000000..efcf22ea1
--- /dev/null
+++ b/ui/src/app/core-ui/data-download-dialog/components/select-data/select-data-range/select-data-range.component.html
@@ -0,0 +1,88 @@
+<!--
+  ~  Licensed to the Apache Software Foundation (ASF) under one or more
+  ~  contributor license agreements.  See the NOTICE file distributed with
+  ~  this work for additional information regarding copyright ownership.
+  ~  The ASF licenses this file to You under the Apache License, Version 2.0
+  ~  (the "License"); you may not use this file except in compliance with
+  ~  the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~  Unless required by applicable law or agreed to in writing, software
+  ~  distributed under the License is distributed on an "AS IS" BASIS,
+  ~  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~  See the License for the specific language governing permissions and
+  ~  limitations under the License.
+  ~
+  -->
+
+<h5>Data Range</h5>
+<mat-radio-group
+    class="sp-radio-group"
+    [(ngModel)]="dataExportConfig.dataRangeConfiguration">
+  <mat-radio-button
+      value="visible"
+      class="sp-radio-button"
+      *ngIf="dataExplorerDataConfig">
+    Currently configured query
+  </mat-radio-button>
+  <!--  <div fxLayout="column"-->
+  <!--       fxLayoutAlign="start start"-->
+  <!--       class="ml-35 mb-10"-->
+  <!--       *ngIf="dataExportConfig.dataRangeConfiguration === 'visible' && dataExplorerDataConfig && dataExplorerDataConfig.sourceConfigs.length > 1">-->
+  <!--    <h5>Select source (only one source can be exported in a single file)</h5>-->
+  <!--    <mat-radio-group-->
+  <!--        class="sp-radio-group"-->
+  <!--        fxLayout="column">-->
+  <!--      &lt;!&ndash;        [ngModel]="ngModel_1"&ndash;&gt;-->
+  <!--      &lt;!&ndash;        (ngModelChange)="ngModel_1Change.emit($event)"&ndash;&gt;-->
+  <!--      <mat-radio-button-->
+  <!--          class="p-5"-->
+  <!--          [value]="i"-->
+  <!--          *ngFor="let sourceConfig of dataExplorerDataConfig.sourceConfigs; let i = index">-->
+  <!--        {{sourceConfig.measureName}}-->
+  <!--      </mat-radio-button>-->
+  <!--    </mat-radio-group>-->
+  <!--  </div>-->
+  <mat-radio-button
+      value="all"
+      class="sp-radio-button">
+    All data in database
+  </mat-radio-button>
+  <mat-radio-button
+      value="customInterval"
+      class="sp-radio-button">
+    All data in custom time interval
+  </mat-radio-button>
+
+  <div
+      fxLayout="row"
+      fxLayoutAlign="start center"
+      class="ml-35"
+      *ngIf="dataExportConfig.dataRangeConfiguration === 'customInterval'">
+    <mat-form-field
+        class="form-field-date">
+      <input
+          matInput
+          [owlDateTime]="dt1"
+          [owlDateTimeTrigger]="dt1"
+          [(ngModel)]="datePickerSelection"
+          [selectMode]="'range'"
+          (dateTimeChange)="setDateRangeFromSelection()">
+      <mat-icon
+          matSuffix
+          [owlDateTimeTrigger]="dt1"
+          *ngIf="dataExportConfig.dataRangeConfiguration === 'customInterval'">
+        event
+      </mat-icon>
+      <mat-icon
+          matSuffix
+          class="event-color"
+          *ngIf="dataExportConfig.dataRangeConfiguration !== 'customInterval'">
+        event
+      </mat-icon>
+      <owl-date-time #dt1></owl-date-time>
+    </mat-form-field>
+  </div>
+</mat-radio-group>
+
diff --git a/ui/src/app/core-ui/data-download-dialog/select-format/select-format.component.scss b/ui/src/app/core-ui/data-download-dialog/components/select-data/select-data-range/select-data-range.component.scss
similarity index 100%
copy from ui/src/app/core-ui/data-download-dialog/select-format/select-format.component.scss
copy to ui/src/app/core-ui/data-download-dialog/components/select-data/select-data-range/select-data-range.component.scss
diff --git a/ui/src/app/core-ui/data-download-dialog/select-data/select-data-range/select-data-range.component.ts b/ui/src/app/core-ui/data-download-dialog/components/select-data/select-data-range/select-data-range.component.ts
similarity index 56%
rename from ui/src/app/core-ui/data-download-dialog/select-data/select-data-range/select-data-range.component.ts
rename to ui/src/app/core-ui/data-download-dialog/components/select-data/select-data-range/select-data-range.component.ts
index dcd32f895..e1275f0a6 100644
--- a/ui/src/app/core-ui/data-download-dialog/select-data/select-data-range/select-data-range.component.ts
+++ b/ui/src/app/core-ui/data-download-dialog/components/select-data/select-data-range/select-data-range.component.ts
@@ -18,31 +18,38 @@
 
 import { Component, Input, OnInit } from '@angular/core';
 import { DataExplorerDataConfig, DateRange } from '@streampipes/platform-services';
+import { DataExportConfig } from '../../../model/data-export-config.model';
 
 @Component({
   selector: 'sp-select-data-range',
   templateUrl: './select-data-range.component.html',
-  styleUrls: ['./select-data-range.component.scss']
+  styleUrls: ['./select-data-range.component.scss',
+    '../select-data.component.scss']
 })
 export class SelectDataRangeComponent implements OnInit {
-  @Input() date: DateRange;
-  @Input() dataConfig: DataExplorerDataConfig;
-  @Input() dataRangeConfiguration: 'all' | 'customInterval' | 'visible';
 
-  dateRange: Date[] = []; // [0] start, [1] end
+  @Input() dataExplorerDataConfig: DataExplorerDataConfig;
+  @Input() dataExportConfig: DataExportConfig;
 
-  ngOnInit(): void {
-    if (!this.date) {
-      const endDate = new Date();
+  datePickerSelection: Date[] = [];
 
-      endDate.setDate(endDate.getDate() - 5);
-      this.date = {startDate: new Date(), endDate};
+  ngOnInit(): void {
+    if (!this.dataExportConfig.dateRange) {
+      this.initDateSelection();
     }
-    this.dateRange[0] = this.date.startDate;
-    this.dateRange[1] = this.date.endDate;
+  }
 
-    if (this.dataConfig) {
-      this.dataRangeConfiguration = 'visible';
-    }
+  initDateSelection() {
+    const endDate = new Date();
+    endDate.setDate(endDate.getDate() - 5);
+    this.datePickerSelection[0] = new Date();
+    this.datePickerSelection[1] = endDate;
+    this.dataExportConfig.dateRange = new DateRange(this.datePickerSelection[0], this.datePickerSelection[1]);
+    this.setDateRangeFromSelection();
   }
+
+  private setDateRangeFromSelection() {
+    this.dataExportConfig.dateRange = new DateRange(this.datePickerSelection[0], this.datePickerSelection[1]);
+  }
+
 }
diff --git a/ui/src/app/core-ui/data-download-dialog/select-data/select-data.component.html b/ui/src/app/core-ui/data-download-dialog/components/select-data/select-data.component.html
similarity index 82%
rename from ui/src/app/core-ui/data-download-dialog/select-data/select-data.component.html
rename to ui/src/app/core-ui/data-download-dialog/components/select-data/select-data.component.html
index bdccb54ac..39f879078 100644
--- a/ui/src/app/core-ui/data-download-dialog/select-data/select-data.component.html
+++ b/ui/src/app/core-ui/data-download-dialog/components/select-data/select-data.component.html
@@ -18,12 +18,11 @@
 
 <div class="mt-10">
   <sp-select-data-range
-      [date]="date"
-      [dataConfig]="dataConfig"
-      [dataRangeConfiguration]="exportDataConfiguration.dataRangeConfiguration">
+      [dataExplorerDataConfig]="dataExplorerDataConfig"
+      [dataExportConfig]="dataExportConfig">
   </sp-select-data-range>
 
   <sp-select-data-missing-values
-      [missingValueBehaviour]="exportDataConfiguration.missingValueBehaviour">
+      [dataExportConfig]="dataExportConfig">
   </sp-select-data-missing-values>
 </div>
diff --git a/ui/src/app/core-ui/data-download-dialog/select-data/select-data.component.scss b/ui/src/app/core-ui/data-download-dialog/components/select-data/select-data.component.scss
similarity index 95%
rename from ui/src/app/core-ui/data-download-dialog/select-data/select-data.component.scss
rename to ui/src/app/core-ui/data-download-dialog/components/select-data/select-data.component.scss
index dd1090a9f..7cb92e135 100644
--- a/ui/src/app/core-ui/data-download-dialog/select-data/select-data.component.scss
+++ b/ui/src/app/core-ui/data-download-dialog/components/select-data/select-data.component.scss
@@ -16,7 +16,7 @@
  *
  */
 
-@import 'src/scss/sp/sp-dialog';
+@import '../../../../../scss/sp/sp-dialog';
 
 .sp-radio-group {
   display: flex;
diff --git a/ui/src/app/core-ui/data-download-dialog/select-data/select-data.component.ts b/ui/src/app/core-ui/data-download-dialog/components/select-data/select-data.component.ts
similarity index 70%
rename from ui/src/app/core-ui/data-download-dialog/select-data/select-data.component.ts
rename to ui/src/app/core-ui/data-download-dialog/components/select-data/select-data.component.ts
index 10f41ad60..5cacf1f78 100644
--- a/ui/src/app/core-ui/data-download-dialog/select-data/select-data.component.ts
+++ b/ui/src/app/core-ui/data-download-dialog/components/select-data/select-data.component.ts
@@ -18,8 +18,8 @@
 
 import { Component, Input } from '@angular/core';
 
-import { DataExplorerDataConfig, DateRange } from '@streampipes/platform-services';
-import { ExportDataConfiguration } from '../export-data-configuration.model';
+import { DataExplorerDataConfig } from '@streampipes/platform-services';
+import { DataExportConfig } from '../../model/data-export-config.model';
 
 @Component({
   selector: 'sp-select-data',
@@ -28,12 +28,15 @@ import { ExportDataConfiguration } from '../export-data-configuration.model';
 })
 export class SelectDataComponent {
 
-  @Input() dataConfig: DataExplorerDataConfig;
-  @Input() date: DateRange;
+  /**
+   * Contains the measurement and date range for a selected data widget
+   * This value is not required
+   */
+  @Input() dataExplorerDataConfig: DataExplorerDataConfig;
 
-  @Input() exportDataConfiguration: ExportDataConfiguration;
-
-  selectedQueryIndex = 0;
-  // selectedData = 'visible';
+  /**
+   * Represents the user configurations for the download
+   */
+  @Input() dataExportConfig: DataExportConfig;
 
 }
diff --git a/ui/src/app/core-ui/data-download-dialog/select-format/select-format.component.html b/ui/src/app/core-ui/data-download-dialog/components/select-format/select-format.component.html
similarity index 51%
rename from ui/src/app/core-ui/data-download-dialog/select-format/select-format.component.html
rename to ui/src/app/core-ui/data-download-dialog/components/select-format/select-format.component.html
index 90e67c58f..dfe354587 100644
--- a/ui/src/app/core-ui/data-download-dialog/select-format/select-format.component.html
+++ b/ui/src/app/core-ui/data-download-dialog/components/select-format/select-format.component.html
@@ -16,4 +16,22 @@
   ~
   -->
 
-<p>select-format works!</p>
+<ng-template matStepLabel>Select Format</ng-template>
+<div>
+  <h5>Download Format</h5>
+  <mat-radio-group class="sp-radio-group" [(ngModel)]="formatExportConfig.exportFormat">
+    <mat-radio-button value="json" class="sp-radio-button">
+      JSON
+    </mat-radio-button>
+    <mat-radio-button value="csv" class="sp-radio-button">
+      CSV
+    </mat-radio-button>
+  </mat-radio-group>
+</div>
+<div *ngIf="formatExportConfig.exportFormat === 'csv'" class="mt-10">
+  <h5>Delimiter</h5>
+  <mat-radio-group [(ngModel)]="formatExportConfig.delimiter" class="sp-radio-group">
+    <mat-radio-button value="comma" class="sp-radio-button">&nbsp;,</mat-radio-button>
+    <mat-radio-button value="semicolon" class="sp-radio-button">&nbsp;;</mat-radio-button>
+  </mat-radio-group>
+</div>
diff --git a/ui/src/app/core-ui/data-download-dialog/select-format/select-format.component.scss b/ui/src/app/core-ui/data-download-dialog/components/select-format/select-format.component.scss
similarity index 100%
rename from ui/src/app/core-ui/data-download-dialog/select-format/select-format.component.scss
rename to ui/src/app/core-ui/data-download-dialog/components/select-format/select-format.component.scss
diff --git a/ui/src/app/core-ui/data-download-dialog/select-format/select-format.component.ts b/ui/src/app/core-ui/data-download-dialog/components/select-format/select-format.component.ts
similarity index 78%
rename from ui/src/app/core-ui/data-download-dialog/select-format/select-format.component.ts
rename to ui/src/app/core-ui/data-download-dialog/components/select-format/select-format.component.ts
index a380b0db3..467b7d09f 100644
--- a/ui/src/app/core-ui/data-download-dialog/select-format/select-format.component.ts
+++ b/ui/src/app/core-ui/data-download-dialog/components/select-format/select-format.component.ts
@@ -16,15 +16,18 @@
  *
  */
 
-import { Component, OnInit } from '@angular/core';
+import { Component, Input, OnInit } from '@angular/core';
+import { FormatExportConfig } from '../../model/format-export-config.model';
 
 @Component({
   selector: 'sp-select-format',
   templateUrl: './select-format.component.html',
-  styleUrls: ['./select-format.component.scss']
+  styleUrls: ['./select-format.component.scss', '../../data-download-dialog.component.scss']
 })
 export class SelectFormatComponent implements OnInit {
 
+  @Input() formatExportConfig: FormatExportConfig;
+
   constructor() {
   }
 
diff --git a/ui/src/app/core-ui/data-download-dialog/data-download-dialog.component.html b/ui/src/app/core-ui/data-download-dialog/data-download-dialog.component.html
index 9bb51824a..8adb6f961 100644
--- a/ui/src/app/core-ui/data-download-dialog/data-download-dialog.component.html
+++ b/ui/src/app/core-ui/data-download-dialog/data-download-dialog.component.html
@@ -19,52 +19,23 @@
 <div class="sp-dialog-container">
   <div class="sp-dialog-content p-15">
     <div fxFlex="100">
-      <mat-horizontal-stepper #stepper>
+      <mat-horizontal-stepper #downloadDialogStepper>
+
         <mat-step>
           <sp-select-data
-              [dataConfig]="dataConfig"
-              [date]="date"
-              [exportDataConfiguration]="exportDataConfiguration">
+              [dataExplorerDataConfig]="dataDownloadDialogModel.dataExplorerDataConfig"
+              [dataExportConfig]="exportConfig.dataExportConfig">
           </sp-select-data>
           <ng-template matStepLabel>Select Data</ng-template>
         </mat-step>
 
         <mat-step>
-          <sp-select-format></sp-select-format>
-          <ng-template matStepLabel>Select Format</ng-template>
-          <div>
-            <h5>Download Format</h5>
-            <mat-radio-group class="sp-radio-group" [(ngModel)]="downloadFormat">
-              <mat-radio-button value="json" class="sp-radio-button">
-                JSON
-              </mat-radio-button>
-              <mat-radio-button value="csv" class="sp-radio-button">
-                CSV
-              </mat-radio-button>
-            </mat-radio-group>
-          </div>
-          <div *ngIf="downloadFormat === 'csv'" class="mt-10">
-            <h5>Delimiter</h5>
-            <mat-radio-group [(ngModel)]="delimiter" class="sp-radio-group">
-              <mat-radio-button value="comma" class="sp-radio-button">&nbsp;,</mat-radio-button>
-              <mat-radio-button value="semicolon" class="sp-radio-button">&nbsp;;</mat-radio-button>
-            </mat-radio-group>
-          </div>
+          <sp-select-format
+            [formatExportConfig]="exportConfig.formatExportConfig"></sp-select-format>
         </mat-step>
 
-
         <mat-step>
           <sp-download></sp-download>
-          <ng-template matStepLabel>Download</ng-template>
-          <div fxFlex="100" fxLayout="column" fxLayoutAlign="center center" *ngIf="!downloadFinish" class="mt-35">
-            <mat-spinner [diameter]="30" color="accent"></mat-spinner>
-            <label *ngIf="downloadedMBs !== undefined">{{downloadedMBs | number : '1.0-2' }} Mb</label>
-            <button mat-button warn color="warn" (click)="cancelDownload()">Cancel</button>
-          </div>
-          <div fxLayout="column" fxLayoutAlign="space-around center" *ngIf="downloadFinish">
-            <mat-icon class="icon-check">check</mat-icon>
-            <h5>Download successful</h5>
-          </div>
         </mat-step>
       </mat-horizontal-stepper>
 
@@ -80,21 +51,21 @@
         mat-raised-button
         class="mat-basic"
         style="margin-right: 10px;"
-        *ngIf="stepper.selectedIndex == 1"
+        *ngIf="downloadDialogStepper.selectedIndex == 1"
         (click)="previousStep()">
       Previous
     </button>
     <button
         mat-button
         mat-raised-button
-        *ngIf="stepper.selectedIndex < 1" color="accent"
+        *ngIf="downloadDialogStepper.selectedIndex < 1" color="accent"
         (click)="nextStep()">
       Next
     </button>
     <button
         mat-button
         mat-raised-button
-        *ngIf="stepper.selectedIndex == 1" color="accent"
+        *ngIf="downloadDialogStepper.selectedIndex == 1" color="accent"
         (click)="downloadData()">
       Download
     </button>
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 4c3aace79..8c4cf8b46 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
@@ -16,18 +16,11 @@
  *
  */
 
-import { HttpEventType } from '@angular/common/http';
 import { Component, Input, OnInit, ViewChild } from '@angular/core';
 import { MatStepper } from '@angular/material/stepper';
-import {
-  DataExplorerDataConfig,
-  DatalakeQueryParameters,
-  DatalakeRestService,
-  DataViewQueryGeneratorService,
-  DateRange
-} from '@streampipes/platform-services';
 import { DialogRef } from '@streampipes/shared-ui';
-import { ExportDataConfiguration } from './export-data-configuration.model';
+import { ExportConfig } from './model/export-config.model';
+import { DataDownloadDialogModel } from './model/data-download-dialog.model';
 
 
 @Component({
@@ -35,206 +28,51 @@ import { ExportDataConfiguration } from './export-data-configuration.model';
   templateUrl: 'data-download-dialog.component.html',
   styleUrls: ['./data-download-dialog.component.scss']
 })
-// tslint:disable-next-line:component-class-suffix
 export class DataDownloadDialogComponent implements OnInit {
 
-  /**
-   * Provide either measureName without additional configuration
-   * or dataConfig to allow selection of multiple sources
-   */
-  @Input() measureName: string;
+  @Input() dataDownloadDialogModel: DataDownloadDialogModel;
 
-  @Input() date: DateRange;
-  @Input() dataConfig: DataExplorerDataConfig;
-  // selectedData = 'visible';
-  // dateRange: Date [] = []; // [0] start, [1] end
+  @ViewChild('downloadDialogStepper', {static: true}) downloadDialogStepper: MatStepper;
 
-  exportDataConfiguration: ExportDataConfiguration;
+  exportConfig: ExportConfig;
 
-  downloadFormat = 'csv';
-  delimiter = 'comma';
-  downloadFinish = false;
-  downloadedMBs: number = undefined;
-  selectedQueryIndex = 0;
-
-  @ViewChild('stepper', {static: true}) stepper: MatStepper;
-
-  downloadHttpRequestSubscribtion;
-
-  delme = '';
-
-  constructor(public dialogRef: DialogRef<DataDownloadDialogComponent>,
-              public datalakeRestService: DatalakeRestService,
-              private dataViewQueryService: DataViewQueryGeneratorService) {
+  constructor(public dialogRef: DialogRef<DataDownloadDialogComponent>) {
   }
 
   ngOnInit() {
-    this.exportDataConfiguration = new ExportDataConfiguration();
-    // if (!this.date) {
-    //   const endDate = new Date();
-    //   endDate.setDate(endDate.getDate() - 5);
-    //   this.date = {startDate: new Date(), endDate};
-    // }
-    // this.dateRange[0] = this.date.startDate;
-    // this.dateRange[1] = this.date.endDate;
-
-    // if (!this.dataConfig) {
-    //   this.selectedData = 'all';
-    // }
-  }
-
-  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();
-    const startDateString = this.getDateString(this.date.startDate);
-    const endDateString = this.getDateString(this.date.endDate);
-    // TODO
-    // switch (this.selectedData) {
-    switch (this.delme) {
-      case 'all':
-        this.performRequest(this.datalakeRestService.downloadRawData(
-          index,
-          this.downloadFormat,
-          this.delimiter), '', '');
-        break;
-      case 'customInterval':
-        this.performRequest(this.datalakeRestService.downloadRawData(
-            index,
-            this.downloadFormat,
-            this.delimiter,
-            startTime,
-            endTime), startDateString,
-          endDateString);
-        break;
-      case 'visible':
-        this.performRequest(
-          this.datalakeRestService
-            .downloadQueriedData(
-              index,
-              this.downloadFormat,
-              this.delimiter,
-              this.generateQueryRequest(startTime, endTime)
-            ),
-          startDateString,
-          endDateString
-        );
-
-    }
-  }
-
-  generateQueryRequest(startTime: number,
-                       endTime: number): DatalakeQueryParameters {
-    return this.dataViewQueryService
-      .generateQuery(startTime, endTime, this.dataConfig.sourceConfigs[this.selectedQueryIndex]);
-  }
-
-  performRequest(request, startDate, endDate) {
-    this.downloadHttpRequestSubscribtion = request.subscribe(event => {
-      // progress
-      if (event.type === HttpEventType.DownloadProgress) {
-        this.downloadedMBs = event.loaded / 1024 / 1014;
+    const measurement = this.dataDownloadDialogModel.measureName !== undefined ?
+      this.dataDownloadDialogModel.measureName : this.dataDownloadDialogModel.dataExplorerDataConfig.sourceConfigs[0].measureName;
+
+    this.exportConfig = {
+      dataExportConfig: {
+        dataRangeConfiguration: 'all',
+        missingValueBehaviour: 'ignore',
+        measurement: measurement
+      },
+      formatExportConfig: {
+        exportFormat: 'csv',
+        delimiter: 'comma'
       }
-
-      // finished
-      if (event.type === HttpEventType.Response) {
-        this.createFile(event.body, this.downloadFormat, this.measureName, startDate, endDate);
-        this.downloadFinish = true;
-      }
-    });
-  }
-
-  convertData(data, format, xAxesKey, yAxesKeys) {
-    const indexXKey = data.headers.findIndex(headerName => headerName === xAxesKey);
-    const indicesYKeys = [];
-    yAxesKeys.forEach(key => {
-      indicesYKeys.push(data.headers.findIndex(headerName => headerName === key));
-    });
-
-    if (format === 'json') {
-      const resultJson = [];
-
-
-      data.rows.forEach(row => {
-        const tmp = {'time': new Date(row[indexXKey]).getTime()};
-        indicesYKeys.forEach(index => {
-          if (row[index] !== undefined) {
-            tmp[data.headers[index]] = row[index];
-          }
-        });
-        resultJson.push(tmp);
-      });
-
-      return JSON.stringify(resultJson);
-    } else {
-      // CSV
-      let resultCsv = '';
-
-      // header
-      resultCsv += xAxesKey;
-      yAxesKeys.forEach(key => {
-        resultCsv += ';';
-        resultCsv += key;
-      });
-
-
-      // content
-      data.rows.forEach(row => {
-        resultCsv += '\n';
-        resultCsv += new Date(row[indexXKey]).getTime();
-        indicesYKeys.forEach(index => {
-          resultCsv += ';';
-          if (row[index] !== undefined) {
-            resultCsv += row[index];
-          }
-        });
-      });
-
-      return resultCsv;
-    }
+    };
   }
 
-  createFile(data, format, fileName, startDate, endDate) {
-    const a = document.createElement('a');
-    document.body.appendChild(a);
-    a.style.display = 'display: none';
-
-    let name = 'sp_' + startDate + '_' + fileName + '.' + this.downloadFormat;
-    name = name.replace('__', '_');
-
-    const url = window.URL.createObjectURL(new Blob([String(data)], {type: 'data:text/' + format + ';charset=utf-8'}));
-    a.href = url;
-    a.download = name;
-    a.click();
-    window.URL.revokeObjectURL(url);
-  }
-
-  cancelDownload() {
-    try {
-      this.downloadHttpRequestSubscribtion.unsubscribe();
-    } finally {
-      this.exitDialog();
-    }
-  }
-
-
-  exitDialog(): void {
+  exitDialog() {
     this.dialogRef.close();
   }
 
   nextStep() {
-    this.stepper.next();
+    this.downloadDialogStepper.next();
   }
 
   previousStep() {
-    this.stepper.previous();
+    this.downloadDialogStepper.previous();
   }
 
-  getDateString(date: Date): string {
-    return date.toLocaleDateString() + 'T' + date.toLocaleTimeString().replace(':', '.')
-      .replace(':', '.');
-  }
+  downloadData() {
+    // if (this.exportConfig.dataExportConfig.dataRangeConfiguration === 'visible') {
+    //  this.exportConfig.dataExportConfig.dateRange = this.dataDownloadDialogModel.dataExplorerDateRange;
+    // }
 
+    console.log(this.exportConfig);
+  }
 }
diff --git a/ui/src/app/core-ui/data-download-dialog/export-data-configuration.model.ts b/ui/src/app/core-ui/data-download-dialog/export-data-configuration.model.ts
deleted file mode 100644
index 9c181243d..000000000
--- a/ui/src/app/core-ui/data-download-dialog/export-data-configuration.model.ts
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- */
-
-export class ExportDataConfiguration {
-  dataRangeConfiguration: 'all' | 'customInterval' | 'visible';
-  missingValueBehaviour: 'ignore' | 'default' | 'empty';
-
-  constructor() {
-    this.dataRangeConfiguration = 'all';
-    this.missingValueBehaviour = 'ignore';
-  }
-}
-
diff --git a/ui/src/app/core-ui/data-download-dialog/select-data/select-data-missing-values/select-data-missing-values.component.ts b/ui/src/app/core-ui/data-download-dialog/model/data-download-dialog.model.ts
similarity index 64%
rename from ui/src/app/core-ui/data-download-dialog/select-data/select-data-missing-values/select-data-missing-values.component.ts
rename to ui/src/app/core-ui/data-download-dialog/model/data-download-dialog.model.ts
index 0c51dbe5c..42ae9a733 100644
--- a/ui/src/app/core-ui/data-download-dialog/select-data/select-data-missing-values/select-data-missing-values.component.ts
+++ b/ui/src/app/core-ui/data-download-dialog/model/data-download-dialog.model.ts
@@ -15,22 +15,19 @@
  *  limitations under the License.
  *
  */
+import { DataExplorerDataConfig, DateRange } from '@streampipes/platform-services';
 
-import { Component, Input, OnInit } from '@angular/core';
-
-@Component({
-  selector: 'sp-select-data-missing-values',
-  templateUrl: './select-data-missing-values.component.html',
-  styleUrls: ['./select-data-missing-values.component.scss']
-})
-export class SelectDataMissingValuesComponent implements OnInit {
-
-  @Input() missingValueBehaviour: 'ignore' | 'default' | 'empty';
-
-  constructor() {
-  }
+/**
+ * Provide either measureName without additional configuration
+ * or dataConfig to allow selection of multiple sources
+ */
+export interface DataDownloadDialogModel {
 
-  ngOnInit(): void {
-  }
+  // option 1 provide a measurement name
+  measureName?: string;
 
+  // option 2 provide data explorer configs
+  dataExplorerDateRange?: DateRange;
+  dataExplorerDataConfig?: DataExplorerDataConfig;
 }
+
diff --git a/ui/src/app/core-ui/data-download-dialog/model/data-export-config.model.ts b/ui/src/app/core-ui/data-download-dialog/model/data-export-config.model.ts
new file mode 100644
index 000000000..3f13a4c0b
--- /dev/null
+++ b/ui/src/app/core-ui/data-download-dialog/model/data-export-config.model.ts
@@ -0,0 +1,45 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+import { DateRange } from '@streampipes/platform-services';
+
+export interface DataExportConfig {
+  dataRangeConfiguration: 'all' | 'customInterval' | 'visible';
+  missingValueBehaviour: 'ignore' | 'default' | 'empty';
+  dateRange?: DateRange;
+  measurement?: string;
+}
+
diff --git a/ui/src/app/core-ui/data-download-dialog/model/export-config.model.ts b/ui/src/app/core-ui/data-download-dialog/model/export-config.model.ts
new file mode 100644
index 000000000..8d29f3435
--- /dev/null
+++ b/ui/src/app/core-ui/data-download-dialog/model/export-config.model.ts
@@ -0,0 +1,44 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+import { DataExportConfig } from './data-export-config.model';
+import { FormatExportConfig } from './format-export-config.model';
+
+export interface ExportConfig {
+  dataExportConfig: DataExportConfig;
+  formatExportConfig: FormatExportConfig;
+}
+
diff --git a/ui/src/app/core-ui/data-download-dialog/model/format-export-config.model.ts b/ui/src/app/core-ui/data-download-dialog/model/format-export-config.model.ts
new file mode 100644
index 000000000..f2f4ddc96
--- /dev/null
+++ b/ui/src/app/core-ui/data-download-dialog/model/format-export-config.model.ts
@@ -0,0 +1,48 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+export type FormatExportConfig = JsonFormatExportConfig | CsvFormatExportConfig;
+
+export interface JsonFormatExportConfig {
+  exportFormat: 'json';
+}
+
+export interface CsvFormatExportConfig {
+  exportFormat: 'csv';
+  delimiter: 'comma' | 'semicolon';
+}
+
+
diff --git a/ui/src/app/core-ui/data-download-dialog/select-data/select-data-range/select-data-range.component.html b/ui/src/app/core-ui/data-download-dialog/select-data/select-data-range/select-data-range.component.html
deleted file mode 100644
index 708d2701c..000000000
--- a/ui/src/app/core-ui/data-download-dialog/select-data/select-data-range/select-data-range.component.html
+++ /dev/null
@@ -1,86 +0,0 @@
-<!--
-  ~  Licensed to the Apache Software Foundation (ASF) under one or more
-  ~  contributor license agreements.  See the NOTICE file distributed with
-  ~  this work for additional information regarding copyright ownership.
-  ~  The ASF licenses this file to You under the Apache License, Version 2.0
-  ~  (the "License"); you may not use this file except in compliance with
-  ~  the License.  You may obtain a copy of the License at
-  ~
-  ~     http://www.apache.org/licenses/LICENSE-2.0
-  ~
-  ~  Unless required by applicable law or agreed to in writing, software
-  ~  distributed under the License is distributed on an "AS IS" BASIS,
-  ~  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  ~  See the License for the specific language governing permissions and
-  ~  limitations under the License.
-  ~
-  -->
-
-<h5>Data Range</h5>
-<mat-radio-group
-    class="sp-radio-group"
-    [ngModel]="dataRangeConfiguration">
-  <mat-radio-button
-      value="visible"
-      class="sp-radio-button"
-      *ngIf="dataConfig">
-    Currently configured query
-  </mat-radio-button>
-  <div fxLayout="column"
-       fxLayoutAlign="start start"
-       class="ml-35 mb-10"
-       *ngIf="dataRangeConfiguration === 'visible' && dataConfig && dataConfig.sourceConfigs.length > 1">
-    <h5>Select source (only one source can be exported in a single file)</h5>
-    <mat-radio-group
-        class="sp-radio-group"
-        fxLayout="column">
-      <!--        [ngModel]="ngModel_1"-->
-      <!--        (ngModelChange)="ngModel_1Change.emit($event)"-->
-      <mat-radio-button
-          class="p-5"
-          [value]="i"
-          *ngFor="let sourceConfig of dataConfig.sourceConfigs; let i = index">
-        {{sourceConfig.measureName}}
-      </mat-radio-button>
-    </mat-radio-group>
-  </div>
-  <mat-radio-button
-      value="all"
-      class="sp-radio-button">
-    All data in database
-  </mat-radio-button>
-  <mat-radio-button
-      value="customInterval"
-      class="sp-radio-button">
-    All data in custom time interval
-  </mat-radio-button>
-</mat-radio-group>
-<div
-    fxLayout="row"
-    fxLayoutAlign="start center"
-    class="ml-35"
-    *ngIf="dataRangeConfiguration === 'customInterval'">
-  <mat-form-field
-      class="form-field-date">
-    <input
-        matInput
-        [owlDateTime]="dt1"
-        [owlDateTimeTrigger]="dt1"
-        [(ngModel)]="dateRange"
-        [selectMode]="'range'"
-        [disabled]="dataRangeConfiguration !== 'customInterval'">
-    <mat-icon
-        matSuffix
-        [owlDateTimeTrigger]="dt1"
-        *ngIf="dataRangeConfiguration === 'customInterval'">
-      event
-    </mat-icon>
-    <mat-icon
-        matSuffix
-        class="event-color"
-        *ngIf="dataRangeConfiguration !== 'customInterval'">
-      event
-    </mat-icon>
-    <owl-date-time #dt1></owl-date-time>
-  </mat-form-field>
-</div>
diff --git a/ui/src/app/core-ui/data-download-dialog/select-data/select-data-range/select-data-range.component.scss b/ui/src/app/core-ui/data-download-dialog/select-data/select-data-range/select-data-range.component.scss
deleted file mode 100644
index 13d28184a..000000000
--- a/ui/src/app/core-ui/data-download-dialog/select-data/select-data-range/select-data-range.component.scss
+++ /dev/null
@@ -1,33 +0,0 @@
-/*!
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- */
-.sp-radio-group {
-  display: flex;
-  flex-direction: column;
-  margin: 15px 0;
-}
-
-.sp-radio-button {
-  margin: 5px;
-  width: 100%;
-}
-
-.form-field-date {
-  top: -10px;
-  width: 300px;
-}
-
diff --git a/ui/src/app/core-ui/data-download-dialog/services/data-export.service.ts b/ui/src/app/core-ui/data-download-dialog/services/data-export.service.ts
new file mode 100644
index 000000000..9744d3d56
--- /dev/null
+++ b/ui/src/app/core-ui/data-download-dialog/services/data-export.service.ts
@@ -0,0 +1,167 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+import { Injectable } from '@angular/core';
+import { ExportConfig } from '../model/export-config.model';
+import { DatalakeRestService } from '@streampipes/platform-services';
+import { DataDownloadDialogModel } from '../model/data-download-dialog.model';
+
+@Injectable({
+  providedIn: 'root'
+})
+export class DataExportService {
+
+  constructor(public datalakeRestService: DatalakeRestService) {
+  }
+
+  downloadData(exportConfig: ExportConfig) {
+
+    // const index = !this.dataExplorerDataConfig ?
+    //   this.measureName : this.dataExplorerDataConfig.sourceConfigs[this.selectedQueryIndex].measureName;
+    // // this.nextStep();
+    // const startTime = this.date.startDate.getTime();
+    // const endTime = this.date.endDate.getTime();
+    // const startDateString = this.getDateString(this.date.startDate);
+    // const endDateString = this.getDateString(this.date.endDate);
+    switch (exportConfig.dataExportConfig.dataRangeConfiguration) {
+      case 'all':
+        this.performRequest(this.datalakeRestService.downloadRawData(
+          exportConfig.dataExportConfig.measurement,
+          exportConfig.formatExportConfig.exportFormat,
+          exportConfig.formatExportConfig.exportFormat['delimiter']),
+          '',
+          '');
+        break;
+      case 'customInterval':
+        this.performRequest(this.datalakeRestService.downloadRawData(
+            index,
+            this.downloadFormat,
+            this.delimiter,
+            startTime,
+            endTime), startDateString,
+          endDateString);
+        break;
+      case 'visible':
+        this.performRequest(
+          this.datalakeRestService
+            .downloadQueriedData(
+              index,
+              this.downloadFormat,
+              this.delimiter,
+              this.generateQueryRequest(startTime, endTime)
+            ),
+          startDateString,
+          endDateString
+        );
+
+    }
+  }
+
+    generateQueryRequest(startTime: number,
+                       endTime: number): DatalakeQueryParameters {
+    return this.dataViewQueryService
+      .generateQuery(startTime, endTime, this.dataExplorerDataConfig.sourceConfigs[this.selectedQueryIndex]);
+  }
+
+  performRequest(request, startDate, endDate) {
+    this.downloadHttpRequestSubscription = request.subscribe(event => {
+      // progress
+      if (event.type === HttpEventType.DownloadProgress) {
+        this.downloadedMBs = event.loaded / 1024 / 1014;
+      }
+
+      // finished
+      if (event.type === HttpEventType.Response) {
+        this.createFile(event.body, this.downloadFormat, this.measureName, startDate, endDate);
+        this.downloadFinish = true;
+      }
+    });
+  }
+
+  convertData(data, format, xAxesKey, yAxesKeys) {
+    const indexXKey = data.headers.findIndex(headerName => headerName === xAxesKey);
+    const indicesYKeys = [];
+    yAxesKeys.forEach(key => {
+      indicesYKeys.push(data.headers.findIndex(headerName => headerName === key));
+    });
+
+    if (format === 'json') {
+      const resultJson = [];
+
+
+      data.rows.forEach(row => {
+        const tmp = {'time': new Date(row[indexXKey]).getTime()};
+        indicesYKeys.forEach(index => {
+          if (row[index] !== undefined) {
+            tmp[data.headers[index]] = row[index];
+          }
+        });
+        resultJson.push(tmp);
+      });
+
+      return JSON.stringify(resultJson);
+    } else {
+      // CSV
+      let resultCsv = '';
+
+      // header
+      resultCsv += xAxesKey;
+      yAxesKeys.forEach(key => {
+        resultCsv += ';';
+        resultCsv += key;
+      });
+
+
+      // content
+      data.rows.forEach(row => {
+        resultCsv += '\n';
+        resultCsv += new Date(row[indexXKey]).getTime();
+        indicesYKeys.forEach(index => {
+          resultCsv += ';';
+          if (row[index] !== undefined) {
+            resultCsv += row[index];
+          }
+        });
+      });
+
+      return resultCsv;
+    }
+  }
+
+  createFile(data, format, fileName, startDate, endDate) {
+    const a = document.createElement('a');
+    document.body.appendChild(a);
+    a.style.display = 'display: none';
+
+    let name = 'sp_' + startDate + '_' + fileName + '.' + this.downloadFormat;
+    name = name.replace('__', '_');
+
+    const url = window.URL.createObjectURL(new Blob([String(data)], {type: 'data:text/' + format + ';charset=utf-8'}));
+    a.href = url;
+    a.download = name;
+    a.click();
+    window.URL.revokeObjectURL(url);
+  }
+
+  getDateString(date: Date): string {
+    return date.toLocaleDateString() + 'T' + date.toLocaleTimeString().replace(':', '.')
+      .replace(':', '.');
+  }
+
+
+}
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 16dd074e9..276e45138 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
@@ -182,8 +182,10 @@ export class DataExplorerDashboardWidgetComponent implements OnInit, OnDestroy {
       title: 'Download data',
       width: '50vw',
       data: {
-        'date': DateRange.fromTimeSettings(this.timeSettings),
-        'dataConfig': this.configuredWidget.dataConfig as DataExplorerDataConfig
+        'dataDownloadDialogModel': {
+          'dataExplorerDateRange': DateRange.fromTimeSettings(this.timeSettings),
+          'dataExplorerDataConfig': this.configuredWidget.dataConfig as DataExplorerDataConfig
+        }
       }
     });
   }


[incubator-streampipes] 03/04: Merge branch 'dev' into STREAMPIPES-583

Posted by ze...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

zehnder pushed a commit to branch STREAMPIPES-583
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git

commit 149ba5bb570ad62e97f69499674383e39939ce99
Merge: 9f94cead3 5d1945b02
Author: Philipp Zehnder <ze...@fzi.de>
AuthorDate: Wed Sep 21 10:38:27 2022 +0200

    Merge branch 'dev' into STREAMPIPES-583

 .../dataexplorer/commons/influx/InfluxStore.java   | 284 +++++++++++----------
 .../apache/streampipes/model/runtime/Event.java    |   3 +-
 .../routing/StandaloneSpInputCollector.java        |   4 -
 .../runtime/StandaloneEventProcessorRuntime.java   |  40 +--
 .../runtime/StandaloneEventSinkRuntime.java        |  20 +-
 .../StandaloneExternalEventProcessorRuntime.java   |   2 +-
 .../StandaloneExternalEventSinkRuntime.java        |   2 +-
 .../wrapper/routing/RawDataProcessor.java          |   4 +-
 8 files changed, 196 insertions(+), 163 deletions(-)