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 2025/01/31 12:42:28 UTC
(streampipes) 02/02: Move data download dialog to shared UI module
This is an automated email from the ASF dual-hosted git repository.
riemer pushed a commit to branch 3448-add-excel-export-feature
in repository https://gitbox.apache.org/repos/asf/streampipes.git
commit 476fec8dbfdd1fc9056af56ce8bce9cd935eae38
Author: Dominik Riemer <do...@gmail.com>
AuthorDate: Fri Jan 31 13:41:56 2025 +0100
Move data download dialog to shared UI module
---
.../support/utils/DataDownloadDialogUtils.ts | 6 +-
.../dataDownloadDialogTest.smoke.spec.ts | 2 +-
.../configuration-box.component.html | 0
.../configuration-box.component.scss | 0
.../configuration-box.component.ts | 0
.../date-input/date-input.component.html | 0
.../date-input/date-input.component.scss | 0
.../components}/date-input/date-input.component.ts | 0
.../components/download/download.component.html | 0
.../components/download/download.component.scss | 0
.../components/download/download.component.ts | 0
.../select-data-missing-values.component.html | 39 +++---
.../select-data-missing-values.component.scss | 0
.../select-data-missing-values.component.ts | 0
.../select-data-range.component.html | 65 ++++++++++
.../select-data-range.component.scss | 0
.../select-data-range.component.ts | 0
.../select-data/select-data.component.html | 0
.../select-data/select-data.component.scss | 2 +-
.../select-data/select-data.component.ts | 2 +-
.../select-format/select-format.component.html | 134 +++++++++++++++++++++
.../select-format/select-format.component.scss | 0
.../select-format/select-format.component.ts | 6 +-
.../data-download-dialog.component.html | 0
.../data-download-dialog.component.scss | 2 +-
.../data-download-dialog.component.ts | 6 +-
.../model/data-download-dialog.model.ts | 0
.../model/data-export-config.model.ts | 0
.../model/download-progress.model.ts | 0
.../model/export-config.model.ts | 0
.../model/format-export-config.model.ts | 0
.../services/data-export.service.ts | 0
.../services/file-name.service.spec.ts | 0
.../services/file-name.service.ts | 0
.../shared-ui/src/lib/shared-ui.module.ts | 27 +++++
.../streampipes/shared-ui/src/public-api.ts | 3 +
.../datalake-configuration.component.ts | 2 +-
ui/src/app/core-ui/core-ui.module.ts | 19 ---
.../select-data-range.component.html | 64 ----------
.../select-format/select-format.component.html | 127 -------------------
.../services/data-explorer-shared.service.ts | 7 +-
41 files changed, 268 insertions(+), 245 deletions(-)
diff --git a/ui/cypress/support/utils/DataDownloadDialogUtils.ts b/ui/cypress/support/utils/DataDownloadDialogUtils.ts
index 04ce651078..c134bfe27a 100644
--- a/ui/cypress/support/utils/DataDownloadDialogUtils.ts
+++ b/ui/cypress/support/utils/DataDownloadDialogUtils.ts
@@ -16,10 +16,10 @@
*
*/
-import { ExportConfig } from '../../../src/app/core-ui/data-download-dialog/model/export-config.model';
+import { ExportConfig } from '../../../projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/model/export-config.model';
import { DataLakeUtils } from './datalake/DataLakeUtils';
-import { FileNameService } from '../../../src/app/core-ui/data-download-dialog/services/file-name.service';
-import { CsvFormatExportConfig } from '../../../src/app/core-ui/data-download-dialog/model/format-export-config.model';
+import { FileNameService } from '../../../projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/services/file-name.service';
+import { CsvFormatExportConfig } from '../../../projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/model/format-export-config.model';
export class DataDownloadDialogUtils {
public static testDownload(
diff --git a/ui/cypress/tests/dataDownloadDialog/dataDownloadDialogTest.smoke.spec.ts b/ui/cypress/tests/dataDownloadDialog/dataDownloadDialogTest.smoke.spec.ts
index 29f7b79e74..c36bd19413 100644
--- a/ui/cypress/tests/dataDownloadDialog/dataDownloadDialogTest.smoke.spec.ts
+++ b/ui/cypress/tests/dataDownloadDialog/dataDownloadDialogTest.smoke.spec.ts
@@ -16,7 +16,7 @@
*
*/
-import { ExportConfig } from '../../../src/app/core-ui/data-download-dialog/model/export-config.model';
+import { ExportConfig } from '../../../projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/model/export-config.model';
import { DataDownloadDialogUtils } from '../../support/utils/DataDownloadDialogUtils';
import { DataLakeUtils } from '../../support/utils/datalake/DataLakeUtils';
import { PrepareTestDataUtils } from '../../support/utils/PrepareTestDataUtils';
diff --git a/ui/src/app/core-ui/configuration-box/configuration-box.component.html b/ui/projects/streampipes/shared-ui/src/lib/components/configuration-box/configuration-box.component.html
similarity index 100%
rename from ui/src/app/core-ui/configuration-box/configuration-box.component.html
rename to ui/projects/streampipes/shared-ui/src/lib/components/configuration-box/configuration-box.component.html
diff --git a/ui/src/app/core-ui/configuration-box/configuration-box.component.scss b/ui/projects/streampipes/shared-ui/src/lib/components/configuration-box/configuration-box.component.scss
similarity index 100%
rename from ui/src/app/core-ui/configuration-box/configuration-box.component.scss
rename to ui/projects/streampipes/shared-ui/src/lib/components/configuration-box/configuration-box.component.scss
diff --git a/ui/src/app/core-ui/configuration-box/configuration-box.component.ts b/ui/projects/streampipes/shared-ui/src/lib/components/configuration-box/configuration-box.component.ts
similarity index 100%
rename from ui/src/app/core-ui/configuration-box/configuration-box.component.ts
rename to ui/projects/streampipes/shared-ui/src/lib/components/configuration-box/configuration-box.component.ts
diff --git a/ui/src/app/core-ui/date-input/date-input.component.html b/ui/projects/streampipes/shared-ui/src/lib/components/date-input/date-input.component.html
similarity index 100%
rename from ui/src/app/core-ui/date-input/date-input.component.html
rename to ui/projects/streampipes/shared-ui/src/lib/components/date-input/date-input.component.html
diff --git a/ui/src/app/core-ui/date-input/date-input.component.scss b/ui/projects/streampipes/shared-ui/src/lib/components/date-input/date-input.component.scss
similarity index 100%
rename from ui/src/app/core-ui/date-input/date-input.component.scss
rename to ui/projects/streampipes/shared-ui/src/lib/components/date-input/date-input.component.scss
diff --git a/ui/src/app/core-ui/date-input/date-input.component.ts b/ui/projects/streampipes/shared-ui/src/lib/components/date-input/date-input.component.ts
similarity index 100%
rename from ui/src/app/core-ui/date-input/date-input.component.ts
rename to ui/projects/streampipes/shared-ui/src/lib/components/date-input/date-input.component.ts
diff --git a/ui/src/app/core-ui/data-download-dialog/components/download/download.component.html b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/download/download.component.html
similarity index 100%
rename from ui/src/app/core-ui/data-download-dialog/components/download/download.component.html
rename to ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/download/download.component.html
diff --git a/ui/src/app/core-ui/data-download-dialog/components/download/download.component.scss b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/download/download.component.scss
similarity index 100%
rename from ui/src/app/core-ui/data-download-dialog/components/download/download.component.scss
rename to ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/download/download.component.scss
diff --git a/ui/src/app/core-ui/data-download-dialog/components/download/download.component.ts b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/download/download.component.ts
similarity index 100%
rename from ui/src/app/core-ui/data-download-dialog/components/download/download.component.ts
rename to ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/download/download.component.ts
diff --git a/ui/src/app/core-ui/data-download-dialog/components/select-data/select-data-missing-values/select-data-missing-values.component.html b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/select-data/select-data-missing-values/select-data-missing-values.component.html
similarity index 56%
rename from ui/src/app/core-ui/data-download-dialog/components/select-data/select-data-missing-values/select-data-missing-values.component.html
rename to ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/select-data/select-data-missing-values/select-data-missing-values.component.html
index a22dad4c62..c507310bd5 100644
--- a/ui/src/app/core-ui/data-download-dialog/components/select-data/select-data-missing-values/select-data-missing-values.component.html
+++ b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/select-data/select-data-missing-values/select-data-missing-values.component.html
@@ -16,23 +16,24 @@
~
-->
-<h5>Behaviour in case of missing values</h5>
-<mat-radio-group
- class="sp-radio-group"
- [(ngModel)]="dataExportConfig.missingValueBehaviour"
->
- <mat-radio-button
- value="ignore"
- class="sp-radio-button"
- data-cy="download-configuration-ignore"
+<sp-configuration-box title="Behaviour in case of missing values">
+ <mat-radio-group
+ class="sp-radio-group"
+ [(ngModel)]="dataExportConfig.missingValueBehaviour"
>
- Ignore lines with missing value
- </mat-radio-button>
- <mat-radio-button
- value="empty"
- class="sp-radio-button"
- data-cy="download-configuration-empty"
- >
- Leave entry empty
- </mat-radio-button>
-</mat-radio-group>
+ <mat-radio-button
+ value="ignore"
+ class="sp-radio-button"
+ data-cy="download-configuration-ignore"
+ >
+ Ignore lines with missing value
+ </mat-radio-button>
+ <mat-radio-button
+ value="empty"
+ class="sp-radio-button"
+ data-cy="download-configuration-empty"
+ >
+ Leave entry empty
+ </mat-radio-button>
+ </mat-radio-group>
+</sp-configuration-box>
diff --git a/ui/src/app/core-ui/data-download-dialog/components/select-data/select-data-missing-values/select-data-missing-values.component.scss b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/select-data/select-data-missing-values/select-data-missing-values.component.scss
similarity index 100%
rename from ui/src/app/core-ui/data-download-dialog/components/select-data/select-data-missing-values/select-data-missing-values.component.scss
rename to ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/select-data/select-data-missing-values/select-data-missing-values.component.scss
diff --git a/ui/src/app/core-ui/data-download-dialog/components/select-data/select-data-missing-values/select-data-missing-values.component.ts b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/select-data/select-data-missing-values/select-data-missing-values.component.ts
similarity index 100%
rename from ui/src/app/core-ui/data-download-dialog/components/select-data/select-data-missing-values/select-data-missing-values.component.ts
rename to ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/select-data/select-data-missing-values/select-data-missing-values.component.ts
diff --git a/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/select-data/select-data-range/select-data-range.component.html b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/select-data/select-data-range/select-data-range.component.html
new file mode 100644
index 0000000000..eeef53fca5
--- /dev/null
+++ b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/select-data/select-data-range/select-data-range.component.html
@@ -0,0 +1,65 @@
+<!--
+ ~ 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-configuration-box title="Data Range">
+ <mat-radio-group
+ class="sp-radio-group"
+ [(ngModel)]="dataExportConfig.dataRangeConfiguration"
+ >
+ <mat-radio-button
+ value="visible"
+ class="sp-radio-button"
+ data-cy="download-configuration-visible"
+ *ngIf="dataExplorerDataConfig"
+ >
+ Currently configured query
+ </mat-radio-button>
+ <mat-radio-button
+ value="all"
+ class="sp-radio-button"
+ data-cy="download-configuration-all"
+ >
+ All data in database
+ </mat-radio-button>
+ <mat-radio-button
+ value="customInterval"
+ class="sp-radio-button"
+ data-cy="download-configuration-customInterval"
+ >
+ All data in custom time interval
+ </mat-radio-button>
+
+ <div
+ fxLayout="row"
+ fxLayoutGap="10px"
+ class="ml-35"
+ *ngIf="dataExportConfig.dataRangeConfiguration === 'customInterval'"
+ >
+ <div>
+ <h5>From </h5>
+ <sp-date-input [(date)]="dataExportConfig.dateRange.startDate">
+ </sp-date-input>
+ </div>
+ <div>
+ <h5>To </h5>
+ <sp-date-input [(date)]="dataExportConfig.dateRange.endDate">
+ </sp-date-input>
+ </div>
+ </div>
+ </mat-radio-group>
+</sp-configuration-box>
diff --git a/ui/src/app/core-ui/data-download-dialog/components/select-data/select-data-range/select-data-range.component.scss b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/select-data/select-data-range/select-data-range.component.scss
similarity index 100%
rename from ui/src/app/core-ui/data-download-dialog/components/select-data/select-data-range/select-data-range.component.scss
rename to ui/projects/streampipes/shared-ui/src/lib/dialog/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/components/select-data/select-data-range/select-data-range.component.ts b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/select-data/select-data-range/select-data-range.component.ts
similarity index 100%
rename from ui/src/app/core-ui/data-download-dialog/components/select-data/select-data-range/select-data-range.component.ts
rename to ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/select-data/select-data-range/select-data-range.component.ts
diff --git a/ui/src/app/core-ui/data-download-dialog/components/select-data/select-data.component.html b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/select-data/select-data.component.html
similarity index 100%
rename from ui/src/app/core-ui/data-download-dialog/components/select-data/select-data.component.html
rename to ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/select-data/select-data.component.html
diff --git a/ui/src/app/core-ui/data-download-dialog/components/select-data/select-data.component.scss b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/select-data/select-data.component.scss
similarity index 94%
rename from ui/src/app/core-ui/data-download-dialog/components/select-data/select-data.component.scss
rename to ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/select-data/select-data.component.scss
index fe9dc8d86b..8c8e47d1e6 100644
--- a/ui/src/app/core-ui/data-download-dialog/components/select-data/select-data.component.scss
+++ b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/select-data/select-data.component.scss
@@ -16,7 +16,7 @@
*
*/
-@import '../../../../../scss/sp/sp-dialog';
+@import '../../../../../../../../../src/scss/sp/sp-dialog';
.sp-radio-group {
display: flex;
diff --git a/ui/src/app/core-ui/data-download-dialog/components/select-data/select-data.component.ts b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/select-data/select-data.component.ts
similarity index 100%
rename from ui/src/app/core-ui/data-download-dialog/components/select-data/select-data.component.ts
rename to ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/select-data/select-data.component.ts
index 9bc10c72c4..9e7dbc4267 100644
--- a/ui/src/app/core-ui/data-download-dialog/components/select-data/select-data.component.ts
+++ b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/select-data/select-data.component.ts
@@ -18,8 +18,8 @@
import { Component, Input } from '@angular/core';
-import { DataExplorerDataConfig } from '@streampipes/platform-services';
import { DataExportConfig } from '../../model/data-export-config.model';
+import { DataExplorerDataConfig } from '@streampipes/platform-services';
@Component({
selector: 'sp-select-data',
diff --git a/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/select-format/select-format.component.html b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/select-format/select-format.component.html
new file mode 100644
index 0000000000..ba5fe2b074
--- /dev/null
+++ b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/select-format/select-format.component.html
@@ -0,0 +1,134 @@
+<!--
+ ~ 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.
+ ~
+ -->
+
+<ng-template matStepLabel>Select Format</ng-template>
+<div>
+ <sp-configuration-box title="Download Format">
+ <mat-radio-group
+ class="sp-radio-group"
+ [(ngModel)]="formatExportConfig.format"
+ >
+ <mat-radio-button
+ value="json"
+ class="sp-radio-button"
+ data-cy="download-configuration-json"
+ >
+ JSON
+ </mat-radio-button>
+ <mat-radio-button
+ value="csv"
+ class="sp-radio-button"
+ data-cy="download-configuration-csv"
+ >
+ CSV
+ </mat-radio-button>
+ <mat-radio-button
+ value="xlsx"
+ class="sp-radio-button"
+ data-cy="download-configuration-xlsx"
+ >
+ Excel (XLSX)
+ </mat-radio-button>
+ </mat-radio-group>
+ </sp-configuration-box>
+</div>
+<div *ngIf="formatExportConfig.format === 'csv'" class="mt-10">
+ <sp-configuration-box title="Delimiter">
+ <mat-radio-group
+ [(ngModel)]="formatExportConfig.delimiter"
+ class="sp-radio-group"
+ >
+ <mat-radio-button
+ value="comma"
+ class="sp-radio-button"
+ data-cy="download-configuration-delimiter-comma"
+ > ,
+ </mat-radio-button>
+ <mat-radio-button
+ value="semicolon"
+ class="sp-radio-button"
+ data-cy="download-configuration-delimiter-semicolon"
+ > ;
+ </mat-radio-button>
+ </mat-radio-group>
+ </sp-configuration-box>
+</div>
+<div
+ *ngIf="formatExportConfig.format === 'xlsx' && hasReadFilePrivilege"
+ fxLayout="column"
+>
+ <sp-configuration-box title="Excel template">
+ <div fxLayout="column">
+ <mat-checkbox
+ [(ngModel)]="formatExportConfig.useTemplate"
+ [disabled]="excelTemplates.length === 0"
+ >
+ Use uploaded file template
+ </mat-checkbox>
+ @if (formatExportConfig.useTemplate && excelTemplates.length > 0) {
+ <mat-form-field class="mt-10" color="accent">
+ <mat-select
+ [(ngModel)]="formatExportConfig.templateId"
+ placeholder="Choose template"
+ >
+ <mat-option
+ *ngFor="let template of excelTemplates"
+ [value]="template.fileId"
+ >
+ {{ template.filename }}
+ </mat-option>
+ </mat-select>
+ </mat-form-field>
+ <mat-form-field color="accent">
+ <mat-label>First row index to append data</mat-label>
+ <input
+ matInput
+ [(ngModel)]="formatExportConfig.startRow"
+ type="number"
+ />
+ </mat-form-field>
+ }
+ </div>
+ </sp-configuration-box>
+</div>
+<div
+ *ngIf="
+ formatExportConfig.format === 'xlsx' ||
+ formatExportConfig.format === 'csv'
+ "
+>
+ <sp-configuration-box title="Header column name">
+ <mat-radio-group
+ [(ngModel)]="formatExportConfig.headerColumnName"
+ class="sp-radio-group"
+ >
+ <mat-radio-button
+ value="key"
+ class="sp-radio-button"
+ data-cy="download-configuration-column-name-key"
+ >Use field key (runtime name) as header column
+ </mat-radio-button>
+ <mat-radio-button
+ value="label"
+ class="sp-radio-button"
+ data-cy="download-configuration-column-name-label"
+ >Use field label as header column if available
+ </mat-radio-button>
+ </mat-radio-group>
+ </sp-configuration-box>
+</div>
diff --git a/ui/src/app/core-ui/data-download-dialog/components/select-format/select-format.component.scss b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/select-format/select-format.component.scss
similarity index 100%
rename from ui/src/app/core-ui/data-download-dialog/components/select-format/select-format.component.scss
rename to ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/select-format/select-format.component.scss
diff --git a/ui/src/app/core-ui/data-download-dialog/components/select-format/select-format.component.ts b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/select-format/select-format.component.ts
similarity index 89%
rename from ui/src/app/core-ui/data-download-dialog/components/select-format/select-format.component.ts
rename to ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/select-format/select-format.component.ts
index 23db806489..65c67e535c 100644
--- a/ui/src/app/core-ui/data-download-dialog/components/select-format/select-format.component.ts
+++ b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/components/select-format/select-format.component.ts
@@ -19,8 +19,7 @@
import { Component, inject, Input, OnInit } from '@angular/core';
import { FormatExportConfig } from '../../model/format-export-config.model';
import { FileMetadata, FilesService } from '@streampipes/platform-services';
-import { UserPrivilege } from '../../../../_enums/user-privilege.enum';
-import { CurrentUserService } from '@streampipes/shared-ui';
+import { CurrentUserService } from '../../../../services/current-user.service';
@Component({
selector: 'sp-select-format',
@@ -43,14 +42,13 @@ export class SelectFormatComponent implements OnInit {
ngOnInit() {
this.hasReadFilePrivilege = this.currentUserService.hasRole(
- UserPrivilege.PRIVILEGE_READ_FILES,
+ 'PRIVILEGE_READ_FILES',
);
if (this.hasReadFilePrivilege) {
this.fileService
.getFileMetadata(['xlsx'])
.subscribe(excelTemplates => {
this.excelTemplates = excelTemplates;
- console.log(this.excelTemplates);
});
}
}
diff --git a/ui/src/app/core-ui/data-download-dialog/data-download-dialog.component.html b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/data-download-dialog.component.html
similarity index 100%
rename from ui/src/app/core-ui/data-download-dialog/data-download-dialog.component.html
rename to ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/data-download-dialog.component.html
diff --git a/ui/src/app/core-ui/data-download-dialog/data-download-dialog.component.scss b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/data-download-dialog.component.scss
similarity index 96%
rename from ui/src/app/core-ui/data-download-dialog/data-download-dialog.component.scss
rename to ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/data-download-dialog.component.scss
index 90c5a378b6..c37920a318 100644
--- a/ui/src/app/core-ui/data-download-dialog/data-download-dialog.component.scss
+++ b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/data-download-dialog.component.scss
@@ -16,7 +16,7 @@
*
*/
-@import '../../../scss/sp/sp-dialog';
+@import '../../../../../../../src/scss/sp/sp-dialog';
.sp-radio-group {
display: flex;
diff --git a/ui/src/app/core-ui/data-download-dialog/data-download-dialog.component.ts b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/data-download-dialog.component.ts
similarity index 95%
rename from ui/src/app/core-ui/data-download-dialog/data-download-dialog.component.ts
rename to ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/data-download-dialog.component.ts
index 59e7ea58cd..b2bbde88e7 100644
--- a/ui/src/app/core-ui/data-download-dialog/data-download-dialog.component.ts
+++ b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/data-download-dialog.component.ts
@@ -18,7 +18,7 @@
import { Component, Input, OnInit, ViewChild } from '@angular/core';
import { MatStepper } from '@angular/material/stepper';
-import { DialogRef } from '@streampipes/shared-ui';
+import { DialogRef } from '../base-dialog/dialog-ref';
import { ExportConfig } from './model/export-config.model';
import { DataDownloadDialogModel } from './model/data-download-dialog.model';
import { DataExportService } from './services/data-export.service';
@@ -34,6 +34,7 @@ export class DataDownloadDialogComponent implements OnInit {
@ViewChild('downloadDialogStepper', { static: true })
downloadDialogStepper: MatStepper;
+ @Input()
exportConfig: ExportConfig;
constructor(
@@ -48,7 +49,7 @@ export class DataDownloadDialogComponent implements OnInit {
: this.dataDownloadDialogModel.dataExplorerDataConfig
.sourceConfigs[0].measureName;
- this.exportConfig = {
+ this.exportConfig ??= {
dataExportConfig: {
dataRangeConfiguration: 'all',
missingValueBehaviour: 'ignore',
@@ -60,6 +61,7 @@ export class DataDownloadDialogComponent implements OnInit {
headerColumnName: 'key',
},
};
+ console.log(this.exportConfig);
}
exitDialog() {
diff --git a/ui/src/app/core-ui/data-download-dialog/model/data-download-dialog.model.ts b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/model/data-download-dialog.model.ts
similarity index 100%
rename from ui/src/app/core-ui/data-download-dialog/model/data-download-dialog.model.ts
rename to ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/model/data-download-dialog.model.ts
diff --git a/ui/src/app/core-ui/data-download-dialog/model/data-export-config.model.ts b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/model/data-export-config.model.ts
similarity index 100%
rename from ui/src/app/core-ui/data-download-dialog/model/data-export-config.model.ts
rename to ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/model/data-export-config.model.ts
diff --git a/ui/src/app/core-ui/data-download-dialog/model/download-progress.model.ts b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/model/download-progress.model.ts
similarity index 100%
rename from ui/src/app/core-ui/data-download-dialog/model/download-progress.model.ts
rename to ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/model/download-progress.model.ts
diff --git a/ui/src/app/core-ui/data-download-dialog/model/export-config.model.ts b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/model/export-config.model.ts
similarity index 100%
rename from ui/src/app/core-ui/data-download-dialog/model/export-config.model.ts
rename to ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/model/export-config.model.ts
diff --git a/ui/src/app/core-ui/data-download-dialog/model/format-export-config.model.ts b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/model/format-export-config.model.ts
similarity index 100%
rename from ui/src/app/core-ui/data-download-dialog/model/format-export-config.model.ts
rename to ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/model/format-export-config.model.ts
diff --git a/ui/src/app/core-ui/data-download-dialog/services/data-export.service.ts b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/services/data-export.service.ts
similarity index 100%
rename from ui/src/app/core-ui/data-download-dialog/services/data-export.service.ts
rename to ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/services/data-export.service.ts
diff --git a/ui/src/app/core-ui/data-download-dialog/services/file-name.service.spec.ts b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/services/file-name.service.spec.ts
similarity index 100%
rename from ui/src/app/core-ui/data-download-dialog/services/file-name.service.spec.ts
rename to ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/services/file-name.service.spec.ts
diff --git a/ui/src/app/core-ui/data-download-dialog/services/file-name.service.ts b/ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/services/file-name.service.ts
similarity index 100%
rename from ui/src/app/core-ui/data-download-dialog/services/file-name.service.ts
rename to ui/projects/streampipes/shared-ui/src/lib/dialog/data-download-dialog/services/file-name.service.ts
diff --git a/ui/projects/streampipes/shared-ui/src/lib/shared-ui.module.ts b/ui/projects/streampipes/shared-ui/src/lib/shared-ui.module.ts
index ee9a72ba55..131f813f35 100644
--- a/ui/projects/streampipes/shared-ui/src/lib/shared-ui.module.ts
+++ b/ui/projects/streampipes/shared-ui/src/lib/shared-ui.module.ts
@@ -70,6 +70,18 @@ import { MatFormFieldModule } from '@angular/material/form-field';
import { MatMenuModule } from '@angular/material/menu';
import { FormsModule } from '@angular/forms';
import { MatTreeModule } from '@angular/material/tree';
+import { DataDownloadDialogComponent } from './dialog/data-download-dialog/data-download-dialog.component';
+import { MatStepperModule } from '@angular/material/stepper';
+import { SelectDataComponent } from './dialog/data-download-dialog/components/select-data/select-data.component';
+import { SelectFormatComponent } from './dialog/data-download-dialog/components/select-format/select-format.component';
+import { DownloadComponent } from './dialog/data-download-dialog/components/download/download.component';
+import { SelectDataRangeComponent } from './dialog/data-download-dialog/components/select-data/select-data-range/select-data-range.component';
+import { SelectDataMissingValuesComponent } from './dialog/data-download-dialog/components/select-data/select-data-missing-values/select-data-missing-values.component';
+import { MatRadioModule } from '@angular/material/radio';
+import { SpConfigurationBoxComponent } from './components/configuration-box/configuration-box.component';
+import { DateInputComponent } from './components/date-input/date-input.component';
+import { MatCheckboxModule } from '@angular/material/checkbox';
+import { MatInputModule } from '@angular/material/input';
@NgModule({
declarations: [
@@ -85,6 +97,8 @@ import { MatTreeModule } from '@angular/material/tree';
AssetBrowserToolbarComponent,
ConfirmDialogComponent,
CustomTimeRangeSelectionComponent,
+ DataDownloadDialogComponent,
+ DateInputComponent,
PanelDialogComponent,
StandardDialogComponent,
SpBasicFieldDescriptionComponent,
@@ -102,15 +116,23 @@ import { MatTreeModule } from '@angular/material/tree';
TimeRangeSelectorComponent,
TimeRangeSelectorMenuComponent,
DataExplorerRefreshIntervalSettingsComponent,
+ SelectDataComponent,
+ SelectFormatComponent,
+ DownloadComponent,
+ SpConfigurationBoxComponent,
+ SelectDataRangeComponent,
+ SelectDataMissingValuesComponent,
],
imports: [
CommonModule,
FlexLayoutModule,
FormsModule,
MatButtonModule,
+ MatCheckboxModule,
MatDividerModule,
MatFormFieldModule,
MatIconModule,
+ MatInputModule,
MatMenuModule,
MatSelectModule,
MatTabsModule,
@@ -121,14 +143,18 @@ import { MatTreeModule } from '@angular/material/tree';
PortalModule,
OverlayModule,
MatDialogModule,
+ MatStepperModule,
MatTableModule,
MatPaginator,
+ MatRadioModule,
MatSort,
],
providers: [DefaultMatCalendarRangeStrategy, MatRangeDateSelectionModel],
exports: [
AssetBrowserComponent,
ConfirmDialogComponent,
+ DataDownloadDialogComponent,
+ DateInputComponent,
PanelDialogComponent,
StandardDialogComponent,
SpBasicFieldDescriptionComponent,
@@ -136,6 +162,7 @@ import { MatTreeModule } from '@angular/material/tree';
SpBasicHeaderTitleComponent,
SpBasicViewComponent,
SpBasicNavTabsComponent,
+ SpConfigurationBoxComponent,
SpExceptionDetailsComponent,
SpExceptionMessageComponent,
SpExceptionDetailsDialogComponent,
diff --git a/ui/projects/streampipes/shared-ui/src/public-api.ts b/ui/projects/streampipes/shared-ui/src/public-api.ts
index fc63ee4a92..cbf05ab894 100644
--- a/ui/projects/streampipes/shared-ui/src/public-api.ts
+++ b/ui/projects/streampipes/shared-ui/src/public-api.ts
@@ -21,6 +21,7 @@ export * from './lib/shared-ui.module';
export * from './lib/dialog/base-dialog/base-dialog.model';
export * from './lib/dialog/base-dialog/base-dialog.service';
export * from './lib/dialog/base-dialog/dialog-ref';
+export * from './lib/dialog/data-download-dialog/data-download-dialog.component';
export * from './lib/dialog/confirm-dialog/confirm-dialog.component';
export * from './lib/dialog/panel-dialog/panel-dialog.component';
@@ -32,6 +33,8 @@ export * from './lib/components/basic-inner-panel/basic-inner-panel.component';
export * from './lib/components/basic-field-description/basic-field-description.component';
export * from './lib/components/basic-view/basic-view.component';
export * from './lib/components/basic-nav-tabs/basic-nav-tabs.component';
+export * from './lib/components/configuration-box/configuration-box.component';
+export * from './lib/components/date-input/date-input.component';
export * from './lib/components/split-section/split-section.component';
export * from './lib/components/sp-exception-message/sp-exception-message.component';
export * from './lib/components/sp-exception-message/exception-details-dialog/exception-details-dialog.component';
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 41d21bd933..93b7c72e55 100644
--- a/ui/src/app/configuration/datalake-configuration/datalake-configuration.component.ts
+++ b/ui/src/app/configuration/datalake-configuration/datalake-configuration.component.ts
@@ -26,6 +26,7 @@ import {
import { MatPaginator } from '@angular/material/paginator';
import { MatSort } from '@angular/material/sort';
import {
+ DataDownloadDialogComponent,
DialogRef,
DialogService,
PanelType,
@@ -35,7 +36,6 @@ import {
import { DeleteDatalakeIndexComponent } from '../dialog/delete-datalake-index/delete-datalake-index-dialog.component';
import { SpConfigurationTabsService } from '../configuration-tabs.service';
import { SpConfigurationRoutes } from '../configuration.routes';
-import { DataDownloadDialogComponent } from '../../core-ui/data-download-dialog/data-download-dialog.component';
@Component({
selector: 'sp-datalake-configuration',
diff --git a/ui/src/app/core-ui/core-ui.module.ts b/ui/src/app/core-ui/core-ui.module.ts
index bae8bdd7b2..586e207a66 100644
--- a/ui/src/app/core-ui/core-ui.module.ts
+++ b/ui/src/app/core-ui/core-ui.module.ts
@@ -65,16 +65,9 @@ import { PlatformServicesModule } from '@streampipes/platform-services';
import { SharedUiModule } from '@streampipes/shared-ui';
import { PipelineElementTemplateConfigComponent } from './pipeline-element-template-config/pipeline-element-template-config.component';
import { PipelineElementTemplatePipe } from './pipeline-element-template-config/pipeline-element-template.pipe';
-import { DataDownloadDialogComponent } from './data-download-dialog/data-download-dialog.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';
import { StatusWidgetComponent } from './status/status-widget.component';
import { SpSimpleMetricsComponent } from './monitoring/simple-metrics/simple-metrics.component';
import { SpSimpleLogsComponent } from './monitoring/simple-logs/simple-logs.component';
-import { DateInputComponent } from './date-input/date-input.component';
import { HelpComponent } from './help/help.component';
import { PipelineElementRuntimeInfoComponent } from './pipeline-element-runtime-info/pipeline-element-runtime-info.component';
import { PipelineElementDocumentationComponent } from './pipeline-element-documentation/pipeline-element-documentation.component';
@@ -121,7 +114,6 @@ import { ConfigurationCodePanelComponent } from './configuration-code-panel/conf
import { JsonPrettyPrintPipe } from './pipes/json-pretty-print.pipe';
import { YamlPrettyPrintPipe } from './pipes/yaml-pretty-print.pipe';
import { TopicsComponent } from './topics/topics.component';
-import { SpConfigurationBoxComponent } from './configuration-box/configuration-box.component';
@NgModule({
imports: [
@@ -176,8 +168,6 @@ import { SpConfigurationBoxComponent } from './configuration-box/configuration-b
],
declarations: [
ConfigurationCodePanelComponent,
- DataDownloadDialogComponent,
- DateInputComponent,
DisplayRecommendedPipe,
ObjectPermissionDialogComponent,
PipelineElementTemplateConfigComponent,
@@ -214,12 +204,6 @@ import { SpConfigurationBoxComponent } from './configuration-box/configuration-b
ErrorHintComponent,
AddToCollectionComponent,
PipelineStartedStatusComponent,
- SelectDataComponent,
- SelectFormatComponent,
- DownloadComponent,
- SelectDataRangeComponent,
- SelectDataMissingValuesComponent,
- SpConfigurationBoxComponent,
SpSimpleLogsComponent,
SpSimpleMetricsComponent,
StatusWidgetComponent,
@@ -236,8 +220,6 @@ import { SpConfigurationBoxComponent } from './configuration-box/configuration-b
providers: [MatDatepickerModule, DisplayRecommendedPipe],
exports: [
ConfigurationCodePanelComponent,
- DataDownloadDialogComponent,
- DateInputComponent,
PipelineElementTemplateConfigComponent,
PipelineElementRuntimeInfoComponent,
PipelineElementDocumentationComponent,
@@ -261,7 +243,6 @@ import { SpConfigurationBoxComponent } from './configuration-box/configuration-b
StaticSlideToggleComponent,
ErrorHintComponent,
PipelineStartedStatusComponent,
- SpConfigurationBoxComponent,
SpSimpleLogsComponent,
SpSimpleMetricsComponent,
StatusWidgetComponent,
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
deleted file mode 100644
index cef9f3d334..0000000000
--- a/ui/src/app/core-ui/data-download-dialog/components/select-data/select-data-range/select-data-range.component.html
+++ /dev/null
@@ -1,64 +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)]="dataExportConfig.dataRangeConfiguration"
->
- <mat-radio-button
- value="visible"
- class="sp-radio-button"
- data-cy="download-configuration-visible"
- *ngIf="dataExplorerDataConfig"
- >
- Currently configured query
- </mat-radio-button>
- <mat-radio-button
- value="all"
- class="sp-radio-button"
- data-cy="download-configuration-all"
- >
- All data in database
- </mat-radio-button>
- <mat-radio-button
- value="customInterval"
- class="sp-radio-button"
- data-cy="download-configuration-customInterval"
- >
- All data in custom time interval
- </mat-radio-button>
-
- <div
- fxLayout="row"
- fxLayoutGap="10px"
- class="ml-35"
- *ngIf="dataExportConfig.dataRangeConfiguration === 'customInterval'"
- >
- <div>
- <h5>From </h5>
- <sp-date-input [(date)]="dataExportConfig.dateRange.startDate">
- </sp-date-input>
- </div>
- <div>
- <h5>To </h5>
- <sp-date-input [(date)]="dataExportConfig.dateRange.endDate">
- </sp-date-input>
- </div>
- </div>
-</mat-radio-group>
diff --git a/ui/src/app/core-ui/data-download-dialog/components/select-format/select-format.component.html b/ui/src/app/core-ui/data-download-dialog/components/select-format/select-format.component.html
deleted file mode 100644
index 423ac7035c..0000000000
--- a/ui/src/app/core-ui/data-download-dialog/components/select-format/select-format.component.html
+++ /dev/null
@@ -1,127 +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.
- ~
- -->
-
-<ng-template matStepLabel>Select Format</ng-template>
-<div>
- <h5>Download Format</h5>
- <mat-radio-group
- class="sp-radio-group"
- [(ngModel)]="formatExportConfig.format"
- >
- <mat-radio-button
- value="json"
- class="sp-radio-button"
- data-cy="download-configuration-json"
- >
- JSON
- </mat-radio-button>
- <mat-radio-button
- value="csv"
- class="sp-radio-button"
- data-cy="download-configuration-csv"
- >
- CSV
- </mat-radio-button>
- <mat-radio-button
- value="xlsx"
- class="sp-radio-button"
- data-cy="download-configuration-xlsx"
- >
- Excel
- </mat-radio-button>
- </mat-radio-group>
-</div>
-<div *ngIf="formatExportConfig.format === '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"
- data-cy="download-configuration-delimiter-comma"
- > ,
- </mat-radio-button>
- <mat-radio-button
- value="semicolon"
- class="sp-radio-button"
- data-cy="download-configuration-delimiter-semicolon"
- > ;
- </mat-radio-button>
- </mat-radio-group>
-</div>
-<div
- *ngIf="formatExportConfig.format === 'xlsx' && hasReadFilePrivilege"
- fxLayout="column"
->
- <mat-checkbox
- [(ngModel)]="formatExportConfig.useTemplate"
- [disabled]="excelTemplates.length === 0"
- >
- Use uploaded file template
- </mat-checkbox>
- @if (formatExportConfig.useTemplate && excelTemplates.length > 0) {
- <mat-form-field class="mt-10" color="accent">
- <mat-select
- [(ngModel)]="formatExportConfig.templateId"
- placeholder="Choose template"
- >
- <mat-option
- *ngFor="let template of excelTemplates"
- [value]="template.fileId"
- >
- {{ template.filename }}
- </mat-option>
- </mat-select>
- </mat-form-field>
- <mat-form-field color="accent">
- <mat-label>First row index to append data</mat-label>
- <input
- matInput
- [(ngModel)]="formatExportConfig.startRow"
- type="number"
- />
- </mat-form-field>
- }
-</div>
-<div
- *ngIf="
- formatExportConfig.format === 'xlsx' ||
- formatExportConfig.format === 'csv'
- "
->
- <h5>Header column name</h5>
- <mat-radio-group
- [(ngModel)]="formatExportConfig.headerColumnName"
- class="sp-radio-group"
- >
- <mat-radio-button
- value="key"
- class="sp-radio-button"
- data-cy="download-configuration-column-name-key"
- >Use field key (runtime name) as header column
- </mat-radio-button>
- <mat-radio-button
- value="label"
- class="sp-radio-button"
- data-cy="download-configuration-column-name-label"
- >Use field label as header column if available
- </mat-radio-button>
- </mat-radio-group>
-</div>
diff --git a/ui/src/app/data-explorer-shared/services/data-explorer-shared.service.ts b/ui/src/app/data-explorer-shared/services/data-explorer-shared.service.ts
index 02eb54ff2a..ad85f31bf9 100644
--- a/ui/src/app/data-explorer-shared/services/data-explorer-shared.service.ts
+++ b/ui/src/app/data-explorer-shared/services/data-explorer-shared.service.ts
@@ -23,8 +23,11 @@ import {
DateRange,
TimeSettings,
} from '@streampipes/platform-services';
-import { DialogService, PanelType } from '@streampipes/shared-ui';
-import { DataDownloadDialogComponent } from '../../core-ui/data-download-dialog/data-download-dialog.component';
+import {
+ DataDownloadDialogComponent,
+ DialogService,
+ PanelType,
+} from '@streampipes/shared-ui';
import { ObjectPermissionDialogComponent } from '../../core-ui/object-permission-dialog/object-permission-dialog.component';
@Injectable({ providedIn: 'root' })